$(document).ready(function() {
	// hover
	$('#clients .img_act').css({opacity:0})
	$('#clients a').hover(function(){
		$(this).find('.img_act').stop().animate({opacity:1}, function(){$(this).css({ opacity:'none'})})						   
	}, function(){
		$(this).find('.img_act').stop().animate({opacity:0})						   
	})
	
	
	$('.lightbox-image .bord').css({opacity:0})
	$('.lightbox-image').hover(function(){
		$(this).find('.bord').stop().animate({opacity:1}, function(){$(this).css({opacity:'none'})})								
	}, function(){
		$(this).find('.bord').stop().animate({opacity:0})								
	})
	
	// for lightbox
	$("a[data-type^='prettyPhoto']").prettyPhoto({theme:'dark_square'});
	
	
	$('#form1').jqTransform({imgPath:'jqtransformplugin/img/'});
	
	$('ul#menu').superfish({
      delay:       600,
      animation:   {height:'show'},
      speed:       600,
      autoArrows:  false,
      dropShadows: false
    });
	
	$('.slider')._TMS({
		preset:'simpleFade',
		easing:'easeOutQuad',
		duration:800,
		slideshow:6000,
		nextBu:'.next',
		prevBu:'.prev',
		playBu:'.play'
	})
	
	// contact form
	$('#ContactForm').forms({
		ownerEmail:'ya.za0za@yandex.ru'
	})
	
 });
$(document).ready(function() {
	var h_cont=870;
	var h, new_h;
	setHeight();
	h=new_h;
	setSize();
	function setHeight(){
		new_h=$(window).height();
	}
	function setSize(){
		if (h>h_cont) {
			$('.main').stop().animate({paddingTop:~~((h-h_cont)/2)});	
		} else {
			$('.main').stop().animate({paddingTop:0});	
		}
	}
	setInterval(setNew,1);
	function setNew(){
		setHeight();
		if (h!=new_h) {
			h=new_h;
			setSize();
		}
	}
})
$(window).load(function() {	
	// scroll
	$('.scroll').cScroll({
		duration:700,
		step:100,
		trackCl:'track',
		shuttleCl:'shuttle'
	})	
	
	// contact form
	$('#ContactForm').forms({
		ownerEmail:'ya.za0za@yandex.ru'
	})
	
	//content switch
	var content=$('#content'),
		nav=$('.menu');
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			Cufon.replace('#menu > li > a', { fontFamily: 'Kozuka Gothic Pro OpenType', hover:true });
		},
		hoverOut:function(li){
			Cufon.replace('#menu > li > a', { fontFamily: 'Kozuka Gothic Pro OpenType', hover: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'}).stop().animate({height:'100%'},600,'easeOutQuad');	
			});
		},
		hideFu:function(){
			var _=this
			_.li.stop().animate({height:0},600,'easeOutQuad', function(){$(this).css({display:'none'})})
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none'});
		}
	})
	nav.navs(0)
})

