

//following is to fix -click to activate and use this control 
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}

function testAlert(mesg){
alert("testAlert"+mesg);
}

//function writeHeader(page) {
//	document.write("<div class=\"nav\" id=\"navWrap\">");
//	document.write("<ul>");
//	document.write("<li id=\"agk-games\"><a href=\"games.action\">Games</a></li>");
//	document.write("<li id=\"agk-videos\"><a href=\"videos.action\">Videos</a></li>");
//	document.write("<li id=\"agk-activities\"><a href=\"activities.action\">Activities</a></li>");
//	document.write("</ul>");
//	document.write("</div>");
//	document.write("<div id=\"train\" class=\"brands\">");
//	document.write("<img src=\"/images/char-train.gif\">");
//	document.write("</div>");
//	//document.write("<script type=\"text/javascript\">");
//	// <![CDATA[
//	var so = new SWFObject("/swf/universalnav.swf", "uninav", "520", "85", "9", "#009DE9");
//	so.addVariable("thisPage", page);
//	so.addParam("base", "/swf");
//	so.addParam("wmode", "transparent");
//	so.useExpressInstall("/js/expressinstall.swf");
//	so.write("navWrap");
//	// ]]>
//	//document.write("</script>");
//	// <![CDATA[
//	var so = new SWFObject("/swf/trainnav.swf", "trainnav", "924", "160", "9", "#04BAFF");
//	so.addParam("base", "/swf");
//	so.write("train");
//	// ]]>
//}

//function writeFooter(){
//	document.write("<div class=\"footer\">");
//	document.write("<p class=\"flinks\">");
//	document.write("<span class=\"emph\">Your Favorite Characters:</span><br />");
//	document.write("Care Bears Strawberry Shortcake Sushi Pack<br />");
//	document.write("Popples Holly Hobbie and Friends Maryoku Yummy <span class=\"emph\">more...</span>");
//	document.write("</p>");
//	document.write("<p class=\"flinks\">");
//	document.write("<span class=\"emph\">Top Games:</span><br />");
//	document.write("Muffin Make Pack a Picnic Oopsy Bear's Slide <br />");
//	document.write("Strawberry Dancer Berry Patch <span class=\"emph\">more...</span>");
//	document.write("</p>");
//	document.write("<br />");
//	document.write("<p class=\"fbar\">");
//	document.write("<a href=\"#\" > Contact Us </a>&nbsp;&nbsp;&nbsp;");
//	document.write("<a href=\"#\" > Terms of Use </a>&nbsp;&nbsp;&nbsp;");
//	document.write("<a href=\"#\" > Privacy Policy </a>&nbsp;&nbsp;&nbsp;");
//	document.write("<a href=\"#\" > Site Map </a>&nbsp;&nbsp;&nbsp;");
//	document.write("<a href=\"#\" > Internet Safely </a>&nbsp;&nbsp;&nbsp;");
//	document.write("<a href=\"#\" > RSS Set-Up </a>&nbsp;&nbsp;&nbsp;");
//	document.write("<a href=\"/rss/feed.xml\"><img src=\"images/feed.gif\" title=\"RSS Feed\"/></a>");
//	document.write("</p>");
//	document.write("</div>");
//}
var activityPlayerLoaded = false;
var thisLoc = location.host;
var sep = thisLoc.indexOf(".");
var pre = thisLoc.substr(0,sep);
var hostRef= location.href;
var pathName= location.pathname;
var brandName=pathName.substr(1,pathName.indexOf("/"));

// Use a variable to reference the embedded SWF.
var flashPlayer;
var newWin = null;
var loadActivityPlayer=false; 

var winexist=false;
/* When the HTML page loads (via the onLoad event of the <body> tag) we have it call the initialize() function. */
function initialize(flashAsset) {
	/* Check if the browser is IE. If so, flashVideoPlayer is window.videoPlayer. Otherwise, it's window.document.videoPlayer. The videoPlayer is the id assigned to <object> and <embed> tags. */
	var ie = navigator.appName.indexOf("Microsoft") != -1;
	flashPlayer = (ie) ? window[flashAsset] : document[flashAsset];
}
//function sendPlayList(playlist, id){

