//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;
}

//gets the page user is on
var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
var to;
var to2;
var asset_url;
var asset_name;
var asset_type;
var jsform;

var displayAGKAd = Get_Cookie( "agpFlag" );

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", "65", "8", "#009DE9",true,"margin:-20px 0px 0pt");
	so.addVariable("thisPage", page);
	so.addParam("base", "/swf");
	so.addParam("wmode", "transparent");
	so.addVariable("prefix", pre)
	so.addParam("allowScriptAccess","always")	
	so.useExpressInstall("/js/expressinstall.swf");
	so.write("navWrap");
	
	// ]]>

	setTimeout("drawTrain()",50);
	//drawTrain()
}

function drawTrain()
{
	// <![CDATA[
	var so = new SWFObject("/swf/trainnav.swf", "trainnav", "924", "140", "8", "#04BAFF");
	so.addParam("base", "/swf");
	so.addParam("allowScriptAccess","always");
	so.addVariable("prefix", pre);
	//so.addVariable("noAnimation", "true");
	so.addParam("wmode", "transparent");	
	so.addParam("swliveconnect", "true");
	so.write("train");
	
	//jsprop5=window.installedplayer;
	// ]]>
}

function delay() {
}
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("/"));

//following is to setup Omniture values
var jschannel=""
var jspageName=""
var jsbrand=""
var jssection=""
var jsprop2="";
var jsprop4=""
var jsprop5=""
var jsprop6="";
var stat_games="";
var stat_game_name="";
sep=pathName.indexOf(".")
var pageurl=pathName.substr(0,sep);
//alert("pageurl="+pageurl+" pathName="+pathName.substr(0,26))

if(pathName.length >= 26)
stat_games=pathName.substr(0,27);

//alert("stat_games="+stat_games)
if(stat_games == "/partners/spill_group/games")
{
		jsbrand="agkidzone";
		jssection="games";

}
else
{
	if(pageurl.indexOf("_") == -1){
		jspageName=pageurl.substr(1,pageurl.length);
	}else{
		if(pageurl.substr(1,4) == "meet")
		jspageName=pageurl.substr(1,pageurl.length);
		else
		jspageName=pageurl.substr(1,2);
	}

	if(jspageName.length > 2)
	{

	if(jspageName=="home" || jspageName=="games" || jspageName=="videos" || jspageName=="activities")
	{
		//alert("inside agkid...");
		jsbrand="agkidzone";
		jssection=jspageName;
	}
	else {
	
		if(jspageName == "berrypoints")
		{
			jsbrand="strawberryshortcake"
			jssection="berrypoints";
		
		}
		else
		if(jspageName.substr(0,4) == "meet")
		{
			
			jsbrand=jspageName.substr(5,jspageName.length);
			if(jsbrand == "strawberry")
			jsbrand="strawberryshortcake";
			
			jssection="meet";
		
		}
		else{
			jsbrand=jspageName;
			jssection="home";
		}

	}
	
}else {
	
	jsbrand=getBrand(jspageName)
	jssection=pageurl.substr(4,pageurl.length)

}

}

//alert("brand & section "+jsbrand+"|"+jssection)
jspageName=jsbrand+"|"+jssection;
jschannel=jsbrand+"|"+jssection;
jsprop4=jsbrand;
jsprop6=jssection
if(Get_Cookie('agpPCC') != null)
{
	jsprop2 =Get_Cookie('agpPCC');
	Delete_Cookie( 'agpPCC', '/', '' );
}



//alert(jsprop2);
//alert("brand & section "+jsbrand+"|"+jssection)
//alert("jspageName="+jspageName+" jschannel="+jschannel+" jsprop4="+jsprop4+" jsprop6="+jsprop6)

function getBrand(brandval)
{
	if(brandval== "carebears" || brandval =="cb")
	{
		return "carebears";
	}else
	if(brandval== "strawberryshortcake" || brandval =="ss")
	{
		return "strawberryshortcake"
	}else
	if(brandval== "sushipack" || brandval =="sp")
	{
		return "sushipack"
	}else
	if(brandval== "hollyhobbie" || brandval =="hh")
	{
		return "hollyhobbie"
	}
	else 
	{
		return "agkidzone";
	}

}
// Use a variable to reference the embedded SWF.
var flashPlayer;
var catalogPlayer;
var newWin = null;
var loadActivityPlayer=false; 
var playList;
var winexist=false;
var playID;
var ie = navigator.appName.indexOf("Microsoft") != -1;

/* 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. */
	flashPlayer = (ie) ? window[flashAsset] : document[flashAsset];
	catalogPlayer = (ie) ? window['catalog'] : document['catalog'];
}
function initializeAP(flashAsset,playerName) {
	//alert("flashAsset="+flashAsset+"playerName=="+playerName);
	initialize(flashAsset)
}

