// JavaScript Document
// 10.7.05

// Univeral method for javascript->flash setvariable
/* -----------------------------------------------------------
// Detection snippet from http://www.dithered.com/javascript/browser_detect/index.html
function setFlashVariables(movieid, flashquery)

be sure path to varGateway works****

movieid: id of object tag, name of movieid passed in through FlashVars, used by vargateway.swf as localconnection name
flashquery: querystring of values to set. example( var1=foo&var2=bar )
----------------------------------------------------------- */
function setFlashVariables(movieid, flashquery, rootpath){
	var i,values;
	var sRoot = (rootpath != null)?  rootpath : "../";

	
	//alert("setFlashVariables("+movieid+", "+flashquery+", is_pc_ie="+is_pc_ie+", path to gateway="+sRoot+"flash/varGateway.swf)");
	var divcontainer = "flash_setvariables_"+movieid;
	if(!document.getElementById(divcontainer)){
		var divholder = document.createElement("div");
			divholder.id = divcontainer;
			document.body.appendChild(divholder);
	};
		document.getElementById(divcontainer).innerHTML = "";
		
	if(is_pc_ie){
		/*var chunk = flashquery.split("&");
		for(i in chunk){
			values = chunk[i].split("=");
			document[movieid].SetVariable(values[0],values[1]);
		};*/
		
		var divinfo = '<object width="0" height="0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="movie" value="'+sRoot+'flash/varGateway.swf"><param name="FlashVars" value="lc='+movieid+'&fq='+escape(flashquery)+'"> </object>';
			document.getElementById(divcontainer).innerHTML = divinfo;
	}else{

		var divinfo = '<embed src="'+sRoot+'flash/varGateway.swf" FlashVars="lc='+movieid+'&fq='+escape(flashquery)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
		document.getElementById(divcontainer).innerHTML = divinfo;
	};
};



