$(document).ready(function() {	
	//gallery1 
	$("#gallery1").jCarouselLite({
			btnNext: ".next1",
		 	btnPrev: ".prev1",
			visible: 4,
			speed: 600,
			easing: 'easeOutCirc'
	});	
	//gallery2 
	$("#gallery2").jCarouselLite({
			btnNext: ".next2",
		 	btnPrev: ".prev2",
			visible: 3,
			speed: 600,
			easing: 'easeOutCirc'
	});	
	//gallery2 
	$("#gallery3").jCarouselLite({
			btnNext: ".next3",
		 	btnPrev: ".prev3",
			visible: 3,
			speed: 600,
			easing: 'easeOutCirc'
	});	
	// forms
	$('#ContactForm').forms()
    $('#search').jqTransform({imgPath:'jqtransformplugin/img/'});	
	
	// for lightbox
	if ($("a[rel^='prettyPhoto']").length) {
				// prettyPhoto
				$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
	}
	$('.border_').css({opacity:'0'})
	$('.prettyPhoto').hover(function(){
			$(this).find('.border_').stop().animate({opacity:'1'}, function(){$(this).css({opacity:'none'})})						 
		}, function(){
			$(this).find('.border_').stop().animate({opacity:'0'})
		}
	)
	//content & menu
	$('ul#menu').superfish({
      delay:       600,
      animation:   {height:'show'},
      speed:       600,
      autoArrows:  false,
      dropShadows: false
    });
	var content=$('#content'),
		nav=$('.menu');
	nav.navs({
		useHash:true,
		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'});
				if (_.next.attr('id')=='page_Home') {
					_.next.stop().animate({height:'470'},500, 'easeOutCirc');
					$('#content').css({height:'470', overflow:'inherit'})
				} else {
					_.next.stop().animate({height:'700'},500, 'easeInCirc');
					$('#content').css({overflow:'hidden'}).stop().animate({height:'820'},500, 'easeInCirc')
					$('body').css({overflow:'inherit',overflowY:'inherit'})
				}
			});	
		},
		hideFu:function(){
			var _=this
					_.li.stop().animate({height:'0'},500, 'easeOutCirc',function(){
						_.li.css({display:'none'});
					})
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none', height:'0'});
			
		}
	})
	nav.navs(0);
	//bg animate
	$('#bgSlider').bgSlider({
		duration:1000,
		pagination:'.pagination',
		preload:true,
		spinner:'.bg_spinner'
	})
})
$(window).load(function() {	
	$('.spinner').fadeOut();
	$('body').css({overflow:'inherit'})
})
