
$(document).ready(function() {
   

//Read cookie and open the right menu item
    if (readCookie('menu') != null) {
        var catName = (readCookie('menu'));
       
	   $("." + catName).show();

        lastItem = catName;
        saveCookie(catName);
		
		$("." + catName).parent().css({ 'font-weight' : 'bolder'}) ;
    }

	//Highlight the selected item
	
	$('.main-menu-holder a').each
	(
		function()
		{
			if( this.href == window.location)
			{	
				document.getElementById(this.id).style.fontWeight="bolder";
			}
		}
	)


});

var lastItem = "na";

function menuClick(catName) {
    saveCookie(catName);
  
	 //$("." + catName).parent().css({ 'font-weight' : 'bolder'}) ;
	
	$("." + lastItem).parent().css({ 'font-weight' : 'normal'}) ;
	$("." + catName).parent().css({ 'font-weight' : 'bolder'}) ;
	
    $("."+catName).show();
    $("." + lastItem).hide();
    lastItem = catName;
	
	
	

  
}




function saveCookie(catName) {

    document.cookie = 'menu=' + catName + '; expires=Sat, 1 Jan 2011 23:59:59 UTC; path=/';

}

function readCookie(catName) {
    var catNameEQ = catName + "=";
    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(catNameEQ) == 0) return c.substring(catNameEQ.length, c.length);
    }
    return null;
}
