	
   $(document).ready(function(){  
       
       if($('#scroll').length > 0)
         $('#scroll').not(".no-scroll").jScrollPane({dragMaxHeight:"20", showArrows:false});
       //When mouse rolls over  
       
       $(".button a").not(".theone").mouseenter(function(){  
           var el = $(this).parent().andSelf();
           var color = $(this).data("color") ? $(this).data("color")　: el.css("background-color");
           var alt = $(this).data("alt");
           
           $(this).data("color", color);
           
           if(typeof(alt) == "undefined")
           {
               // Extract color codes
               if(color.substr(0,1) == "#")
               {
                 color = color.substr(1);
                 alt = new Array();
                 for(var d = 0; d < 3; d++)
                    alt.push(parseInt(color.substr(d*2,2), 16));
               }
               else
                 alt = color.split("(")[1].slice(0,-1).split(",");

               for(var d in alt)
                alt[d] = Math.max(parseInt((parseInt(alt[d])) /1.5), 0);
               
               alt = "rgb("+alt[0]+","+alt[1]+","+alt[2]+")";

               $(this).data("alt", alt);
           }

           try
           {
             el.stop().dequeue().css("background-color", color).animate({color:"#dedede", backgroundColor:alt, backgroundPosition: "(210px 8px)"},{duration:200, easing: 'easeOutSine'});
           }
           catch(e){}
       });  
     
       //When mouse is removed  
       $(".button a").not(".theone").mouseleave(function(){  
           var el = $(this).parent().andSelf();
           var color = $(this).data("color", color);
           try
           {
             el.stop().dequeue().animate({color:'white', backgroundColor:color, backgroundPosition: "(250px 8px)"},{duration:100, easing: 'easeOutSine'});
           }
           catch(e){}
       });  
	   
	   
	   $("#topmenu ul li").click(function(){ location.href = $("a", this).attr("href"); });
	   
	   //When mouse rolls over  
       $("#topmenu ul li").not(".theone").mouseenter(function(){
           $("a", this).andSelf().stop().dequeue().animate({color:'#505050',backgroundColor:'#ffffff'},{duration:150, easing:'easeOutSine'});
       });  
     
       //When mouse is removed  
       $("#topmenu ul li").not(".theone").mouseleave(function(){  
           $("a", this).andSelf().stop().dequeue().animate({backgroundColor:'#393939',color:'#ffffff'}, {duration:75, easing: 'easeOutSine'});
       }); 
	   
	   
       $("#sidebar a").mouseover(function(){  
           $(this).parent().animate({ backgroundPosition: "(4px 10px)" }, 150, 'easeOutSine');
       });  
     
       //When mouse is removed  
       $("#sidebar a").mouseout(function(){  
           if(!$(this).parent().is(".theone"))
           {
             $(this).parent().animate({ backgroundPosition: "(-7px 10px)" }, {duration:100, easing:'easeOutExpo'});  
           }
       });  

     
   });  

// Cookie code
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 var 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 eraseCookie(name) {
    createCookie(name,"",-1);
}
