function clearMyField(elem){
	if(elem.value=="Enter your email address")
		elem.value="";
}

function changeImage(id, image){
	document.getElementById(id).src=image;
}

function addAddress(){
	
	
}

/************ FORM VALIDATION FUNCTIONS *************/

function validateBapenForm1(){
	
	if(!validate())
		return false;
	if(!document.getElementById('agreement').checked){
		alert('Please confirm that you have read and understood the above agreement');
		return false;
	}
}
function validateBapenForm2(){
	
	if(!validate())
		return false;
}
//check that all fields with classname 'required' are filled in
function validate(){
var elems=document.getElementsByTagName('input'); 
for(var i=0;i<elems.length;i++){
	if((elems[i].className=='required')&&(elems[i].value=="")){
		alert("Please fill in all required fields");
		return false;
	}
}
return true;
}

/*** This validation function checks that an email address contains both '@' and '.' **/
function validateEmailAddress(email_address){
var email = document.getElementById(email_address).value;
	if((email.indexOf('@')==-1)||(email.indexOf('.')==-1)){
		alert("Invalid email address");
		return false;
	}
	else
		return true;
}

//Check that two fields have the same values, useful for password changes etc
function validateSame(type, retype){
if(document.getElementById(type).value == document.getElementById(retype).value)
	return true;
else{
	alert("Passwords do not match.");
	return false;
}
}