
jQuery(document).ready(function(){ 
	var open_menu = false;
	NavInit();
	
	jQuery('#slide-down-overlay').css({height: jQuery('.main').height()+100});
	jQuery('#Menu-overlay,.menu-header-hover').hover(
		function() { hideMenuOverlay();jQuery("#NavLayer").animate({top: '-350'});open_menu=false;jQuery('#f-menu li a').each(function(){jQuery(this).removeClass('NavLayer_bg_on').addClass('defaut');});},
		function() { }
	);
	jQuery('#f-menu li a').hover(
		function() { NavInit();NavShow(jQuery(this).attr('rel')); },
		function() {}
	);
	jQuery('#f-menu ul').hover(
		function() {showMenuOverlay();if(open_menu==false){jQuery("#NavLayer").animate({top: '0'});open_menu=true};},
		function() {}
	);
	jQuery('#NavLayer').hover(
		function() {},
		function() { }
	);
	jQuery('#image').click(
		function() { jQuery("#imageZ").attr({src:jQuery(this).attr('rel')});showSlideDown()}
	);
	jQuery('#display-slide-down,#imageZ').click(
		function() { displaySlideDown()}
	);
	
	jQuery('.page-head h3,.page-head-alt h3,.page-title h1').each(function(){jQuery("#breadcrumbs").html("<div class='breadcrumbs'><strong>"+jQuery(this).html()+"</strong></div>");jQuery(".page-head,.page-title,.page-head-alt").remove()});
	/*
	jQuery('.vignette').each(function(){
		jQuery(this).hover(
			function() {jQuery(this).css({backgroundColor: '#ffe'})},
			function() {jQuery(this).css({backgroundColor: '#125468'})}
		);
	});	*/
	jQuery('.loupe').click(function() {
	  jQuery("#imageZ").attr({src:jQuery(this).attr('rel')});
	  jQuery('html, body').animate(
		{
			scrollTop: '90px'
		},
		{
			duration: 500,
			complete: function() {showSlideDown();}
	    });
	});
	
	
});
function NavInit(){
	jQuery('#NavLayer .NavLayer-block').each(function(){jQuery(this).hide(); });
	jQuery('#f-menu li a').each(function(){jQuery(this).removeClass('NavLayer_bg_on').addClass('defaut');jQuery(this).css({color: "#ffffff"});});	
}
function NavShow(e,ta){

	this_nav = '#f-menu li a[rel='+e+']';
	this_layer_html = '.NavLayer_'+e;
	jQuery(this_nav).removeClass('defaut').addClass('NavLayer_bg_on');
	jQuery(this_nav).css({color: "#ffffff"});
	/*$(this_layer_html).css({opacity: 0});*/
	jQuery(this_layer_html).show();
	/*$(this_layer_html).fadeTo(300, 1);*/
}
function showMenuOverlay(){
    new Effect.Appear($('Menu-overlay'), { duration: 0.3,  to: 0.7 });
}

function hideMenuOverlay(){
    $('Menu-overlay').hide();
}

function showSlideDown(){
	jQuery("#slide-down-overlay").show().animate({opacity: '0.8'});
	jQuery("#slide-down").animate({top: '0'});
}
function displaySlideDown(){
	jQuery("#slide-down-overlay").hide().animate({opacity: '0.8'});
	jQuery("#slide-down").animate({top: '-580'});
}
function switch_img(url,urlZ) {
	jQuery("#image").attr({rel:urlZ});
	jQuery("#image").attr({src:url});
} 
