function validateForm(whichForm) {
	var boolIsValid = true;
	var strErrorMessage = "";
	//1) check for content with firstname, lastname, address, city, province, postalcode
	//2) if email is supplied, check format
	if (whichForm.to_fname.value == "") {
		strErrorMessage += "Please enter your friend's first name.\n";
		boolIsValid = false;
	}
	if (whichForm.to_lname.value == "") {
		strErrorMessage += "Please enter your friend's last name.\n";
		boolIsValid = false;
	}
	if (!validateEmail(whichForm.to_email.value)) {
		strErrorMessage += "Please enter a valid email address for your friend.\n";
		boolIsValid = false;
	}
	if (whichForm.from_fname.value == "") {
		strErrorMessage += "Please enter your first name.\n";
		boolIsValid = false;
	}
	if (whichForm.from_lname.value == "") {
		strErrorMessage += "Please enter your last name.\n";
		boolIsValid = false;
	}
	if (!validateEmail(whichForm.from_email.value)) {
		strErrorMessage += "Please enter a valid email address.\n";
		boolIsValid = false;
	}
	if (whichForm.from_phone.value == "") {
		strErrorMessage += "Please enter your phone number.\n";
		boolIsValid = false;
	}
	if (whichForm.from_address.value == "") {
		strErrorMessage += "Please enter your address.\n";
		boolIsValid = false;
	}
	if (whichForm.from_city.value == "") {
		strErrorMessage += "Please enter the name of your city.\n";
		boolIsValid = false;
	}
	if (whichForm.from_pcode.value == "") {
		strErrorMessage += "Please enter your postal code.\n";
		boolIsValid = false;
	}
	if (whichForm.from_message.value == "") {
		strErrorMessage += "Please enter your message.\n";
		boolIsValid = false;
	}
	/*if (whichForm.rules.checked != true) {
		strErrorMessage += "Please indicate that you have read the Rules and Regulations.\n";
		boolIsValid = false;
	}*/
	if (!boolIsValid) {
		alert(strErrorMessage);
	}
	return boolIsValid;
}

function submitForm(whichForm) {
	if (validateForm(whichForm)) {
		whichForm.submit();
	}
}

function validateEmail(strValue) {
	//var strEmailRegExp = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	//var objRegExp = new RegExp(strEmailRegExp);
	var objRegExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	return objRegExp.test(strValue);
}

function openWindow(content) {
	strWinParams = "status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=300,width=400";
	objWin = window.open(content+".cfm",content+"Window",strWinParams);
}