<!--
// Copyright information must stay intact
// FormCheck v1.02
// Copyright NavSurf.com 2002, all rights reserved
// For more scripts, visit NavSurf.com at http://navsurf.com

 
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}

   

function formCheck(formobj){
	var emailValidity = true;
	var checkView = 1;
	// dialog message
	var alertMsg = "Please complete the following fields:\n";
	var l_Msg = alertMsg.length;
	for (var i = 0; i < reqFields.length; i++){
	   var obj = formobj.elements[reqFields[i]];
	    if (obj){
		switch(obj.type){
		  case "select-one":
			if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].value == ""){
				alertMsg += " - " + reqFieldDesc[i] + "\n";
			}
			break;
		  case "select-multiple":
			if (obj.selectedIndex == -1){
				alertMsg += " - " + reqFieldDesc[i] + "\n";
			}
			break;
		  case "text":
		  case "textarea":
			if (obj.value == "" || obj.value == null){
				alertMsg += " - " + reqFieldDesc[i] + "\n";
			}
			
			break;
		   default:
			if (obj.value == "" || obj.value == null){
			  alertMsg += " - " + reqFieldDesc[i] + "\n";
			}
		 }
		 if (reqFields[i] == emailField) {
		    emailValidity = isValidEmail(obj.value);
		 }   
	    }
	}


	if (alertMsg.length == l_Msg){	   
	   if (emailValidity) {
	     return true;
	   } else {
	     alert("Please enter a valid Email Id");
	     return false;
	   }		
	} else{
		alert(alertMsg);
		return false;
	}
}


// -->



