function di(id,name)
{
	document.images[id].src=eval(name+".src");
}

butt = new Image(20, 19); butt.src = '/images/butt_off.gif';
butto = new Image(20, 19); butto.src = '/images/butt_over.gif';

function displayCopy(urlToLink, selectBox)
{	
	var valueToPass;
	var optionLength;
	
	valueToPass = selectBox.options[selectBox.selectedIndex].value;
	optionLength = valueToPass.length;
	if (optionLength > 0)
	{
		//alert("URL : " + urlToLink + valueToPass);
		document.location.href = urlToLink + valueToPass;
	}	
}

// handles the Enter button being pressed on the Login Screen
function doKeyPressLogin(event, form)
{
	if (event.keyCode==13)
	{
		if (validateLogin(form) == true)
		{
			form.submit();
		}
	}
	
}

// handles the Enter button being pressed on the Login Screen
function doKeyPressChangePassword(event, form)
{
	if (event.keyCode==13)
	{
		if (validateChangePassword(form) == true)
		{
			form.submit();
		}
	}
	
}

// validates the Login Form
function validateLogin(form)
{
	var username;
	var password;
	var errorText;
	username = form.Username.value;
	password = form.Password.value;
	errorText = "";

	if (username.length < 1)
	{
		errorText = errorText + "Your username must not be blank\n";
		form.Username.focus();
	}
	
	if (password.length < 5)
	{
		errorText = errorText + "Your password must be AT LEAST 5 characters\n";
		form.Password.focus();
	}
	else
	{
		if (password.length > 15)
		{
			errorText = errorText + "Your password must be less than 15 characters\n";
			form.Password.focus();
		}
	}
	if (errorText.length != 0)
	{
		alert(errorText);
		validateLogin == false;
	}
	else
	{
		validateLogin == true;
		form.submit();
	}
	
}

// validates the ChangePassword Form (when user first logs in)
function validateChangePassword(form)
{
	var newPassword;
	var confirmNewPassword;
	var errorText;
	newPassword = form.newPassword.value;
	confirmNewPassword = form.confirmNewPassword.value;
	errorText = "";

	if (newPassword.length < 1)
	{
		errorText = errorText + "Your new password must NOT be blank!\n";
	}
	else 
	{
		if (newPassword.length < 5)
		{
			errorText = errorText + "Your new password must be AT LEAST 5 characters!\n";
		}
	}
	if (newPassword.length > 15)
	{
		errorText = errorText + "Your new password must be less than 15 characters!\n";
	}
	if (newPassword != confirmNewPassword)
	{
		errorText = errorText + "Your new passwords must match!\n";
	}
	if (errorText.length != 0)
	{
		alert(errorText);
		validateChangePassword == false;
	}
	else
	{
		validateChangePassword == true;
		form.submit();
	}
}

// validates the forgotten password form
function validateForgottenPassword(form)
{
	var emailAddress;
	var username;
	var returnBoolean;
	var errorText;
	
	errorText = "";
	emailAddress = form.existingEmail.value;
	username = form.existingUsername.value;
	
	if (username.length == 0)
	{
		errorText = errorText + "Your username must NOT be blank!\n";
		form.existingUsername.focus();
	}
	
	if (emailAddress.length > 0)
	{
		if (checkEmail(emailAddress) == false)
		{
			errorText = errorText + "The email address you have entered appears to be invalid.\n";
			form.existingEmail.focus();
		}
	}
	else 
	{
		if (emailAddress.length == 0)
		{
			errorText = errorText + "You must enter a valid email address\n";
			form.existingEmail.focus();
		}
	}
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		form.submit();
	}
}

function validateAccountMessage(form){
	var accountMessage;
	accountMessage = form.txtMessage.value;
	
	if(accountMessage.length <= 0){
		alert("Please enter an account message before submitting the form.");
	}
	else{
		form.submit();
	}
}

/*
function validateAccountUsage(){	
	if(docForm.chkUsage.checked != true){
		alert("If you would like to receive monthly account statistics, please check the box on the form before submitting.");
	}
	else{
		docForm.submit();
	}
}
*/

