$(document).ready(function() {	
	
	//gallery1 
	$("#gallery1").jCarouselLite({
			btnNext: ".next1",
		 	btnPrev: ".prev1",
			visible: 7,
			speed: 600,
       		vertical: true,
			easing: 'easeOutCirc'
	});	
	$('#ContactForm').forms()
	//content & menu
	
	$('ul#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', height:'show'},
      speed:       600,
      autoArrows:  false,
      dropShadows: false
    });
	$('#menu li > a > span').css({opacity:'0'});
	var content=$('#content'),
		nav=$('.menu');
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			$('> a > span',li).stop().animate({opacity:'1'},400);
			$('> a > strong',li).stop().animate({opacity:'0'},400);
		},
		hoverOut:function(li){
			if (li.hasClass('sfHover')) {} else {
				$('> a > span',li).stop().animate({opacity:'0'},400);
				$('> a > strong',li).stop().animate({opacity:'0.69'},400);
			}
		},
		hover:true
	})	
	nav.navs(function(n){
			content.cont_sw(n);
	})	

	content.cont_sw({
		showFu:function(){
			var _=this
			$.when(_.li).then(function(){	
				_.next.css({display:'block'});
				_.next.stop().animate({height:'100%'},500, 'easeOutCirc');
			});	
			$('#content').stop().animate({height:'479'}, 500, 'easeOutCirc')
			$('header').stop().animate({height:'182', marginTop:'0'}, 500, 'easeOutCirc');
			h=$(window).height();
			if (h>826) {
				$('.container_24').stop().animate({marginTop:~~((h-826)/2), height:'766'});
			} else {
				$('.container_24').stop().animate({marginTop:'0', height:'766'});
			}
		},
		hideFu:function(){
			var _=this
				_.li.stop().animate({height:'0'},500, 'easeOutCirc',function(){
					_.li.css({display:'none'});
				})
			$('#content').stop().animate({height:'0'}, 500, 'easeOutCirc', function(){
				if (h>826) {
					$('header').stop().animate({height:'153', marginTop:'569'}, 500, 'easeOutCirc');
				} else {
					h=$(window).height();
					$('.container_24').css({ height:h-60});
					$('header').css({marginTop:h-257+'px'})	
				}
			})
			
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none', height:'0'});
			$('#content').css({height:'0', overflow:'hidden'})
			$('header').css({height:'153px', marginTop:'569px'})
			h=$(window).height();
			if (h>826) {
			$('body').css({overflowY:'hidden'});
			$('.container_24').stop().animate({marginTop:~~((h-826)/2), height:'766'});
			if ((location.hash=='')||(location.hash=='#')) {
				$('header').stop().animate({marginTop:'569'})
			}
		} else {
			if ((location.hash=='')||(location.hash=='#')) {
				$('.container_24').css({ height:h-60});
				$('header').css({marginTop:h-257+'px'})
			}
			$('.container_24').css({marginTop:0});
			$('body').css({overflow:'inherit'})
		}
		}
	})
	//bg animate
	$('#bgSlider').bgSlider({
		duration:1000,
		pagination:'.pagination',
		preload:true,
		spinner:'.bg_spinner'
	})
	$('.list1 a').hover(function(){
		$(this).stop().animate({paddingLeft:'32px'}, 500)
	}, function(){
		$(this).stop().animate({paddingLeft:'22px'}, 500)
	})
	$('.close .img_act, .next1 .img_act, .prev1 .img_act').css({opacity:'0'})
	$('.close, .next1, .prev1').hover(function(){
		$(this).find('.img').stop().animate({opacity:'0'})					   
		$(this).find('.img_act').stop().animate({opacity:'1'})					   
	}, function(){
		$(this).find('.img_act').stop().animate({opacity:'0'})					   
		$(this).find('.img').stop().animate({opacity:'1'})					   
	})
})
$(window).load(function() {	
	$('.spinner').fadeOut();
	$('body').css({overflow:'inherit'})
})
