/**
 * @author Mike Creighton
 */
function closeLightbox() {
	$('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
	$('GameTrailer').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("GameTrailer")!=null){
      setTimeout( function() { displayVideo(video, gameName, gameDate, externalUrl, requiresAgeGate) },10);
   }
}
//, gameName, gameDate, externalUrl, requiresAgeGate
function displayVideo(video){
	window.lightboxes.show('GameTrailer');
//	alert("Video to be displayed: " + video + "\n" + gameName + "\n" + gameDate + "\n" + externalUrl + "\nAge Gate: " + requiresAgeGate);	
    /*
	var flashvars = {					
			videoURL: video,
			gameName: gameName,
			gameDate: gameDate,
			externalUrl: externalUrl,
			requiresAgeGate: requiresAgeGate,
			keyColor : SysColor
	};
    */
    var flashvars = {clip: video};
	swfobject.embedSWF('/videoplayer.prt1-v2.swf', 'simplevideoplayer', '704px', '548px', '9.0.0', '/js/expressinstall.swf', {clip: video}, {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')){
			$('GameTrailer').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
	   $('GameTrailer').insert("<div id=\"simplevideoplayer\"></div>");
	   return false;
	}
}
