<!--

function checkWholeForm(theForm) {
    var why = "";
    why += isEmpty(theForm.Contact_Name.value, 'Name');
    why += isEmpty(theForm.Company_Name.value, 'Company');
    why += isEmpty(theForm.Email_Confirm.value, 'E-Mail Confirmation');
    why += isEmpty(theForm.Phone.value, 'Phone Number');
    why += isDifferent(theForm.Email.value ,theForm.Email_Confirm.value);
    why += checkEmail(theForm.Email.value);

	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if (sPage == "Webinar_Access_Request.htm")	{
		if (! radioIsSelected(theForm.Requested_Webinar_Code) ){
			why += "Please select a webinar.";
		}
	} else if (sPage == "eDiscovery_Download_Form.htm") {
		if (theForm.Litigation_Hold_Notice.checked == false && theForm.Chain_of_Custody_Form.checked == false && theForm.E_Disclosure_Form.checked == false && theForm.eDiscovery_Checklist.checked == false ) {
			why += "Please select an eDiscovery form";
		}
	}

    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function radioIsSelected(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return true;
    else return false ;
}



// non-empty textbox
function isEmpty(strng,errorcode) {
var error = "";
  if (strng.length == 0) {
     error =  errorcode + " field has not been filled in.\n";
  }
return error;	  
}

function isDifferent(strng, strng2) {
  var error = "";
  if (strng != strng2) {
     error = "Email addresses do not match.\n";
  }
return error;
}



function checkPhone (p_number) {
var error="";
if (p_number == "") {
   error = "You didn't enter a Phone Number.\n";
}

    var emailFilter=/\d{3}\-\d{3}\-\d{4}/;
    if (!(emailFilter.test(p_number))) { 
       error = "Please enter a valid phone number (xxx-xxx-xxxx).\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (p_number.match(illegalChars)) {
          error = "The phone number address contains illegal characters.\n";
       }
    }
return error;   
}


function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,4}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}


function checkRadio(choice, errorcode) {
var error = "";
var radiock = -1;
for (i=0; i<choice.length; i++)
{ 
	if (choice[i].checked) {
		radiock = i 
	}
}    
	if(radiock == -1) {
    		error =  "Please indicate " + errorcode + ".\n";
	}
return error;
}    



function checkCheckbox(choice) {
var cbox;
var cnum = -1;
var cname = new Array("information", "cert", "business", "computer", "biogate", "icu"); 
var error = "";
	for (i=0; i<6; i++) {
		cbox = cname[i];
		if (choice[cbox].checked) { 
			cnum = i
		} 
	}

	if(cnum == -1) {
    		error =  "Please indicate which product you are interested. " +  "\n";
	}
return error;
}
//-->


