
	$(document).ready( function () {
		$('.normal').hoverIntent( makeBig, makeSmall );
	});
	function makeBig(){
		$("#makeMeScrollable").smoothDivScroll("stopAutoScroll");
		//$("#makeMeScrollable").smoothDivScroll("moveToElement","first");
		$('.scrollableArea').css({
			width: function(index, value) {
				return parseFloat(value) + 200;
			}
		});
		
		ell = $(this);
			
		$(this).dequeue().animate({  
					width: '251px',
					}, 250)
					.find('.gallery_img').animate({
						marginTop: '0px',
						width: '251px',
						height: '176px'
					}, 250)
					.find('.img_center, .img_center img').animate({
						width: '233px',
						height: '158px'
					}, 250)
					.end().find('.img_top, .img_bot').animate({
						width: '233px'
					}, 250)
					.end().find('.img_left, .img_right').animate({
						height: '158px'
					}, 250)
					.end().end().find('.gallery_info').animate({
						width: '229px'
					}, 250);
					
		my_scroll_pos = $('.scrollableArea').position().left;
		my_pos_left = ell.position().left;
		my_pos_right = ell.position().left + 251;
		my_pos = my_pos_right + my_scroll_pos
		if(my_pos>918){
			x = (my_pos - 918);
			$('.scrollableArea').animate({
					marginLeft: '-' + x + 'px'
				}, 250);		
		} else if(my_pos<251){
			x = (251-my_pos);
			$('.scrollableArea').animate({
				marginLeft: x + 'px'
			}, 250);
		}	
	};
		
	function makeSmall(){
		$("#makeMeScrollable").smoothDivScroll("startAutoScroll");
		$(this).dequeue().animate({  
					width: '151px'
					}, 250)
					.find('.gallery_img').animate({
						marginTop: '70px',
						width: '151px',
						height: '106px'
					}, 250)
					.find('.img_center, .img_center img').animate({
						width: '133px',
						height: '88px'
					}, 250)
					.end().find('.img_top, .img_bot').animate({
						width: '133px'
					}, 250)
					.end().find('.img_left, .img_right').animate({
						height: '88px'
					}, 250)
					.end().end().find('.gallery_info').animate({
						width: '129px'
					}, 250, function (){
						$('.scrollableArea').css({
							width: function(index, value) {
								return parseFloat(value) - 200;
							}
						});		
					});
					
		if(typeof x != 'undefined'){
			$('.scrollableArea').animate({
				marginLeft: '0px'
			}, 250);
		}
		//clearInterval(iid);
	}

