$(window).load(function(){ 
		$('.animated_shadow').hover(
							function(){$(this).stop().animate({shadow: '0 0 30px white'}, 200);},
							function(){$(this).stop().animate({shadow: '0 0 7px white'});}
									
		);
		
		$('.scroll-pane ul li').hover(
							function(){$('.name', this).stop().animate({paddingTop: '12px'},100).animate({paddingTop: '19px'},100);},
							function(){$('.name', this).stop().animate({paddingTop: '19px'},100)}
									
		);


		$('.scroll-pane').jScrollPane({
			
			showArrows: true,
			horizontalDragMinWidth: 119,
			horizontalDragMaxWidth: 119,
			animateScroll: true,
			animateDuration: 300,
			animateEase: 'linear',
			clickOnTrack: false
										});
		
														
});


		$('.scroll_button.next').live('click',function(){
			var api=$('.scroll-pane').data('jsp')
			api.scrollBy(240,0)
			return false
		})
		
		$('.scroll_button.prev').live('click',function(){
			var api=$('.scroll-pane').data('jsp')
			api.scrollBy(-240,0)
			return false
		})


$(function(){
			var replaceImg=function(href){ 
				var img=$('.model_gal .big_img img').eq(0),nImg=document.createElement('img')
				$('.model_gal .big_img').append($(nImg).css('opacity',0))
				nImg.onload=function(){$(this).animate({opacity:1},'fast');img.remove()} 
				nImg.src=href
			}
			
			$('.model_gal .small_img a').opacityrollover()
			$('.model_gal .small_img li a').click(function(){
			$('.model_gal .small_img .current').removeClass('current')
			replaceImg($(this).attr('href'))
			$(this).addClass('current')
			return false
			})
			
			
			$('.model_gal .big_img img').live('click',function(){
				var curr,indx=0,len=$('.model_gal .small_img ul li a').length
				$('.model_gal .small_img ul li a').each(function(){if(this.className.indexOf('current')!=-1){curr=indx}else{indx++}})
				$('.model_gal .small_img ul li a.current').removeClass('current')
				$('.model_gal .small_img ul li a').eq(((curr+1)<len)?curr+1:0).addClass('current')
				replaceImg($('.model_gal .small_img ul li a.current').attr('href'))
			})
			
			
});
