/**
 * @author Mike Creighton
 */
function closeLightbox() {
	//$('lightbox').hide();
	//$('pageoverlay').hide();
	//Remove the lightbox and video when finished
	//window.lightboxesModule.hide('VideoTrailer'); 

	//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) },10);
   }
}

function displayVideo(video, gameName, gameDate, externalUrl, requiresAgeGate){
	window.lightboxesModule.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('/Content/PSNzip/storeaboutmoviestv/videomodulecontent/swf/simpleVideoPlayer.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');
		
		//Readd 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');
		
		//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\"></div>");
	   return false;
	}
	
	
		
}