// Create var to tell other Utilities that this one is present
var HSNAV = true;

function hsSetSwfSize(w, h, hid, firstrun){
	
		//trace("<br />hsSetSwfSize()");
	
		hid = hid ? hid : '0';
		
		// Add 'px' in absence of '%'
		var w = String(w + 'px');
		var h = String(h + 'px');
		
		var divEmbed = document.getElementById( 'divEmbed'+String(hid) );
		
		/*
		if ( firstrun ) {
			var divBlock = document.getElementById( 'divBlock'+String(hid) );
			divBlock.style.width = w;
			divBlock.style.height = h;
		}
		*/
		
		divEmbed.style.width = w;
		divEmbed.style.height = h;

}

function hsNav ( tagID, w, h, style, lockroot, fv1, fv2, fv3, fv4, fv5 ) {
	
	var targetTag			= tagID			? document.getElementById(tagID)	: "";
	lockroot 				= lockroot 		? lockroot 							: false;
	fv1 					= fv1 			? fv1 								: '';
	fv2 					= fv2 			? fv2  								: '';
	fv3 					= fv3 			? fv3  								: '';
	fv4 					= fv4 			? fv4  								: '';
	fv5 					= fv5 			? fv5  								: '';
	
	// Target Tag must be a div
	if ( targetTag.nodeName == "DIV" ) {
		// All good.
	} else {
		targetTag.innerHTML = "This Element Must Be &lt;div&gt; rather than "+targetTag.nodeName+" for the SWF to be placed.";
		return false; // << Might cause problems in IE... if Full page is not loaded
	}
	
	var noflash = targetTag.innerHTML;
	
	//var fullURL = "pub/util_hs_swfembed/hc.swf?path="+contentPath+"&tid="+tagID+"&lockroot="+lockroot+"&fv1="+fv1+"&fv2="+fv2+"&fv3="+fv3+"&fv4="+fv4+"&fv5="+fv5;
	
	//if ( w ) { targetTag.style.width = w+"px"; };
	//if ( h ) { targetTag.style.height = h+"px"; };
	
	var randomNumber=Math.floor(Math.random()*100000000);
	var hid = String(randomNumber);
	
	var sSwfPath = 'includes/util_hsnav/nav.swf?hid='+hid+'&fv1='+fv1+'';
	
	var injection = "";
	
	injection += '\t<div id="divEmbed'+hid+'" style="width:'+w+'px;height:'+h+'px;'+style+'">\n';
	injection += '\n\n\t<!-- Javascript Injected: swfEmbed() -->\n';
	injection += '\t\t<object type="application/x-shockwave-flash" data="'+sSwfPath+'" width="100%" height="100%">\n';
	injection += '\t\t<param name="movie" value="'+sSwfPath+'" />\n';
	injection += '\t\t<param name="allowScriptAccess" value="always" />\n';
	injection += '\t\t<param name="wmode" value="transparent" />\n';
	injection += '\t\t'+noflash+'\n';
	injection += '\t\t</object>\n';
	injection += '\t</div>\n';
	
	targetTag.innerHTML = injection;
	
	//trace(injection);
	
} // hsInjectSWF()