<!-- // Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 
// If called with no parameters this function returns a floating point value 
// which should be the version of the Flash Player or 0.0 
// ex: Flash Player 7r14 returns 7.14
// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
	return (reqVer ? false : 0.0);
}
// Browser identification string
var info = navigator.userAgent.toLowerCase();

// Misc. test functions
function hasWin () {
	return Boolean(info.indexOf("win") +1);
}
function hasQT () {
	for(var i=0; i<navigator.plugins.length; i++) {
		var name = navigator.plugins[i].name;
		if(name.indexOf("QuickTime") >= 0) {
			quickTimeVersion = parseFloat(name.substring(name.lastIndexOf(" "), name.length));
			hasQuickTime = (quickTimeVersion >= QTversion);
			if(hasQuickTime) {
				haveqt = true;
				break;
			}
		}
	}
	return haveqt;
}
function hasOSX () {
	return Boolean(info.indexOf("mac os x") +1);
}
function hasIE6 () {
	var pos = info.indexOf("msie 6");
	return Boolean((pos+1) && !isOpera);
	//return Boolean((pos +1) && (parseInt(info.charAt(pos + 5)) >= 6) && !isOpera);
	//return info.indexOf("msie 6") +1;
}
function hasMozilla () {
	return Boolean(info.indexOf("firefox") + 1 || (info.indexOf("mozilla/5.0") +1 && info.indexOf("rv:1.7") +1));
}

function hasSafari () {
	var pos = info.indexOf("safari");
	return Boolean(pos + 1 && (parseInt(info.charAt(pos + 7)) >= 3));
}
	

function hasWmp () {
	var version = 1;
	if(isIE && document.getElementById("WMPtest").versionInfo) {
		version = WMPtest.versionInfo.split(".")[0];
	}
	return (version >= 9);
}

