function chkF(field,alerttxt,reject){
	with (field) {
		if (value==null||value==""||value==reject){
			alert(alerttxt);
			return false
		} else { return true }
	}
}

function chkE(field,alerttxt){
	with (field){
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
			  {alert(alerttxt);return false}
		else {return true}
	}
}

function applyForm(thisForm) {
	with (thisForm){
		if (chkF(apply_title, "Please enter your name.", "asd")==false){
			apply_title.focus();
			return false
		}
		
		if (chkF(apply_first, "Please enter your first name.", "asd")==false){
			apply_first.focus();
			return false
		}
		
		if (chkF(apply_surname, "Please enter your surname.", "asd")==false){
			apply_surname.focus();
			return false
		}
		
		if (chkF(apply_contact, "Please enter your contact number.", "asd")==false){
			apply_contact.focus();
			return false
		}
		
		if (chkE(apply_email,"Sorry that isn't a valid Email Address")==false){
			apply_email.focus();
			return false
		}
	}
}

function equityForm(thisForm) {
	with (thisForm){
		if (chkF(equity_name, "Please enter your name.", "asd")==false){
			equity_name.focus();
			return false
		}
		
		if (chkF(equity_contact, "Please enter your contact number.", "asd")==false){
			equity_contact.focus();
			return false
		}
		
		if (chkE(equity_email,"Sorry that isn't a valid Email Address")==false){
			equity_email.focus();
			return false
		}
	}
}


function changeimg(img) {
	if(img.src.match("-norm")) {
		img.src = img.src.split("-norm").join("-fade");
	} else {
		img.src = img.src.split("-fade").join("-norm");
	}
}


function newwin(lnk) {
	window.open(lnk.href, 'newwindow','toolbar=yes, location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes');
	return false;
}

function areyousure(txt) {
	var q = confirm(txt);
	if (!q){ return false; }
}