function validateManageUsers(form){
	var numSelected;
	//initial value
	numSelected = 0
	for(var i=0; i<form.elements.length; i++){
		if(form.elements[i].type == "checkbox"){
			if(form.elements[i].checked == true){
				numSelected += 1;
			}
		}
	}
	if(numSelected > 0){
		if(numSelected == 1){
			if(confirm("You are about to delete " + numSelected + " user from this contract.\nAre you sure you want to continue?")){
				form.submit();
			} 
		}
		else{
			if(numSelected > 1){
				if(confirm("You are about to delete " + numSelected + " users from this contract.\nAre you sure you want to continue?")){
					form.submit();
				} 
			}
		}
	}
	else{
		alert("If you would like to delete a user, you must select at least one user from the list.");
	}
}

// This function is used to validate the Search Form when the image or the GO link is pressed
// have the function below because with only ONE <input> pressing ENTER ALWAYS submits!
function validateSearch(form)
{
	var searchPhrase;
	var errorText;
	errorText = "";
	searchPhrase = form.keywords.value;
	
	if(searchPhrase.length < 2)
	{
		alert("Your search phrase should be at least 2 characters long.");		
	}
	else
	{
		form.submit();
	}
	
}

function validateWatchListSearch(form)
{
	var searchPhrase;
	var errorText;
	errorText = "";
	searchPhrase = form.txtSearch.value;
	
	if(searchPhrase.length < 2)
	{
		alert("Your search phrase should be at least 2 characters long.");		
	}
	else
	{
		form.submit();
	}
	
}

function validateWatchListKeyword(form)
{
	var keyword;
	keyword = form.kid.value;
	if(keyword.length < 2){
		alert("Your keyword should be at least 2 characters long.");		
	}
	else{
		form.submit();
	}
	
}

// this handles the ENTER key being pressed to submit the form
function validateSearchKeyPress(form)
{
	var searchPhrase;
	var errorText;
	errorText = "";
	searchPhrase = form.keywords.value;
	
	if(searchPhrase.length < 2)
	{
		alert("Your search phrase should be at least 2 characters long.");		
		return(false);
	}
	else
	{
		form.submit();
		return(true);
	}
	
}

function validateMailFriend(form){
	var senderEmail;
	var receiverEmail;
	var errorMessage;
	
	errorMessage = "";
	senderEmail = form.txtSenderEmail.value;
	receiverEmail = form.txtRecepientEmail.value;
	
	//Sender's email
	if(senderEmail.length <= 0){
		errorMessage = errorMessage + "Please enter your email address. \n";
	}
	else{
		if (checkEmail(senderEmail) == false){
			errorMessage = errorMessage + "The sender email address you have entered appears to be invalid. \n";
		}
	}
	//Recepient's email
	if(receiverEmail.length <= 0){
		errorMessage = errorMessage + "Please enter the recepient's email address. \n";
	}
	else{
		if (checkEmail(receiverEmail) == false){
			errorMessage = errorMessage + "The recepient email address you have entered appears to be invalid. \n";
		}
	}
	//Decide whether to submit or not
	if (errorMessage.length > 0){
		alert(errorMessage);
	}
	else{
		form.submit();
	}
}

function validateContactUs(form){
	var title;
	var firstName;
	var surname;
	var jobFunction;
	var company;
	var country;
	var telephone;
	var email;
	var contactMethod;
	var message;
	var errorMessage;
	
	errorMessage = "";

	firstName = form.txtFirstName.value;
	if(firstName.length <= 0){
		errorMessage = errorMessage + "Please enter your first name. \n";
	}

	surname = form.txtSurname.value;
	if(surname.length <= 0){
		errorMessage = errorMessage + "Please enter your surname. \n";
	}

	if (form.cmbJobFunction.selectedIndex == 0) { //note checking for first item in drop-down list which will always be blank
		errorMessage = errorMessage + "Please select a job function from the dropdown list. \n";
	}
	else {
		jobFunction = form.cmbJobFunction.options[form.cmbJobFunction.selectedIndex].value; // jobFunction = form.cmbJobFunction.value;
	}

	company = form.txtCompany.value;
	if(company.length <= 0){
		errorMessage = errorMessage + "Please enter your company name. \n";
	}

	if (form.cmbCountry.selectedIndex == -1) {
		errorMessage = errorMessage + "Please select a country from the dropdown list. \n";
	}
	else {
		country = form.cmbCountry.options[form.cmbCountry.selectedIndex].value; // country = form.cmbCountry.value;
	}

	telephone = form.txtTelephone.value;

	email = form.txtEmail.value;

	contactMethod = "";
    for (i=0; i<form.radContactMethod.length; i++){
		if (form.radContactMethod[i].checked){
           contactMethod = form.radContactMethod[i].value;
		}
	}

	//contact method
	if(contactMethod.length <= 0){
		errorMessage = errorMessage + "Please select a contact method. \n";
	}
	else{
		if(contactMethod == "Email"){
			if(email.length <= 0){
				errorMessage = errorMessage + "You have chosen email as your prefered contact method, therefore, please enter your email. \n";
			}
		}
		if(contactMethod == "Phone"){
			if(telephone.length <= 0){
				errorMessage = errorMessage + "You have chosen phone as your prefered contact method, therefore, please enter your phone number. \n";
			}
		}				
	}
	//Check for validity of email (only if an email address is submitted)
	if(email.length > 0){
		if (checkEmail(email) == false){
			errorMessage = errorMessage + "The email address you have entered appears to be invalid. \n";
		}
	}
	//Decide whether to submit or not
	if (errorMessage.length > 0){
		alert(errorMessage);
	}
	else{
		form.submit();
	}	
}