function sendPlayList(playlist, id){
	playList=playlist;
	playID=id;
  	flashPlayer.sendPlayList(playlist, id);

	catalogPlayer = (ie) ? window['catalog'] : document['catalog'];
}
var catalogReadyState = false;
function catalogReady(bool, playIndex){
	catalogReadyState = bool;
}
function updateCatalog(playIndex, assetType){
	if (catalogReadyState) {
		catalogPlayer.updateCatalog(playIndex);
	}
	asset_type = assetType;
	if(document.getElementById("sendtof")){
        hideForm();
    }
}
var paramValue;
var focusStatus;
function handlePlay(param ,videoTop) {
	//alert("param=="+param+"videoTop="+videoTop)
	paramValue=param;
	focusStatus=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]);
		}
		
	}
	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();	
}


var activityflag=false
function loadAPlayer(base,brand_type, assetName, type)
{
//alert(" loadAPlayer .....myInterval="+myInterval);
asset_name = assetName;
asset_type = type;
//hideForm();
//if(document.getElementById("fromLink")){
//    hideForm();
//}
//if(document.getElementById("fromName")){
//    hideForm();
//}
if(myInterval != null)
clearInterval(myInterval);



// <![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.addVariable("base", base)
		so1.addVariable("brand_type",brand_type);	        
        so1.addParam("allowScriptAccess","always")
        so1.addVariable("prefix", pre)
        so1.addParam("swliveconnect", "true");
         so1.addParam("id", "activityplayer");
	    so1.useExpressInstall('/js/expressinstall.swf')
	    so1.write("activities-top")
	    initializeAP('activityplayer',base+"/activityPlayer.swf");
        initialize('activityplayer');
// ]]>

	//if(document.getElementById( "activityplayer" ) != null)
	//document.getElementById( "activityplayer" ).focus();

	//so1.loadScene();
	
	//catalogPlayer.getAPSelected("loaded AP player...")
	myInterval =setInterval('waitUntilLoaded()',600);


	
	
}
function setPlaylist()
{
  	flashPlayer.sendPlayList(playList, playID);
  	handlePlay(paramValue,focusStatus)

}

var myInterval;

function waitUntilLoaded() {
  var testMovie = document.getElementById( "activityplayer" );

 if(testMovie != null)
 {
	  if(testMovie.PercentLoaded() == 100 ) 
	  {
	  	 	clearInterval(myInterval);
	  	 	
	  	 	catalogPlayer.SetVariable("jsActivityPlayer","true");
	  
	   } 
   }
 
}

function loadGamePlayer(url,loadtime, asset, type)
{
	var t;
	var ret;
    asset_name = asset;
    asset_type = type;
    
    if(asset_type == "activities"){
        hideForm();
    }
    if(document.getElementById("fromLink")){
        hideForm();
    }
    if(document.getElementById("fromName")){
        hideForm();
    }
     //AGK loader ad
	displayAGKLoaderAd();
	
	//spill group loader ad
	displayLoaderAd();
	
	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" || loadtime == "")
		{
			//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]);
			
			}
			
		}
	}
	//re-load the banner ad on the spill group page when a new game is selected.
	loadSpillAd();
}

//This function will display central ad for the AGK games pages
function displayAGKLoaderAd()
{
   	var loaderDiv = document.getElementById("loaderAd");
	if(loaderDiv)
    {	
    	if(displayAGKAd == "true")
    	{
	    	
	    	document.getElementById("games-shell").style.display = "none";
	    	displayAdTitle();
	    	//document.getElementById("gamesMain").style.marginTop = "-53px";
	    	document.getElementById("loaderAd").style.display = "block";
	    	
	    	document.getElementById("email_wrap").style.display = "none";
	    	
	    	$("#loaderAd").load("/loader.jsp");
	  		
	    	clearTimeout(to2);
	    	to2 = setTimeout('hideAGKLoaderAd()', 15000);
    	}	
    	else
    	{
    		hideAGKLoaderAd();
    	}	
    }
}

function displayAdTitle()
{
//	var milli = new Date().getTime();
//	var adTitle = document.getElementById("adTitle");
//	adTitle.innerHTML = "<iframe src=\"http://ad.doubleclick.net/adi/agi.kidzone.home/games;tile=1;dcopt=ist;sz=290x51;ord=" + milli + "?\" width=\"290\" height=\"51\" marginwidth=\"0\" marginheight=\"0\" hspace=\"0\" vspace=\"0\" frameborder=\"0\" scrolling=no borderCOLOR=\"#000000\">" +
//	"<script language=\"JavaScript\" src=\"http://ad.doubleclick.net/adj/agi.kidzone.home/games;tile=1;dcopt=ist;sz=290x51;abr=!ie;ord=" + milli + "?\" type=\"text/javascript\"></script>" +
//	"<noscript><a href=\"http://ad.doubleclick.net/jump/agi.kidzone.home/games;tile=1;sz=290x51;abr=!ie4;abr=!ie5;abr=!ie6;ord=" + milli + "?\" target=\"_blank\"><img src=\"http://ad.doubleclick.net/ad/agi.kidzone.home/games;tile=1;sz=290x51;abr=!ie4;abr=!ie5;abr=!ie6;ord=" + milli + "?\" width=\"290\" height=\"51\" border=\"0\" alt=\"\"></a></noscript>" +
//	"</iframe>";
	document.getElementById("adTitle").style.display = "block";
}

