function isEmail(string) {
/***************************************************************************/
/* Special Req's :- None                                                   */
/* Related Files :- None                                                   */
/* Purpose       :- Check to see if string represents a valid email address*/
/* Version       :- 1.00                                                   */
/* Author        :- Dennis McDermott                                       */
/* Date          :- 14/02/2002                                             */
/***************************************************************************/
/* Desc of Mod   :-                                                        */
/* Modified By   :-                                                        */
/* Date          :-                                                        */
/***************************************************************************/

if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
  return true;
else
  return false;
}
/***************************************************************************/
/*                        End of function isEmail()                        */
/***************************************************************************/

function validateenquiry() {
/***************************************************************************/
/* Special Req's :- None                                                   */
/* Related Files :- None                                                   */
/* Purpose       :- Check data has been entered before submitting form     */
/* Version       :- 1.00                                                   */
/* Author        :- Dennis McDermott                                       */
/* Date          :- 14/02/2002                                             */
/***************************************************************************/
/* Desc of Mod   :-                                                        */
/* Modified By   :-                                                        */
/* Date          :-                                                        */
/***************************************************************************/

/* if no name has been supplied */
if (document.frmenquiry.txtname.value == "") {
  alert("Please enter your Name");
  window.frmenquiry.txtname.focus();  
  return;
}  

/* if email has been supplied but is invalid */
if (document.frmenquiry.txtemail.value != "" && !isEmail(document.frmenquiry.txtemail.value)) {
    alert("Your e-mail Address appears to be invalid\n\nPlease enter a valid E-mail Address");
    window.frmenquiry.txtemail.focus();
    return; 
}  

/* if email nor telephone number have been supplied */
if (document.frmenquiry.txtemail.value == "" && document.frmenquiry.txttelephone.value == "") {
    alert("Please supply either a Telephone Number or a valid E-mail address");
    window.frmenquiry.txttelephone.focus();
    return; 
}  

/* if no message has been supplied */
if (document.frmenquiry.txtmessage.value == "") {
  alert("Please enter your Message");
  window.frmenquiry.txtmessage.focus();  
  return;
}  
alert("Thank you for contacting Abbey Storage and Office Systems Ltd")
document.frmenquiry.submit()
}
/***************************************************************************/
/*                    End of function validateenquiry()                    */
/***************************************************************************/
