

//Phone
function CustomerPhone (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a customer phone number.\n";
}
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
    if (isNaN(parseInt(stripped))) {
       error = "The customer phone number should only have numbers.";
  
    }
    if (!(stripped.length > 9)) {
	error = "The customer phone number is the wrong length. Make sure you included an area code.\n";
    } 
return error;
}
function RecipientPhone (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a recipient phone number.\n";
}
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
    if (isNaN(parseInt(stripped))) {
       error = "The recipient phone number should only have numbers.";
  
    }
    if (!(stripped.length > 9)) {
	error = "The recipient phone number is the wrong length. Make sure you included an area code.\n";
    } 
return error;
}

//Names
function CustomerName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "The customer name has not been filled in.\n"
  }
return error;	  
}

function RecipientName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "The recipient name has not been filled in.\n"
  }
return error;	  
}

//Date
function Date(strng) {
var error = "";
  if (strng.length == 0) {
     error = "You must enter the delivery date for the order.\n"
  }
return error;	  
}

//Address
function DeliveryAddress(strng) {
var error = "";
  if (strng.length == 0) {
     error = "You must enter the delivery Address for the order.\n"
  }
return error;	  
}

//Confirmation Number
function ConfirmationNumber (strng) {
var error = "";
  if (strng.length == 0) {
     error = "You must add comments.\n"
  }
return error;	  
}

//Comments
function Comments(strng) {
var error = "";
  if (strng.length == 0) {
     error = "You must add comments.\n"
  }
return error;	  
}


//Email
function CustomerEmail (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 = "Please enter a valid email address.\n";
       }
    }
return error;    
}