// JavaScript Document
var emailFormShowing = false;
var brochureFormShowing = false;

function openPolicyWindow() {
	policyWindow = window.open("privacy_policy.aspx","privacyPolicy","status,menubar,dependent,height=300,width=400");
	policyWindow.focus();
}

function openPrintWindow() {
	contentPage = "/print/" + currentPage + ".aspx";
	printWindow = window.open(contentPage,"content","status,menubar,dependent,resizable,scrollbars,height=490,width=480");
	printWindow.print();
	printWindow.focus();
}

function clearComments() {
	if (emailFormShowing) {
		if (document.emailForm.commentsField.value == "Comments") {
			document.emailForm.commentsField.style.color="#666666";
			document.emailForm.commentsField.value = "";
		}
	} else {
		if (document.brochureForm.commentsField.value == "Comments") {
			document.brochureForm.commentsField.value = "";
			document.brochureForm.commentsField.style.color="#666666";
		}
	}
}

function clearCSZ() {
	if (document.brochureForm.cityStateZip.value == "City, State ZIP") {
		document.brochureForm.cityStateZip.value = "";
		document.brochureForm.cityStateZip.style.color="#666666";
	}
}

function toggleEmailForm() {
	if (emailFormShowing) {
		// de-highlight the Email Page tab
		document.getElementById("emailTab").style.background="#ffffff";
		document.getElementById("emailLink").style.color="#8AA0B2";
		
		// hides the form div
		document.getElementById("emailFormDiv").style.display="none";
		emailFormShowing = false;
	} else {
		// highlight the Email Page tab
		document.getElementById("emailTab").style.background="#eeeeee";
		document.getElementById("emailLink").style.color="#006699";
		
		// hide the brochure form if showing
		if (brochureFormShowing) {
			toggleBrochureForm();
		}
		
		// shows the form div
		document.getElementById("emailFormDiv").style.display="block";
		emailFormShowing = true;
	}
}

function toggleBrochureForm() {
	if (brochureFormShowing) {
		// de-highlight the Request Brochure tab
		document.getElementById("brochureTab").style.background="#ffffff";
		document.getElementById("brochureLink").style.color="#8AA0B2";
		
		// hides the form div
		document.getElementById("brochureFormDiv").style.display="none";
		brochureFormShowing = false;
	} else {
		// highlight the Request Brochure tab
		document.getElementById("brochureTab").style.background="#eeeeee";
		document.getElementById("brochureLink").style.color="#006699";
		
		// hide the email form if showing
		if (emailFormShowing) {
			toggleEmailForm();
		}
		
		// shows the form div
		document.getElementById("brochureFormDiv").style.display="block";
		brochureFormShowing = true;
	}
}

function validateEmailForm() {
	if (document.emailForm.txtUserName.value=="") {
		alert("Please provide your Name.");
		document.emailForm.txtUserName.focus();
		return (false);
	}
	if (document.emailForm.txtUserEmail.value=="") {
		alert("Please type in your Phone number.");
		document.emailForm.txtUserEmail.focus();
		return (false);
	}
	if (document.emailForm.txtUserEmail.value.indexOf("@") == -1) {
		alert("Email Address must contain @");
		document.emailForm.txtUserEmail.focus();
		return (false);
	}
	if (document.emailForm.txtUserEmail.value.indexOf(".") == -1) {
		alert("Email Address must contain a DOT");
		document.emailForm.txtUserEmail.focus();
		return (false);
	}
	if (document.contactForm.txtSendToEmail.value=="") {
		alert("Please type in the recipient's Email address.");
		document.emailForm.txtSendToEmail.focus();
		return (false);
	}
	if (document.emailForm.txtSendToEmail.value.indexOf("@") == -1) {
		alert("Email Address must contain @");
		document.emailForm.txtSendToEmail.focus();
		return (false);
	}
	if (document.emailForm.txtSendToEmail.value.indexOf(".") == -1) {
		alert("Email Address must contain a DOT");
		document.emailForm.txtSendToEmail.focus();
		return (false);
	}
return (true);
}

function validateBrochureForm() {
	if (document.brochureForm.Name.value=="") {
		alert("Please provide your Name.");
		document.brochureForm.Name.focus();
		return (false);
	}
	if (document.brochureForm.Email.value=="") {
		alert("Please type in your Email address.");
		document.brochureForm.Email.focus();
		return (false);
	}
	if (document.brochureForm.Email.value.indexOf("@") == -1) {
		alert("Email Address must contain @");
		document.brochureForm.Email.focus();
		return (false);
	}
	if (document.brochureForm.Email.value.indexOf(".") == -1) {
		alert("Email Address must contain a DOT");
		document.brochureForm.Email.focus();
		return (false);
	}
return (true);
}