   // 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;
     }
}

