function validateForm(form) {  
	if ((form.firstname.value == "") || (form.surname.value == "") || (form.gender.value == "") || (form.fromemail.value == "") || (form.paper.value == "")) {
		alert("You have not completed all the compulsory fields.");
		return false;
	}
	else {
		if (validateEmail(form,form.fromemail.value)) return(true);	
		else return(false);	
	}
}

function validateEmail(form,email) {
	var validEmail = false;
	var emailString = email; 
	var addressIsValid = false; 
	var invalidPatterns = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; 
	var validPatterns = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; 
	if (window.RegExp) { 
		if (!invalidPatterns.test(emailString) && validPatterns.test(emailString)) { 
			addressIsValid = true; 
		} 
		else { 
			addressIsValid = false; 
		} 
	}
	else { 
		if(emailString.indexOf("@") >= 0) 
			addressIsValid = true; 
	} 
	if (!addressIsValid) { 
		alert("\"The address " + emailString + "\" is not a valid e-mail.");  
	} 
      	return addressIsValid; 
}

function openWindow(t,f,w,h) {
	var newWindow = window.open(f,t,'height='+h+',width='+w+',dependent=yes,titlebar=yes,menubar=no,toolbar=no,status=yes,scrollbars=yes,resizable=yes,hotkeys=yes');
	return false;
}

function updateMenu(j) {
	m = document.getElementById('menu');
	n = m.getElementsByTagName('a') ;
	n[j].className = 'menuactive';
}

function showhideSibling(t) {
    while (t.nodeName != 'BLOCKQUOTE') t = t.nextSibling;
    if (t.style.display=='none') t.style.display = 'block';
    else t.style.display = 'none';
}
