/* swap stylesheet */
function setActiveStyleSheet(title) {
	if (document.getElementsByTagName) {
		for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {
			if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) a.disabled = true;
			if (a.getAttribute("title") == title) a.disabled = false;
		}
	}
}

/* validate contact us enquiry form */
function validateContactUs(oForm) {
	var bValid = true;

	//check email
	if (validateEmail(oForm.email) == false) {
		alert('Please enter a valid email address');
		return false;
	}

	//check normal form
	if (oForm.name.value == '' ||
		oForm.email.value == '' ||
		oForm.telephone.value == '') {
		bValid = false;
	}

	//return correctly
	if (bValid == false) {
		alert('Please fill out all fields');
		return false;
	}

	return true;
}

/* validate the email field */
function validateEmail(field) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) { return false; }
		else { return true; }
	}
}
