/**
 * @author Mike Creighton
 */
function closeLightbox() {
	//$('lightbox').hide();
	//$('pageoverlay').hide();
/*---------------------------------------------------------------------*/
	//Remove the lightbox and video when played finished
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	//if ((browser=="Netscape"|| browser=="Microsoft Internet Explorer") && (version>=4))
	if ((browser=="Opera" || browser=="Microsoft Internet Explorer") && (version>=4))
	  {
		$('lightbox').hide();
		$('pageoverlay').hide();
		swfobject.removeSWF('simplevideoplayer_flash');
		//alert('Lighbox removed for IE');
	  }
	  else if ((browser=="Netscape"|| browser=="Crome"))
	  {
		$('lightbox').hide();
		$('pageoverlay').hide();
		swfobject.removeSWF('simplevideoplayer_flash');
		//alert('Lighbox removed for FF or other browsers');
	  }
	else
	  {
		//Remove the lightbox and video when played finished
		window.lightboxes.hide('VideoTrailer'); 
		//alert('Lighbox removed for Safari or other browsers');
	  }
/*---------------------------------------------------------------------*/	
	//Remove the SWF embedded above so we can update it
	//swfobject.removeSWF('simplevideoplayer_flash');
	
	//Readd our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
	$('VideoTrailer').insert("<div id=\"simplevideoplayer\"><p>Upgrade your flash player to see this content.</p></div>");
	
}

function displayDelayVideo(video,gameName, gameDate, externalUrl, requiresAgeGate)
{
   if(document.getElementById("VideoTrailer")!=null){
      setTimeout( function() { displayVideo(video, gameName, gameDate, externalUrl, requiresAgeGate) });
   }
}

function displayVideo(video, gameName, gameDate, externalUrl, requiresAgeGate){
	window.lightboxes.show('VideoTrailer');
	//alert("Video to be displayed: " + video + "\n" + gameName + "\n" + gameDate + "\n" + externalUrl + "\nAge Gate: " + requiresAgeGate);	
	
		var flashvars = {					
			videoURL:video,
			//videoURL: "http://fp.scea.com/csimg/psp/PSP_MM_PS_STORE_General.flv",
			gameName: gameName,
			gameDate: gameDate,
			externalUrl: externalUrl,
			requiresAgeGate: requiresAgeGate,
			keyColor : SysColor
	};
		
	swfobject.embedSWF('swf/simpleVideoPlayer.swf', 'simplevideoplayer', '640px', '480px', '9.0.47', 'js/swfobject/expressinstall.swf', flashvars, {bgcolor: '#000000', menu: 'false', allowFullScreen:'false', quality:'best', scale:'noscale', saligh:'lt', allowScriptAccess:'always', wmode:'transparent'}, {id: 'simplevideoplayer_flash'});
	
	//Get and Register an event to our lightbox close button
	this.close = $('lightbox').select('div.close a').first();
	this.overlay = $('pageoverlay');
	
	this.overlay.observe('click', function(e){
		Event.stop(e);
		$('lightbox').hide();
		$('pageoverlay').hide();
		
		//Remove the SWF embedded above so we can update it
		swfobject.removeSWF('simplevideoplayer_flash');
		
		//Read our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
		if(!$('simplevideoplayer')){
			$('VideoTrailer').insert("<div id=\"simplevideoplayer\"><p>Upgrade your flash player to see this content.</p></div>");
		}
		
	});

	this.close.onclick = function(e){
	
		$('lightbox').hide();
		$('pageoverlay').hide();
		
		//Remove the SWF embedded above so we can update it
		swfobject.removeSWF('simplevideoplayer_flash');
		
		//Read our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
	   $('VideoTrailer').insert("<div id=\"simplevideoplayer\">Upgrade your flash player to see this content.</div>");
	   return false;
	}
	
	
		
}
function displayVideo_new(video, gameName, gameDate, externalUrl, requiresAgeGate){
	window.lightboxes.show('VideoTrailer_new');
	//alert("Video to be displayed: " + video + "\n" + gameName + "\n" + gameDate + "\n" + externalUrl + "\nAge Gate: " + requiresAgeGate);	
	
		var flashvars = {					
			videoURL:video,
			//videoURL: "http://fp.scea.com/csimg/psp/PSP_MM_PS_STORE_General.flv",
			gameName: gameName,
			gameDate: gameDate,
			externalUrl: externalUrl,
			requiresAgeGate: requiresAgeGate,
			keyColor : SysColor
	};
		
	swfobject.embedSWF('swf/popupVideoPlayer_working.swf', 'simplevideoplayer', '594px', '333px', '9.0.47', 'js/swfobject/expressinstall.swf', flashvars, {bgcolor: '#000000', menu: 'false', allowFullScreen:'false', quality:'best', scale:'noscale', saligh:'lt', allowScriptAccess:'always', wmode:'transparent'}, {id: 'simplevideoplayer_flash'});
	
	//Get and Register an event to our lightbox close button
	this.close = $('lightbox').select('div.close a').first();
	this.overlay = $('pageoverlay');
	
	this.overlay.observe('click', function(e){
		Event.stop(e);
		$('lightbox').hide();
		$('pageoverlay').hide();
		
		//Remove the SWF embedded above so we can update it
		swfobject.removeSWF('simplevideoplayer_flash');
		
		//Read our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
		if(!$('simplevideoplayer')){
			$('VideoTrailer_new').insert("<div id=\"simplevideoplayer\"><p>Upgrade your flash player to see this content.</p></div>");
		}
		
	});

	this.close.onclick = function(e){
	
		$('lightbox').hide();
		$('pageoverlay').hide();
		
		//Remove the SWF embedded above so we can update it
		swfobject.removeSWF('simplevideoplayer_flash');
		
		//Read our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
	   $('VideoTrailer_new').insert("<div id=\"simplevideoplayer\">Upgrade your flash player to see this content.</div>");
	   return false;
	}
	
	
		
}




