$(document).ready(function(){
	
	$(".scrollable").scrollable({
		onSeek: function(event, i) {
			$(".border_active").remove();
			$("img.active").removeClass("active");
			$(".thumb").eq(i).children("img").addClass("active");
			$(".thumb").eq(i).append("<div class='border_active'></div>");
			$(".description_active").removeClass("description_active");
			$(".description").eq(i).addClass("description_active");
		},
		onBeforeSeek: function(event, i) {
			img_width = $('.items').children("div").eq(i).children("img").width();
			if(img_width < 615){
	    		$('.items').children("div").eq(i).children("img").css("margin-left",(615-img_width)/2);
	    	}
		}
	});
	
	$("#column_2_page table tr td:last-child").css("padding-right","0px");
	var api = $(".scrollable").data("scrollable");
	
	$('.thumb').click(function() {
		$(".border_active").remove();
		$(this).children("img").addClass("active");
		$(this).append("<div class='border_active'></div>");
  		index = $("div.thumb").index(this);
  		api.seekTo(index,400);
  		$(".description_active").removeClass("description_active");
		$(".description").eq(index).addClass("description_active");
	});
	
	setTimeout(function(){
		img_width = $('.items').children("div").eq(0).children("img").width();
		if(img_width < 615){
			$('.items').children("div").eq(0).children("img").css("margin-left",(615-img_width)/2);
		}
	}, 3000)
	    	
	setTimeout(function(){
		$("#loading").fadeOut("fast");
	}, 3200)

}); 
