$(document).ready(function() {
	// hover
	$('.buttons strong').css({opacity:0})
	$('.buttons a').hover(function(){
		$(this).find('strong').stop().animate({opacity:1}, function(){$(this).css({opacity:'none'})})
		$(this).find('span').stop().animate({opacity:0})						   
	}, function(){
		$(this).find('span').stop().animate({opacity:1}, function(){$(this).css({opacity:'none'})})
		$(this).find('strong').stop().animate({opacity:0})						   
	})
	
	$('.bord').css({opacity:0})
	
	$('.lightbox-image').hover(function(){
		$(this).find('.bord').stop().animate({opacity:0.33})								
	}, function(){
		$(this).find('.bord').stop().animate({opacity:0})								
	})
	
	// for lightbox
	$("a[data-type^='prettyPhoto']").prettyPhoto({theme:'light_square'});
	
	
	$('ul#menu').superfish({
      delay:       600,
      animation:   {height:'show'},
      speed:       600,
      autoArrows:  false,
      dropShadows: false
    });

	//bg animate
	$('#bgSlider').bgSlider({
	  	duration:1000,
	  	images:['images/img1.jpg','images/img2.jpg','images/img3.jpg','images/img4.jpg','images/img5.jpg'],
	 	preload:false,
	  	spinner:'.bg_spinner',
	  	nextBu:'.buttons > .next',
	  	prevBu:'.buttons > .prev'
	 })
		
 });

$(window).load(function() {	
	// scroll
	$('.scroll').cScroll({
		duration:700,
		step:100,
		trackCl:'track',
		shuttleCl:'shuttle'
	})		
	
	tabs.init();
	//content switch
	var content=$('#content'),
		nav=$('.menu');
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			$('> span',li).stop().animate({opacity:'1'},600);
		},
		hoverOut:function(li){
			$('> span',li).stop().animate({opacity:'0'},600);
		},
		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:570});	
			});
			$('#content').stop().animate({ height:580})
		},
		hideFu:function(){
			var _=this
			_.li.stop().animate({height:0}, function(){$(this).css({display:'none'})})
			$('#content').stop().animate({ height:0})
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', display:'none'});
		}
	})
})
