
        function showColorPallete()
        {
            if(document.getElementById("DIVColorPallete").className=='clShowPallete')
            {
                document.getElementById("IMGPallete").className='clColorDown';
                document.getElementById("DIVColorPallete").className='clHidePallete';
            }    
            else
            {
                document.getElementById("IMGPallete").className='clColorTop';
                document.getElementById("DIVColorPallete").className='clShowPallete';
            }   
           return false; 
        }
        function createCookie(name,value,days) {
          if (days) {
            var date = new Date();
            date.setTime(date.getTime()+(days*24*60*60*1000));
            var expires = "; expires="+date.toGMTString();
          }
          else expires = "";
          document.cookie = name+"="+value+expires+"; path=/";
        }
        function readCookie(name) {
          var nameEQ = name + "=";
          var ca = document.cookie.split(';');
          for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
          }
          return null;
        }
        
function getPreferredStyleSheet() {
    var i, a;
    for(i=0; (a = document.getElementsByTagName("link")[i]); i++) 
    {
    if(a.getAttribute("title")=='Color-Scheme')return a;        
    }
    return null;
}
        function  setStyle() {
          var cookie = readCookie("style");  
          var oLink = getPreferredStyleSheet();
          var cssFile = cookie ? cookie : oLink.href;
          //LNKChangeTheme
          var arr = oLink.href.split('/'); 
      
           if(cookie!=null)
                cssFile = oLink.href.replace(arr[arr.length-1],cookie);                
           else
                cssFile = oLink.href.replace(arr[arr.length-1],'gray.css');     
        
            oLink.setAttribute("href",cssFile);
        }
        function setCookie(cssStyle)
        {
            createCookie("style", cssStyle, 365);     
            setStyle();
            showColorPallete();
            return false;
        }
        window.onload = setStyle;