// This function creates a popup window with set properties
function CreatePopUp(target,name,w,h,scroll,loc,stat,menu,tool,pos,res)
{
    var LeftPos = 50
    var TopPos = 50
    var objWin;

    if(pos=="center")
    {
        LeftPos=(screen.width)?(screen.width-w)/2:100;
        TopPos=(screen.height)?(screen.height-h)/2:100;
    }
    var settings='width='+w+',height='+h+',top='+TopPos+',left='+LeftPos+',scrollbars='+scroll+',location='+loc+',directories=no,status='+stat+',menubar='+menu+',toolbar='+tool+',resizable='+res;

    objWin = window.open(target,name,settings);
    objWin.focus();
    return objWin;
}

// This function launches a pop-up to display the mail a friend page
function launchMailFriend(refererURL)
{
    winPopUp = CreatePopUp('/mailfriend/index.asp?url=' + refererURL,'new',412,350,'no','no','no','no','no','center','no');
}

function checkForSpaces(sThing)
{
    if (sThing.indexOf(' ') == -1 )
    {
        return false;
    }
    else
    {
        return true;
    }
}

function checkEmail(emailAddress){
	var filter = /^[\w\.]+@{1}[\w\.]+$/
	
	if (filter.test(emailAddress)){
		return true;
	}
	else{
		return false;
	}
}

// checks the Edit My Profile Form for errors
function validateEditMyProfile(form)
{
	var title;
	var firstName;
	var lastName;
	var jobFunction;
	var company;
	var companyType;
	var address;
	var town;
	var postCode;
	var country;
	var email;
	var verifyEmail;
	var marketingInfo;
	var errorText;
	errorText = ""
	
	form.title.options[form.title.selectedIndex].value;
	
	/*
	Ensure that <SELECT> element validation work with NETSCAPE 4.x
	*/
	
	if (form.title.selectedIndex == -1) {
		errorText = errorText + "Please enter a Title\n";
		form.title.focus();
	}
	else {
		title = form.title.options[form.title.selectedIndex].value; //form.title.value;
	}
	
	firstName = form.firstName.value;

	if (firstName.length == 0)
	{
		errorText = errorText + "Please enter your First name\n";
		form.firstName.focus();
	}

	lastName = form.lastName.value;
	if (lastName.length == 0)
	{
		errorText = errorText + "Please enter your Last name\n";
		form.lastName.focus();
	}

	if (form.jobFunction.selectedIndex == -1 || form.jobFunction.selectedIndex == 0) {	
		errorText = errorText + "Please enter your Job Function\n";
		form.jobFunction.focus();
	}
	else {
		jobFunction = form.jobFunction.options[form.jobFunction.selectedIndex].value; //form.jobFunction.value;
	}

	company = form.company.value;
	if (company.length == 0)
	{
		errorText = errorText + "Please enter your Company name\n";
		form.company.focus();
	}

	if (form.companyType.selectedIndex == -1)
	{
		errorText = errorText + "Please enter your Company type\n";
		form.companyType.focus();
	}
	else {
		companyType = form.companyType.options[form.companyType.selectedIndex].value  //form.companyType.value;
	}
		
	address = form.address1.value;
	if (address.length == 0)
	{
		errorText = errorText + "Please enter your Address\n";
		form.address.focus();
	}
	
	town = form.city.value;
	if (town.length == 0)
	{
		errorText = errorText + "Please enter your Town/City\n";
		form.city.focus();
	}
	
	postCode = form.postCode.value;
	if (postCode.length == 0)
	{
		errorText = errorText + "Please enter your Postal/Zip Code\n";
		form.postCode.focus();
	}
	
	if (form.country.selectedIndex == -1)
	{
		errorText = errorText + "Please enter a Country\n";
		form.country.focus();
	}
	else {
		country = form.country.options[form.country.selectedIndex].value //form.country.value;	
	}
	
	email = form.email.value;
	
	verifyEmail = form.verifyEmail.value;
	
	if (email.length == 0)
	{
		errorText = errorText + "Please enter an Email address\n";
		form.email.focus();
	}
	else
	{
		if (checkEmail(email) == false) 
		{
			errorText = errorText + "Please enter a valid email address\n";
			form.email.focus();
		}
	}
	if (verifyEmail.length == 0)
	{
		errorText = errorText + "Please enter a Verify Email address\n";
		form.verifyEmail.focus();
	}
	else
	{
		if (checkEmail(verifyEmail) == false) 
		{
			errorText = errorText + "Please enter a valid Verify email address\n";
			form.verifyEmail.focus();
		}
	}
	if (email != verifyEmail)
	{
		errorText = errorText + "Your email addresses must match\n";
		form.email.focus();
	}

	//marketingInfo = form.marketingInfo.value;
	
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		form.submit();
	}
		
}

