// email

function checkEmail (strng) {
var error="";
var emailFilter=/^.+@.+\..{2,3}$/;
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
if (strng == "") {
   error = "You didn't enter an email address.\n";
}else if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    } else if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
    }
return error;    
}


// phone number - strip out delimiters and check for 10 digits

function checkzip(strng) {
var error = "";
var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
if (strng == "") {
   error = "You didn't enter Zipcode.\n";
}else  if (isNaN(parseInt(stripped))) {
       error = "The Zipcode contains illegal characters.\n";
  
    }
   // if (!(stripped.length == 10)) {
	//error = "The phone number is the wrong length. Make sure you included an area code.\n";
    //} 
return error;
}


// password - between 6-10 chars, uppercase, lowercase, and numeral

function checkPassword (strng) {
var error = "";
 var illegalChars = /[\W_]/; // allow only letters and numbers
    
if (strng == "") {
   error = "You didn't enter a password.\n";
}else  if ((strng.length < 6) || (strng.length > 15)) {
       error = "The password is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
      error = "The password contains illegal characters.\n";
    } 
    else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/)))) {
       error = "The password must contain at least one uppercase letter, one lowercase letter, and one numeral.\n";
    }  
return error;    
}    


// username - 4-10 chars, uc, lc, and underscore only.

function checkUsername (strng) {
var error = "";
 var illegalChars = /\W/; // allow letters, numbers, and underscores
 if (illegalChars.test(strng)) {
    error = "The User Id contains illegal characters.\n";
    } 
if (strng == "") {
   error = "You didn't enter a User Id.\n";
}
else if((strng.length < 4) || (strng.length > 20)) {
       error = "The User Id is the wrong length.\n";
    }
    
return error;
}       


// non-empty textbox

function isEmpty(strng,value) {
var error = "";
var illegalChars = /[\W_]/;
  if (strng.length == 0) {
     error = "The " + value + " has not been filled.\n"
  }else if (illegalChars.test(strng)) {
      error = "The "+ value + " contains illegal characters.\n";
    } 
return error;	  
}
// non-empty textbox

function isEmptyText(strng,value) {
var error = "";

  if (strng.length == 0) {
     error = "The " + value + " has not been filled.\n"
  } 
return error;	  
}
// was textbox altered

function isDifferent(strng) {
var error = ""; 
  if (strng != "Can\'t touch this!") {
     error = "You altered the inviolate text area.\n";
  }
return error;
}

// exactly one radio button is chosen

function checkRadio(checkvalue) {
var error = "";
   if (!(checkvalue)) {
       error = "Please check a radio button.\n";
    }
return error;
}

// valid selector from dropdown list

function checkDropdown(choice1,choice2,choice3) {
var error = "";
    if ((choice1 == 0)|| (choice2 == 0) || (choice3 == 0)) {
    error = "You didn't choose an option from the Data of Birth.\n";
    }    
return error;
}    
//checkbox

function checkBox(checkvalue){
var error= "";
var bool="false";
if(checkvalue)
	{
	bool="true";
	}
if(bool=="false")
{
error="Please Select Terms & Conditions.\n";
}
return error;
}

function verPassword(pass,verpass)
{
	var error="";
if(pass!=verpass)
{
error="Verify password is not match with password.\n";
}
return error;
}