$(document).ready(function() {
	//gallery1 
	$('.gallery1 li span').css({opacity:'0'})
	$('.gallery1 li').hover(function(){
		$(this).find('span').stop().animate({opacity:'1'},600, function(){$(this).css({opacity:'none'})})							 
	}, function(){
		$(this).find('span').stop().animate({opacity:'0'},600)
	})
	//content & menu
	$('#menu > li > span').css({ opacity:'0'})
	$('ul#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', width:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	var content=$('#content'),
		nav=$('.menu'),
		foot_nav=$('.footer_menu');
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			$('> a > span',li).stop().animate({opacity:'1'},400, function(){$(this).css({opacity:'none'})});
			Cufon.replace($('> a',li), { fontFamily: 'Kozuka Gothic Pro OpenType', color:'#000' });
		},
		hoverOut:function(li){
			if (li.hasClass('sfHover')) {} else {
				$('> a > span',li).stop().animate({opacity:'0'},400);
				Cufon.replace($('> a',li), { fontFamily: 'Kozuka Gothic Pro OpenType', color:'#f1f1f1' });
			}
		},
		hover:true
	})
	foot_nav.navs({
		useHash:true,
		hover:true
	})
	nav.navs(function(n){
			content.cont_sw(n);
	})	
	foot_nav.navs(function(n){
			content.cont_sw(n);
	})
	content.cont_sw({
		showFu:function(){
			var _=this
			$.when(_.li).then(function(){									   
				_.next.css({visibility:'visible'}).stop().animate({height:'700'},400, function(){										 
				})
			});
					$('#splash_content').stop().animate({height:'0'});		
					$('#content').stop().animate({height:'700'});									
		},
		hideFu:function(){
			var _=this
				_.li.not(':hidden').stop().animate({height:'0'},400,function(){
					$(this).css({visibility:'hidden'})
				})
					
					$('#content').stop().animate({height:'0'}, function(){$('#splash_content').stop().animate({height:'700'});});
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', visibility:'hidden', height:'0'});
		}
	})
	//gallery2 
	$("#gallery2").jCarouselLite({
			btnNext: ".next1",
		 	btnPrev: ".prev1",
			visible: 3,
			speed: 600,
			easing: 'easeOutCirc'
	});	
	// buttons
	$('.button span').css({opacity:'0'})
	$('.button').hover(function(){
		$(this).find('span').stop().animate({opacity:'1'},600, function(){$(this).css({opacity:'none'})})
	},function(){
		$(this).find('span').stop().animate({opacity:'0'},600)
	})
	
	//catalogue 
	
	nav=location.hash;
	if (nav=='#!/page_Catalogue') {
		$('.ul_1 li').eq(0).addClass('active');
	}
	$('#menu > li > a').click(function(){
		if ($(this).attr('href')!='#!/page_Catalogue') {
			$('.ul_1 li').removeClass('active');
		}
	})
	$('a').click(function(){
		if ($(this).attr('href')=='#!/page_Catalogue')	{
			$('.ul_1 li').removeClass('active');
			$('.ul_1 li').eq(0).addClass('active');
		}				  
	})
	$('.ul_1 a').click(function(){
		$('.ul_1 li').removeClass('active');
		$(this).parent().addClass('active');
	})
	//tabs
	tabs.init();
	// for lightbox
	if ($("a[rel^='prettyPhoto']").length) {
		$(document).ready(function() {
			// prettyPhoto
			$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_square'});
		});
	}
	
	$("#catalogue1").jCarouselLite({
			btnNext: ".next2",
		 	btnPrev: ".prev2",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});
	$("#catalogue2").jCarouselLite({
			btnNext: ".next3",
		 	btnPrev: ".prev3",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});
	$("#catalogue3").jCarouselLite({
			btnNext: ".next4",
		 	btnPrev: ".prev4",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});
	$("#catalogue4").jCarouselLite({
			btnNext: ".next5",
		 	btnPrev: ".prev5",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});
	$("#catalogue5").jCarouselLite({
			btnNext: ".next6",
		 	btnPrev: ".prev6",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});
	$("#catalogue6").jCarouselLite({
			btnNext: ".next7",
		 	btnPrev: ".prev7",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});
	hover_1('.next1, .prev1');
	hover_1('.next2, .prev2');
	hover_1('.next3, .prev3');
	hover_1('.next4, .prev4');
	hover_1('.next5, .prev5');
	hover_1('.next6, .prev6');
	hover_1('.next7, .prev7');
	hover_1('.close');
})
function hover_1(elem){
	$(elem).find('.img_act').css({opacity:'0'});
	$(elem).hover(function(){
		$(this).find('.img').stop().animate({opacity:'0'});
		$(this).find('.img_act').stop().animate({opacity:'1'},400, function(){$(this).css({opacity:'none'})});
	}, function(){
		$(this).find('.img_act').stop().animate({opacity:'0'});
		$(this).find('.img').stop().animate({opacity:'1'},400, function(){$(this).css({opacity:'none'})});
	})
}
$(window).load(function() {	
	$('.spinner').fadeOut();
	$('body').css({overflow:'inherit'});
})

