function validate() 
{
  var score=0
  if (document.getElementById("sName").innerHTML=="<font color=\"#ff0000\">Your name may not be blank!</font>") { score++; }
  if (document.getElementById("sEmailMsg").innerHTML!="") { score++; }
  if (document.getElementById("sMessage").innerHTML=="<font color=\"#ff0000\">Message may not be blank!</font>") { score++; }
  if (document.getElementById("result").innerHTML!="<font color=\"#088a4b\">Correct</font>") { score++; }
  if (score>0) { alert("Please correct the fields as shown and resubmit."); return false; }
}

function checkEmail(str) 
{  
  email = document.getElementById("contactemail").value;
  AtPos = email.indexOf("@");
  StopPos = email.lastIndexOf(".");
  Message = "";
  if (AtPos==-1||AtPos==email.length-1||StopPos==email.length-1) { Message = "<font color=#FF0000>Email address is not valid!</font>"; }  
  if (StopPos < AtPos) { Message = "<font color=#FF0000>Email address is not valid!</font>"; }  
  if (StopPos - AtPos == 1) { Message = "<font color=#FF0000>Email address is not valid!</font>"; }
  if (email=="") { Message = "<font color=#FF0000>Email may not be blank!</font>"; }  
  document.getElementById("sEmailMsg").innerHTML=Message;
}

function checkName()
{ 
  if (document.getElementById("contactname").value=="") { document.getElementById("sName").innerHTML="<font color=\"#ff0000\">Your name may not be blank!</font>";  } else  { document.getElementById("sName").innerHTML=""; }
}
function checkMessage()
{
  if (document.getElementById("contactmessage").value=="") { document.getElementById("sMessage").innerHTML="<font color=\"#ff0000\">Message may not be blank!</font>";  } else  { document.getElementById("sMessage").innerHTML=""; }
}
