window.onload=setBack;

function Process(obj1) {  //process the form
   if (isNaN(obj1.quantity.value-0)) {
      alert ("Quantity must be a number!");
      return false;
   }

   if (obj1.quantity.value-0 < 1) {
      alert ("Quantity must greater than 0!");
      return false;
   }

   if (obj1.fmt.value==0) {
      alert ("You must specify Media Format!");
      return false;
   } else {
      obj1.item_number.value=obj1.fmt.value;
      switch(obj1.fmt.value) {
         case '689076536523': obj1.amount.value=20;
                              break;
         case '689076536524': obj1.amount.value=15; 
                              break;
         default: alert("Unknown Media Format:"+obj1.fmt.value); 
                  return false;
      }
   }
   
   if (obj1.shp.value==0) {
      alert ("You must specify shipping destination!");
      return false;
   } else {
      obj1.shipping.value=obj1.shp.value;
   }
   
   if ((obj1.ref.value==0) ||
       (obj1.ref.value=="other" && obj1.reftxt.value=="")) {
      alert ("Please tell us how you heard of us.");
      return false;
   } 

   if (obj1.ref.value=="other") {
      obj1.os0.value=obj1.reftxt.value;
   } else {
      obj1.os0.value=obj1.ref.options[obj1.ref.selectedIndex].text;
   }

   obj1.item_name.value="Power Yoga for Athletes - " + 
           obj1.fmt.options[obj1.fmt.selectedIndex].text.substring(0,3);

}

function refselected(obj1) {
   if (obj1.value=="other") {
      showref(true);
   } else {
      showref(false);
   }
}

function showref(v) {
   elem=document.getElementById("reftxt");
   if (v) {
      elem.style.display='block';
   } else {
      elem.style.display='none';
      document.orderform.reftxt.value="";
   }
}

function setBack() {
   document.orderform.ref.options.selectedIndex=0;
   document.orderform.fmt.options.selectedIndex=0;
   document.orderform.shp.options.selectedIndex=0;
   document.orderform.reftxt.value="";
   document.orderform.quantity.value="1";
}

