// name - 4-10 chars, uc, lc, and underscore only.
function checkName01 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter One's first name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter One's first name contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter One's first name.\n";
}
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkName02 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter Two's first name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter Two's first name contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter Two's first name.\n";
}
return error;
}

/******************************************* Surnames ***************************************/
// name - 4-10 chars, uc, lc, and underscore only.
function checkSurname01 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter One's last name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter One's last name contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter One's last name.\n";
}
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkSurname02 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter Two's last name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter Two's last name contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter Two's last name.\n";
}
return error;
}

/******************************************* Organisations ***************************************/


// email
function checkEmail01 (strng) {
var error="";

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Session Presenter One's email address is invalid.\n";
    }
    else {
	//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Session Presenter One's email address contains illegal characters.\n";
       }
    }

	if (strng == "") {
	   error = "Please enter Session Presenter One's email address.\n";
	}

return error;
}
// email
function checkEmail02 (strng) {
var error="";

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Session Presenter Two's email address is invalid.\n";
    }
    else {
	//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Session Presenter Two's email address contains illegal characters.\n";
       }
    }

	if (strng == "") {
	   error = "Please enter Session Presenter Two's email address.\n";
	}

return error;
}

/******************************************* Position ***************************************/
// name - 4-10 chars, uc, lc, and underscore only.
function checkPosition01 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter One's Position is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter One's Position contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter One's Position.\n";
}
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkPosition02 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter Two's Position is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter Two's Position contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter Two's Position.\n";
}
return error;
}

/******************************************* Organisations ***************************************/
// name - 4-10 chars, uc, lc, and underscore only.
function checkOrg01 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter One's Organisation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter One's Organisation contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter One's Organisation.\n";
}
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkOrg02 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter Two's Organisation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter Two's Organisation contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter Two's Organisation.\n";
}
return error;
}


/******************************************* Country ***************************************/

// country, uc, lc, and underscore only.
function checkCountry01 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter One's country is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter One's country contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter One's country.\n";
}
return error;
}
// country, uc, lc, and underscore only.
function checkCountry02 (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Presenter Two's country is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Presenter Two's country contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Presenter Two's country.\n";
}
return error;
}

/******************************************* Others ***************************************/

// valid title
function checkTitle(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select your title.\n";
    }    
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkName (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Your first name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Your first name contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter your first name.\n";
}
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkSurname (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Your last name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Your last name contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter your last name.\n";
}
return error;
}

// organisation - 4-10 chars, uc, lc, and underscore only.
function checkOrg (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Your organisation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Your organisation contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter your organisation.\n";
}
return error;
}

// address, uc, lc, and underscore only.
function checkAddress (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Your address is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Your address contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter your address.\n";
}
return error;
}

// name - 4-10 chars, uc, lc, and underscore only.
function checkCity (strng) {
var error = "";
    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "The city name is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "The city name contains illegal characters.\n";
    } 
if (strng == "") {
   error = "Please enter your city name.\n";
}	
return error;
}

// province, uc, lc, and underscore only.
function checkProvince (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Your province is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Your province contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter your province.\n";
}
return error;
}

// country, uc, lc, and underscore only.
function checkCountry (strng) {
var error = "";

    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Your country is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Your country contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter your country.\n";
}
return error;
}

// email
function checkEmail (strng) {
var error="";

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Your email address is invalid.\n";
    }
    else {
	//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Your email address contains illegal characters.\n";
       }
    }

	if (strng == "") {
	   error = "Please enter your email address.\n";
	}

return error;
}

// international tel number - strip out delimiters and check for tel number
function checkTel (strng) {
var error = "";
var stripped = strng.replace(/[\(\)\.\-\ ]/g, "");
var illegalChars = strng.replace(/[\(\)\.\-\ \0-9]/g, "");
	if (strng == "") {
   	error = "Please enter your phone number.\n";
	}
	else if (illegalChars.length != 0) {
       	error = "Your phone number contains illegal characters.\n";
	}	
	else if (stripped.length <10) {
		error = "Your phone number is the wrong length.\n";
	}
return error;
}

// non-empty textbox
function checkSesFormat(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select the session format.\n";
    }    
return error;
}

// non-empty textbox
function checkSesTheme(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select the session sub-theme.\n";
    }    
return error;
}

// non-empty textbox
function checkSesTitle(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter a session title.\n"
  }
return error;	  
}

// non-empty textbox
function checkSesDescrip(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter a session description.\n"
  }
return error;	  
}




