function echeck(str)
 {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Format")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Format")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Format")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Format")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Format")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Format")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Format")
		    return false
		 }
	}

function valButton(btn)
{
	var cnt = -1;
	for (var i=0; i < btn.length; i++)
	{
   		if (btn[i].checked) {cnt = i; i = btn.length;}
	}
	if (cnt > -1) return btn[cnt].value;
	else return null;
}

function Form_Validator(theForm)
{
	

if (theForm.name.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.name.focus();
    return (false);
  }
if (theForm.address.value == "")
  {
    alert("Please enter a value for the \"Address\" field.");
    theForm.address.focus();
    return (false);
  }  
if (theForm.city.value == "")
  {
    alert("Please enter a value for the \"City\" field.");
    theForm.city.focus();
    return (false);
  }
if (theForm.ZipCode.value == "")
  {
    alert("Please enter a value for the \"Zip Code\" field.");
    theForm.ZipCode.focus();
    return (false);
  }
if (theForm.homephone.value == "")
  {
    alert("Please enter a value for the \"Home Phone\" field.");
    theForm.homephone.focus();
    return (false);
  }
if (theForm.workphone.value == "")
  {
    alert("Please enter a value for the \"Work Phone\" field.");
    theForm.workphone.focus();
    return (false);
  }
if (theForm.cellphone.value == "")
  {
    alert("Please enter a value for the \"Cell Phone\" field.");
    theForm.cellphone.focus();
    return (false);
  }
  
if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }
if (theForm.brandrighteye.value == "")
  {
    alert("Please enter a value for the \"Brand - Right Eye\" field.");
    theForm.brandrighteye.focus();
    return (false);
  }
if (theForm.brandlefteye.value == "")
  {
    alert("Please enter a value for the \"Brand - Left Eye\" field.");
    theForm.brandlefteye.focus();
    return (false);
  }
  
  
if (theForm.basecurverighteye.value == "select")
  {
    alert("Please enter a value for the \"Select Base Curve Right Eye\" field.");
    theForm.basecurverighteye.focus();
    return (false);
  }
  
if (theForm.basecurvelefteye.value == "select")
  {
    alert("Please enter a value for the \"Select Base Curve Left Eye\" field.");
    theForm.basecurvelefteye.focus();
    return (false);
  }
  
if (theForm.powerrighteye.value == "select")
  {
    alert("Please enter a value for the \"Select Prescription Right Eye\" field.");
    theForm.powerrighteye.focus();
    return (false);
  }  
  
if (theForm.powerlefteye.value == "select")
  {
    alert("Please enter a value for the \"Select Prescription Left Eye\" field.");
    theForm.powerlefteye.focus();
    return (false);
  }

if (theForm.quantityrighteye.value == "select")
  {
    alert("Please enter a value for the \"Brand Right Eye\" field.");
    theForm.quantityrighteye.focus();
    return (false);
  }

if (theForm.quantitylefteye.value == "select")
  {
    alert("Please enter a value for the \"Brand Left Eye\" field.");
    theForm.quantitylefteye.focus();
    return (false);
  }
if (theForm.shipping.value == "select")
  {
    alert("Please enter a value for the \"Shipping\" field.");
    theForm.shipping.focus();
    return (false);
  }

  return (true);
}