// JavaScript Document
function check_question() {
missinginfo = "";
field=document.myform
if (field.Message.value == ""){
alert("Sorry, you have forgotten to type in your message !");
} else {
processform();
}
}

function IsNumeric(strString)
//  check for valid numeric strings	
{
   var strValidChars = "0123456789.-+";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
        {
         blnResult = false;
        }
      }
   return blnResult;
}

function processform() {
missinginfo = "";
field=document.myform
if (field.Name) {
	if ((field.Name.id == "required") && (field.Name.value == "")) {
	    missinginfo += "\n     -  Your Full Name Missing";
	}
}

if (field.Contact) {
	if ((field.Contact.id == "required") && !(IsNumeric(field.Contact.value))) {
	    missinginfo += "\n     -  Invalid Contact Number";
	}

}

if (field.Email.value != "") {
	if ((field.Email.value.indexOf('@') == -1) || (field.Email.value.indexOf('.') == -1)) {
		 missinginfo += "\n     -  Invalid Email Address";
	}
}
displaymissingmessage()
}

function displaymissingmessage() {
if (missinginfo != "") {
missinginfo ="_______________________________\n" +
"The field(s) below incorrect or not filled:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
}
else {
document.myform.submit()
}
}
