// JavaScript Document
//  SET THIS VALUE TO "true" IF THE PLATFORM IS DOWN AND/OR PLAYER IS DOWN
//  when set to "true" each instance of the broadband player will display a "Site Down" page.
var siteDown = false;

if (!siteDown) {
	// CSS FILES FOR PLAYER -------------------------------------
		document.write("<link rel='stylesheet' type='text/css' href='http://pbskids.org/go/video/css/stationModule.css'/>");
		document.write("<link rel='stylesheet' type='text/css' href='http://pbskids.org/includes/localize/localize.css'/>");
		document.write("<link rel='stylesheet' type='text/css' href='http://pbskids.org/includes/auth/ajax.css'/>");
	
	// JAVASCRIPT FILES FOR PLAYER ------------------------------
		document.write("<script type='text/javascript' src='http://pbskids.org/includes/flash/swfobject2.js'></script>");
	
	// PBS KIDS BRIDGE LIGHTBOX ---------------------------------
		document.write("<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>");
		document.write("<script type='text/javascript' src='http://pbskids.org/includes/javascript/bridge.urls.js'></script>");
		document.write("<script type='text/javascript' src='http://pbskids.org/includes/javascript/bridge.stations.js'></script>");

	// TOGGLE LIGHTBOX FUNCTION ---------------------------------
		function toggleLightBox(visible) {
			document.getElementById("LightBoxFill").style.display = visible == "true" ? "block" : "none";
		}
	
	//====== CREATE PBS KIDS GO! PLAYER MODULE =======================================
		if(!this.pbs) this.pbs = {};
		if(!pbs.kidsgo) pbs.kidsgo = {};
		pbs.kidsgo.broadbandplayer = {};
		pbs.kidsgo.broadbandplayer.init = function(_stationID, _supersite, _configObj) {
			
			// CREATE CONTAINERS ----------------------------------------
				document.writeln('<div id="playerWrapper">');
				document.writeln('	<div id="playerInnerWrapper">');
				<!-- Flash Content -->
				<!-- Div replaced with FlashObject -->
				document.writeln('		<div id="playerContent">');
				document.writeln('		</div>');
				<!-- END Div replaced with FlashObject -->
				<!-- FlashObject code -->
				document.writeln('	</div>');
				document.writeln('</div>');
				
				
				LightBoxFill = document.createElement('div');
				LightBoxFill.id = "LightBoxFill";
				window.onload=function(){
					container = document.getElementsByTagName("body")[0];
					setTimeout('container.appendChild(LightBoxFill)', 4000);
				}
			
			
			// ADD FLASH VARS -------------------------------------------
				var flashvars = {};
					flashvars.lockStation = "true";
					flashvars.isPlayerModule = "true";
					flashvars.stationCallLetters = _stationID;
					flashvars.affiliateID = "kidsGOplayer-" + _stationID;
			
			// ADD FLASH PARAMETERS AND ATTRIBUTES ----------------------
				var params = {};
					params.menu = "false";
					params.wmode = "transparent";
					params.allowFullScreen = "true";
					params.allowscriptaccess = "always";
					
				var attributes = {};
					attributes.id = "kidsGoPlayer"
					attributes.name = "kidsGoPlayer";
					
			// CREATE THE PLAYER SWF ------------------------------------
				swfobject.embedSWF_PBS_enable_cdn('http://pbskids.org/go/video/swf/KidsGoPlayer.swf', 
								   "playerContent", 950, 734, "10.0.0",
								   "http://www-tc.pbskids.org/video/swf/expressinstall.swf", 
								   flashvars, params, attributes
								  );
			
		}
	
	
} else {// IF SITE OR thePlatform IS DOWN //
    
    document.write('<style type="text/css">body {margin: 0px;height: 100%;width: 100%;}</style> <table border="0" cellspacing="0" cellpadding="0" width="100%" height="90%" valign="middle"><tr><td><div style="margin:auto; width:760px; height:376px"><img src="http://www-tc.pbskids.org/go/video/img/down.jpg" border="0" alt="Our site is down, but we will be back soon. Just play outside or clean your room!"></div></td></tr></table>');

}
    
    
