// JavaScript Document


(function($) {
		  
	$(function() {
		$('#bg img').maxImage({
			isBackground: true
	    });
		
		$('.scroll-pane').jScrollPane({
			verticalDragMinHeight: 20,
			verticalDragMaxHeight: 20
		});
	});

	
	$(document).ready(function() {
							   
		$('.menu-nav li.item01 a').hover(
			function() { $(this).stop().animate({ backgroundPosition: "-173px -2px", height: 25 }, 150) }, 
			function() { $(this).stop().animate( { backgroundPosition: "0 -2px", height: 16 } , 150) } 
		);
		
		$('.menu-nav li.item02 a').hover(
			function() { $(this).stop().animate({ backgroundPosition: "-173px -29px", height: 30 }, 150) }, 
			function() { $(this).stop().animate( { backgroundPosition: "0 -24px", height: 16 } , 150) } 
		);
		
		$('.menu-nav li.item03 a').hover(
			function() { $(this).stop().animate({ backgroundPosition: "-173px -61px", height: 30 }, 150) }, 
			function() { $(this).stop().animate( { backgroundPosition: "0 -45px", height: 16 } , 150) } 
		);
		
		$('.menu-nav li.item04 a').hover(
			function() { $(this).stop().animate({ backgroundPosition: "-173px -94px", height: 45 }, 150) }, 
			function() { $(this).stop().animate( { backgroundPosition: "0 -65px", height: 16 } , 150) } 
		);
		
		$('.menu-nav li.item05 a').hover(
			function() { $(this).stop().animate({ backgroundPosition: "-173px -143px", height: 52 }, 150) }, 
			function() { $(this).stop().animate( { backgroundPosition: "0 -87px", height: 16 } , 150) } 
		);
		
		$('.menu-nav li.item06 a').hover(
			function() { $(this).stop().animate({ backgroundPosition: "-173px -199px", height: 50 }, 150) }, 
			function() { $(this).stop().animate( { backgroundPosition: "0 -107px", height: 16 } , 150) } 
		);
		
		
		/*$('#gallery').cycle({ 
			fx:     'fade', 
			speed:   300, 
			timeout: 3000, 
			next:   '#gallery', 
			pause:   1 
		});*/
		
		$(function(){
    //Get our elements for faster access and set overlay width
    var div = $('div.sc_menu'),
                 ul = $('ul.sc_menu'),
                 // unordered list's left margin
                 ulPadding = 15;

    //Get menu width
    var divWidth = div.width();

    //Remove scrollbars
    div.css({overflow: 'hidden'});

    //Find last image container
    var lastLi = ul.find('li:last-child');

    //When user move mouse over menu
    div.mousemove(function(e){

      //As images are loaded ul width increases,
      //so we recalculate it each time
      var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

      var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
      div.scrollLeft(left);
    });
});

		 
	});
	
})(jQuery);
