function openpopup(){
var popurl="disclaimer.htm"
winpops=window.open(popurl,"","width=400,height=338,scrollbars,resizable,")
}

function SetBgColor(obj, strColor) { 
	obj.style.backgroundColor=strColor
}

function magnifyThis(URLtogo, stud, width, height) { 
	window.open(URLtogo, "", "Height=" + height + ",Width=" + width + ", fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0");
}

function validateForm() {
	
	// quickie references to my fields
	var firstname = document.getElementById('firstname');
	var surname = document.getElementById('surname');
	var email = document.getElementById('email');
	var comments = document.getElementById('comments');
	var captcha_test = document.getElementById('captcha_test');
		
	// check the inputs  (main function nav)
	if(textArea(comments, "mand", "Please provide us with some details regarding the nature of your enquiry so we can respond accordingly.")) {
		if (alphaNumField(surname, "mand", "your family or surname.")) {
			if (emailField(email, "mand", "valid email address.")) {
				if (alphaNumField(firstname, "mand", "your first or given name.")) {
					if (alphaNumField(captcha_test, "mand", "the letters and numbers for the SPAM blocker test.")) {
						return true;
					}
				}	
			}
		}
	}
	return false;
}

// function for checking alphanumeric text fields
function alphaNumField(element, which, fieldDesc) {
	var alphaNumExp = /^[-0-9a-zA-Z',&.'";:-_ /]+$/;
	if ((which == 'mand') && (element.value.length < 2)) {
		var shortStub = 'Please enter ';
		alert(shortStub + fieldDesc);
		element.focus(); // set the focus to this input
		return false;
	} else if ((element.value.length > 1) && (!element.value.match(alphaNumExp))) {
	var wrongStub = 'Please enter only letters and numbers for your ';
		alert(wrongStub + fieldDesc);
		element.focus();
		return false;
	} else {
		return true;
	}
}
	
// function for checking text areas
function textArea(element, which, message){
	if ((which == 'mand') && (element.value.length < 20)) {
		alert(message);
		element.focus();
		return false;
	} else {
		return true;
	}
}

// function for quickly checking email format (check again on server side)	
function emailField(element, which, fieldDesc){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if ((which == 'mand') && (element.value.length < 6)) {
		var shortStub = 'Please enter your ';
		alert(shortStub + fieldDesc);
		element.focus(); // set the focus to this input
		return false;
	} else if (element.value.match(emailExp)) {
		return true;
	} else {
		var wrongStub = 'Please check the format of your ';
		alert(wrongStub + fieldDesc);
		element.focus();
		return false;
	}
}