﻿
function mycarousel_initCallback(carousel) {
    var index = 0;
    $("#mycarousel li img").eq(index).attr("class", "curr");

    $("#mycarousel li").click(function() {
        index = $("#mycarousel li").index(this);
        $("#ctl00_ctl00_InnerRootPlaceHolder_InnerMainPlaceHolder_ctl00_ctrlProductInfo_productImage")[0].src = this.getElementsByTagName("img")[0].src.replace("smaller", "middle");
        $("#ctl00_ctl00_InnerRootPlaceHolder_InnerMainPlaceHolder_ctl00_ctrlProductInfo_BigViewImage").attr("href", this.getElementsByTagName("img")[0].src.replace("smaller", "Big"));
        $(this).siblings().each(function() {
            this.getElementsByTagName("img")[0].className = "";
        })
        this.getElementsByTagName("img")[0].className = "curr";

    });

    $("#mycarousel li").hover(function() {
        $("#ctl00_ctl00_InnerRootPlaceHolder_InnerMainPlaceHolder_ctl00_ctrlProductInfo_productImage")[0].src = this.getElementsByTagName("img")[0].src.replace("smaller", "middle");
        this.getElementsByTagName("img")[0].className = "curr";

    },
				function() {
				    var currIndex = $("#mycarousel li").index(this);
				    if (!(index == currIndex)) {
				        this.getElementsByTagName("img")[0].className = "";
				    }
				    $("#ctl00_ctl00_InnerRootPlaceHolder_InnerMainPlaceHolder_ctl00_ctrlProductInfo_productImage")[0].src = $("#mycarousel li img").eq(index).attr("src").replace("smaller", "middle");
				});


    temp_carousel = carousel;
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.hover(function() {
        t1 = setInterval("temp_carousel.buttonNext.click()", 500);
        if (typeof t2 != "undefined") clearInterval(t2);
    },
				 function() {
				     clearInterval(t1);
				 });
    carousel.buttonPrev.hover(function() {
        t2 = setInterval("temp_carousel.buttonPrev.click()", 500);
        if (t1 != undefined) clearInterval(t1);
    }, function() {
        clearInterval(t2);
    });
};
function mycarousel_initCallback2(carousel) {
    temp_carousel1 = carousel;
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.hover(function() {
        t3 = setInterval("temp_carousel1.buttonNext.click()", 5);
        if (typeof t4 != "undefined") clearInterval(t4);
    },
				 function() {
				     clearInterval(t3);
				 });
    carousel.buttonPrev.hover(function() {
        t4 = setInterval("temp_carousel1.buttonPrev.click()", 5);
        if (t3 != undefined) clearInterval(t3);
    }, function() {
        clearInterval(t4);
    });

};


$(document).ready(function() {

    $(".jqzoom").jqzoom({
        zoomWidth: 300,
        zoomHeight: 300,
        xzoom: 100,
        yzoom: 100,
        offset: 20,
        position: "right"
    });
    jQuery('#mycarousel').jcarousel({ vertical: false, initCallback: mycarousel_initCallback });
    jQuery('#first-carousel').jcarousel();
});

