﻿//Removes Enable Javascript Message ****not used now per editorial and creative review****
function removeTest() {
  var d = document.getElementById('leaderboard');
  var olddiv = document.getElementById('javascripttest');
  d.removeChild(olddiv);
}
// code to grab prefix if needed (dev, stage, www)
var thisLoc = location.host;
var sep = thisLoc.indexOf(".");
var pre = thisLoc.substr(0,sep);
//
//hack for ie 6 or lower, layout (css issues) long live firefox!
function ie6Layout(){
    if (navigator.appName=='Microsoft Internet Explorer'){
        // Split the string into part [0] and part [1]
        temp=navigator.appVersion.split('MSIE');
        // Parse the string for the "6" in 6.0
        ieVer=parseInt(temp[1]);
        //if version 6 then fix layout        
        if (ieVer<=6){            
            var sPath = window.location.pathname;
            var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
            var dropDiv = '-14px';
            $("mainnav").style.top=dropDiv;
            $("maincontent").style.top=dropDiv;
            $("footer").style.top=dropDiv;  
            if (sPage=="index.html" || sPage==""){                
                $("mainPromo").style.width=715;
                $("mainPromo").style.left=25;
                $("subPromo").style.width=715;
                $("subPromo").style.left=25;
            }
            if (sPage=="wallpaper.html"){
                $("wallPromo").style.width=715;
                $("wallPromo").style.left=50;
            }
        }
        if (ieVer==5){
            $("maincontent").style.left=0;
        }
    }
}
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;
}
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
   
   var ad = MM_findObj("agkzpad", d);
   if(ad)
   {
      var milli = new Date().getTime();
      ad.innerHTML = "<iframe src=\"http://ad.doubleclick.net/adi/agi.kidzone.parents/" + subCat + ";tile=1;dcopt=ist;sz=728x90;ord=" + milli + "?\" width=\"728\" height=\"90\" 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.parents/" + subCat + ";tile=1;dcopt=ist;sz=728x90;abr=!ie;ord=" + milli + "?\" type=\"text/javascript\"></script>" +
					"<noscript><a href=\"http://ad.doubleclick.net/jump/agi.kidzone.parents/" + subCat + ";tile=1;sz=728x90;abr=!ie4;abr=!ie5;abr=!ie6;ord=" + milli + "?\" target=\"_blank\"><img src=\"http://ad.doubleclick.net/ad/agi.kidzone.parents/" + subCat + ";tile=1;sz=728x90;abr=!ie4;abr=!ie5;abr=!ie6;ord=" + milli + "?\" width=\"728\" height=\"90\" border=\"0\" alt=\"\"></a></noscript>" +
					"</iframe>";
	}
}
//
//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";
}
// loads game that is passed to it
function loadGame(game){
    if (game==014){
        frames['gameHolder'].location.href = 'games/threeofakind.html';        
    }
    if (game==024){
        frames['gameHolder'].location.href = 'games/sweetride.html';
    }
}
//
//browses to url that is past to it.. javascript link
function linkTo(url)
{
    window.location=url;
}
//
// opens new window to link that is past to it
function newWindow(url)
{
    window.open(url);
}
//
//Ad server
var subCat = "home";
function loadAd() { //v3.0
    var d=document; 
    var ad = MM_findObj('leaderboard', d);
    if(ad)
    {
        var milli = new Date().getTime();
        ad.innerHTML = "<iframe src=\"http://ad.doubleclick.net/adi/agi.kidzone.iheartbears/" + subCat + ";tile=1;dcopt=ist;sz=728x90;ord=" + milli + "?\" width=\"728\" height=\"90\" 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.iheartbears/" + subCat + ";tile=1;dcopt=ist;sz=728x90;abr=!ie;ord=" + milli + "?\" type=\"text/javascript\"></script>" +
                        "<noscript><a href=\"http://ad.doubleclick.net/jump/agi.kidzone.iheartbears/" + subCat + ";tile=1;sz=728x90;abr=!ie4;abr=!ie5;abr=!ie6;ord=" + milli + "?\" target=\"_blank\"><img src=\"http://ad.doubleclick.net/ad/agi.kidzone.iheartbears/" + subCat + ";tile=1;sz=728x90;abr=!ie4;abr=!ie5;abr=!ie6;ord=" + milli + "?\" width=\"728\" height=\"90\" border=\"0\" alt=\"\"></a></noscript>" +
                       "</iframe>"
    }
}
