
$(document).ready(function() {
	$('footer').css({opacity:'0.96'});
	
	$('#menu > li > strong').css({opacity:'0'})
	
	//gallery 
	$(".gallery1").jCarouselLite({
			btnNext: ".next",
		 	btnPrev: ".prev",
       		mouseWheel: true,
			visible: 3,
			speed: 600,
			easing: 'easeOutCirc'
	});
	$(".gallery2").jCarouselLite({
			btnNext: ".next",
		 	btnPrev: ".prev",
       		mouseWheel: true,
			visible: 2,
			speed: 600,
			easing: 'easeOutCirc'
	});
	
	// for lightbox
	$("a[data-type^='prettyPhoto']").prettyPhoto({theme:'light_square'});
	
	$('#ContactForm').forms({
		ownerEmail:'ya.za0za@yandex.ru'
	})
	
	var content=$('#content'),
		nav=$('.menu');
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			$('> strong',li).stop().animate({opacity:'1'},400);
		},
		hoverOut:function(li){
			if (li.hasClass('sfHover')) {} else {
				$('> strong',li).stop().animate({opacity:'0'},400);
			}
		},
		hover:true
	})	
	nav.navs(function(n){
			content.cont_sw(n);
	})	

	content.cont_sw({
		showFu:function(){
			var _=this
			$.when(_.li).then(function(){					   
				if (_.next.attr('id')=='page_Home') {
					_.next.css({display:'block'}).find('.caption').stop().animate({right:'30'},1000, 'easeOutBack');
					$('#content').stop().animate({height:'740px'})
				} else {					   
					_.next.css({display:'block'}).stop().animate({height:'900'},500, 'easeOutCirc');
					$('#content').stop().animate({height:'900px'})
				}
			});	
		},
		hideFu:function(){
			var _=this
				$('#page_Home').find('.caption').stop().animate({right:'-600'},1000, 'easeInBack')
				_.li.stop().animate({height:'0'},500, 'easeOutCirc');
				
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none', height:'0'});
			$('#page_Home').find('.caption').css({right:'-600px'});
		}
	})
	nav.navs(0);
	//menu
	$('#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', height:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	
	
	//bg animate
	$('#bgSlider').bgSlider({
		duration:1000,
		pagination:'.pagination',
		preload:true,
		spinner:'.bg_spinner'
	})
	$('.caption > div').css({right:'-600px'});
	$('.caption_1').css({right:'0'});
	$('.pagination a').click(function(){
		var number = parseInt($(this).attr('data-type'));	
		$('.caption > div').stop().animate({right:'-600'},1000,'easeInBack', function(){
			$('.caption_'+(number+1)).stop().animate({right:'0'},1000,'easeOutBack')
		});
	})
	
 });