// validates the Change Password Form - for Edit My Profile
function validateProfileChangePass(form)
{
	var username;
	var oldPassword;
	var newPassword;
	var verifyNewPassword;
	var errorText;
	errorText = "";
	
	username = form.username.value;
	oldPassword = form.oldPassword.value;
	newPassword = form.newPassword.value;
	verifyNewPassword = form.verifyNewPassword.value;
	
	if (username.length <= 0)
	{
		errorText = errorText + "You must enter your username\n";
		form.username.focus();
	}
	if (oldPassword.length < 5)
	{
		errorText = errorText + "Your old password must be at least 5 characters\n";
		form.oldPassword.focus();
	}
	if (newPassword.length < 5)
	{
		errorText = errorText + "Your new password must be at least 5 characters\n";
		form.newPassword.focus();
	}
	else
	{
		if (newPassword.length > 15)
		{
			errorText = errorText + "Your new password must be 15 characters or less\n";
			form.newPassword.focus();
		}
	}
	if (verifyNewPassword.length < 5)
	{
		errorText = errorText + "Your verify password must be at least 5 characters\n";
		form.verifyNewPassword.focus();
	}
	else
	{
		if (verifyNewPassword.length > 15)
		{
			errorText = errorText + "Your verify password must be 15 characters or less\n";
			form.verifyNewPassword.focus();
		}
	}
	if (newPassword != verifyNewPassword)
	{
		errorText = errorText + "Your new password must be the same as your verify password\n";
		form.newPassword.focus();
	}
	if (newPassword == oldPassword)
	{
		errorText = errorText + "Your new password cannot be the same as your old password\n";
		form.newPassword.focus();
	}
	
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		form.submit();
	}
	
}

// validates the Subscription Purchase Form
// If hidden form value (checkBillingCode) = 1, then a billingCode has been passed - check 0-length
// check that the selectedOption is not the default - "Please Select.."
function subscriptionPurchase(subscriptionPurchaseForm)
{
	var checkBillingCode;
	var billingCode;
	var errorText;
	errorText = "";
	
	checkBillingCode = subscriptionPurchaseForm.checkBillingCode.value;
	
	if (subscriptionPurchaseForm.chosenCreditLine.selectedIndex == 0)
	{
		errorText = errorText + "Please choose a Subscription to purchase this research\n";
	}
	
	if (checkBillingCode == 1)
	{
		billingCode = subscriptionPurchaseForm.billingCode.value;
		if (billingCode.length == 0) 
		{
			errorText = errorText + "You must provide a billing code for this purchase\n";
		}
	}
	
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		subscriptionPurchaseForm.submit();
	}
	
}

function confirmSavedSearchDeletion(){
	if(confirm("You are about to delete a saved search query.\nAre you sure you want to continue?")){
		return true;
	}
}

