var swfSrc		= "";
var swfTitle		= "";
var playerSwfReady	= false;
var menuSwfReady	= false;
function toggleVideoPlayer(bool){
	if( bool == true ){
		document.getElementById('videoPlayer').className	= "videoPlayerClass";	
		if( document.getElementById('videoBTN') ){
			document.getElementById('videoBTN').style.visibility 	= "hidden";	
			touchSWF();	
		}
	} else {
		document.getElementById('videoPlayer').className	= "hidden";	
		if( document.getElementById('videoBTN') )
			document.getElementById('videoBTN').style.visibility 	= "visible";	
	}
}
function touchSWF(){
	var swf = document.getElementById("videoPlayerSWF");
	if( swf != null )
		swf.userIsOpeningSWF()
}
function sendVideoSrc(_src, _title){
	toggleVideoPlayer(true);
	swfSrc		= _src;
	swfTitle	= _title;
	if( playerSwfReady == true )
		videoPlayerSWFReady();
}
// called when the videoPlayer swf gets added to stage.
function videoPlayerSWFReady(){
	playerSwfReady	= true;
	if( swfSrc != "" ){
		var swf	= document.getElementById('videoPlayerSWF');
		if( swf != null ){
			swf.passSRC(swfSrc, swfTitle);
		}
	}
}
function goBack(){
	history.back();
}
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function fixPNGs(name){
	var img	= document.getElementById('videoBTNimg');
	if( window.addEventListener ){

		//Moz,NN
		img.addEventListener('mouseover', function(){ this.src='images/'+name+'-over.png';}, false);
		img.addEventListener('mouseout', function(){ this.src='images/'+name+'.png';}, false);
		img.src	= 'images/'+name+'.png';
	} else if( window.attachEvent) {

		//IE
		if( getInternetExplorerVersion() < 7){
			img.attachEvent('onmouseover', function(){ document.getElementById('videoBTNimg').src='images/'+name+'-over.gif';});
			img.attachEvent('onmouseout', function(){ document.getElementById('videoBTNimg').src='images/'+name+'.gif';});
			img.src	= 'images/'+name+'.gif';
		} else {
			img.attachEvent('onmouseover', function(){ document.getElementById('videoBTNimg').src='images/'+name+'-over.png';});
			img.attachEvent('onmouseout', function(){ document.getElementById('videoBTNimg').src='images/'+name+'.png';});
			img.src	= 'images/'+name+'.png';
		}
	} else {
		img.onmouseover	= function(){ this.src='images/'+name+'-over.png';};
		img.onmouseout	= function(){ this.src='images/'+name+'.png';};
		img.src	= 'images/'+name+'.png';
	}
}