function hideAGKLoaderAd()
{
	document.getElementById("loaderAd").innerHTML = "";
	document.getElementById("loaderAd").style.display = "none";	
	document.getElementById("games-shell").style.display = "block";
	document.getElementById("email_wrap").style.display = "block";
	document.getElementById("adTitle").style.display = "none";
}

//This function will display central ad for the spill group games
function displayLoaderAd()
{
    	var loaderAdDiv = document.getElementById("spacontain");
        if(loaderAdDiv)
        {	
            //alert(loaderAdDiv);
	        document.getElementById("games-shell").style.display = "none";
	        document.getElementById("spacontain").style.display = "";
	        //document.getElementById("loaderImage").src = "/partners/sg/images/sploader.gif";

	           var so = new SWFObject("/partners/sg/swf/loader.swf", "loader", "280", "14", "8", "#FFFFFF")
	           so.addParam("base", "/partners/sg/swf")
	           so.useExpressInstall('/js/expressinstall.swf')
	           so.write("Ploader")
    		
	        //var milli = new Date().getTime();
	        var loaderAd = document.getElementById("spillLoaderAd");
	        //hard coded AD TAG supplied by Spil Group
		    loaderAd.innerHTML = "<iframe id='a33ed07e' name='a33ed07e' src='http://www2.boago.com/www/delivery/afr.php?n=a33ed07e&amp;zoneid=1571' framespacing='0' frameborder='no' scrolling='no' width='300' height='250'>" + 
		    	"<a href='http://www2.boago.com/www/delivery/ck.php?n=aa9854e4' target='_blank'><img src='http://www2.boago.com/www/delivery/avw.php?zoneid=1571&amp;n=aa9854e4' border='0' alt='' /></a></iframe>"
		        		
		    clearTimeout(to);
		    to = setTimeout('hideLoaderAd()', 30000);		
	    }
   
}


//This function will hide the central ad for the spill group games and show the regular games 

function hideLoaderAd()
{
	document.getElementById("spacontain").style.display = "none";
	document.getElementById("games-shell").style.display = "block";
}


function scrollBack()
{
	//scroll(0,0);
}
function processReqChange() 
{
	// only if req shows "complete"
	if (req.readyState == 4) {
	// only if "OK"
		if (req.status == 200) {
//			alert(req.responseText.indexOf("<html"));
			if (req.responseText.indexOf("<") == -1) {
					var brokenString = req.responseText.split(", ");
					//alert(pre + " the prefix");
					//alert("processReqChange="+brokenString);
					var mo = new SWFObject(""+brokenString[0]+"", ""+brokenString[1]+"", ""+brokenString[2]+"", ""+brokenString[3]+"", ""+brokenString[4]+"", ""+brokenString[5]+"");
					mo.addParam("base", ""+brokenString[6]+"");
					mo.addVariable("prefix", pre);
					mo.addVariable("vName", getQueryParamValue("vName"));
					mo.addVariable("vFrom", getQueryParamValue("vFrom"));
					mo.addVariable("vMsg", getQueryParamValue("vMsg"));
					mo.addVariable("vS", getQueryParamValue("vS"));
					mo.addVariable("vF", getQueryParamValue("vF"));
					mo.addVariable("vB", getQueryParamValue("vB"));
					mo.addVariable("vIm", getQueryParamValue("vIm"));
					mo.write(""+brokenString[7]+"");
					
					if (brokenString[7]=="game"){
						var gtop = document.getElementById("games-top");
						var game = document.getElementById("game");
						game.style.cssFloat ="left";
						game.style.styleFloat ="left";
						game.style.width ="640px";
						game.style.height ="500px";
						var newdiv = document.createElement('div');
						var divIdName = 'instructions';
						newdiv.setAttribute('id',divIdName);
						gtop.appendChild(newdiv);
						var no = new SWFObject(brokenString[6]+"instructions.swf", "instr", "200", "420", "8", "#FFFFFF");
						no.write("instructions");	
					}
			} else {
				
				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;
				} else if(document.getElementById("home-content") != null){
					document.getElementById("home-content").innerHTML = req.responseText;
				}
				
			}
		} 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)
{
	var ret1;
	// <![CDATA[
	var so = new SWFObject(theURL, "interactiveplayer", "920", "540", "9.0.28", "#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]);
		}
	}
}
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(siteUrl)
{
  var formId = 'hiddenParentalLink';
  var hintId = 'hiddenParentalUrl';
  
  var form = document.getElementById(formId);
  
  if (form != null)
  {
    var hint = document.getElementById(hintId);
    
    if (hint != null)
    {
      	if (siteUrl != undefined && siteUrl != null)
  		{
  			hint.value = siteUrl; 
  		}
      	 
  		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.");
  }
}

//Places focus on first input in the first valid form on page
function setFocus()
{
    //sets focus on first form with className of inputForm
    var classInputForm = $$('form.inputForm');
    if (classInputForm.length != 0)
    {
        Form.focusFirstElement(classInputForm[0]);
    }
    else
    {        
        //gets the number of forms on the page
        var frmArray = $$('form');
        var y = frmArray.length;
        //loops through form elements to find first form that is not null and not hidden
        for (var x = 0; x<= y - 1; x++)
        {
            var frm = document.forms[x];
            if (frm != null)
            {
                if (frm.style.display != 'hidden')
                {
                    //places the focus on first element
                    Form.focusFirstElement(frm);
                    break;
                }
            }
        }
    }
}

// Open the specified URL in the popup's parent window 
// and close the popup
function openInParentWindow(url)
{
  opener.location = url;  
  self.close();
}

function loadSpillAd()
{
    
	    //load the Ad tag for the spill group page.
   	    var ad = document.getElementById("spillAd");
        
   	    if(ad)
   	    {
			//hard coded AD TAG supplied by Spil Group
			ad.innerHTML = "<iframe id='a0aaa882' name='a0aaa882' src='http://www2.boago.com/www/delivery/afr.php?n=a0aaa882&amp;zoneid=1572' framespacing='0' frameborder='no' scrolling='no' width='728' height='90'>" +
		    	"<a href='http://www2.boago.com/www/delivery/ck.php?n=a11182b3' target='_blank'><img src='http://www2.boago.com/www/delivery/avw.php?zoneid=1572&amp;n=a11182b3' border='0' alt='' /></a></iframe>";
			
		    //scroll to top of page so the ad is viewable
		    scroll(0,0);
	    }
	
};

// Sets cookie for code redemtion page
// accessed by external call from vault.swf passing it the name of the cookie and the value(code entered), and number of days(send 0 to not set expire attrib)
function setCookie (name, value, days) {    
    if (days<1){
        //alert("not setting expire");
        document.cookie = name + '=' + value;
    }else{
        //alert("setting cookie " + name + " " + value + " " + days);
        var today = new Date();
	    var expires = new Date( today.getTime() + (days * 1000 * 60 * 60 * 24) );
 	    document.cookie = name + '=' + value + "; expires=" + expires.toGMTString()+";";
    } 	
}

function Get_Cookie( name ){
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function getPlayerVersion(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
	var x=navigator.plugins["Shockwave Flash"];
	if(x&&x.description){
	_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));
	}
}else{
if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){
	var axo=1;var _26=3;while(axo){
try{
	_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);
	_23=new deconcept.PlayerVersion([_26,0,0]);
}catch(e){
	axo=null;
}
}
}else{
	try{
		var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
	}catch(e){
try{
	var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
	_23=new deconcept.PlayerVersion([6,0,21]);
	axo.AllowScriptAccess="always";
} catch(e){
if(_23.major==6){
	return _23;
}
}try{
	axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
}catch(e){
}
}if(axo!=null){
	_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
}
}
}
	return _23;
};
this.installedVer=getPlayerVersion();
jsprop5 = this.installedVer.major + "," + this.installedVer.minor + "," + this.installedVer.rev;


