//
//	FLASH OBJECT            
//	---------------------------------
//	Insert flash code with flash detection, 
//	html alternative and fix eolas
//

//flash detection player version 8 and higher
var MM_contentVersion = 8;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

//insert flash code
function insertFlashObj(fileName,w,h,params,bgc,flashContainer,wmode){
	if (bgc == ""){
		bgc = "ffffff";
	}
	params = "src_xml="+params;
	var  flashSource = "";
	if ( MM_FlashCanPlay ) {
		flashSource += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ";
		flashSource += "id=\"flashItem\" width=\""+w+"\" height=\""+h+"\" border=\"0\">";
		flashSource += "<param name=\"movie\" value=\""+fileName+"\" /><param name=\"loop\" value=\"false\" /><param name=\"menu\" value=\"false\">";
		if (wmode) flashSource += "<param name=\"wmode\" value=\"transparent\">";
		flashSource += "<param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noscale\" /><param name=\"salign\" value=\"lt\" /><param name=\"bgcolor\" value=\"#"+bgc+"\" />";
		if (params != "") flashSource += "<param name=\"flashvars\" value=\""+params+"\" />";
		flashSource += "<embed src=\""+fileName+"\" loop=\"false\" menu=\"false\" quality=\"high\" bgcolor=\"#"+bgc+"\"";
		if (wmode) flashSource += " wmode=\"transparent\"";
		flashSource += " swLiveConnect=\"false\" width=\""+w+"\" height=\""+h+"\" name=\"flashItem\"";
		flashSource += " type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";
		if (params!="") flashSource += " flashvars=\""+params+"\"";
		flashSource += ">";
		flashSource += "</embed>";
		flashSource += "</object>";
		if (document.getElementById("printContent"))
			document.getElementById("printContent").innerHTML = document.getElementById(flashContainer).innerHTML;
		document.getElementById(flashContainer).innerHTML = flashSource;		
	}
}


//Flash Container Resize
function mainFlash_DoFSCommand(command, args) { 
	if (command == "flashResize") { 
		flashResize(args);
	}
}




function flashResize(width,height){
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
/*

	if (document.getElementById("flashContent")){
		
		if (frameHeight <= height)
		{
			document.getElementById("flashContent").style.height = height+"px";			
		} else {
			document.getElementById("flashContent").style.height = "100%";
		}

	}*/
//	document.getElementById("flashContent").style.width = width+"px";
	document.getElementById("flashContent").style.height = height+"px";
//	document.getElementById("flashItem").style.width = width+"px";
	document.getElementById("flashItem").style.height = height+"px";
		if (frameWidth <= 930)
		{
			document.getElementById("flashContent").style.width = "930px";
			document.getElementById("flashItem").style.width = "930px";
		} else {
			document.getElementById("flashContent").style.width = "100%";
			document.getElementById("flashItem").style.width = "100%";
		}
}


function showBig(fileName,title,containerId){
	if (title == undefined)
	{
		title = "";
	}
	if (containerId == undefined)
	{
		containerId = "fullImage";
	}
	iURL = "/i/library";
	if (document.getElementById(containerId))
	{
		iSrc = "<img src=\""+iURL+fileName+"\" alt=\""+title+"\"/><br />"+title;
		document.getElementById(containerId).innerHTML = iSrc;
	}
}