
function WebMailSubmit(type) 
{

if (type == 'webmail') {
 if (!CheckDetails() )
   {	
   document.form1.submit();
   return true;
   }
 else {
   return false;
   }
}

}


function CheckDetails() {

if (!document.form1.c.value.length)
{
document.form1.c.focus()
alert('You have not filled out all of the necessary details.\n\n' +
'Please select the person or department you wish to contact.');
return true;
}

if (!document.form1.subject.value.length)
{
document.form1.subject.focus()
alert('You have not filled out all of the necessary details.\n\n' +
'Please enter your subject for this message.');
return true;
}

if (!document.form1.message.value.length)
{
document.form1.message.focus()
alert('You have not filled out all of the necessary details.\n\n' +
'Please enter your message.');
return true;
}

if (!document.form1.name.value.length)
{
document.form1.name.focus()
alert('You have not filled out all of the necessary details.\n\n' +
'Please enter your name.');
return true;
}

if (!document.form1.school.value.length)
{
document.form1.school.focus()
alert('You have not filled out all of the necessary details.\n\n' +
'Please enter the School or Organisation that you work for.');
return true;
}

if (!document.form1.email.value.length)
{
document.form1.email.focus()
alert('You have not filled out all of the necessary details.\n\n' +
'Please enter your email address.');
return true;
}

if (document.form1.email.value.length)
{
if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.email.value)))
{
document.form1.email.focus()
alert('The format of your email address appears to be incorrect.\n\n' +
      'Please carefully check that you have correctly entered\n' +
      'your email address in the \'Your Email Address\' field .')
return true;
}
}

if (document.form1.confirmemail.value != document.form1.email.value)
{
document.form1.confirmemail.focus()
alert('You have not entered your email address correctly.\n\n' +
'Please check that you have typed the same valid email address\n' +
'into the \'Your Email Address\' and \'Confirm Email Address\' fields.');
return true;
}

else 
{
return false;
}

}