var videostate=0;
function toggleLayer(whichLayer,sta) {
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(sta==0) {
  	vis.display = 'none';
  	videostate=0;
  }
  else {
  	vis.display = 'block';
  	videostate=1;
  }
}

function doVideo(vtype,vers,vpath,wid,hei) {
	var tdiv = document.getElementById("video");
	if (vtype=="qt") {
		tdiv.innerHTML = '<p id="clvid"><a href="javascript:closeVideo();" onmouseover="cV(1);" onmouseout="cV(0);">close</a></p><object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" width="640" height="480" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\n<param name="src" value="'+vpath+'" /><param name="autoplay" value="true">\n<embed src="'+vpath+'" width="640" height="480" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>\n<br />&nbsp;';
		tdiv.innerHTML += "";
	}  else if (vtype=="flash") {
		tdiv.innerHTML = '<p id="clvid"><a href="javascript:closeVideo();" onmouseover="cV(1);" onmouseout="cV(0);">close</a></p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+wid+'" height="'+hei+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">\n<param name="movie" value="'+vpath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" />\n<embed src="'+vpath+'" menu="false" quality="high" bgcolor="#FFFFFF" width="'+wid+'" height="'+hei+'" name="vsl" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>\n';
	}
}
function setVideo(vtype,vers,vpath,wid,hei) {
	if(videostate==0) {
	
	toggleLayer("video",1);
	var tdiv = document.getElementById("video");
	if (vtype=="qt") {
		if(haveqt==true && vers <= 6) {
			tdiv.innerHTML = '<p id="clvid"><a href="javascript:closeVideo();">close</a></p><object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" width="'+wid+'" height="'+hei+'" codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="qtobj">\n<param name="src" value="'+vpath+'" /><param name="scale" value="aspect" /><param name="autoplay" value="true">\n<embed src="'+vpath+'" width="'+wid+'" height="'+hei+'" scale="aspect" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" name="qtobj" enablejavascript="true"></embed></object>\n<br />&nbsp;';
			tdiv.innerHTML += "";
		} else {
			tdiv.innerHTML = "<p id='clvid'><a href='javascript:closeVideo();' onmouseover='cV(1);' onmouseout='cV(0);'>close</a></p><div id='qtplugin'>Sorry, you need the latest version of QuickTime to view this video.<br /><a href='http://www.apple.com/quicktime/download/' target='_blank'>Download it for free here</a>.<p>If you are receiving this message in error, please <a href='javascript:doVideo(\""+vtype+"\","+vers+",\""+vpath+"\","+wid+","+hei+")'>try here</a>.</p></div>";
		}
	} else if (vtype=="flash") {
		if (vers=='') vers=6;
		var hasRightVersion = DetectFlashVer(vers, 0, 0);
		if(hasRightVersion) {
			tdiv.innerHTML = '<p id="clvid"><a href="javascript:closeVideo();" onmouseover="cV(1);" onmouseout="cV(0);">close</a></p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+wid+'" height="'+hei+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">\n<param name="movie" value="'+vpath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" />\n<embed src="'+vpath+'" menu="false" quality="high" bgcolor="#FFFFFF" width="'+wid+'" height="'+hei+'" name="vsl" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>\n<br />&nbsp;';
		} else {
			tdiv.innerHTML = "<div id='qtplugin'><p id='clvid'><a href='javascript:closeVideo();' onmouseover='cV(1);' onmouseout='cV(0);'>close</a></p>Sorry, you need the latest version of Flash to view this video.<br /><a href='http://www.macromedia.com/go/getflashplayer' target='_blank'>Download it for free here</a>.<p>If you are receiving this message in error, please <a href='javascript:doVideo(\""+vtype+"\","+vers+",\""+vpath+"\","+wid+","+hei+")'>try here</a>.</p></div>";
		}
	} else {
			tdiv.innerHTML = "<div id='qtplugin'><p id='clvid'><a href='javascript:closeVideo();' onmouseover='cV(1);' onmouseout='cV(0);'>close</a></p>Sorry, we could not detect the correct video player.</div>";
		}
}}

function closeVideo() {
	if(document.embeds["qtobj"]){document.qtobj.Stop();}
	var tdiv = document.getElementById("video");
	tdiv.innerHTML = "&nbsp;";
			tdiv.innerHTML += "";
	toggleLayer("video",0);
}

function cV(arg){
	if (arg==0) {
	myPage.sound.stopSound();
	}
	else {
		myPage.sound.playSound("mp3s/CLOSE.mp3");
	}
}