// JavaScript Document
<!--
// non-empty textbox

function checkName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your name.\n"
  }
return error;	  
}

//checkemail

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "Please enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

// non-empty textbox

function checkAddress(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your address.\n"
  }
return error;	  
}

// non-empty textbox

function checkTown(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the name of your town.\n"
  }
return error;	  
}

// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "Please enter a phone number.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number contains illegal characters.";
  
    }
    if (!(stripped.length == 10)) {
	error = "The phone number is the wrong length. Make sure you included an area code if not supplying a mobile number.\n";
    } 
return error;
}

// non-empty textbox

function checkLocation(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the location of your burn.\n"
  }
return error;	  
}

// non-empty textbox

function checkStart(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the permit start date.\n"
  }
return error;	  
}

// non-empty textbox

function checkEnd(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the permit end date.\n"
  }
return error;	  
}

// valid selector from dropdown list

function checkBrigade(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select your Brigade area.\n";
    }    
return error;
}    

// non-empty textbox

function checkIssuer(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the officer who issed your permit.\n"
  }
return error;	  
}

// non-empty textbox

function checkPermitNumber(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the Permit Number.\n"
  }
  if (isNaN(strng)) {
     error = "Please enter a valid Permit Number.\n"
  }
  var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The Permit Number contains illegal characters.\n"
       }
	   
  if (parseInt(strng) < 1 || parseInt(strng) > 10000) {
     error = "The Permit Number is not in the valid range.\n"
  }

return error;	  
}














//-->

