var i = 0;
var ch=0;
var j=0;
var strj="0";
//alert ("Hiq" & len(Session("rdcustomertype")));
function remspaces(what) {
    result=""
    for (x=0;x<=what.length;x++) {
            if (what.substring(x,x+1) != " ") {
                result=result+what.substring(x,x+1)
            }
    }
    return result
}

function everythingok() {
with (document.contact) {
	  testing=remspaces(email.value)
	  if (testing.length < 8 || testing=="" || testing.indexOf("@") == -1  ) {
		  alert("Please enter A Valid E-Mail Account")
		  return false
	  }
	  testing=remspaces(firstname.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your First Name")
		  return false
	  }
	  testing=remspaces(lastname.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your Last Name")
		  return false
	  }
	  testing=remspaces(company.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your Company")
		  return false
	  }
	  testing=remspaces(address1.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your Address")
		  return false
	  }
	  testing=remspaces(city.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your City ")
		  return false
	  }
	  testing=remspaces(state.value)
	  testing1=remspaces(txtstate.value)
	  if ((testing.length == 0 || testing=="") && (testing1.length == 0 || testing1=="")){
		  alert("Please enter your State")
		  return false
	  }
	  testing=remspaces(zip.value)
	  if (testing.length == 0 || testing=="" || testing.length<5 ) {
		  alert("Please enter your Zip Code")
		  return false
	  }
	  testing=remspaces(phone_area.value)
	  if (testing.length == 0 || testing=="" || testing.length<3) {
		  alert("Please enter your Area Code")
		  return false
	  }
	  testing=remspaces(phone.value)
	  if (testing.length == 0 || testing=="" || testing.length<7) {
		  alert("Please enter your Phone Number")
		  return false
	  }
   // alert("Hi33" & length(Session("rdcustomertype")));
 if(length(Session("rdcustomertype")) =0) then
	if (ch == 0) {
		alert("Please select an customer type.");
			return false;
		// location.reload();
	}
	else {
		var frmInputs = document.contact.elements;
		for (i = 0; i < frmInputs.length; i++) {
			if (frmInputs[i].type == "radio") {
				if (frmInputs[i].radio) {
					j = frmInputs[i].value;
				}
			}
		}
	}
	  return true
 }
}
function eeverythingok() {
with (document.contact) {
	  testing=remspaces(name.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your Name")
		  return false
	  }
	  testing=remspaces(company.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your Company")
		  return false
	  }
	  testing=remspaces(address1.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your Address")
		  return false
	  }
	  testing=remspaces(city.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your City ")
		  return false
	  }
	  testing=remspaces(state.value)
	  if (testing.length == 0 || testing=="") {
		  alert("Please enter your State")
		  return false
	  }
	  testing=remspaces(zip.value)
	  if (testing.length == 0 || testing=="" || testing.length<5 ) {
		  alert("Please enter your Zip Code")
		  return false
	  }
	  return true
 }
}
function setCheckBox(chkb) {
  if (chkb.checked) {
    ch=ch+1;
  }
  else {
    ch=ch-1;
  }
}