var bookmarkurl="http://www.agkidzone.com";
var bookmarktitle="agkidzone";
function addbookmark()
{
	if(ie)
	{
		if (document.all);window.external.AddFavorite(bookmarkurl,bookmarktitle)
	}
	else
	{
		addbookmarkforothers();
	}
}
	
function addbookmarkforothers()
{
	alert(" Automatic bookmarking is not suppported by your browser,\n Please Click 'Bookmarks' in the toolbar to add us to your 'Favorites' ");
}
function sethomepageforothers() 
{
		 
	var myAgent = navigator.userAgent;
	w=open('','agkidzone Home Page instructions','width=600,height=250,scrollbars,resizable,toolbar,status');
	if (myAgent.indexOf("Safari") != -1 || myAgent.indexOf("Mac") != -1)
	{
	    	with(w.document)
	    	{
		   		write("<body>");
				write('1. Click on the Safari menu, select Preferences..  <br>');
				write('2. In the home page text field enter  <br>');
				write('  http://www.agkidzone.com   <br>');
				write('3. click ok to save your preferences  <br>');
				write('4. agkidzone.com is now your home page <br>');
		   		write("</body>");
	 		}
	
	}else
	{
    	w=open('','agkidzone Home Page instructions','width=600,height=250,scrollbars,resizable,toolbar,status');
    	with(w.document)
    	{
    		write("<body>");
			write('1. Click Tools  <br>');
			write('2. Select options  <br>');
			write('3. Select main  <br>');
			write('4. In the home page text field enter  <br>');
			write('  http://www.agkidzone.com   <br>');
			write('5. click ok to save your preferences  <br>');
			write('6. agkidzone.com is now your home page <br>');
	   		write("</body>");
  		}
  	}
 		
}
function delete_cookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
function callCookieInfo()
{
if(Get_Cookie("dob"))
{
delete_cookie("dob");
document.forms[0].action = 'register.action';
document.forms[0].submit();
}
}

var intImage = 1;
function swapImage1() {
	switch (intImage) {
		case 1:
			document.getElementById("how_btn").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_07_roll.gif";
			document.getElementById("greeting_txt").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_06_roll.gif";
			intImage = 2;
			var ret;
			var elem = document.getElementById("ssl");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
		case 2:
			document.getElementById("how_btn").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_07.gif";
			document.getElementById("greeting_txt").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_06.gif";
			intImage = 1;
			var ret;
			var elem = document.getElementById("ssl");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
	}

}

