//<![CDATA[
$.fn.extend({
  slideRightShow: function() {
    return this.each(function() {
        $(this).show('slide', {direction: 'right'}, 600);
    });
  },
  slideLeftHide: function() {
    return this.each(function() {
      $(this).hide('slide', {direction: 'left'}, 600);
    });
  },
  slideRightHide: function() {
    return this.each(function() {
      $(this).hide('slide', {direction: 'right'}, 600);
    });
  },
  slideLeftShow: function() {
    return this.each(function() {
      $(this).show('slide', {direction: 'left'}, 600);
    });
  }
});

    $(document).ready(function(){
        $("#subscribe_hover").hover(
        function() {
            var hidden = $("#form_hover").is(":hidden");
            if (hidden) {
                $("#form_hover").toggle("fast");
            }
        },
        function () {
            $("#form_hover").toggle("fast");
        })
    });
current_img=1;
max_img=1;
function img_init(img_counter){
    max_img=img_counter;
}
function img_back(){
    if ($(':animated').length) {
        return false;
    }else{
        if(current_img>1) {
            showImg=current_img-1;
//            $("#product_img_"+showImg).css("display","block");
            $("#product_img_"+current_img).slideLeftHide();
            $("#product_img_"+showImg).slideRightShow();
            current_img--;
            $('#img_num').text(current_img);
        } else {
            showImg=max_img;
//            $('#product_img_'+showImg).css('display','block');
            $("#product_img_"+current_img).slideLeftHide();
            $("#product_img_"+showImg).slideRightShow();
            current_img=max_img;
            $('#img_num').text(current_img);
        }
    }
}
function img_next(){
    if ($(':animated').length) {
        return false;
    }else{
        if(current_img<max_img) {
            showImg=current_img+1;
            //$("#product_img_"+showImg).css("display","block");
            //$("#product_img_"+current_img).css("display","none");
            $("#product_img_"+current_img).slideRightHide();
            $("#product_img_"+showImg).slideLeftShow();
            current_img++;
            $('#img_num').text(current_img);
        } else {
            showImg=1;
           // $('#product_img_'+showImg).css('display','block');
          //  $('#product_img_'+current_img).css('display','none');
            $("#product_img_"+current_img).slideRightHide();
            $("#product_img_"+showImg).slideLeftShow();
            current_img=1;
            $('#img_num').text(current_img);
        }
    }
}
function image_change(src,lImg,rImg){
    i++;
    alert(i);
    $('#product_image').attr("src", src);
    $('#arrow_left').attr("class",lImg);
    $('#arrow_right').attr("class",rImg);
}
function box(whichText){
    alert(whichText);
}
function check_source() {
    document.getElementById('other_source_wrapper').style.display = "none";
    if (document.getElementById('source').value == "Other") {
        document.getElementById('other_source_wrapper').style.display = "block";
    }
}
function changeLocation(menuObj)
{
   var i = menuObj.selectedIndex;

   if(i > 0)
   {
      if(menuObj.options[i].value.indexOf('search') >= 0 || menuObj.options[i].value.indexOf('catalogue') >= 0)
      {
        window.location = menuObj.options[i].value;
      }
   }
}
//]]>