var old_img = '';

function SwitchImg(img_name) {
   old_img = document.images['prod_thumb'].src;
   document.images['prod_thumb'].src = 'store/vendor3/thumbs/' + img_name;
   document.images['prod_thumb2'].src = 'store/vendor3/thumbs/' + img_name;
}

function FixImg() {
   document.images['prod_thumb'].src = old_img;  
   document.images['prod_thumb2'].src = old_img;
}
 
function popUp(url) {
   sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
   self.name = "mainWin";
}

function quantity_alert()
{
   if ( (document.purchase.in_stock.value != null) && (document.purchase.quantity.value != null) )
   {
      var num_instock = parseInt(document.purchase.in_stock.value);
      var input = parseInt(document.purchase.quantity.value);
      if (input > num_instock)
      {
         alert("There are currently only " + num_instock + " in stock.");
      }
   }
}
   
function option_alert(form_name)
{
   if (document.eval(form_name).stDrop[eval(form_name).stDrop.selectedIndex].value == 0)
   {
      alert("Please choose the size option.");
      return false;
   } 
   else 
   {
      return true;
   }
}

function ImageFlip(strField, strImage, strhref) {
   if (document.images) {
      document.images[strField].src = strImage;
      if(document.getElementById("enlargeLink")) {
         document.getElementById("enlargeLink").href = "javascript:window.open('" + strhref + "','prodEnlarge','toolbar=no,resizeable=yes,scrollbars=no,width=575,height=515'); void('');";
      }
   }
}

/* plus and minus sign definition for the left nav */
var img1 = new Image();
img1.src = "images/nav/minus.png";
var img2 = new Image();
img2.src = "images/nav/plus.png";

function view(id, id2) {
    var get = (document.all) ? document.all[id] : document.getElementById(id);
    get.style.display = (get.style.display == "none") ? 'block' : 'none';
    var get2 = (document.all) ? document.all[id2] : document.getElementById(id2);		
    document.images[id2].src = (document.images[id2].src == img1.src) ? img2.src : img1.src;

    var state = true;

    if (get.style.display == "none") 
    {
        state = false;
    }
    else state = true;

    return state;
}