function swapImage2() {
			
	switch (intImage) {
		case 1:
			document.getElementById("how_btn").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_06_roll.gif";
			document.getElementById("greeting_txt").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_05_roll.gif";
			intImage = 2;
			var ret;
			var elem = document.getElementById("lll");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
			

			
		case 2:
			document.getElementById("how_btn").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_06.gif";
			document.getElementById("greeting_txt").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_05.gif";
			intImage = 1;
			var ret;
			var elem = document.getElementById("lll");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
			
	}
}
function swapImage3() {
	
	switch (intImage) {
		case 1:
			document.getElementById("how_btn").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_06_roll.gif";
			document.getElementById("greeting_txt").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_05_roll.gif";
			intImage = 2;
			var ret;
			var elem = document.getElementById("lll");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
			

			
		case 2:
			document.getElementById("how_btn").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_06.gif";
			document.getElementById("greeting_txt").src = "/assets/games/lll/style_me_lovely_gm_lll/images/lll_of_05_nobirthday.gif";
			intImage = 1;
			var ret;
			var elem = document.getElementById("lll");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
			
	}
}

function swapImage4() {
	switch (intImage) {
		case 1:
			document.getElementById("how_btn").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_07_roll.gif";
			document.getElementById("greeting_txt").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_06_roll.gif";
			intImage = 2;
			var ret;
			var elem = document.getElementById("ssl");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
		case 2:
			document.getElementById("how_btn").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_07.gif";
			document.getElementById("greeting_txt").src = "/assets/games/ss/berrylicious_bake_off_gm_ss/images/ss1_of_06_alt.gif";
			intImage = 1;
			var ret;
			var elem = document.getElementById("ssl");
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
	}

}

function swapOFImage(path, scrollToNm) {
	switch (intImage) {
		case 1:
			document.getElementById("how_btn").src = path + "how_roll.jpg";
			document.getElementById("greeting_txt").src = path + "greeting_roll.jpg";
			intImage = 2;
			var ret;
			var elem = document.getElementById(scrollToNm);
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
		case 2:
			document.getElementById("how_btn").src = path + "how.jpg";
			document.getElementById("greeting_txt").src = path + "greeting.jpg";
			intImage = 1;
			var ret;
			var elem = document.getElementById(scrollToNm);
			ret=findPos(elem);
			scroll(ret[0],ret[1]);
			return(false);
	}

}

//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
function mousePoint()
{
document.body.style.cursor="default";
};
// *** Send to friend code *** //
function thisMovie(movieName) {
//    var flashVideoPlayer;
//    var isIE = navigator.appName.indexOf("Microsoft") != -1;
//    flashVideoPlayer = (isIE) ? window['videoPlayer'] : document['videoPlayer'];

    if (navigator.appName.indexOf("Microsoft") != -1) {
        return document[movieName];
    } else {
        return document[movieName];
    }
}
// swap image functions for button mouseovers
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
};
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
};
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
};

//creates Email form
function showEmailPage()
{
    setImages();
	var emailS=generateEmailForm();
	$("#email_wrap").slideUp("medium", function (){
	    $("#email_wrap").html(emailS).css({"background-image":"url(" + emailBkgnd + ")", "background-repeat":"no-repeat"}).slideDown("slow", function(){
	        $("#fromName").focus();
            $("#ag_tellsubmit").css({visibility:"visible"});  
            setColors();
            //code allows only alpha numeric characters through use of jquery constrain plugin
//            $(".alpha").constrain({
//	            allow:	{ regex: "[a-zA-Z0-9]"}
//            });     
	    });	    
	});
};
//generates form html and returns it
function generateEmailForm()
{   
    var emailStr='<div id="ag_tellfriends"><img id="email_close" src="' + closeBtn + '" style="cursor:pointer;" onclick="hideForm();" /><form name="form1"><div id="email_inputs"><div class="email_left"><label for="name">Your First Name: &nbsp</label></div><div class="email_right"><input class="alpha text_input" id="fromName" name="fromName" type="text"></div><div class="email_left"><label for="friends">Your Friends First Name: &nbsp</label></div><div class="email_right"><input class="alpha text_input" id="toName" name="toName" type="text"></div><div class="email_left"><label for="email">Your Friends Email: &nbsp</label></div><div class="email_right"><input class="text_input" id="emailTo" name="emailTo" type="text"></div><p>We will not collect your friend&#39;s email. It is in our <a href="http://' + pre + '.agkidzone.com/privacy_policy.action">Privacy Policy</a></p></div><div id="ag_tellsubmit"><img id="send_btn" name="send_btn" style="cursor:pointer;" src="' + sendBtn + '" onclick="sendToFEmail(form1);" onmouseover=MM_swapImage("send_btn","","' + sendOvBtn + '",1); onmouseout=MM_swapImgRestore(); /></div></form></div>'
	return emailStr;	
};
/*---  make AJAX Request  ---*/
function sendToFEmail(form1)
{
	jsform=form1;
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var fromName=jQuery.trim(document.form1.fromName.value);
    var toName=jQuery.trim(document.form1.toName.value);
    var emailTo=jQuery.trim(document.form1.emailTo.value);
    if(fromName == "" || fromName == null ||
    toName == "" || toName == null ||
    emailTo == "" || emailTo == null)
    {
    	alert("Please fill out all the form elements to send Email to your Friend.");
    	return false;
    }
	else if(reg.test(emailTo) == false)
    {
    	alert("The email address is not valid.");
    	return false;
    }
    else
    {   
        var subject='Hello '+fromName+' just sent you an email!';
     	var sendLink;
     	//alert(sPage);
     	sendLink = linkIt();
     	
        sendLink = sendLink + '&receiverName='+toName+'&senderName='+fromName;
     	var requestUrl='http://' + pre + '.agkidzone.com/send_mail.action?emailFrom=share@agkidzone.com&emailTo='+emailTo+'&emailTemplate=agkz_sendto_friend_email&subject='+subject+'&targetUrl='+sendLink;
    	sendToFriend(requestUrl);
    	
    }
};

