		// check the valid email address
		function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}




		function chkMailForm()
		{
			var returnValue = false;
			var missing = new Array();
			var email = $("#Email").val();
			
			// loop through the form fields
			$(".required").each(function()
			{
			var theId = this.id;
			var theValue = $("#" + theId).val();
			if (theValue == '')
			{
			missing.push(theId);
			$("label[for='" + theId + "']").addClass('error');
			}
			else
			{
			$("label[for='" + theId + "']").removeClass('error');
			}
			});
			
			eChk = echeck(email);
			// generate some verbal output
			if (missing.length > 0)
			{
			var alertMsg = "'" + missing[0] + "' is a required field.";
			$("#" + missing[0]).focus();
			alert(alertMsg);
			missing.length = 0;
			}
			else if (!eChk)
			{
			alert('Not a valid email address.');
			$("label[for='Email']").addClass('error');
			$("#Email").focus();
			}
			else
			{
			returnValue = true;
			}
			return returnValue;
		}

