<!--
	var type = "IE";	//Variable used to hold the browser name

    //detects the capabilities of the browser
    function BrowserSniffer() {
        if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";		//Opera
        else if (document.all) type="IE";														//Internet Explorer e.g. IE4 upwards
        else if (document.layers) type="NN";													//Netscape Communicator 4
        else if (!document.all && document.getElementById) type="MO";							//Mozila e.g. Netscape 6 upwards
        else type = "IE";		//I assume it will not get here
    }

    BrowserSniffer();

    function ChangeMessage(id, str) {
        if (type=="IE") {
            document.all[id].innerHTML = str;
        }
        if (type=="NN") { 
            document.layers[id].document.open();
            document.layers[id].document.write(str);
            document.layers[id].document.close();
        }
        if (type=="MO" || type=="OP") {
            document.getElementById(id).innerHTML = str;
        }
    }

    // Trim leading and trailing white space
    function trim(str) {
      return str.replace(/^\s+|\s+$/g, '')
    };

    // Validate the email address
    function validateEmail(email) {
        var re = false;        
        var ea = trim(email);        
        var pattern = /^[a-zA-Z][\w\-\.]{0,19}\@[a-zA-Z]\w+(\.[a-zA-Z]\w+)+$/;
        if (ea != "" && pattern.test(ea)) {
            re = true;
        }
        return re;
    }

    // Check whether it is empty or not
    function validateEmpty(nm){
        var name = trim(nm);
        return name==""? false : true;
    }

    //------------------------------------------- david
    //trim the input
    function trim(str)
    {
      return str.replace(/^\s+|\s+$/g, '')
    };
    //validate the phone number
    function validatePhone(num){
        var re = false;
        var n = trim(num);
        var pattern = /^\(?\d{3}\)?\s?\d{3}[\s-]?\d{4}$/;
        if(!n=="" && pattern.test(n)){
            re = true;
        }
        return re;
        
    }
    //validate an Email address
    function validateEmail(email)
    {
        var re = false;
        //trim off leading and trailing white space
        var ea = trim(email);
        // Declare the regular expression for e-mail validation
        // var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.[a-zA-Z]{2,3})+$/; 
        var pattern = /^[a-zA-Z][\w\-\.]{0,19}\@[a-zA-Z]\w+(\.[a-zA-Z]\w+)+$/;
        // ^ : begining with
        // \w: a single letters, numbers and underscore
        // + : One or more occurences of previuos item.
        // (): Forms a group
        // [] : Any one of the characters
        // ? : zero or one occurance of previous item
        // * : Zero or more occurances of previous item
        // \ : To escape a special charcter
        // {n1,n2, .. }) : n1 or n2 occurances of previous item 
        // \s : One white space character
        if (ea != "" && pattern.test(ea)) {
            re = true;
        }
        return re;
    }

    //validate the form
    function validateContactForm(){
		var name = document.ContactForm.nameB.value;
        var email = document.ContactForm.emailB.value;

        var err = "";
        var re = false;

         if(name=="" || email==""){
            err += "Name and Email are required.<br/>";
        }else{
            if(!validateEmail(email)){
                err += "Invalid email address.<br/>";
            }else{
                re = true;
            }
        }
       if(!re){
            err = "<font color=red>" + err + "</font>";
            ChangeMessage('msgArea', err);        
        }
        return re;
    }
	
 //-->