//  flashPlayer.sendPlayList(playlist, id);
//}
//function handlePlay(param ,videoTop) {
//alert("hello");
//	//alert("param=="+param+"videoTop="+videoTop)
//	flashPlayer.getSelected(param);
//	var ret;
//	var playerDIV=null;
//	if(document.getElementById("vidplayer") != null)
//	{
//	
//		playerDIV=document.getElementById("vidplayer");
//		
//	}else if(document.getElementById("activityplayer") != null)
//	{
//	
//		playerDIV=document.getElementById("activityplayer");
//			
//	}
//	
//	if(playerDIV != null){
//		
//		ret=findPos(playerDIV);
//		//alert("inside videoPlayer div not null...."+ret[0]+"::"+ret[1]);		
//		if(videoTop == "false" || videoTop==""){
//			
//			scroll(ret[0],ret[1]);
//		}
//		
//		/*else {
//			scroll(0,0);
//		}*/
//		
//	}
//	 
//	return true;
//}
//function clearVideoPlayList(){

//	flashPlayer.clearVideoPlayList();

//}
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
//function loadScene(){
//	flashPlayer.loadScene();	
//}

//function loadAPlayer(base){
////alert("calling Aplayer ");
//// <![CDATA[
////alert("loadAplayer pre="+pre);
//var so1 = new SWFObject(base+"/activityPlayer.swf", "activityplayer", "920", "540", "9", "#FFFFFF")
//        so1.addParam("allowfullscreen","true")
//        so1.addParam("base", base)
//        so1.addParam("allowScriptAccess","always")
//        so1.addParam("swliveconnect", "true");
//        so1.addVariable("videoCatalog", "/videos/videos.xml")
//        so1.useExpressInstall('/js/expressinstall.swf')
//		so1.addVariable("prefix", pre)
//        so1.write("activities-top")
//        initialize('activityplayer');
//// ]]>
//	//if(document.getElementById( "activityplayer" ) != null)
//	//document.getElementById( "activityplayer" ).focus();

//	//so1.loadScene();
//	

//}

//function loadGamePlayer(url,loadtime)
//{
//	
//	//alert("loadGamePlayer url="+url);
//	var t;
//	var ret;
//	
//	if(url.indexOf("html") != -1){
//		if (window.XMLHttpRequest) 
//		{
//			req = new XMLHttpRequest();
//			req.onreadystatechange = processReqChange;
//			req.open("GET", url, true);
//			req.send(null);
//			// branch for IE/Windows ActiveX version
//		} else if (window.ActiveXObject) 
//		{
//			req = new ActiveXObject("Microsoft.XMLHTTP");
//			if (req) 
//			{
//				req.onreadystatechange = processReqChange;
//				req.open("GET", url, true);
//				req.send();
//			}
//		}
//		if(loadtime=="thumbnail")
//		{
//			//t=setTimeout("scrollBack()",0);
//			if(document.getElementById("games-shell") != null)
//			{
//				ret=findPos(document.getElementById("games-shell"));
//				scroll(ret[0],ret[1]);
//			} else if(document.getElementById("activities-top") != null)
//			{
//				ret=findPos(document.getElementById("activities-top"));
//				scroll(ret[0],ret[1]);
//			
//			}
//			
//		}
//	}
//}
//function scrollBack()
//{
//	//scroll(0,0);
//}
//function processReqChange() 
//{
//	// only if req shows "complete"
//	if (req.readyState == 4) {
//	// only if "OK"
//		if (req.status == 200) {
//			if(document.getElementById("games-shell") != null){
//				document.getElementById("games-shell").innerHTML = req.responseText;
//			}else if(document.getElementById("activities-top") != null){
//				document.getElementById("activities-top").innerHTML = req.responseText;
//			}
//			/*if(document.getElementById("game")!= null)
//			{
//				document.getElementById("game").focus();
//			}*/
//		} else {
//			alert("There was a problem retrieving the XML data:\n" + req.statusText);
//		}
//	}
//}

//function openActivityDownload(path)
//{
//	newWin = window.open(path, 'newWin'); 
//	newWin.focus();
//	
//}