/*---  make call to get new content  ---*/
function sendToFriend(requestUrl)
{
    var emailStr="";
        jQuery.post(requestUrl, function(data) {
        	var temp = new Array();
			temp = data.split(' ');

			if(temp[1].charAt(0) == "P")
        	{
        		emailStr='<div id="ag_tellfriends1"><img id="sendtof" src="' + sendItBtn + '" alt="Send an Email" style="cursor:pointer;" onclick="showEmailPage();" onmouseover=MM_swapImage("sendtof","","' + sendItOvBtn + '",1); onmouseout=MM_swapImgRestore(); /><img id="linkimg" src="' + linkItBtn +'" alt="Link to this page" style="cursor:pointer;" onclick="showLinkIt();" onmouseover=MM_swapImage("linkimg","","' + linkItOvBtn + '",1); onmouseout=MM_swapImgRestore(); /><img src="/images/ag_tellsiteerror.gif" alt="Server error" /></div>';
        	}
        	else
        	{
        		emailStr='<div id="ag_tellfriends1"><img id="sendtof" src="' + sendItBtn + '" alt="Send an Email"  style="cursor:pointer;" onclick="showEmailPage();" onmouseover=MM_swapImage("sendtof","","' + sendItOvBtn + '",1); onmouseout=MM_swapImgRestore(); /><img id="linkimg" src="' + linkItBtn +'" alt="Link to this page" style="cursor:pointer;" onclick="showLinkIt();" onmouseover=MM_swapImage("linkimg","","' + linkItOvBtn + '",1); onmouseout=MM_swapImgRestore(); /><img src="/images/ag_tellsend.gif" alt="Email has been sent" /></div>';        		
        	}
 			document.form1.fromName.value="";
       		document.form1.toName.value="";
	   		document.form1.emailTo.value="";
	   		
  			$("#email_wrap").slideUp("medium", function (){
                $("#email_wrap").html(emailStr).css({"background-image":"none"}).slideDown("slow");
   		    });
	    })
};
//hides form and recreates buttons
function hideForm()
{   
    setImages();
    if(asset_type == "coloringPages" || asset_type == "tvShow" || asset_type == "movieClip" || asset_type == "musicVideo" || sPage == "videos.action" || sPage == "ss_videos.action" || sPage == "hh_videos.action" || sPage == "cb_videos.action" || sPage == "sp_videos.action"){
        $("#ag_tellsubmit").css({visibility:"hidden"});
        $("#email_wrap").slideUp("medium", function (){
                $("#email_wrap").html("").slideDown("slow").css({"background-image":"none"});
        });
    }else{
        var emailStr='<div id="ag_tellfriends1"><img id="sendtof" src="' + sendItBtn + '" alt="Send an E-Mail" style="cursor:pointer;" onclick="showEmailPage();" onmouseover=MM_swapImage("sendtof","","' + sendItOvBtn + '",1); onmouseout=MM_swapImgRestore(); /><img id="linkimg" src="' + linkItBtn +'" alt="Link to this page" style="cursor:pointer;" onclick="showLinkIt();" onmouseover=MM_swapImage("linkimg","","' + linkItOvBtn + '",1); onmouseout=MM_swapImgRestore(); /></div>';
        $("#ag_tellsubmit").css({visibility:"hidden"});
        $("#email_wrap").slideUp("medium", function (){
                $("#email_wrap").html(emailStr).slideDown("slow").css({"background-image":"none"});
        });
    }
};
//used for external call from flash to set the asset name
function setAssetName(assetName, assetType){
    asset_name=assetName;
    if(assetType != undefined){
        asset_type=assetType;
    }
    hideForm();
//    if(document.getElementById("fromName")){
//        hideForm();
//    }
//    if(document.getElementById("fromLink")){
//        hideForm();        
//    }
};

