function menuBind(){
		$('#menu > li > a').bind ('mouseenter', function(){
			$(this).parent().find('strong').stop().animate({backgroundPosition:'-80 -30'},400, 'easeInQuad')
		});
		$('#menu > li > a').bind ('mouseleave',function(){
			$(this).parent().find('strong').stop().animate({backgroundPosition:'-310 -30'},400, 'easeOutQuad')
		});
}
function menuUlBind(){
		$('ul').bind ('mouseenter', function(){
			$(this).parent().find('> strong').stop().animate({backgroundPosition:'-80 -30'},400, 'easeInQuad')
		});
		$('ul').bind ('mouseleave',function(){
			$(this).parent().find('> strong').stop().animate({backgroundPosition:'-310 -30'},400, 'easeOutQuad')
		});
}
function closeBind(){
		$('.close').bind ('mouseenter', function(){
			$(this).stop().animate({right:'73'},400,'easeInBack')	
		});
		$('.close').bind ('mouseleave',function(){
			$(this).stop().animate({right:'92'},400,'easeOutBack')
		});
}
$(document).ready(function() {
	$('#menu, #content').show();
	//logo animate
	$('h1').hover(function(){
			$(this).stop().animate({left:'0'},400,'easeInBack')			 
		}, function(){
			$(this).stop().animate({left:'-69'},400,'easeOutBack')	
		}
	)
	$('#icon li a span').css({height:'0px'})
	$('#icon li a').mouseenter(function(){			   
			$(this).find('span').stop().animate({height:'62'},400)
		}).mouseleave(function(){
			$(this).find('span').stop().animate({height:'0'},400)
		}
	)
	closeBind();
	//menu animate
	menuBind();
	menuUlBind();
	$('ul#menu').superfish({
      delay:       600,
      animation:   {opacity:'show', height:'show'},
      speed:       400,
      autoArrows:  false,
      dropShadows: false
    });
	//button animate
	$('.button1').hover(function(){
			$(this).find('span').stop().animate({backgroundPosition:'-80 -45'},400, 'easeInQuad')
		}, function(){
			$(this).find('span').stop().animate({backgroundPosition:'-310 -45'},400, 'easeOutQuad')
		}
	)
	$('.enter_button').hover(function(){
			$(this).find('strong').stop().animate({backgroundPosition:'-80 -33'},400, 'easeInQuad')
		}, function(){
			$(this).find('strong').stop().animate({backgroundPosition:'-410 -33'},400, 'easeOutQuad')
		}
	)
	// tool tip
	$('.normaltip').aToolTip({
    	toolTipClass: 'aToolTip'});
	// vertical scroll	
    $('.scroll-pane').jScrollPane({
		showArrows:true,
		scrollbarWidth:24,
		dragMaxHeight:56
	});	
	// tabs
	tabs.init();
	//list animate
	$('.list1 li a, .list2 li a').hover(function(){
			$(this).stop().animate({paddingLeft:'23'},400);			
		}, function(){
			$(this).stop().animate({paddingLeft:'13'},400);	
		}
	)
	// bg resize
	var w_img=1980, 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);
		}
		$('.bg_img').css({width:w_img_new, height:h_img_new});
	}
	setInterval(setNew,150);
	function setNew(){
		setWidth();
		setHeight();
		if ((w!=new_w)|(h!=new_h)) {
			w=new_w;h=new_h;
			setSize();
		}
	}
 });
