
function contactcheck(theform)
{
	  

	//var fnamestr = document.form1.fname.value;
	//var lnamestr = document.form1.lname.value;

	var phonestr = document.form1.phone.value;

    splitphonestr = phonestr.split("-")

	//alert("lname length = " + lnamestr);

if (document.form1.fname.value == "")
  {
	  alert("Please enter your First Name!");
	  form1.fname.focus();
	  return false;
  }
  
  if (document.form1.lname.value == "")
  {
	  alert("Please enter your Last Name!");
	  form1.lname.focus();
	  return false;
  }

  
  if (document.form1.address.value == "")
   {
	  alert("Please enter your Address!");
	  form1.address.focus();
	  return false;
   }

   if (document.form1.city.value == "")
   {
	  alert("Please enter your City!");
	  form1.city.focus();
	  return false;
   }
  
  if (document.form1.state.value == "")
  {
	  alert("Please select your State!");
	  form1.state.focus();
	  return false;
  }

  if (document.form1.zip.value == "")
  {
	  alert("Please enter your Zip code!");
	  form1.zip.focus();
	  return false;
  }
  
  if (document.form1.phone.value == "")
  {
	  alert("Please enter your Phone number!\n(all contact information is strictly confidential)");
	  form1.phone.focus();
	  return false;
  }
  if (phonestr.length < 12)
  {
	  alert("Please enter your \"Area Code\" and Phone number!\n(all contact information is strictly confidential)");
	  form1.phone.focus();
	  return false;
  }
  
  
  if(isNaN(splitphonestr[0]))
   {
    alert("Please enter a valid Phone number!\n(all contact information is strictly confidential)");
	  form1.phone.focus();
	  return false; 
   } 
   if(isNaN(splitphonestr[1]))
   {
    alert("Please enter a valid Phone number!\n(all contact information is strictly confidential)");
	  form1.phone.focus();
	  return false; 
   } 
   if(isNaN(splitphonestr[2]))
   {
    alert("Please enter a valid Phone number!\n(all contact information is strictly confidential)");
	  form1.phone.focus();
	  return false; 
   } 

  if (document.form1.email.value == "")
  {
	  alert("Please enter your Email address!");
	  form1.email.focus();
	  return false;
  }

//shipto form check starts here...
 if (document.form1.shiptosame.checked == false)
  {
	 //alert("ShipTo form being checked!");
	 if (document.form1.fnameb.value == "")
  {
	  alert("Please enter your First Name in \"Shipping Form\"!");
	  form1.fnameb.focus();
	  return false;
  }
  /*if (fnamestr.length < 2)
	  {
		  alert("Please Enter your complete First Name!");
	      form1.fname.focus();
	      return false;
	  }
 */
  if (document.form1.lnameb.value == "")
  {
	  alert("Please enter your Last Name in \"Shipping Form\"!");
	  form1.lnameb.focus();
	  return false;
  }

  if (document.form1.addressb.value == "")
   {
	  alert("Please enter your Address in \"Shipping Form\"!");
	  form1.addressb.focus();
	  return false;
   }

  if (document.form1.cityb.value == "")
   {
	  alert("Please enter your City in \"Shipping Form\"!");
	  form1.cityb.focus();
	  return false;
   }

  if (document.form1.stateb.value == "")
  {
	  alert("Please select your State in \"Shipping Form\"!");
	  form1.stateb.focus();
	  return false;
  }

  if (document.form1.zipb.value == "")
  {
	  alert("Please enter your Zip code in \"Shipping Form\"!");
	  form1.zipb.focus();
	  return false;
  }
	 

   //now submit the form all is ok
   //alert("end of checkform function!");
   
   }//end of shipto form check

//make them choose a product!
    if (document.form1.subtotal.value == "")
   {
	   alert("Please choose an item for purchase before submitting your order!");
	   return false;
   }
   form1.submit();
   //return false;
}

//------- Check the Password form -------
function thepassword(passcheck)
{
	
	var user = document.form2.username.value;
	var password = document.form2.password.value;

    //alert("Username = " + user + " Password = " + password);

if (document.form2.username.value == "")
  {
	  alert("Please enter your username name!");
	  form2.username.focus();
	  return false;
  }

  if (document.form2.password.value == "")
  {
	  alert("Please enter your password!");
	  form2.password.focus();
	  return false;
  }

  //form2.submit();
  //alert("crap");

}
//function to disable a form elemtnst
function enableField(state)
{
 
  //clear it also just in case
 document.form1.companyb.value = "";
 document.form1.fnameb.value = "";
 document.form1.lnameb.value = "";
 document.form1.addressb.value = "";
 document.form1.cityb.value = "";
 document.form1.stateb.value = "";
 document.form1.zipb.value = "";

 document.form1.companyb.disabled=state;
 document.form1.fnameb.disabled=state;
 document.form1.lnameb.disabled=state;
 document.form1.addressb.disabled=state;
 document.form1.cityb.disabled=state;
 document.form1.stateb.disabled=state;
 document.form1.zipb.disabled=state;

 disappear(document.form1.companyb);
 disappear(document.form1.fnameb);
 disappear(document.form1.lnameb);
 disappear(document.form1.addressb);
 disappear(document.form1.cityb);
 disappear(document.form1.stateb);
 disappear(document.form1.zipb);
}

function addup(stuff)
{

 //var thetotal = 0;
 //alert("select3 = " + document.form1.select3.value);
thetotal = eval(document.form1.DeluxeTraininStation.value * 2600);
thetotal = thetotal + eval(document.form1.UltraTrainingStation.value * 2850);
thetotal = thetotal + eval(document.form1.Upgrade.value * 500);
thetotal = thetotal + eval(document.form1.PracticeRailReplacement.value * 250);
thetotal = thetotal + eval(document.form1.Cylinders.value * 60);
thetotal = thetotal + eval(document.form1.LockSeals.value * 60);
thetotal = thetotal + eval(document.form1.MagnaForceLockSeals.value * 50);
//thetotal = thetotal + eval(document.form1.EmergencyEscape.value * 655);

document.form1.subtotalview.value = " $" + String(thetotal);// customer see this field
document.form1.subtotal.value = " $" + String(thetotal); //used for true data
document.form1.total.value = "$" + String(thetotal);
 
}

function disappear(obj) {
  if (obj.style.visibility == "hidden") {
    obj.style.visibility = "visible";
  }
  else {
    obj.style.visibility = "hidden";
  }
}

// shipto form check...
function shiptocheck(theform)
{
	
	var fnamestr = document.form1.fnameb.value;
	
   	//alert("fname length = " + fnamestr.length);

if (document.form1.fnameb.value == "")
  {
	  alert("Please enter your First Name!");
	  form1.fnameb.focus();
	  return false;
  }
  /*if (fnamestr.length < 2)
	  {
		  alert("Please Enter your complete First Name!");
	      form1.fname.focus();
	      return false;
	  }
 */
  if (document.form1.lnameb.value == "")
  {
	  alert("Please enter your Last Name!");
	  form1.lnameb.focus();
	  return false;
  }

  if (document.form1.addressb.value == "")
   {
	  alert("Please enter your Address!");
	  form1.addressb.focus();
	  return false;
   }

  if (document.form1.cityb.value == "")
   {
	  alert("Please enter your City!");
	  form1.cityb.focus();
	  return false;
   }

  if (document.form1.stateb.value == "")
  {
	  alert("Please select your State!");
	  form1.stateb.focus();
	  return false;
  }

  if (document.form1.zipb.value == "")
  {
	  alert("Please enter your Zip code!");
	  form1.zipb.focus();
	  return false;
  }
}