$(document).ready(function () {
			 
			 	if($.cookie("hideTop")==1) {
	  				topMenuCloserAction(false);
	  			}
	  			
	  			if($.cookie("hideLeft")==1) {
	  				leftMenuCloserAction(false);
	  			}
			 
			 	$(".topMenuCloser").click(function(){			 				 					 	
			 		$.cookie("hideTop", ($.cookie("hideTop")==1 ? 0 : 1));
			 		topMenuCloserAction(true);							
			 	});
			 	
			 	$(".leftMenuCloser").click(function(){			 					 	
			 		$.cookie("hideLeft", ($.cookie("hideLeft")==1 ? 0 : 1));
			 		leftMenuCloserAction(true);					
			 	});
			 	
			 	function topMenuCloserAction(animate){
				 	if(animate){
				 		$('#header').animate({
						    height: 'toggle'
						}, 300, function() {});	 
						if( $('#topheader').height() == 44 ){
							$('#topheader').animate({
						    	height: '110'
							}, 300, function() {});
						}else{
							$('#topheader').animate({
						    	height: '44'
							}, 300, function() {});
						}
				 	}else{
				 		$('#header').toggle();	 
						if( $('#topheader').height() == 44 ){
							$('#topheader').css({height: '110'});
						}else{
							$('#topheader').css({height: '44'});
						}
				 	}						
				 }
				 
				 function leftMenuCloserAction(animate){
				 	if(animate){
				 		$('#content .menuW UL').animate({
						    height: 'toggle'
						}, 300, function() {});
					
						if( $('.leftMenuCloser').height() == 27 ){
							$('.leftMenuCloser').animate({
						    	height: '14'
							}, 300, function() {});
						}else{
							$('.leftMenuCloser').animate({
						    	height: '27'
							}, 300, function() {});
						}	
						
						if( $('#content .main').width() == 784 ){
							$('#content .main').animate({
						    	width: '984'
							}, 300, function() {});
						}else{
							$('#content .main').animate({
						    	width: '784'
							}, 300, function() {});
						}	
						
						if( $('#content .menuW').width() == 220 ){
							$('#content .menuW').animate({
						    	width: '20'
							}, 290, function() {});
						}else{
							$('#content .menuW').animate({
						    	width: '220'
							}, 300, function() {});
						}
				 	}else{
				 		$('#content .menuW UL').toggle();
					
						if( $('.leftMenuCloser').height() == 27 ){
							$('.leftMenuCloser').css({height: '14'});
						}else{
							$('.leftMenuCloser').css({height: '27'});
						}	
						
						if( $('#content .main').width() == 784 ){
							$('#content .main').css({width: '984'});
						}else{
							$('#content .main').css({width: '784'});
						}	
						
						if( $('#content .menuW').width() == 220 ){
							$('#content .menuW').css({width: '20'});
						}else{
							$('#content .menuW').animate({width: '220'});
						}
				 	}						
				 }
				 
				  });
			 			 
			 $(window).load(function () {
			  	
			 	if( $("#content .menuW").height() < $(".main").height() ) {
			 		$("#content .menuW").height( $(".main").height() - 24  );
			 	} else {
			 		$(".main").height( $("#content .menuW").height() + 24  );
			 	}
			 
			 
			 });