function displayVideo_watch(video, gameName, gameDate, externalUrl, requiresAgeGate){
	window.lightboxes.show('VideoTrailer_new');
	//alert("Video to be displayed: " + video + "\n" + gameName + "\n" + gameDate + "\n" + externalUrl + "\nAge Gate: " + requiresAgeGate);	
	
		var flashvars = {					
			videoURL:video,
			//videoURL: "http://fp.scea.com/csimg/psp/PSP_MM_PS_STORE_General.flv",
			gameName: gameName,
			gameDate: gameDate,
			externalUrl: externalUrl,
			requiresAgeGate: requiresAgeGate,
			keyColor : SysColor
	};
		
	swfobject.embedSWF('swf/popupVideoPlayer_working.swf', 'simplevideoplayer', '594px', '333px', '9.0.47', 'js/swfobject/expressinstall.swf', flashvars, {bgcolor: '#000000', menu: 'false', allowFullScreen:'false', quality:'best', scale:'noscale', saligh:'lt', allowScriptAccess:'always', wmode:'transparent'}, {id: 'simplevideoplayer_flash'});
	
	//Get and Register an event to our lightbox close button
	this.close = $('lightbox').select('div.close a').first();
	this.overlay = $('pageoverlay');
	
	this.overlay.observe('click', function(e){
		Event.stop(e);
		$('lightbox').hide();
		$('pageoverlay').hide();
		
		//Remove the SWF embedded above so we can update it
		swfobject.removeSWF('simplevideoplayer_flash');
		
		//Read our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
		if(!$('simplevideoplayer')){
			$('VideoTrailer_new').insert("<div id=\"simplevideoplayer\"><p>Upgrade your flash player to see this content.</p></div>");
		}
		
	});

	this.close.onclick = function(e){
	
		$('lightbox').hide();
		$('pageoverlay').hide();
		
		//Remove the SWF embedded above so we can update it
		swfobject.removeSWF('simplevideoplayer_flash');
		
		//Read our simplevideoplayer div that was removed during removeSWF() so we can re-emebed the movie player w/ the new movie
	   $('VideoTrailer_new').insert("<div id=\"simplevideoplayer\">Upgrade your flash player to see this content.</div>");
	   return false;
	}
	
	
		
}


