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 contactForm(thisForm) {
	with (thisForm){
		if (chkF(name, "Please enter your name.", "asd")==false){
			name.focus();
			return false
		}
		
		if (chkF(tele,"Please enter your Contact Number", "asd")==false){
			tele.focus();
			return false
		}
		
		if (chkE(email,"Sorry that isn't a valid Email Address")==false){
			email.focus();
			return false
		}
		
		if (chkF(enquiry, "Please enter a Message", "asd")==false){
			enquiry.focus();
			return false
		}
	}
}

function updateImage(src){
	var imagetochange = document.getElementById('theimage');
	imagetochange.src = 'images/' + src;
}
