function validateContactForm() {
	var fullName = document.getElementById('full_name');
	var email = document.getElementById('email');
	var phone = document.getElementById('phone');
	var query = document.getElementById('query');
	
	if (fullName.value == "") {
		alert("You must enter your full name.");
		fullName.focus();
		return false;
	}
	if (phone.value == "") {
		alert("You must enter your phone number.");
		phone.focus();
		return false;
	}		
	if (phone.value != "" && !isPhone(phone.value)) {
		alert("The phone number contains invalid characters.");
		phone.focus();
		return false;
	}
	if (email.value == "") {
		alert("You must enter your email address.");
		email.focus();
		return false;
	}	
	if (email.value != "") {
		if (!validateEmail(email.value)) {
    		alert("You must enter a valid email address");
    	    email.focus();
    		return false;
    	}
	}	
	if (query.value == "") {
		alert("You must enter a query.");
		query.focus();
		return false;
	}
	return true;
}

function validateEmail(email) {
	// E-mail Validation by Henrik Petersen / NetKontoret
	// Explained at www.echoecho.com/jsforms.htm
	// Please do not remove this line and the two lines above.
	apos=email.indexOf("@"); 
	dotpos=email.lastIndexOf(".");
	lastpos=email.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
		return false;
	} else {
		return true;
	}
}

function isNumeric(strString) {
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
	return blnResult;
}

function isPhone(strString) {
	var strValidChars = "0123456789()+- ";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
	return blnResult;
}

function hideBlock(divId) {
	document.getElementById(divId).style.display = "none";
}

function showBlock(divId) {
	document.getElementById(divId).style.display = "block";
}

function inlineBlock(divId) {
	document.getElementById(divId).style.display = "inline";
}

function resetForm(formId) {
	document.getElementById(formId).reset();
	return false;
}