/*
	writeFlashTags_v2.js - v1.01

	last modified: 16 Aug 07 dconner@alleni.com
		changed:
			added flashVars param to writeFlashTags function
			now works w/ddb's flash/html template
			changed default allowScriptAccess setting for nonIE to "always"

	last Modified 13 Jul 07 - ddb
		changed:
			based on variable 'isIE_bool' 
			writes either <object> for IE or <embed> for nonIE, 
			
	last modified 21 Sep 06 dbenston@alleni.com
 		added values to set menu to false (needed for custom right-click menu's)
 		added swLiveConnect
 		updated wmode, bgColor
		Object and Embed tags
		allowScriptAccess="always"
*/

function writeFlashTags(file, id, w, h, bg, al, scale, menu, flashVars)
{
	//alert("isIE_bool:"+isIE_bool);
	var txt = "";
	if (isIE_bool) {
		// write only Object tag for IE
		txt += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " + 
				"type=\"application/x-shockwave-flash\" " + 
				"codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab\"" +
				"width=\""+w+"\" " +
				"height=\""+h+"\" " +
				"id=\""+id+"\" " + 
				"name=\""+id+"\" ";
		txt += 		"data=\""+file+"\"><param name=\"movie\" value=\""+file+"\" />";
		if (bg == null){
			txt += "<param name=\"bgcolor\" value=\"#000000\" />";
			txt += "<param name=\"wmode\" value=\"opaque\" />";
		}else if (bg.toLowerCase() == "transparent"){
			txt += "<param name=\"wmode\" value=\"transparent\" />";
		}else{
			txt += "<param name=\"bgcolor\" value=\"#"+bg+"\" />";
			txt += "<param name=\"wmode\" value=\"opaque\" />";
		}
		if(al != null){
			txt += "<param name=\"salign\" value=\""+al+"\" />";
		}
		if (scale != null){
			txt += "<param name=\"scale\" value=\""+scale+"\" />";
		}else{
			txt += "<param name=\"scale\" value=\"noscale\" />";
		}
		if (menu.toLowerCase() == "false") {
			txt += "<param name=\"menu\" value=\"false\" />";
		} else {
			txt += "<param name=\"menu\" value=\"true\" />";
		}
		if(flashVars != null){
			txt += "<param name=\"FlashVars\" value="+flashVars+"/>";
		}
		txt += "<param name=\"allowScriptAccess\" value=\"always\" />";
		txt += "<param name=\"swLiveConnect\" value=\"true\" />";
		txt += "</object>";
	} else {
		// write only Embed tag for Non-IE
		txt += "<embed src=\""+file+"\" ";
		if(flashVars !=null){
			txt += "FlashVars=\""+flashVars+"\" ";
		}
		txt += "quality=\"high\" width=\""+w+"\" height=\""+h+"\" name=\""+id+"\" id=\""+id+"\" align=\""+al+"\"";
		if (bg == null) {
			txt += "bgcolor=\"#000000\" ";
			txt += "wmode=\"opaque\" ";
		} else if (bg.toLowerCase() == "transparent") {
			txt += "wmode=\"transparent\" ";
		} else {
			txt += "bgcolor=\"#"+bg+"\" ";
			txt += "wmode=\"opaque\" ";
		}
		if (menu.toLowerCase() == "false") {
			txt += "menu=\"false\" ";
		} else {
			txt += "menu=\"true\" ";
		}
		txt += "play=\"true\" loop=\"false\" quality=\"high\" allowScriptAccess=\"always\" swLiveConnect=\"true\" type=\"application/x-shockwave-flash\"";
		txt += "pluginspage=\"http://www.macromedia.com/go/getflashplayer\"><\/embed>";	
	}
	// output to browser
	document.write(txt);
}
