﻿// JScript File

    function Validation()
    {
        var frm = document.frmContactus; 
        frm.txtSave.value = 'save';
        var intError = 0;
        var strDescription = 'Your information was not submitted because:\n';
        var focus_field = null;

	     if (!frm.cmbTitle.selectedIndex) {
		     strDescription = strDescription + ' -You did not enter the title\n';
		     intError = 1;
		     if (focus_field == null) focus_field = frm.cmbTitle;
	    }
	     if (isEmpty(frm.txtfname.value)) {
		     strDescription = strDescription + ' -You did not enter the first name\n';
		     intError = 1;
		     if (focus_field == null) focus_field = frm.txtfname;
	    }

	     if (isEmpty(frm.txtlname.value)) {
		     strDescription = strDescription + ' -You did not enter the last name\n';
		     intError = 1;
		     if (focus_field == null) focus_field = frm.txtlname;
	    }

	     if (isEmpty(frm.txtphone.value)) {
		     strDescription = strDescription + ' -You did not enter the phone\n';
		     intError = 1;
		     if (focus_field == null) focus_field = frm.txtphone;
	    }
	    
	    if (isEmpty(frm.txtemail.value)) {
		     strDescription = strDescription + ' -You did not enter the email\n';
		     intError = 1;
		     if (focus_field == null) focus_field = frm.txtemail;
	    }
	    
	     if (!isEmpty(frm.txtemail.value)) {
            if (!isValidEmail(frm.txtemail.value)) {
            strDescription = strDescription + ' -You did not enter a valid email format\n';
            intError = 1;
            if (focus_field == null) focus_field = frm.txtemail;
            }
	 	 }
	     
	     if (isEmpty(frm.txtmessage.value)) {
		     strDescription = strDescription + ' -You did not enter the message\n';
		     intError = 1;
		     if (focus_field == null) focus_field = frm.txtmessage;
	    }
	    	    	    
	     if (intError == 1) {
	 	     alert(strDescription);
	 	     if (focus_field != null)
	 	 	     focus_field.focus();
	 	     return false;
	     }
	     else 
         {	 	   
            frm.submit();
	     }
	    
    }
    

