// ~~~~~~~~~~~~~~~~~~~~~~~~form validator section
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



function securelook_Validator(securelook)
{

	if (IsEmpty(securelook.Applicant,"Please enter Applicant Name.")) 
		{return(false);}
// 	if (securelook.AIT_pr[0].checked) {
// 		if (IsEmpty(securelook.AIT_custnum,"Please enter your AIT Hosting Customer Number (i.e. CUS12345).")) 
// 			{return(false);}	
//		if (IsNotNumber(securelook.AIT_custnum,"Please enter your AIT Hosting Customer Number (i.e. CUS12345).")) 
// 			{return(false);}
// 		if (isbadval(securelook.AIT_custnum))
// 			{return(false);}	
// 		}


	if (IsEmpty(securelook.company,"Please enter Company Name.")) 
		{return(false);}
	if (IsSelectedvalue(securelook.bustype_id,"Please Choose a Business Type."))
		{return(false);}
	if (IsEmpty(securelook.Domain_Name,"Please enter Domain Name.")) 
		{return(false);}
	if (IsEmpty(securelook.contact_name,"Please enter Contact Name.")) 
		{return(false);}
	if (IsEmpty(securelook.contact_title,"Please enter Contact Title.")) 
		{return(false);}
	if (IsEmpty(securelook.address,"Please enter Company Address.")) 
		{return(false);}
	if (IsEmpty(securelook.city,"Please enter City.")) 
		{return(false);}
	if (IsEmpty(securelook.state,"Please enter State.")) 
		{return(false);}
	if (IsEmpty(securelook.zipcode,"Please enter Zipcode.")) 
		{return(false);}
	if (IsEmpty(securelook.country,"Please enter Country.")) 
		{return(false);}
	if (IsEmpty(securelook.phone,"Please enter Business Phone.")) 
		{return(false);}
	if (IsEmpty(securelook.email,"Please enter Contact Email Address.")) 
		{return(false);}
//	if (emailBAD(securelook.email,"Please enter a valid Contact Email Address."))
//		{return(false);}
	if (IsEmpty(securelook.Tax_ID,"Please enter Your Business Tax Id or SSN.")) 
		{return(false);}
	if (IsEmpty(securelook.Years_in_Business,"Please enter Years In Business.")) 
		{return(false);}
	if (IsEmpty(securelook.FinanceInstitution,"Please enter Your Bank Name.")) 
		{return(false);}
	if (IsEmpty(securelook.Years_in_Business,"Please enter Years In Business.")) 
		{return(false);}
	if (IsEmpty(securelook.name_on_account,"Please enter Name on Bank Account.")) 
		{return(false);}
	if (IsEmpty(securelook.branch_address,"Please enter Bank Branch Address.")) 
		{return(false);}
	if (IsEmpty(securelook.bank_phone,"Please enter Bank Branch Phone.")) 
		{return(false);}
	if (IsSelectedvalue(securelook.Card_Type,"Please choose Payment Method."))
		{return(false);}
	if (IsEmpty(securelook.Card_Number,"Please enter Credit Card Number.")) 
		{return(false);}
	if (IsEmpty(securelook.Expiration_Date,"Please enter Expiration Date of Credit Card.")) 
		{return(false);}
//	if (IsEmpty(securelook.Card_Name,"Please enter Name on Credit Card.")) 
//		{return(false);}
//		if (securelook.AIT_pr[1].checked) {
//		alert ("If you are an AIT Premium Reseller, you must check the YES box to be eligable for your discount.  If it is left checked NO, NO discount will be given.");
//			securelook.AIT_pr[1].focus();
//   			securelook.AIT_pr[1].select();}	
	
	

}

// ~~~~~~~~~~~~~~~~~~~~additional function section
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function isbadval(name) {
  var txt=name.value;
  txt=txt.toLowerCase();
  
  if ((txt.indexOf("s")>4) || (txt == "cus") || (txt.length>10) || (txt.length<7)) {
    alert ("Please enter your AIT Hosting Customer Number (i.e. CUS12345).");

    document.securelook.AIT_custnum.focus();
	return(true);}
 
  return(false);


}

//------------------------------------------
function IsEmpty(textField,msg) {
  if (textField.value == "") {
    alert (msg);
    textField.focus();
    textField.select();
	return (true);} 
  return(false);
}

//------------------------------------------

function IsNotNumber(textField,msg) {
  var n = new String(); 
  var s = new String(); 
  var i = 0;
  
  n.value = "0123456789.-+CUS$";
  s.value = textField.value;
       
  for (i=0; i<=s.value.length; i++) {
  if (n.value.indexOf(s.value.charAt(i))== -1) {
         alert (msg);
         textField.focus();
         textField.select();
       return(true);} 
  } 
  return (false);
}

//------------------------------------------

function domainBAD(name) {
  var txt=name.value;
  txt=txt.toLowerCase();
  
  if (txt.indexOf(".")<3){
    alert("Please enter a valid domain name in the form of http://www.domainname.com.");

    document.securelook.Domain_Name.focus();
	return(true);}
 
  return(false);
}

//--------------------------------------------


function IsSelectedvalue(Menu,msg) {
  var s = new String();
  s.value = Menu.options[Menu.selectedIndex].value;
  if (s.value == "") {
    alert (msg);
    Menu.focus();
	return (true);
	} 
  return(false);
}


//----------------------------------------------

function dateBAD(name) {
  var txt=name.value;
  txt=txt.toLowerCase();
  
  if (txt.indexOf("/")<2){
    alert("Please enter a valid date of report.");

    document.securelook.dateofreport.focus();
	return(true);}
 
  return(false);
}

//-----------------------------------------------

function emailBAD(name) {
  var txt=name.value;
  txt=txt.toLowerCase();
  
  if (txt.indexOf("@")<3){
    alert("I'm sorry. This e-mail address seems wrong. Please check the suffix and '@' sign.");

    document.securelook.username.focus();
	return(true);}
 
  return(false);
}


//--------------------------------------------------


function custnumBAD(textField,msg,badval) {
  var s = new String();
  s.value = textField.value;
if (s.value == "" || s.value == badval) {
    alert (msg);
    textField.focus();
	return (true);} 
  return(false);
}

//--------------------------------------------------



function dateBAD2(textField,msg,badval) {
  var s = new String();
  s.value = textField.value;
if (s.value == "" || s.value == badval) {
    alert (msg);
    textField.focus();
	return (true);} 
  return(false);
}

//--------------------------------------------------