(function($){
	$.fn.localGallery = function( option ) {

		// override defaults with specified option
    option = $.extend( {}, $.fn.localGallery.option, option );

    var inactiveImageShift =  -1 * (option.activeImageWidth - option.inactiveImageWidth) / 2;
    
		return this.each(function() {
		  var allImages = $(this).children();

		  // Put classes on each child for reference
		  $(this).children().each(function(index) {
		    $(this).addClass('gallery-image-' + (index + 1));
		  });
		  
		  // Set the first image to active
		  $(this).find('li').eq(0).addClass('active').css("width", option.activeImageWidth + 'px');
		  $(this).find('li:last').addClass('last');
		  
		  // Create mouseover effect for second image
		  $(this).find('li').each(function() {
		    $(this).hoverIntent(function() {
  		    if ($(this).hasClass('active')) {
  		      // don't do anything
  		    } else {
  		      $(this)
  		        .animate({
                width: option.activeImageWidth + 'px'
      		    })
    		      .find('img')
    		        .animate({
    		          left: '0'
    		        })
    		      .end()
    		      .addClass('active');

            $(allImages).not(this)
              .animate({
                width: option.inactiveImageWidth + 'px'
              })
              .find('img')
    		        .animate({
    		          left: inactiveImageShift + 'px'
    		        })
    		      .end()
    		      .removeClass('active'); // Do this last otherwise there can be a jump
  		    }

  		  }, function() {
  		    // Do nothing on mouse out
  		  });
		  });
		  
		});
	};

	// default options
	$.fn.localGallery.option = {
    // Put options here
    activeImageWidth: 600,
    inactiveImageWidth: 46

	};
})(jQuery);;
(function( $ ){
  jQuery(document).ready(function() {
    $('.local-gallery').localGallery({activeImageWidth: 190, inactiveImageWidth: 46});
    $('body.front .local-gallery').localGallery();
  });
})( jQuery );
;
/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);;

