function Trace(msg, debug){
	//alert (msg);
	if (debug) document.getElementById(debug).innerHTML = msg;
}

function loadFlash(htmlAnchor, fileName, width, height, bgColor, bgVisible, variablePairs, KeepSize){
	var html = "";
	var isIE = navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length;
	var node = document.getElementById(htmlAnchor);
	var htmlAnchor = htmlAnchor + "Obj";
	
	//
	// ########################################################### Loads the Flash File #######################################################################
	if (isIE){
		html += '<embed ';
		html += ' name="' + htmlAnchor + '"';
		html += ' id="' + htmlAnchor + '"';
		html += ' src="' + fileName + '"';
		html += ' width="' + width + '" height="' + height + '"';
		html += ' bgcolor="' + bgColor + '"';
		if (variablePairs && typeof(variablePairs) == 'string') html += ' flashvars="' + variablePairs + '"';
		if (bgVisible && typeof(bgVisible) == 'boolean') html += ' wmode="transparent"';
		else html += ' wmode="opaque"';
		html += ' scale="noscale"';
		html += ' align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		
	} else {
		html += '<object id="' + htmlAnchor + '" name="' + htmlAnchor + '" width="' + width + '" height="' + height + '"';
		html += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">';
		html += '	<param name="movie" value="' + fileName + '" />';
		html += '	<param name="bgcolor" value="' + bgColor + '" />';
		if (variablePairs && typeof(variablePairs) == 'string') html += '	<param name="flashvars" value="' + variablePairs + '" />';
		if (bgVisible && typeof(bgVisible) == 'boolean') html += '	<param name="wmode" value="transparent" />';
		else html += '	<param name="wmode" value="opaque" />'; 
		html += '	<param name="quality" value="high" />';
		html += '	<param name="scale" value="noscale" />';
		html += '	<param name = "allowScriptAccess" value = "sameDomain" />';
		html += '</object>';
	}
	node.innerHTML = html;
	//
	// ########################################################### Prepares The Flash Object FSCommand  #######################################################
	var Obj = document.getElementById(htmlAnchor);
	// ########################################################### FSCommand Example  #########################################################################
	
	if (!document.FlashObjects) document.FlashObjects = new Array();
	document.FlashObjects[node.id] = new Object();
	document.FlashObjects[node.id].Obj = Obj;
	document.FlashObjects[node.id].Obj.ID = node.id;
	document.FlashObjects[node.id].Obj.KeepSize = KeepSize;
	if (KeepSize){
		document.FlashObjects[node.id].Obj.onResize = function (){
			this.width = this.height = "100%";
			var Resize = "document.FlashObjects['" + this.ID + "'].Obj" + ".Resize('" + this.ID + "')";
			setTimeout(Resize, 10);
		}
		setTimeout('document.FlashObjects["' + node.id + '"].Obj.onResize()', 10000);
	}
}

function ResizeFlash(Who, Width, Height){
	document.FlashObjects[Who].Obj.width = Width;
	document.FlashObjects[Who].Obj.height = Height;
	//if (Who == "MainFlash") Trace(Width + ", " + Height, "DEBUG");
}

function UpdateFlash(){
	for (var i in document.FlashObjects) {
		if (document.FlashObjects[i].Obj.KeepSize) document.FlashObjects[i].Obj.onResize();
	}
}

function TranslateArgs(Args){
	var Args = Args.split("&");
	var Propertys = new Array();
	for (var i in Args){
		var property = Args[i].split("=");
		Propertys[property[0]] = property[1];
	}
	//
	return Propertys;
}