function alertWin(x, err) {
	h = eval("'height=" + (220 + (x * 10)) + ",width=380'");
	detail=open("","Alert",h);
	detail.document.writeln("<html>\n<title>Alert</title>\n<link href='../style.css' rel='stylesheet' type='text/css' media='screen' />");
	detail.document.writeln("\n<body>\n<h1>Errors:</h1>");
	detail.document.writeln("\n<h2>Please complete the following:</h2>");
	detail.document.writeln("\n<p>")
		for (i = 0; i < x; i++){
			detail.document.write((i+1) + "." + err[i] + "<br />\n");
		}
	detail.document.writeln("</p>")
	detail.document.write("\n<form>\n<input class='button' type='button' value='close window'" + "onclick='self.close()'>" + "\n</form>" + "\n</body>\n</html>");
}


function IsValidForm() {
	var err = new Array();
	var x=0;

	if (document.contact.name.value == ""){
		err[x] = " Please provide a contact name.";
		x = x + 1;
	}
	if (document.contact.company.value == ""){
		err[x] = " Please provide a company name.";
		x = x + 1;
	}
	if (document.contact.email.value == "" || 
		document.contact.email.value.indexOf('@', 0) == -1 ||
		document.contact.email.value.indexOf('.', 0) == -1){
		err[x] = " Please provide a valid email address.";
		x = x + 1;
	}
	if (x > 0){
		alertWin(x, err);
		return false;
	}
	return true
}