	function showEmail(name,domain) {
		sep = '@';
		document.write(name+sep+domain);
	}

	function showMailTo(name,domain,clName,lnName) {
		className = '';
		linkName = (lnName>"")?(lnName):(name+"@"+domain);
		if (clName>"") {
			className = 'class="'+clName+'" ';
		}
		document.write('<a '+className);
		document.write('href="');
		document.write('mail');
		document.write('to:');
		showEmail(name, domain);
		document.write('">');
		document.write(linkName);
		document.write('</a>');
	}

	function openWin(url, name, features){
		var newWin = window.open( url, name, features )
	}	

	function imagePopup (url, width, height) {
		var features = 'width='+width+', height='+height+', menubar';
		var newWin = window.open(url, null, features);
	}
	
	function validateTitle(title) {
	    var error = "";

	    if (title.value == 0) {
		title.style.background = '#99cc66'; 
		error = "your title\n"
	    } else {
	       title.style.background = '#f0f0f0';
	    }
	    return error;  
	}	
	
	function validateName(name) {
	    var error = "";

	    if (name.value == 0) {
		name.style.background = '#99cc66'; 
		error = "your name\n"
	    } else {
	       name.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateSurname(surname) {
	    var error = "";

	    if (surname.value == 0) {
		surname.style.background = '#99cc66'; 
		error = "your surname\n"
	    } else {
		surname.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateTelephone(telephone) 
	{
	   var error="";

	     if (telephone.value == "") {
		telephone.style.background = '#99cc66';
		error = "your telephone\n";
	     }else{

		 telephone.style.background = '#f0f0f0';
	     }

	return error;
      }
	
      function validateEmail(email_address) {
       	var error = "";
       	var tfld = trim(email_address.value);
	 var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	 var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;

	    if (email_address.value == 0) {
		email_address.style.background = '#99cc66'; 
		error = "your email\n"
	    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
		email_address.style.background = '#99cc66';
		error = "a valid email address.\n";       	       
	    } else if (email_address.value.match(illegalChars)) {
		email_address.style.background = '#99cc66';
		error = "email address contains illegal characters.\n";
	    } else {
	email_address.style.background = '#f0f0f0';
	    }
	    return error; 
	}
	
	function validateContrTitle(contribution_title) {
	    var error = "";

	    if (contribution_title.value == 0) {
		contribution_title.style.background = '#99cc66'; 
		error = "the contribution title\n"
	    } else {
	       contribution_title.style.background = '#f0f0f0';
	    }
	    return error;  
        }
        
        function validateSummary(contribution_summary) {
	  var error = "";

	    if (contribution_summary.value == '') {
		contribution_summary.style.background = '#99cc66'; 
		error = "contribution summary\n"
	    } else {
	       contribution_summary.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateEventTitle(event_title) {
	  var error = "";

	    if (event_title.value == 0) {
		event_title.style.background = '#99cc66'; 
		error = "the event title\n"
	    } else {
	       event_title.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateOrganiser(event_organiser) {
	  var error = "";

	    if (event_organiser.value == 0) {
		event_organiser.style.background = '#99cc66'; 
		error = "the organiser\n"
	    } else {
		event_organiser.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateDate(start_date) {
	  var error = "";

	     if (start_date.value == '') {
		 start_date.style.background = '#99cc66'; 
		 error = "the start date\n"
	     } else {
		 start_date.style.background = '#f0f0f0';
	     }
	     return error;  
       }
       
	function validateEndDate(end_date) {
	   var error = "";

	    if (end_date.value == '') {
		end_date.style.background = '#99cc66'; 
		error = "the end date\n"
	    } else {
	        end_date.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateVenue(event_venue) {
	  var error = "";

	    if (event_venue.value == 0) {
		event_venue.style.background = '#99cc66'; 
		error = "the event venue\n"
	    } else {
		event_venue.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateCountry(event_country_ref) {
	  var error = "";

	    if (event_country_ref.selectedIndex == 0) {
		event_country_ref.style.background = '#99cc66'; 
		error = "event country\n"
	    } else {
		event_country_ref.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	function validateContactName(contact_name) {
	 var error = "";

	    if (contact_name.value == 0) {
		contact_name.style.background = '#99cc66'; 
		error = "contact name\n"
	    } else {
	       contact_name.style.background = '#f0f0f0';
	    }
	    return error;  
	}
		
	function validateContactSurname(contact_surname) {
	  var error = "";

	    if (contact_surname.value == 0) {
		contact_surname.style.background = '#99cc66'; 
		error = "contact surname\n"
	    } else {
		contact_surname.style.background = '#f0f0f0';
	    }
	    return error;  
	}

	
	function validateContactNumber(contact_number) 
	{
	   var error="";

	    
	     if (contact_number.value == "") {
		contact_number.style.background = '#99cc66';
		error = "contact number\n";
	     }else{

		 contact_number.style.background = '#f0f0f0';
	     }

	return error;
      }
      
      
      function trim(s)
      {
        return s.replace(/^\s+|\s+$/, '');
      }
      
      function validateContactEmail(contact_email) {
	 var error = "";
	 var tfld = trim(contact_email.value);
	 var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	 var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	
	    if (contact_email.value == 0) {
		contact_email.style.background = '#99cc66'; 
		error = "contact email\n"
	    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
       	        contact_email.style.background = '#99cc66';
       	        error = "a valid email address.\n";       	       
       	    } else if (contact_email.value.match(illegalChars)) {
       	        contact_email.style.background = '#99cc66';
       	        error = "email address contains illegal characters.\n";
       	    } else {
		contact_email.style.background = '#f0f0f0';
	    }
	    return error;  
	}
	
	
	function validateFormOnSubmit(contributorInfo) {
	var reason = "";

	  reason += validateTitle(contributorInfo.title);
	  reason += validateName(contributorInfo.name);
	  reason += validateSurname(contributorInfo.surname);
	  reason += validateTelephone(contributorInfo.telephone);
	  reason += validateEmail(contributorInfo.email_address)
	  reason += validateContrTitle(contributorInfo.contribution_title);
	  reason += validateSummary(contributorInfo.contribution_summary);
	  reason += validateEventTitle(contributorInfo.event_title)
	  reason += validateOrganiser(contributorInfo.event_organiser);
	  reason += validateDate(contributorInfo.start_date);
	  reason += validateEndDate(contributorInfo.end_date);
	  reason += validateVenue(contributorInfo.event_venue);
	  reason += validateCountry(contributorInfo.event_country_ref);
	  reason += validateContactName(contributorInfo.contact_name);
	  reason += validateContactSurname(contributorInfo.contact_surname);
	  reason += validateContactNumber(contributorInfo.contact_number);
	  reason += validateContactEmail(contributorInfo.contact_email);
	 
	 
	  	  
	 
	  if (reason != "") {
	    alert("Please enter/select:\n" + reason);
	    return false;
	  }

	  return true;
}