/*************************************************
* Validate the registration form using JS		 *
* Created: 18.12.04 -> 01:03am					 *
* Modified: GS -> 18.12.04 @ 02:56am
		    GS -> 18.12.04 @ 09:33am
			GS -> 23.12.04 @ 22:50pm									 *
* Note:											 *
*************************************************/

function valRegister(which){
	if (which.js.value == "on"){
			// Make sure that the Colledge name is not empty
			if (which.CompanyName.value == ""){
				alert (registerARR[0]);
				which.CompanyName.focus();
				return false;
			}else
		
			// Make sure Address line one is not empty
			if (!document.getElementById('buyer').checked && !document.getElementById('seller').checked){
				alert(registerARR[16]);
				return false;
			}else
		
			// Make sure Address line one is not empty
			if (which.FirstName.value == ""){
				alert(registerARR[1]);
				which.FirstName.focus();
				return false;
			}else
		
			// Make sure Address line one is not empty
			if (which.LastName.value == ""){
				alert(registerARR[2]);
				which.LastName.focus();
				return false;
			}else
			// make sure company position is not empty
			if (which.CompanyPosition.value == ""){
				alert(registerARR[17]);
				which.CompanyPosition.focus();
				return false;
			}else
		
			// Make sure Address line one is not empty
			if (which.AddressLine1.value == ""){
				alert(registerARR[3]);
				which.AddressLine1.focus();
				return false;
			}else
		
			// Make sure Town is not empty
			if (which.Town.value == ""){
				alert(registerARR[4]);
				which.Town.focus();
				return false;
			}else
		
			// Make sure that the postcode is not empty
			if (which.PostCode.value == ""){
				alert(registerARR[5]);
				which.PostCode.focus();
				return false;
			}else
			
			// Make sure that the postcode is not empty
			if (which.Country.value == ""){
				alert(registerARR[18]);
				which.Country.focus();
				return false;
			}else
			
			// Make sure that the Company telephone is not empty
			if (!isNumber(which.CompanyTel) || which.CompanyTel.value == ""){
				alert(registerARR[6]);
				which.CompanyTel.focus();
				return false;
			}else
			
			// Make sure that the Mail email is not empty and is a valid email address
			if (!isEMailAddr(which.Email1)){
				alert(registerARR[7]);
				which.Email1.focus();
				which.Email1.select();
				return false;
			}else
			
			// Make sure that the Mail email is not empty and is a valid email address
			if (which.CompanyRep.value == ""){
				alert(registerARR[15]);
				which.CompanyRep.focus();
				return false;
			}else
		
			// Make sure that the username is filled in and that its more than 4 chars and less than 15 chars
			if (which.UserName.value == "" || which.UserName.value.length < UsernameMinLength ||  which.UserName.value.length > UsernameMaxLength){
				alert(registerARR[8]);
				which.UserName.focus();
				which.UserName.select();
				return false;
			}else
		
			// Make sure that the first passowrd field is not blank
			if (which.Passwd1.value == "" || which.Passwd1.value.length < PasswdMinLength ||  which.Passwd1.value.length > PasswdMaxLength){
				alert(registerARR[9]);
				which.Passwd1.focus();
				return false;
			}else
		
			// Make sure that the second passowrd field is not blank
			if (which.Passwd2.value == "" || which.Passwd2.value.length < PasswdMinLength ||  which.Passwd2.value.length > PasswdMaxLength){
				alert(registerARR[10]);
				which.Passwd2.focus();
				return false;
			}else
		
			// Make sure that the second passowrd field is not blank
			if (which.Passwd1.value != which.Passwd2.value){
				alert(registerARR[11]);
				return false;
			}else
			
			// Make sure that a secret question is selected
			if (!isChosen(which.SecretQuestion)){
				alert(registerARR[12]);
				which.SecretQuestion.focus();
				return false;
			}else
		
			// Make sure that the secret answer is filled in
			if (which.SecretAnswer.value == ""){
				alert(registerARR[13]);
				which.SecretAnswer.focus();
				return false;
			}else
			
			// Make sure that the secret answer is filled in
			if (!document.getElementById('trm').checked){
				alert(registerARR[14]);
				return false;
			}
			else {
				document.register.sendit.disabled = true;
				return true;
			}
		}
	else {
		return true;
	}
}


function opendiv(){
	if (!document.getElementById('buyer').checked){
		document.getElementById('w').style.display = "block";
	}
	else {
		document.getElementById('w').style.display = "none";
		document.getElementById('pvt').checked = false;
	}
}

	function sc(){
		if (document.getElementById('pvtb').checked){
			document.getElementById('sellerr').checked = true;
			document.getElementById('pvtb').checked = false;
			document.getElementById('buyerr').checked = false;
		}
		if (document.getElementById('buyerr').checked){
			document.getElementById('sellerr').checked = true;
			document.getElementById('pvtb').checked = false;
			document.getElementById('buyerr').checked = false;
		}
	}
	function sr(){

		if (document.getElementById('pvtb').checked){
			document.getElementById('pvtb').checked = false;
			document.getElementById('buyerr').checked = false;
		}
	}
	function bc(){
		if (document.getElementById('pvts').checked){
			document.getElementById('buyerr').checked = true;
			document.getElementById('pvts').checked = false;
			document.getElementById('sellerr').checked = false;
		}
		if (document.getElementById('sellerr').checked){
			document.getElementById('buyerr').checked = true;
			document.getElementById('pvts').checked = false;
			document.getElementById('sellerr').checked = false;
		}
		if (!document.getElementById('buyerr').checked){
			document.getElementById('pvtb').checked;
		}
	}
	function br(){

		if (document.getElementById('pvts').checked){
			document.getElementById('pvts').checked = false;
			document.getElementById('sellerr').checked = false;
		}
	}

