
	function tabs_hover(){
		$('.tabs .nav a').hover(function(){
				$(this).stop().animate({paddingLeft:'37'},400).parent().stop().animate({paddingLeft:'29'},400)
			}, function(){
				$(this).stop().animate({paddingLeft:'50'},400).parent().stop().animate({paddingLeft:'0'},400)
			}
		)
	}
	$(document).ready(function() {
	
	//close button
	$('.close .img_act').css({opacity:'0'})
	$('.close').hover(function(){
			$(this).find('.img').stop().animate({opacity:'0'},400);
			$(this).find('.img_act').stop().animate({opacity:'1'},400);
		}, function(){
			$(this).find('.img_act').stop().animate({opacity:'0'},400);
			$(this).find('.img').stop().animate({opacity:'1'},400);
		}
	)	
	
	// captions
	$('.images .caption1').css({opacity:'0'});
	$('.images strong').css({opacity:'0'});
	
	$('.images').hover(function(){
			$(this).find('.caption1').stop().animate({opacity:'1'},400);
			$(this).find('strong').stop().animate({opacity:'1'},400);
		}, function(){
			$(this).find('.caption1').stop().animate({opacity:'0'},400);
			$(this).find('strong').stop().animate({opacity:'0'},400);
		}
	)
	//list1
	$('.list1 a').hover(function(){
			$(this).parent().stop().animate({paddingLeft:'10'},400)					 
		},function(){
			$(this).parent().stop().animate({paddingLeft:'0'},400)					 
		}
	)
	//content & menu
	$('#menu > li > span').css({ opacity:'0'})
	$('.ul_1 li').hover(function(){
			Cufon.replace($(this).find('> a'), { fontFamily: 'Adobe Garamond Pro', color:'#f5be00' });
		}, function(){
			Cufon.replace($(this).find('> a'), { fontFamily: 'Adobe Garamond Pro', color:'#fff' });
		}
	)
	$('ul#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', height:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	var content=$('#content'),
		nav=$('.menu');
	$('#search').css({opacity:'0', display:'none'});
	nav.navs({
		useHash:true,
		hoverIn:function(li){
			$('> span',li).stop().animate({opacity:'1'},400);
			Cufon.replace($('> a',li), { fontFamily: 'Adobe Garamond Pro', color:'#000' });

		},
		hoverOut:function(li){
			$('> span',li).stop().animate({opacity:'0'},400);
			Cufon.replace($('> a',li), { fontFamily: 'Adobe Garamond Pro', color:'#fff' });
		},
		hover:true
	})
	nav.navs(function(n){
			content.cont_sw(n);
	})	
	fl=true;
	content.cont_sw({
		showFu:function(){
			fl=false
			var _=this
			$.when(_.li.find('.text')).then(function(){
			$.when(_.li).then(function(){			
			$('.next img, .prev img').css({zIndex:'1'});							   
				_.next.css({visibility:'visible'}).stop().animate({height:'100%', top:'0'},400, function(){
					$(this).find('.text').css({visibility:'visible'}).stop().animate({opacity:'1'},400, function(){$(this).css({opacity:'none'})})																					 
				})
			});
			});
			$('#search').css({display:'block'}).stop().animate({opacity:'1'});
			$('#content').stop().animate({height:'772'})
			$('footer').stop().animate({marginTop:0})
		},
		hideFu:function(){
			fl=true
			var _=this
				_.li.not(':hidden').find('.text').stop().animate({opacity:'0'},400,function(){
					$(this).css({visibility:'hidden'});
					_.li.not(':hidden').stop().animate({height:'0', top:'386px'},400, function(){$(this).css({visibility:'hidden'});
					$('.next img, .prev img').css({zIndex:'10'});
				});
				})
			$('#search').stop().animate({opacity:'0'},400, function(){$(this).css({display:'none'})});
			$('#content').stop().animate({height:'0'})
			setHeight();
			$('footer').stop().animate({marginTop:new_h-330})
		},
		preFu:function(){
			var _=this
			_.li.css({position:'absolute', visibility:'hidden', height:'0', top:'386px'});
			$('#content').css({overflow:'hidden'});
			$('#content').stop().animate({height:'0'})
		}
	})
	setInterval(function(){
			if (fl) {
			setHeight();
			$('footer').stop().animate({marginTop:new_h-330})
			}},100)
	//tabs
	tabs.init();
	tabs_hover();
	$('.tabs .nav .selected').find('a').mouseenter().unbind('mouseenter, mouseleave')
	//bg animate
	$('#bgSlider').bgSlider({
	  	duration:1000,
	  	images:['images/bg_img1.jpg','images/bg_img2.jpg','images/bg_img3.jpg','images/bg_img4.jpg','images/bg_img5.jpg'],
	 	preload:true,
	  	spinner:'.bg_spinner',
	  	nextBu:'.next',
	  	prevBu:'.prev'
	})
	//buttons for bg
	$('.prev, .next').find('.img_act').css({opacity:'0'})
	$('.prev, .next').hover(function(){
			$(this).find('.img').stop().animate({opacity:'0'});
			$(this).find('.img_act').stop().animate({opacity:'1'});						 
		}, function(){
			$(this).find('.img_act').stop().animate({opacity:'0'});
			$(this).find('.img').stop().animate({opacity:'1'});	
		}
	)
	var w_img=2000, h_img=1200;
	var w,new_w,h, new_h, num;
	setWidth();
	setHeight();
	w=new_w;h=new_h;
	setSize();
	function setWidth(){
		new_w=$(window).width();
	}
	function setHeight(){
		new_h=$(window).height();
	}
	function setSize(){
		if ((w/w_img) > (h/h_img)) {
			w_img_new=w+20;
			h_img_new=~~((w+20)*h_img/w_img);
		} else {
			h_img_new=h+20;	
			w_img_new=~~((h+20)*w_img/h_img);
		}
		$('#bgSlider img').css({width:w_img_new, height:h_img_new});
	}
	setInterval(setNew,1);
	function setNew(){
		setWidth();
		setHeight();
		if ((w!=new_w)|(h!=new_h)) {
			w=new_w;h=new_h;
			setSize();
		}
	}
 });
$(window).load(function() {	
	// scroll
	$('.scroll').cScroll({
		duration:700,
		step:100,
		trackCl:'track',
		shuttleCl:'shuttle',
	})
	$('.scroll2').cScroll({
		duration:700,
		step:100,
		trackCl:'track2',
		shuttleCl:'shuttle',
	})
	$('.scroll3').cScroll({
		duration:700,
		step:100,
		trackCl:'track3',
		shuttleCl:'shuttle',
	})
})

