function checkContactForm()
{
	hasErrors = false;
	errorMessage = "";
	
	checkElement("fname");
	checkElement("lname");
	checkElement("telephone");
	checkElement("email");
	checkElement("message");
	
	if(hasErrors)
	{
		alert(errorMessage);
		return false;
	}
	else
	{
		if (!isEmail(document.getElementById("email").value)) {
			alert("Valid email must be entered.");
			return false;
		}
		return true;
	}
}

function checkSpeedQuoteForm()
{
	hasErrors = false;
	errorMessage = "";
	
	checkElement("fname");
	checkElement("lname");
	checkElement("position");
	checkElement("company");
	checkElement("telephone");
	checkElement("email");
	
	if(hasErrors)
	{
		alert(errorMessage);
		return false;
	}
	else
	{
		if (!isEmail(document.getElementById("email").value)) {
			alert("Valid email must be entered.");
			return false;
		}
		return true;
	}
}

function isEmail(emailAddress) {
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
	return re.test(emailAddress);
}

function checkElement(element)
{
	if(document.getElementById(element).value == '')
	{
		hasErrors = true;
		element = element.ucfirst();
		element = element.replace("-", " ");
		errorMessage += element + " must be entered.\n";
	}
}

String.prototype.ucfirst = function()
{
	return this.charAt(0).toUpperCase() + this.substr(1);
}

function focusSearch() {
	if (document.searchFrm.search.value == 'Search...') {
		document.searchFrm.search.value = ''
	}
}

function doSearch() {
	if (document.searchFrm.search.value != 'Search...') {
		if (document.searchFrm.search.value.length >= 3) {
			document.searchFrm.submit();
		} else {
			alert('Please enter 3 characters or more.');
		}
	}	
}

function enquirySelect(selObj) {
	if (selObj.selectedIndex == 1) {
		document.getElementById('screen-print').style.display = '';
	} else {
		document.getElementById('screen-print').style.display = 'none';
	}
	if (selObj.selectedIndex == 2) {
		document.getElementById('foil-label').style.display = '';
	} else {
		document.getElementById('foil-label').style.display = 'none';
	}
}