var fields=new Array();
var names=new Array();
fields['0']='login';names['0']='Email Address';fields['1']='password';names['1']='Choose Password';fields['2']='passwordc';names['2']='Confirm Password';fields['3']='forename';names['3']='Forename';fields['4']='surname';names['4']='Surname';fields['5']='company';names['5']='Company Name';fields['6']='postcode';names['6']='Post/Area/Zip Code';fields['7']='country';names['7']='Country';fields['8']='phone';names['8']='Telephone';	
	function checkreg() {
		pw1=document.getElementById('password');
		pw2=document.getElementById('passwordc');
		if(!pw1 || !pw2) {
			alert("Corrupt form");
			return false;
		}
		if(pw1.value!=pw2.value) {
			alert("Your passwords do not match");
			return false;
		}
		
		var flength=fields.length;
		for(i=0; i<flength; i++) {
			var check=document.getElementById(fields[i]);
			if(!check) continue;
			if(check.value.length<2) {
				alert("Please fill in the " + names[i] + " field")
				return false;
			}
		
		}
		document.forms[0].submit();
		return false;
	}
	
	function checkpw() {
		var currentid=document.getElementById('current');
		var newpwid=document.getElementById('new');
		var confirmpwid=document.getElementById('confirm');
		if(!currentid || !newpwid || !confirmpwid) {
			alert("This form is corrupt");
			return false;
		}
		
		current=currentid.value;
		newpw=newpwid.value;
		confirmpw=confirmpwid.value;
		if(!current.length) {
			alert("You must enter your current password");
			return false;
		}
		
		if(!newpw.length) {
			alert("You must enter a new password");
			return false;
		}
		
		if(newpw != confirmpw) {
			alert("Those passwords do not match");
			return false;
		}
	
	}

