$(document).ready(function() {

    $('.mycarousel').removeClass('mycarousel').addClass('carouselflat');
    $('#mycarousel').jcarousel({
      animation: 1000
          });

    $(".thumb a").click(function(){
        var imgHref = $(this).attr('href');  //get the src of the thumbnail
        var imgAlt = $(this).find('img').attr('alt');  //get the src of the thumbnail
        $(".thumb a").removeClass("selected");  //remove .selected class from all other links
        $(this).addClass("selected");  //add .selected class to current link
        $(".big").stop();
        $(".big").stop().fadeTo(200, 0, function() {  //fade image out
            $('.big').attr('src',imgHref);  //give new image a src attribute
            $('.big').attr('alt',imgAlt);
	  }).fadeTo("slow", 1);  //fade the image in
	  
        var id = $(this).find('img').attr('id').match(/product([0-9]+)/)[1];
        $('#prod-info').load('product.aspx?id=' + id);

        return false;
      }); 
	  
    $(".thumb a").each(function(){
        var got;
        $(this).find('img').each(function(){
            if (this.id) {
              var id = this.id.match(/product([0-9]+)/)[1];
              $('#prod-info').load('product.aspx?id=' + id);
              got = true;
            }
	  });
        if (got) return false;
      });

    $("img.jqzoom").jqueryzoom({
      xzoom: 572, //zooming div default width(default width value is 200)
	  yzoom: 339, //zooming div default width(default height value is 200)
	  offset: 10 //zooming div default offset(default offset value is 10)
	  //position: "right" //zooming div position(default position value is "right")
	  });

  });