function hasFlash () {
	return (DetectFlashVer(8,0,0));
}
function makeFlash(file, div, id, w, h, wmode) {
	if(isIE) {
		var temp = document.createElement('object');
		document.getElementById(div).appendChild(temp);
		temp.width = w;
		temp.height = h;
		temp.id = id;
		temp.classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
		temp.wmode = wmode;
		//temp.quality = "high";
		temp.allowScriptAccess = "always";
		temp.movie = file;
	} else {
		var tag= '<OBJECT' +
		'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" CODEBASE="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"  align="middle" WIDTH="'+ w +'" HEIGHT="'+ h +'" ID="'+ id +'">' +
		'<PARAM NAME="allowScriptAccess" VALUE="always" />' +
		'<PARAM NAME="movie" VALUE="'+ file +'" />' +
		'<PARAM NAME="wmode" VALUE="'+ wmode +'" />' +
		'<PARAM NAME="quality" VALUE="high" />' +
		'<PARAM NAME="bgcolor" VALUE="#FFFFFF" />' +
		'<EMBED SRC="'+ file +'" QUALITY="high" BGCOLOR="#FFFFFF" WIDTH="'+ w +'" HEIGHT="'+ h +'" NAME="'+ id +'" WMODE="'+ wmode +'" ALIGN="middle" allowScriptAccess="always" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" />' +
		'</OBJECT>';
		document.write(tag);
	}
}
function makeContainer() {
	if(isIE && isWin && hasWmp() && !isOpera && !forceqt) {
		//playerContainer = "window.wmcontainer";
		isWMP = true;
		var temp2 = document.createElement('object');
		document.getElementById("mediacontainer").appendChild(temp2);
		temp2.id = "wmcontainer";
		temp2.classid = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6";
		temp2.width = 512;
		temp2.height = 384;
		//temp.type = "application/x-oleobject";
		temp2.autoStart = "0";
		temp2.enableContextMenu = "0";
		temp2.playCount = "1";
		temp2.stretchToFit = "1";
		temp2.uiMode = "none";
		temp2.volume = "50";
		temp2.invokeURLs = "false";
		temp2.windowlessVideo = "0";
		temp2.URL = "";

		/*
		document.write('<OBJECT ID="wmcontainer"');
		document.write('CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" WIDTH="512px" HEIGHT="384px" z-index=1 STANDBY="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');
      	document.write('<PARAM NAME="autoStart" VALUE="0" />');
      	document.write('<PARAM NAME="enableContextMenu" VALUE="0" />');
      	document.write('<PARAM NAME="playCount" VALUE="1" />');
      	document.write('<PARAM NAME="stretchToFit" VALUE="1" />');
      	document.write('<PARAM NAME="uiMode" VALUE="NONE" />');
      	document.write('<PARAM NAME="volume" VALUE="50" />');
      	document.write('<PARAM NAME="invokeURLs" VALUE="false" />');
      	document.write('<PARAM NAME="windowlessVideo" VALUE="0" />');
	  	document.write('<PARAM NAME="URL" VALUE="" />');
		document.write('</OBJECT>')*/
	}
	else
	{
		//playerContainer = "document.qtcontainer";
		isWMP = false;
		document.write('<OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"');
		document.write('codebase="http://www.apple.com/qtactivex/qtplugin.cab"');
		document.write('width="512" height="384" id="qtcontainer">');
		document.write('<PARAM NAME="autoplay" VALUE="false">'); 
		document.write('<PARAM NAME="href" VALUE="javascript:videoClick()">');
		document.write('<PARAM NAME="controller" VALUE="false">'); 
		document.write('<PARAM NAME="kioskmode" VALUE="true">');
		document.write('<PARAM NAME="scale" VALUE="tofit">');  
		document.write('<PARAM NAME="volume" VALUE="50">');
		document.write('<PARAM NAME="BGCOLOR" VALUE="#000000">'); 
		document.write('<PARAM NAME="SAVEEMBEDTAGS" VALUE="TRUE">');
		document.write('<PARAM NAME="QTNEXT1" VALUE="javascript:videoEnd()">'); 
		document.write('<PARAM NAME="QTNEXT2" VALUE="GOTO1">'); 
		document.write('<PARAM name="src" value="apelogo.qtif">');
		document.write('<EMBED HEIGHT="384" WIDTH="512"');
		document.write('SRC="apelogo.qtif"');
		document.write('TYPE="video/quicktime"');
		document.write('PLUGINSPAGE="www.apple.com/quicktime/download"');
		document.write('CONTROLLER="false"');
		document.write('LOOP="false"');
		document.write('AUTOPLAY="false"');
		document.write('QTNEXT1="javascript:videoEnd()"');
		document.write('QTNEXT2="GOTO1"');
		document.write('SCALE="tofit"');
		document.write('VOLUME="50"');
		document.write('BGCOLOR="#000000"');
		document.write('KIOSKMODE="true"');
		document.write('HREF="javascript:videoClick()"');
		document.write('EnableJavaScript="true"');
		document.write('SAVEEMBEDTAGS="True"');
		document.write('NAME="qtcontainer"'); 
		document.write('/></OBJECT>'); 
	}
}
function makeWMPtest() {
	if(isIE) {
		document.write('<OBJECT CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" CODEBASE="../../#Version=7,0,0,1954" HEIGHT="1" WIDTH="1" ID="WMPtest" VIEVASTEXT></OBJECT>');
	}
}
if(isIE){
	function cleanup() {
		__flash_unloadHandler = function(){
			if (externalProbSet) {return};
			externalProbSet = true;
			for (var obj in getElementsByTagName("OBJECT")){
				var theObj = eval(obj);
				theObj.style.display = "none";
				for (var prop in theObj){
					if (typeof(theObj[prop]) == 'function'){
						theObj[prop]=null
					}
				}
			}
			if (__flash_savedUnloadHandler != null){
				__flash_savedUnloadHandler();
			}
		}
		if (window.onunload != __flash_unloadHandler){
			__flash_savedUnloadHandler = window.onunload;
			window.onunload = __flash_unloadHandler;
		}
	}
	window.onbeforeunload=cleanup;
}

