/*
 *	$Id: jquery.custom.js 59 2008-07-08 09:40:10Z ineo $
 */

 var accessories = 0;
 
$(function(){

	$(".lightbox").lightbox();

	$.scrollTo(0);

	$('.scroll-link').click(function(){
				$.scrollTo( this.hash, 1500, { easing:'easeOutCirc' });
				return false;
	});
	
	var thumbsCount = $("#product-thumbs li").length;
        
	if (thumbsCount>0 && productID != "008") {
		var imgUrl = $("#main-image").attr("src");
		imgUrl = imgUrl.replace(/large/, "thumbs");
		var newThumb = "<li class=\"active\"><a href=\"#\"><img src=\""+imgUrl+"\" alt=\"\" /></a></li>";		
		$("#product-thumbs").prepend(newThumb);
	}

	$("#product-thumbs li a img").click(function(){
		$("#handysittsystem-acc_thumbs li[@class='active']").removeClass("active");
		var imgUrl = $(this).attr("src");
		imgUrl = imgUrl.replace(/thumbs/, "large");	
		$("#main-image").attr("src",imgUrl);
		$("#product-thumbs li[@class='active']").removeClass("active");
		$(this).parent().parent().addClass("active");
		return false;
	});

	$("#handysittsystem-acc_thumbs li a img").click(function(){
		var type = $(this).attr("type");
		var imgUrl = $("#product-thumbs li[@class='active'] a img").attr("src");
		imgUrl = imgUrl.replace(/thumbs/, "large");
		imgUrl = imgUrl.replace(/\.jpg/, "_"+type+".jpg");
		$("#main-image").attr("src",imgUrl);
		$("#handysittsystem-acc_thumbs li[@class='active']").removeClass("active");
		$(this).parent().parent().addClass("active");
		return false;
	});
	
});
