$(document).ready(function() {

	//rollover menu penne
	$('.pensNames a').each(function(){
			
			var myImgId=  $(this).attr('id')+'_img';
			var img = $('#'+myImgId, '#pen_layer');
			
			$(this).data('img', img)
			
			$(this).hover(function() {$(this).data('img').removeClass('hidden')}, function(){$(this).data('img').addClass('hidden')});
	
	
	});
	//end rollover menu penne


	var scrolltop=$(document).scrollTop();
	

	
		
	$("#big_menu").height($("#big_menu").height());
	$("#abs_container").css({'position':'absolute', 'bottom':0, 'width':'100%'});
	
	
	
	
	$("#menu_container").hover(
		function(){
			
			$("#top_nav").addClass('hovermenu');
			
		},
		function(){

			
			$("#top_nav").removeClass('hovermenu');
			
			if($("#top_nav").hasClass('open'))
			{
			
				$("#expand").parent().trigger('click');
			}
			if($("#top_nav").hasClass('hiddenmenu')){
				
				
				
				$("#top_nav").stop(true,false).delay(300).animate({
				    top: '-48px',
				    height: '54px'
				  }, 200);
				
			}
		}
	);
	
	$(window).trigger('scroll');
	
	$("#expand").parent().bind('click', function(e) {
		$("#menu").toggleClass('open');
		$("#top_nav").toggleClass('open');
		$("#big_menu").stop(true,true).slideToggle();
		
		if($("#top_nav").hasClass('open')){
			$("#top_nav").css({'position':'fixed', 'top':0});
		}
		else{
			$("#top_nav").css({'position':'absolute', 'top':scrolltop+'px'});
			$("#top_nav").stop(true,false).delay(300).animate({
			    top: '0'
			  }, 150);
		}
		return false
		
	});
	
	
	
	
	

	
});