function validateSaveSearch(form){
	var searchDescription;
	searchDescription = form.txtSearchDescription.value;
	
	if(searchDescription.length <= 0){
		alert("Please enter a descriptive word/phrase for your search.");
	}
	else{
		form.submit();
	}
}

function updateEmailAlertNewsCheckbox(){
	var newsOption;
	
	newsOption = docForm.cmbNews.value;
	if(newsOption == 0){
		docForm.chkNews.checked = false;
	}
	else{
		docForm.chkNews.checked = true;	
	}
}

function updateEmailAlertNewsDropDown(){
	var newsCheckbox;
	
	if(docForm.chkNews.checked == true){
		newsCheckbox = "on";
	}
	else{
		newsCheckbox = "off";	
	}	
	if(newsCheckbox == "off"){
		docForm.cmbNews.options[0].selected = true;
	}
}

function validateEmailAlert(form){
	var newsOption;

	newsOption = form.cmbNews.value;

	if(newsOption == 0 && form.chkNews.checked == true){
		alert("You have selected to receive email alerts for news and comments that match your news profiles.\nHowever you have not selected how frequently you wish to receive these emails.\nPlease use the drop-down list on the form to indicate how frequently you wish to receive these emails.");
	}
	else{
		form.submit();
	}
}

// validates the Credit Card Purchase Form
function basicCCCheck(form)
{
	var cardNumber;
	var expiryDate;
	var confirmEmail;
	var storedEmail;
	var cv2Number;
	
	var errorText;
	errorText = "";
	
	storedEmail = form.storedEmail.value;
	cardNumber = form.cardNumber.value;
	expiryDate = form.expiryDate.value;
	confirmEmail = form.confirmEmail.value;
	cv2Number = form.cv2Number.value;
	
	if (form.cardType.selectedIndex == 0)
	{
		errorText = errorText + "Please select a Card type\n";
	}
	
	if (cardNumber.length == 0)
	{
		errorText = errorText + "Please supply a Card number\n";
	}
	
	if ((expiryDate.length == 0) || (expiryDate.length != 5) || (expiryDate.substr(2,1) != '/') || (isNaN(expiryDate.substr(0,2))) || (isNaN(expiryDate.substr(3,2))))
	{
		errorText = errorText + "The Expiry date is invalid\n";
	}
	
	if (cv2Number.length == 0)
	{
		errorText = errorText + "Please supply a Security Code Number\n";
	}
	
	if (confirmEmail.length == 0)
	{
		errorText = errorText + "Please supply a Confirmation of your email address\n";
	}
	
	if (storedEmail != confirmEmail)
	{
		errorText = errorText + "Please supply a matching email address\n";
	}
	
	
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		form.submit();
	}
	
}

//function to make sure at least one character is entered
function checkBillingCode (viewCode)
{
	if (document.viewCode.authenticateViewCode.value == '')
	{
		alert('Please enter a View Code value');
	}
	else
	{
		document.viewCode.submit();
	}
}

// validates the Online Order Purchase Form
function invoiceOrderPurchase(form)
{
	var telephone;
	var confirmEmail;
	var storedEmail;
	
	var errorText;
	errorText = "";
	
	telephone = form.telephone.value;
	storedEmail = form.storedEmail.value;
	confirmEmail = form.confirmEmail.value;

	if (telephone.length == 0)
	{
		errorText = errorText + "Please supply a Contact telephone number\n";
	}
	if (confirmEmail.length == 0)
	{
		errorText = errorText + "Please supply a Confirmation of your email address\n";
	}
	
	if (storedEmail != confirmEmail)
	{
		errorText = errorText + "Please supply a matching email address\n";
	}
	
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		form.submit();
	}
	
}

