
function WebMail(type) 
{

if (type == 'webmail') {
 if (!CheckDetails() )
   {	
   document.form1.submit();
   return true;
   }
 else {
   return false;
   }
}

}


function CheckDetails() {

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.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 \'Email\' field.')
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 a subject for your 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;
}

else 
{
return false;
}

}