//generate url string based on category defaults to main category page if no type is given
function linkIt(){
    var link;
    if (asset_name == undefined){
        //alert("inside linkIt undefined");
 	    link= "http://" + pre + ".agkidzone.com/" + sPage;
 	}else {
 	    //alert("inside linkIt"+asset_name);
 	    link= "http://" + pre + ".agkidzone.com/" + sPage + "?asset=" + asset_name;
 	}
    
    return link;
};
//generate Link It form
function generateLinkItForm()
{
    var linkVal = linkIt();
    var linkStr='<div id="ag_tellfriends"><img id="email_close" src="' + closeBtn + '" style="cursor:pointer;" onclick="hideForm();" /><form name="form1"><div id="link_inputs"><div class="link_left"><label for="link">Link to this page: </label></div><div class="link_right"><input class="text_input" id="fromLink" name="fromLink" type="text" READONLY size="75" value="' + linkVal + '"></div></div></form><div id="ag_tellsubmit">'
        + '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="125" height="35" id="copyLink" align="middle">'
	    + '<param name="allowScriptAccess" value="sameDomain" />'
	    + '<param name="allowFullScreen" value="false" />'
	    + '<param name="movie" value="/swf/copy.swf" />'
	    + '<param name="quality" value="high" />'
	    + '<param name="bgcolor" value="transparent" />'
	    + '<param name="wmode" value="transparent" />'
	    + '<param name="FlashVars" value="clipboard=' + encodeURIComponent(linkVal) + '" />'
	    + '<embed src="/swf/copy.swf" FlashVars="clipboard=' + encodeURIComponent(linkVal) + '" quality="high" bgcolor="transparent" wmode="transparent" width="125" height="35" name="copyLink" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
	    + '</object>'
        + '</div></div>'
	return linkStr;
};
//creates link to section
function showLinkIt(){
    setImages();
    var linkS=generateLinkItForm();
	$("#email_wrap").slideUp("medium", function (){
	    $("#email_wrap").css({"background-image":"url(" + linkitBkgnd + ")", "background-repeat":"no-repeat"}).html(linkS).slideDown("slow", function(){
	        $("#ag_tellsubmit").css({visibility:"visible"});
	        setColors();
	    });	    
	});
};
//updates textbox if asset changes
function updateLinkIt(){
    if(document.getElementById("fromLink")){
        hideForm();
        // code to update the linkit url doesn't work in ie?
        //alert("inside update");
        //document.getElementById("fromLink").value = linkIt();
        //alert("linked it");
        //var textToC = document.form1.fromLink.value;
        //alert(textToC);
        //return textToC;
        //alert("updated flash");
//        thisMovie("copyLink").updateCopy(textToC);
        //alert("finished updating flash");
//    }else{
//        return linkIt();
      }
};
//copy to clipboard uses jquery copy plugin which utilizes the jquery.copy.swf to perform copy. Works for firefox browser.
//function copyLink(){ 
//    var copytxt = document.form1.fromLink.value;       
//    //alert(copytxt);
//    if($.browser.msie){
//        clipboardData.setData("Text", copytxt); 
//	}else{
//	    $.copy(copytxt);
//    }
//};

