bErrs = false;
sErrs = "";

function showInfo(sDivName, sContent){
	bErrs = true
	sErrs = sErrs  + sContent + '\n\n';

}

function affSignup() {
	sErrs = "";
	bErrs = false
	x = document.frmAff;
	if (!emailCheck(x.email.value)){
		showInfo('err_email','You have not provided a valid email address.')
	}
	if (x.pw.value.length < 5){
		showInfo('err_pw','Your password must be atleast 5 characters long.')
	}
	if (x.pw.value != x.pw2.value){
		showInfo('err_pw','Your passwords do not match, please re-enter your passwords.')
	}
	

	if (x.tc.checked == false){
		showInfo('err_tc','You must agree to the Terms & Conditions.')
	}
	
	if (x.vatregd.checked == true){
		if (x.vatnum.value == ''){
			showInfo('err_vat','You must provide a VAT number if you are VAT registered.')
		}
	}
	
	if (bErrs == false) {
	x.submit();
	}
	else
	{
	alert (sErrs);
	}

}
function affUpdate() {
	sErrs = "";
	bErrs = false
	x = document.frmAff;
	if (!emailCheck(x.email.value)){
		showInfo('err_email','You have not provided a valid email address.')
	}

	
	if (x.vatregd.checked == true){
		if (x.vatnum.value == ''){
			showInfo('err_vat','You must provide a VAT number if you are VAT registered.')
		}
	}
	
	if (bErrs == false) {
	x.submit();
	}
	else
	{
	alert (sErrs);
	}

}
