var REMAIL = /^[\w\.\-\']+@[a-z\.\-\d]{2,}\.[a-z]{2,10}$/i;

function validateContactForm() {
	var fieldCheck = new Array(2);
	fieldCheck[0] = new Array('fname','company','email','comments');
	fieldCheck[1] = new Array('your name','your company','your email address','the nature of your enquiry');
	var count, check
	for (count=0;count<fieldCheck[0].length;count++) {
		check = eval('document.forms[0].' + fieldCheck[0][count] + '.value');
		if (check.length == 0) {
			alert('Please enter ' + fieldCheck[1][count]);
			return false;
			break;
		} else {
			if ((fieldCheck[0][count] == "email") && (!REMAIL.test(check))) {
				alert('Please enter a valid email address');
				return false;
			}
		}
	}
	return true;
}

var popupWin = null;
function showMap(which) {
	if(popupWin) popupWin.close()
	popupWin = window.open('map_'+which+'.html', 'map', 'width=600,height=680,toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes');
}

function randomNumber(range) {
	var result = Math.ceil(range*Math.random()); 
	return result;
}