//function loadInteractivePlayerold(theURL,loadtime)
//{
//	
//	//alert("loadInteractivePlayer"+theURL);
//	var ret1;
//	// <![CDATA[
//	var so = new SWFObject(theURL, "interactiveplayer", "920", "540", "9", "#FFFFFF")
//	so.addParam("allowfullscreen","true")
//	so.addParam("base", "/swf")
//	so.addParam("allowScriptAccess","always")
//	so.addVariable("prefix", pre)
//	so.addParam("swliveconnect", "true");
//	so.addParam("category_type","activities");	
//	so.useExpressInstall('/js/expressinstall.swf')
//	so.write("activities-top")
//	initialize('interactiveplayer')
//	if(loadtime=="thumbnail")
//	{
//		if(document.getElementById( "interactiveplayer" ) != null){
//			ret1=findPos(document.getElementById("interactiveplayer"));
//			scroll(ret1[0],ret1[1]);
//		}
//	}/*else{
//		scroll(0,0);
//	}*/
//}
//function loadInteractivePlayer(theURL,loadtime){
//alert("new interactive......");
//loadGamePlayer(theURL,loadtime)
//}
// Submit the hidden parental site form
// Used by Flash components to handle the 'Parents' tab.
function openParentalSite()
{
  var formId = 'hiddenParentalLink';
  
  var form = document.getElementById(formId);
  
  if (form != null)
  {
  	form.submit();
  }
  else
  {
    alert("Error: form "+formId+" not found.");
  }
}

// Handle navigation to an external site
function openSite(siteUrl)
{
  var formId = 'hiddenExternalLink';
  var hintId = 'hiddenExternalUrl';

  var form = document.getElementById(formId);
  
  if (form != null)
  {
    var hint = document.getElementById(hintId);
    
    if (hint != null)
    {
      hint.value = siteUrl;
      form.submit();
    }
    else
    {
      alert("Error: input parameter "+hintId+" not found.");
    }
  }
  else
  {
    alert("Error: form "+formId+" not found.");
  }
}

//Mini Video Player
function showMiniPlayer(path, title, desc, mod) {
    closeMiniPlayer();
	document.getElementById("teachMomentsMod" + mod).style.height = "600px"
		
	var so = new SWFObject("/swf/miniPlayer.swf", "vidplayer", "490", "400", "9", "#A2E5FF")
	so.addParam("base", "/swf")
	so.addVariable("prefix", pre)
	so.addVariable("assetPath", path)
	so.addVariable("assetTitle", title)
	so.addVariable("description", desc)	
	so.useExpressInstall('/js/expressinstall.swf')
	so.write("player" + mod)
	initialize('vidplayer')
	initialize('vidplayer')
}
function closeMiniPlayer() {
    var modArray = $$('div.teachMomentsMod');
    var y = modArray.length;
    if (y > 0) {
    
        for (var x =1; x <= y; x++){
            document.getElementById('teachMomentsMod' + x).style.height = "165px";
            document.getElementById('player' + x).innerHTML = "";
        }
    }
	
}
//changes cursor to hand.. for mouseovers on javascript links
function mouseHand()
{   
    document.body.style.cursor="pointer";
}
//changes cursor to default(pointer).. for mouseovers on javascript links works in ie, opera, not in firefox or safari
function mousePoint()
{
    document.body.style.cursor="default";
}
//browses to url that is past to it.. javascript link
function linkTo(url)
{
    window.location=url;
}

function getQueryString(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
} 

var jsprop3 = ''
var src_code = getQueryString('src')
if (src_code != '')
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	var page_name = sPage.substr(0, sPage.indexOf("."));
	jsprop3 = page_name + "|" + src_code;
}
function openVid(path){
	jQuery.facebox(function() {
        videoFile = path + ".flv";
        assetPath = "/assets/videos/ss/" + path + "/";
        jQuery.get("sslp_vid.html", function(data) {
            jQuery.facebox(data)
            jQuery.dimScreen(1000, 0.3);
         })                
    })
}
function sscHomePage(){
    var envir = pre;
    if (pre == "parents"){
        envir = "www";
    }
    urlString = "http://" + envir + ".agkidzone.com/strawberryshortcake.action";
    window.location = urlString;
}