// Validates the registration form and submits if all valid
function validateRegistration() {
	var rtn = true;
	var frm = document.forms['vortal'];

	// If Netscape 4 only provide server side validation
	if (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4)
	{
		frm.submit();
	}
	
	if (document.getElementById) {
		// Check username
		if (frm.Username.value.length == 0)
		{
			document.getElementById('errUsername').innerHTML = 'Please enter a username.';
			document.getElementById('errUsername').style.display = 'block';
			rtn = false;
		}
		else if (frm.Username.value.indexOf(' ') >= 0)
		{
			document.getElementById('errUsername').innerHTML = 'The username must not contain spaces.';
			document.getElementById('errUsername').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errUsername').style.display = 'none';
			document.getElementById('errUsername').innerHTML = '';
		}
	
		// Check title
		if (frm.Title[frm.Title.selectedIndex].text.length == 0)
		{
			document.getElementById('errTitle').innerHTML = 'Please select a title.';
			document.getElementById('errTitle').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errTitle').style.display = 'none';
			document.getElementById('errTitle').innerHTML = '';
		}
	
		// Check firstname
		if (frm.Forename.value.length == 0)
		{
			document.getElementById('errForename').innerHTML = 'Please enter a forename.';
			document.getElementById('errForename').style.display = 'block';
			rtn = false;
		}
		else if (frm.Forename.value.indexOf(' ') == 0)
		{
			document.getElementById('errForename').innerHTML = 'The forename must not start with a space.';
			document.getElementById('errForename').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errForename').style.display = 'none';
			document.getElementById('errForename').innerHTML = '';
		}
	
		// Check surname
		if (frm.Surname.value.length == 0)
		{
			document.getElementById('errSurname').innerHTML = 'Please enter a surname.';
			document.getElementById('errSurname').style.display = 'block';
			rtn = false;
		}
		else if (frm.Surname.value.indexOf(' ') == 0)
		{
			document.getElementById('errSurname').innerHTML = 'The surname must not start with a space.';
			document.getElementById('errSurname').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errSurname').style.display = 'none';
			document.getElementById('errSurname').innerHTML = '';
		}
	
		// Check job function
		if (frm.JobFunction[frm.JobFunction.selectedIndex].text.length == 0)
		{
			document.getElementById('errJobFunction').innerHTML = 'Please select a job function.';
			document.getElementById('errJobFunction').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errJobFunction').style.display = 'none';
			document.getElementById('errJobFunction').innerHTML = '';
		}
	
		// Check email
		if (frm.Email.value.length == 0)
		{
			document.getElementById('errEmail').innerHTML = 'Please enter an email address.';
			document.getElementById('errEmail').style.display = 'block';
			rtn = false;
		}
		else if (frm.Email.value.indexOf(' ') == 0)
		{
			document.getElementById('errEmail').innerHTML = 'The email address must not start with a space.';
			document.getElementById('errEmail').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errEmail').style.display = 'none';
			document.getElementById('errEmail').innerHTML = '';
		}
	
		// Check verify email
		if (frm.VerifyEmail.value.length == 0)
		{
			document.getElementById('errVerifyEmail').innerHTML = 'Please confirm the email address.';
			document.getElementById('errVerifyEmail').style.display = 'block';
			rtn = false;
		}
		else if (frm.VerifyEmail.value != frm.Email.value)
		{
			document.getElementById('errVerifyEmail').innerHTML = 'The email addresses do not match.';
			document.getElementById('errVerifyEmail').style.display = 'block';
			rtn = false;
		}
		else
		{
			document.getElementById('errVerifyEmail').style.display = 'none';
			document.getElementById('errVerifyEmail').innerHTML = '';
		}
	}

	if (rtn)
	{
		frm.submit();
	}
}

// validates either the Financial Markets Events Register or the FM Panels Register form
function iASValidate(form, panel)
{
	var fullName
	var telephone;
	var confirmEmail;
	var storedEmail;
	var question;
	
	var errorText;
	errorText = "";
	
	fullName = form.confirmName.value;
	telephone = form.confirmPhone.value;
	storedEmail = form.storedEmail.value;
	confirmEmail = form.confirmEmail.value;
	
	if (fullName.length == 0)
	{
		errorText = errorText + "Please supply your Full Name\n";
	}
	if (telephone.length == 0)
	{
		errorText = errorText + "Please supply a Contact telephone number\n";
	}
	if (confirmEmail.length == 0)
	{
		errorText = errorText + "Please supply a Confirmation of your email address\n";
	}
	if (storedEmail != confirmEmail)
	{
		errorText = errorText + "Please supply a matching email address\n";
	}
	if (panel == 1)
	// we are validating a panels registration form
	{
		question = form.panelQuestion.value;
		if (question.length == 0)
		{
			errorText = errorText + "Please supply a Panels question\n";
		}
	}
	
	if (errorText.length != 0)
	{
		alert(errorText);
	}
	else
	{
		form.submit();
	}
	
}
