

function validateEmails()
{

var hometeam = document.forms["matchform"].elements["hometeam"].value;
var homeother = document.forms["matchform"].elements["homeother"].value;
var visitors = document.forms["matchform"].elements["visitors"].value;
var matchdetails = document.forms["matchform"].elements["matchdetails"].value;
var mdate = document.forms["matchform"].elements["mdate"].value;
var matchresult = document.forms["matchform"].elements["matchresult"].value;
var location = document.forms["matchform"].elements["location"].value;
var teama = document.forms["matchform"].elements["teama"].value;
var teamb = document.forms["matchform"].elements["teamb"].value;
var r=confirm("Are you happy with all the information?");

if ((!hometeam)&&(!homeother)){
        alert('Please enter the home team');
document.forms["matchform"].elements["hometeam"].focus();
        return false; }



else if (!visitors){
        alert('Please enter the visitor team');
document.forms["matchform"].elements["visitors"].focus();
        return false; }

else if (!matchdetails){
        alert('Please enter the name of the competition - you can choose Friendly if none');
document.forms["matchform"].elements["matchdetails"].focus();
        return false; }

else if (!mdate){
        alert('Please add the date');
document.forms["matchform"].elements["mdate"].focus();
        return false; }


else if (!matchresult){
        alert('Please enter the result of the match');
document.forms["matchform"].elements["matchresult"].focus();
        return false; }


else if (!location){
        alert('Please enter the location of the match');
document.forms["matchform"].elements["location"].focus();
        return false; }


else if (!teama){
        alert('Please enter the name of the team batting first');
document.forms["matchform"].elements["teama"].focus();
        return false; }



else if (!teamb){
        alert('Please enter the name of the team batting second');
document.forms["matchform"].elements["teamb"].focus();
        return false; }




else if (r==true)
  {
  alert("Adding to database");
        return true; 
  }
else
  {
  alert("Sending cancelled");
        return false; 
  }










} 


//-->


