/*****************************************************************************
** Copyright (C) 2002, Stephen Gould 
**
** FILENAME:	contactus.js
** AUTHOR:		Stephen Gould
** COMMENCED:	08 Jun 2002
** MODIFIED:	03 Jul 2002
** DESCRIPTION:	javascript for dymanic menus in web pages for CWC
**
*****************************************************************************/

var sideHeading = "Contact Details";

var sideMenuArray = new Array(
		"Details", "", "../contactus/contactus.html",
		"Contact Form", "", "../contactus/contactform.html",
		"Meet our", "Key People", "../contactus/staff.html",
		"Request","Price List","../contactus/pricelistrequest.html"
);

var sideSubMenu = new Array();

sideSubMenu[0] = new Array();
sideSubMenu[1] = new Array();
sideSubMenu[2] = new Array();
sideSubMenu[3] = new Array();


/* Functions ****************************************************************/

function validate() {
	if (document.contactform.firstname.value == "") {
		alert("Your first name has not been entered.\n" +
			"Please complete this field before re-submitting.");
		document.contactform.firstname.focus();
		return (false);
	}

	if (document.contactform.lastname.value == "") {
		alert("Your last name has not been entered.\n" +
			"Please complete this field before re-submitting.");
		document.contactform.lastname.focus();
		return (false);
	}

	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(document.contactform.email.value))) { 
		alert("You have entered an invalid email address.\n" +
			"Please ensure that this field is\n" +
			"correct before re-submitting.");
		document.contactform.email.focus();
		return (false);
	}

	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (document.contactform.email.value.match(illegalChars)) {
		alert("You have entered an invalid email address.\n" +
			"Please ensure that this field is\n" +
			"correct before re-submitting.");
		document.contactform.email.focus();
		return (false);
	}

 	return (true);
}

function OpenImageWindow(filename) {
	var handle = window.open("", "ImageWindow", "height=650px,width=700px");
	handle.document.open("text/html", "replace");
	handle.document.write("<html><head><title>ImageWindow</title>");
	handle.document.write("<script language=\"javascript\" type=\"text/javascript\">");
	handle.document.write("</script>");
	handle.document.write("</head><body>");
	handle.document.write("<table cellpadding=0 cellspacing=0 border=0>");
	handle.document.write("<tr height=\"480px\"><td width=\"642px\" align=\"center\">");
	handle.document.write("<img src='../images/" + filename + "'></td></tr>");
	handle.document.write("<tr><td align=\"right\" style=\"font: 12px arial, san serif;\">");
	handle.document.write("<span style=\"cursor:hand;\" onClick=\"window.print();\">Print</span>");
	handle.document.write("<font color=red> | </font>");
	handle.document.write("<span style=\"cursor:hand;\" onClick=\"javascript:window.close();\">Close</span>");
	handle.document.write("</td></tr>");
	handle.document.write("</table>");
	handle.document.write("</body></html>");
	handle.document.close();
	handle.focus();
	return false;
}

/*****************************************************************************
** END OF FILE:	contactus.js
*****************************************************************************/