$(document).ready(function() {	
	$('.scroll').jScrollPane({
		scrollbarMargin	: 10,
		reinitialiseOnImageLoad : true
	});
	
	$('.fancybox').fancybox({
		overlayColor	:	'#000',
		titlePosition	:	'over',
		overlayOpacity	: 	'0.6'
	});
	
	$("div.scrollable.horizontal").scrollable(); 		
	
	$("#gallery .items img", this).click(function() { 		 
	    var url = $(this).attr("src").match(/(.+_{2})(.+)/);
	    url = url[2];
	    
	    var resize = $('#image_wrap img').attr('src').match(/(.+_{2})(.+)/);
	    resize = resize[1];
	    
	    url = resize+url;	 	    
	    
	    var div = document.createElement('div');
	    $(div).addClass('positioner').hide();
	    var img = new Image(); 
	    $(img).attr('src',url);
	    $(img).load(function() {
	    	$('#image_wrap .positioner').fadeOut('slow',function() { $(this).remove(); })
	    	$(div).append(img);
	    	$('#image_wrap').append(div);
	    	$(div).fadeIn('slow');
	    });	    	   	  
	}).reflect({height:0.2,opacity:1});
	
	$("div.scrollable.vertical").scrollable({vertical:true}).mousewheel();
	
	$('.preview').show();
	$('.preview a').click(function() {
		if (!$('.preview input').attr('checked')) return false;
	});
	
	
	
});
