   // Skin info.
   var animatedSkin = new Array("themecaranim","themebfliesanim","themeflowersanim","themesportsanim","thememusicanim","themedefaultanim","themepilaranim","themeskyanim");
   //Gets the browser specific XmlHttpRequest Object
   function getXmlHttpRequestObject() {
      if (window.XMLHttpRequest) {
         return new XMLHttpRequest(); //Not IE
      } else if(window.ActiveXObject) {
         return new ActiveXObject("Microsoft.XMLHTTP"); //IE
      } else {
         //Display your error message here. 
         //and inform the user they might want to upgrade
         //their browser.
         return null;
      }
   }        

   function changeDisplay(visible, invisible){
      changeVisibility(invisible,false);
      changeVisibility(visible,true);
   }

   function changeVisibility(objId, isVisible){
       var display = "none";
       if(isVisible){
           display = "block";
       }
       getObjectById(objId).style.display = display;
       
   }
   var themeIDs = new Array();
   function addThemeID( id ){
       themeIDs[themeIDs.length] = id;
   }

   function changeStyle(color,id){
      var style = getObjectById("changableStyle");
      if(style){
          style.href="/KOL/css/"+color+".css";
          setCookie('themeColor',color+"~"+id,365,"/");
      }
      var skin = getObjectById("changableSkin");
      if(skin){
         skin.className = "skin_"+id;
         chnageAnimatedSkin(id);
      }
      setCookie('themeColor',color+"`"+id,365,"/");
   }

    function getObjectById(id){
       var obj;
       if(document.getElementById){
          obj = document.getElementById(id);
       } else {
          obj = eval('document.all.'+id);
       }
       return obj;
    }
    
   function getCookie(NameOfCookie){ 
      if (document.cookie.length > 0){ 
         begin = document.cookie.indexOf(NameOfCookie+"=");
         if (begin != -1){ 
            begin += NameOfCookie.length+1;
            end = document.cookie.indexOf(";", begin);
            if (end == -1) end = document.cookie.length;
            return unescape(document.cookie.substring(begin, end)); 
         }
      }
      return null;
   }
   
   
   
   function setCookie(NameOfCookie, value, expiredays, path){ 
      var expireDate = new Date ();
      expireDate.setTime(expireDate.getTime() + (expiredays * 24 * 3600 * 1000));
      document.cookie = NameOfCookie + "=" + escape(value) +
      ((expiredays == null) ? "" : "; expires=" + expireDate.toGMTString()) +
      ((path == null) ? "" : "; path="+path);
   }
   
   
   
   function delCookie (NameOfCookie){ 
      if (getCookie(NameOfCookie)) {
         document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
      }
   }

   function chnageAnimatedSkin(id){
      var objAni = getObjectById("animation");
      if(objAni){
        var aniFlash = new FlashTag("http://www.aolcdn.com/_media/kol/"+animatedSkin[id - 1]+".swf", "980", "74", "9,0,0,0" );
        aniFlash.setId("animation");
        aniFlash.setAlign("l");
        aniFlash.setQuality("high");
        aniFlash.setWmode("transparent");
        aniFlash.setPlay("true");
        aniFlash.setLoop("false");
        aniFlash.setScale("showall");
        aniFlash.setMenu("true");
        aniFlash.setBgcolor("#ffffff");

        var objStr = aniFlash.toString();
       objAni.innerHTML = objStr;
      }
   }

kolsearch = {
    init:function(){},
    searchTypes:{kol:{action:'/KOL/2/SubPages/Search',target:'_self'},web:{action:'http://search.kids.kol.com/search/search?invocationType=enus-kids-1_-kol-web',target:'_new'}},
    postions:{top:'top',bottom:'bottom'},
    select:function(type, position){
        var id = "";
        for(searchType in this.searchTypes){
           id = "select_"+searchType+"_"+position;
           var liObj = this.getObjectByID(id);
           if(liObj){
               if(searchType == type){
                   liObj.className = "selected";
               } else {
                   liObj.className = "";
               }
           }
        }
        id = position+'Search';
        var formObj = this.getObjectByID(id);
        if(formObj){
            formObj.action = this.searchTypes[type].action;
            formObj.target = this.searchTypes[type].target;
        }
    },
    getObjectByID:function(id){
      var obj;
       if(document.getElementById){
          obj = document.getElementById(id);
       } else {
          obj = eval('document.all.'+id);
       }
       return obj;
     }
}

function embedAlien() {	 					
			var tag =  new FlashTag('http://www.aolcdn.com/_media/ch_kids/kol_alien.swf?'+alienData, '459', '265', '7,0,0,0' );	 		
	 		tag.setId('main');
	 		tag.setWmode('opaque');
	 		tag.setBgcolor('#66CBFF');
	 		tag.setQuality('high');
	 		tag.setScale('noscale');
                        tag.genericParam['allowScriptAccess'] = "always";
	 		tag.setSalign('tl');
	 		tag.write(document);
		}
        var alienReq = getXmlHttpRequestObject();
	var operation = "";
		function saveAlienData() {
			// send off alienData
			if(alienData != null && alienData.length != 0)
			{
				alienReq.open("GET", '/KOL/kol/addAlien.jsp?alienData='+alienData, true);
				alienReq.send(null);
			}
			else{
				return false;
			}
		}
		
		function updateAlienData(p_string) {
			alienData = p_string;                    
			alienReq.open("GET", '/KOL/kol/updateAlien.jsp?alienData='+alienData, true);
			alienReq.send(null);
		}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
		}
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		}
	]

};
BrowserDetect.init();


function setHome(){
	var B="http://kids.aol.com/";
	var A=document.getElementById("mkh");
	var C=BrowserDetect.browser;
	if(A.addBehavior){A.style.behavior="url(#default#homepage)";
		A.setHomePage(B);
		return false;
	}
	else if(BrowserDetect.browser === "Firefox"){
		document.getElementById("mkhp").style.display="block";
	}
	else{
		window.open("http://kids.aol.com/make-homepage","_blank","height=900,width=980,status=1,menubar=1,scrollbars=1");return false
	}
}


function closeMe(){
		var closeMe1 = document.getElementById("closeMe1")
		closeMe1.onclick = function (){
			document.getElementById("mkhp").style.display="none";
		}
}

