var colorpick;
var prodimg;
var proddesc;
var lastlnk;

window.onload=function() {
  theol = document.getElementById('prodcolors');
  for(i=0; i<theol.childNodes.length; i++){
    thisnode = theol.childNodes[i];
    if(thisnode.nodeName=='LABEL') {
      thisid = thisnode.getAttribute('for');
      if(!thisid) {
        thisid = thisnode.htmlFor;
      }
      for(j=0; j<thisnode.childNodes.length; j++){
        if(thisid && thisnode.childNodes[j].nodeName=='SPAN') {
          thisid = thisid.substring(5);
          thisvalue  = '<img src="colors/'+thisid+'.jpg" alt="';
          thisvalue += thisnode.childNodes[j].innerHTML;
          thisvalue += '" width="40" height="40"';
          thisvalue += ' onclick="radioChange(\''+thisid+'\',\''+thisnode.childNodes[j].innerHTML+'\')"';
          thisvalue += '>';
          thisnode.childNodes[j].innerHTML = thisvalue;
        }
      }
    }
  }
  if(thisid) {
    initARC('prodform','radioOn', 'radioOff');
  }
  colorpick = document.getElementById('colorpick');
  prodimg = document.getElementById('prodimg');
  proddesc = document.getElementById('proddesc');
  lastlnk = document.getElementById('lnkp');
}



function desctab(tab) {
  var thislnk = document.getElementById('lnk'+tab);
  if(thislnk==lastlnk) return false;
  lastlnk.className = 'off';
  thislnk.className = 'on';
  lastlnk = thislnk;
  eval("txttab = txt"+tab);
  proddesc.innerHTML = "<div class='proddescbox'>"+txttab+"</div>";
  return false;
}



function checkForm() {
  var size = document.getElementById('size');
  if(size && size.selectedIndex=='') {
    alert("Please select a size.");
    size.focus();
    return false;
  }
  var qty = document.getElementById('qty');
  if(qty && qty.value=='') {
    alert("Please enter a quantity.");
    qty.focus();
    return false;
  }
  return true;
}
