function noEntry() {
var themessage = "You are required to complete the following fields: ";

if (document.form1.txtName.value=="") {
themessage = themessage + " -  Name";
}
if (document.form1.txtAddress.value=="") {
themessage = themessage + " -  Address";
}
if (document.form1.txtEmail.value=="") {
themessage = themessage + " -  Email";
}
if (isValidEmail(document.form1.txtEmail)){
themessage = themessage + " A valid e-mail address is required.\nPlease amend and retry"
		}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.form1.submit();
}
else {
alert(themessage);
return false;
   }
}

function isValidEmail(strEmail){
 validRegExp = /^(([a-zA-Z0-9\-\._]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3})(,(?!$))?)+$/;
  strEmail = document.form1.txtEmail.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      //alert('A valid e-mail address is required.\nPlease amend and retry');
	  return true;
    } 
}

// set the javascript special char here to flag selected value in dropdown
var selChr = "+";
//
function notifySelect(RepSelected){
 var form1 = getObject("form1");
 if (RepSelected == "Please choose") return false;
 var rep_str ="";
 for (i = 0; i < form1.Interested_in.options.length; i++) {
   if (form1.Interested_in.options[i].value != '') {
   var dropdownItem = form1.Interested_in.options[i].text;
   if (dropdownItem == RepSelected || dropdownItem == selChr+RepSelected) {
   if (dropdownItem.substring(0,1) == selChr) {
    //if (confirm("Remove " + RepSelected.substring(1)+ " from Past Due notification?")) {
     document.form1.Interested_in.options[i].text = RepSelected.substring(1);
    //}
   }
    else {
    //if (confirm("Add " + RepSelected + " to Past Due notification?")) { 
     document.form1.Interested_in.options[i].text = selChr + RepSelected;
    //}
    }
   }
   dropdownItem = form1.Interested_in.options[i].text;
      if (dropdownItem.substring(0,1) == selChr) {
    rep_str = rep_str + form1.Interested_in.options[i].value + ",";
   form1.Interested_in.options[i].style.backgroundColor = "#3366CC";
   form1.Interested_in.options[i].style.color = "#FFFFFF";
   }
   else {
    form1.Interested_in.options[i].style.backgroundColor = "#FFFFFF";
   form1.Interested_in.options[i].style.color = "#000000";
   }
   }
 }
 //end of search
 form1.Interested_in.options[0].selected = true;
 document.form1.txtInterested_in.value = rep_str;  
}

//needed for mozilla compatibility
 function getObject(objectId) {
  if (document.all && !document.getElementById) 
   return document.all(objectId);
  else 
   return document.getElementById(objectId);
 }
