$(document).ready(function(){
					   
    if ($("#stepleft")) {
        var steppos = 0;
        $("#stepleft").click(function() {
            steppos += 233;
            $("#row").animate({
                marginLeft: '+=233'
            }, 300, function() {
                steppos = $("#row").css("margin-left").replace("px", "");
                if (steppos>0){
                    $("#row").animate({
                        marginLeft: '0'
                    }, 300);
                }
            });
        });
    }

    if ($("#stepright")) {
        var steppos = 0;
        var items = $("div#row div.items").size();
        $("#stepright").click(function() {
            steppos -= 233;
            $("#row").animate({
                marginLeft: '-=233'
            }, 300, function() {
                steppos = $("#row").css("margin-left").replace("px", "");
                if (steppos<((items-4)*-233)){
                    $("#row").animate({
                        marginLeft: (items-4)*-233
                    }, 300);
                }
            });
        });
    }

    $("div.colorselector").mouseenter(function () {
        var newimgname = $(this).attr("id");
        if (newimgname) {
            var oldimagename = $("div.product img").attr("src");
            var imgArray = oldimagename.split('/');
            imgArray[imgArray.length - 1] = newimgname;
            var newImg = imgArray.join('/');
            $("div.product img").attr("src", newImg);
        }
        //alert(imgname);
//        var index = $("div.items").index(this);
//        $("div#hideable_"+index).stop(true).hide();
//        $("div#showdetails_"+index).stop(true).show();
    });

    $("div.items").mouseleave(function () {
        var index = $("div.items").index(this);
        $("div#showdetails_"+index).stop(true).hide();
        $("div#hideable_"+index).stop(true).show();
    });
	
});

function showshare(){
	$('#shareform').removeClass('rh');
	$('#shareform').addClass('shareform');
}

function hideshare(){
	$('#shareform').removeClass('shareform');
	$('#shareform').addClass('rh');
}