function setImages(){
    sendOvBtn = "/images/send_over.png";
    if (sPage == "sp_games.action" || sPage == "sp_activities.action" || sPage == "sp_videos.action"){
    //alert(sPage);
        emailBkgnd = "/brands/sushipack/images/sp_email_bkgnd.jpg";
        linkitBkgnd = "/brands/sushipack/images/sp_linkit_bkgnd.jpg";
        closeBtn = "/brands/sushipack/images/close.png";
        sendBtn = "/brands/sushipack/images/send.png";
        sendItBtn = "/brands/sushipack/images/sendtofriend.png";
        linkItBtn = "/brands/sushipack/images/linkit.png";
        sendItOvBtn = "/brands/sushipack/images/sendtofriend_over.png";
        linkItOvBtn = "/brands/sushipack/images/linkit_over.png";
    }else if (sPage == "ss_games.action" || sPage == "ss_activities.action" || sPage == "ss_videos.action"){
    //alert(sPage);
        emailBkgnd = "/brands/strawberryshortcake/images/ss_email_bkgnd.jpg";
        linkitBkgnd = "/brands/strawberryshortcake/images/ss_linkit_bkgnd.jpg";
        closeBtn = "/brands/strawberryshortcake/images/close.png";
        sendBtn = "/brands/strawberryshortcake/images/send.png";
        sendItBtn = "/brands/strawberryshortcake/images/sendtofriend.png";
        linkItBtn = "/brands/strawberryshortcake/images/linkit.png";
        sendItOvBtn = "/brands/strawberryshortcake/images/sendtofriend_over.png";
        linkItOvBtn = "/brands/strawberryshortcake/images/linkit_over.png";
    }else if (sPage == "cb_games.action" || sPage == "cb_activities.action" || sPage == "cb_videos.action"){
    //alert(sPage);
        emailBkgnd = "/brands/carebears/images/cb_email_bkgnd.jpg";
        linkitBkgnd = "/brands/carebears/images/cb_linkit_bkgnd.jpg";
        closeBtn = "/images/close.png";
        sendBtn = "/images/send.png";
        sendItBtn = "/images/sendtofriend.png";
        linkItBtn = "/images/linkit.png";
        sendItOvBtn = "/images/sendtofriend_over.png";
        linkItOvBtn = "/images/linkit_over.png";
    }else if (sPage == "hh_games.action" || sPage == "hh_activities.action" || sPage == "hh_videos.action"){
    //alert(sPage);
        emailBkgnd = "/brands/hollyhobbie/images/hh_email_bkgnd.jpg";
        linkitBkgnd = "/brands/hollyhobbie/images/hh_linkit_bkgnd.jpg";
        sendOvBtn = "/brands/hollyhobbie/images/send_over.png";
        closeBtn = "/brands/hollyhobbie/images/close.png";
        sendBtn = "/brands/hollyhobbie/images/send.png";
        sendItBtn = "/brands/hollyhobbie/images/sendtofriend.png";
        linkItBtn = "/brands/hollyhobbie/images/linkit.png";
        sendItOvBtn = "/brands/hollyhobbie/images/sendtofriend_over.png";
        linkItOvBtn = "/brands/hollyhobbie/images/linkit_over.png";
    }else{
    //alert(sPage);
        emailBkgnd = "/images/email_bkgnd.jpg";
        linkitBkgnd = "/images/linkit_bkgnd.jpg";
        closeBtn = "/images/close.png";
        sendBtn = "/images/send.png";
        sendItBtn = "/images/sendtofriend.png";
        linkItBtn = "/images/linkit.png";
        sendItOvBtn = "/images/sendtofriend_over.png";
        linkItOvBtn = "/images/linkit_over.png";
    }
};
function setColors(){
if (sPage == "sp_games.action" || sPage == "sp_activities.action" || sPage == "sp_videos.action"){
        $("#email_wrap a").css("color", "#F6DA17");
        $(".text_input").css("color", "#000000");
    }else if (sPage == "ss_games.action" || sPage == "ss_activities.action" || sPage == "ss_videos.action"){
        $("#email_wrap a").css("color", "#B70045");
        $(".text_input").css("color", "#FF4F91");
    }else if (sPage == "cb_games.action" || sPage == "cb_activities.action" || sPage == "cb_videos.action"){
        $("#email_wrap a").css("color", "#007edd");
        $(".text_input").css("color", "#ED7CB8");
    }else if (sPage == "hh_games.action" || sPage == "hh_activities.action" || sPage == "hh_videos.action"){
        $("#email_wrap a").css("color", "#5BB9AD");
        $(".text_input").css("color", "#5BB9AD");
    }else{
        $("#email_wrap a").css("color", "red");
        $(".text_input").css("color", "#007edd");
    }    
};

function createBookmarkLink() 
{
var value = "";
var borwserName = navigator.appName;
var title = "AGKidzone"; 
var url = "http://www.agkidzone.com";

if(borwserName == "Microsoft Internet Explorer")
	{
		if (document.all);window.external.AddFavorite(url,title)
	}
	else 
	{
		var newWin = window.open ("homepage_bookmark.html?value=bm", 'newWin','toolbar=no,width=780,height=510');
		newWin.focus();
	}
}
	function myHomePage()
	{
	var value = "";
	var borwserName = navigator.appName;
	if(borwserName == "Microsoft Internet Explorer")
		{
		document.forms[0].style.behavior='url(#default#homepage)';
		document.forms[0].setHomePage('http://www.agkidzone.com');
		}
		else  
		{
		var newWin = window.open ("homepage_bookmark.html?value=hp", 'newWin','toolbar=no,width=780,height=510');
		newWin.focus();
		}
	}
	
//	To check for a given plug-in, simply call one of the following functions, which will return a value of 
//  either "true" (if the plug-in is there) or "false" (if the plug-in is not there or could not be detected):

//    * detectQuickTime()
//    * detectFlash()
//    * detectDirector()
//    * detectWindowsMedia()
//    * detectReal()

// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
javascriptVersion1_1 = true;

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;

// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
    
}
var hasFlash = detectFlash();
if (hasFlash == false){
    window.location = "/noflash.html";
}
function goURL(daURL) {
    // if the browser can do it, use replace to preserve back button
    if(javascriptVersion1_1) {
	window.location.replace(daURL);
    } else {
	window.location = daURL;
    }
    return;
}

function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
    // check for redirection
    if( redirectURL && ((pluginFound && redirectIfFound) || 
	(!pluginFound && !redirectIfFound)) ) {
	// go away
	goURL(redirectURL);
	return pluginFound;
    } else {
	// stay here and return result of plugin detection
	return pluginFound;
    }	
}

function canDetectPlugins() {
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
	return true;
    } else {
	return false;
    }
}

function detectFlash(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Shockwave','Flash'); 
    // if not found, try to detect with VisualBasic
    
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectDirector(redirectURL, redirectIfFound) { 
    pluginFound = detectPlugin('Shockwave','Director'); 
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectQuickTime(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('QuickTime');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectQuickTimeActiveXControl();
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectReal(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
		       detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
		       detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
    }	
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectWindowsMedia(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Windows Media Player');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
		    // this name was found
		    numFound++;
		}   
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
    }
    return pluginFound;
} // detectPlugin
