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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/******************************************* Titles ***************************************/
// valid title
function checkTitle01(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select Session Organiser One's title.\n";
    }    
return error;
}

// valid title
function checkTitle02(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select Session Organiser Two's title.\n";
    }    
return error;
}

// valid title
function checkTitle03(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select Session Organiser Three's title.\n";
    }    
return error;
}

// valid title
function checkTitle04(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select Session Organiser Four's title.\n";
    }    
return error;
}

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

    var illegalChars = /\W\ /; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Organiser One's Institutional Affiliation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Organiser One's Institutional Affiliation contains illegal characters.\n";
} 

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

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

    var illegalChars = /\W\ /; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Organiser Two's Institutional Affiliation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Organiser Two's Institutional Affiliation contains illegal characters.\n";
} 

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

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

    var illegalChars = /\W\ /; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Organiser Three's Institutional Affiliation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Organiser Three's Institutional Affiliation contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Organiser Three's Institutional Affiliation.\n";
}
return error;
}

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

    var illegalChars = /\W\ /; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Session Organiser Four's Institutional Affiliation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Session Organiser Four's Institutional Affiliation contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Session Organiser Four's Institutional Affiliation.\n";
}
return error;
}

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

    var illegalChars = /\W\ /; // allow letters, numbers, and underscores
    if ((strng.length < 2)) {
       error = "Corresponding Session Organiser's Institutional Affiliation is the wrong length.\n";
    }
    else if (illegalChars.test(strng)) {
    error = "Corresponding Session Organiser's Institutional Affiliation contains illegal characters.\n";
} 

if (strng == "") {
   error = "Please enter Corresponding Session Organiser's Institutional Affiliation.\n";
}
return error;
}

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

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

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

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

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

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

// valid title
function checkCorrespondTitle(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select Corresponding Session Organiser's title.\n";
    }    
return error;
}

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

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

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

return error;
}

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

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

// valid title
function checkPapersExpected(choice) {
var error = "";
    if (choice == 0) {
    error = "Please select the number of papers expected.\n";
    }    
return error;
}

// non-empty textbox
function checkNamesAffiliations(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter the names and affiliations of those who have agreed in principle to participate.\n"
  }
return error;	  
}



