// COMMON JAVASCRIPT FUNCTIONS

function cleartext()
	{
	document.SearchForm.search.value = "";
	}

function IsObject(obj) {
	if (document.all(obj) != null) {
		return true;
	}
	return false;
}

function GetObject(obj) {

	isNS4 = (document.layers) ? true : false;
	isIE4 = (document.all && !document.getElementById) ? true : false;
	isIE5 = (document.all && document.getElementById) ? true : false;
	isNS6 = (!document.all && document.getElementById) ? true : false;

	if (isNS4) {
	   elem = document.layers[obj];
	}
	else if (isIE4) {
	   elem = document.all[obj];
	}
	else if (isIE5 || isNS6) {
	   elem = document.getElementById(obj);
	}

	return elem;
}

function goSelectBox(field,url) {
	var x = GetObject(field).value;
	var redirect = url + '&' + field + '=' + x;
	window.location = redirect;
}

function doDelete(id,url,qs) {
	var redirect = "";
	var action = "Delete";
	var del = window.confirm('Are you sure you want to delete this item?');
	if (del) {
		if (isEmpty(qs)) {
			redirect = url + '?ac=' + action + '&ai=' + id;
		}
		else {
			redirect = url + '?' + qs + '&ac=' + action + '&ai=' + id;
		}
		window.location = redirect;
	}
}

function doCategoryDelete(id,url,qs) {
	var redirect = "";
	var action = "DeleteCategory";
	var del = window.confirm('Are you sure you want to delete this category?');
	if (del) {
		if (isEmpty(qs)) {
			redirect = url + '?ac=' + action + '&ai=' + id;
		}
		else {
			redirect = url + '?' + qs + '&ac=' + action + '&ai=' + id;
		}
		window.location = redirect;
	}
}

function doFileDelete(id,file,url,qs) {
	var redirect = "";
	var action = "DeleteFile";
	var del = window.confirm('Are you sure you want to delete this file?');
	if (del) {
		if (isEmpty(qs)) {
			redirect = url + '?ac=' + action + '&ai=' + id + '&af=' + file;
		}
		else {
			redirect = url + '?' + qs + '&ac=' + action + '&ai=' + id + '&af=' + file;
		}
		window.location = redirect;
	}
}

function doCheckBox(action,id,url,qs) {
	var redirect = "";
	if (isEmpty(qs)) {
		redirect = url + '?ac=' + action + '&ai=' + id;
	}
	else {
		redirect = url + '?' + qs + '&ac=' + action + '&ai=' + id;
	}
	window.location = redirect;
}

function doSelect(field,url,qs) {
	var prefix = "";
	var redirect = "";
	var x = GetObject(field).value;
	if (!isEmpty(qs)) {
		prefix = "&";
	}
	var redirect = url + '?' + qs + prefix + field + '=' + x;
	window.location = redirect;
}

function doNavSelect(field,pageurl,url) {
	var prefix = "";
	var redirect = "";
	var x = GetObject(field).value;
	var p = url.indexOf(field);
	var newurl = "";
	if (p > 0) {
		newurl = url.substring(0,p - 1);
	} else {
		if (p == 0) {
			newurl = "";
		}
		else {
			newurl = url
		}
	}
	if (newurl != "") {
		var prefix = "&";
	}
	redirect = pageurl + "?" + newurl + prefix + field + "=" + x;
	if (IsObject("pn") == true) {
		redirect = redirect + "&pn=" + GetObject("pn").value + "&ps=" + GetObject("ps").value;
	}
	window.location = redirect;
}

function doSelectOption(field,url,qs) {
	var prefix = "";
	var redirect = "";
	var x = GetObject(field).value;
	var pn = GetObject("pn").value;
	var ps = GetObject("ps").value;
	if (!isEmpty(qs)) {
		var prefix = "&";
	}
	redirect = url + "?" + qs + prefix + "pn=" + pn + "&ps=" + ps + "&sb=" + field + "&so=" + x;
	window.location = redirect;
}

function doNav(pageurl,url) {
	var prefix = "";
	var redirect = "";
	var pn = GetObject("pn").value;
	var ps = GetObject("ps").value;
	if (!isEmpty(url)) {
		var prefix = "&";
	}
	redirect = pageurl + "?" + url + prefix + "pn=" + pn + "&ps=" + ps;
	window.location = redirect;
}

function checkUncheckAll(theElement) {
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++) {
		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') {
			theForm[z].checked = theElement.checked;
		}
	}
}

function changePage() {
	if (isInteger(GetObject("page").value)) return true;
	return false;
}

function setFocus(field) {
	field.focus();
}

function formSave(form) {
	GetObject(form).submit();
}

function formToggle(state,field) {
	var checkboxes = eval(field)
	for (a=0; a < checkboxes.length; a++)
		checkboxes[a].checked = state
}

function openWindow(url) {
	x = window.open(url,'PopupWindow','width=450,height=450,top=100,left=100,scrollbars=yes,resizable=yes');
}

function openPromoWindow(url) {
	x = window.open(url,'PromoWindow','width=466,height=520,top=80,left=80,scrollbars=yes,resizable=yes');
}

function openReportWindow(url) {
	x = window.open(url,'ReportWindow','width=800,height=600,top=10,left=10,scrollbars=yes,resizable=yes');
}

function openFormWindow(url) {
	x = window.open(url,'FormWindow','status=1,width=600,height=500,top=80,left=40,scrollbars=yes,resizable=yes');
}

function confirmDelete() {
	return window.confirm('Are you sure you want to delete these items?');
}

function isEmpty(s) {
	return ((s == null) || (s.length == 0))
}

function isWhitespace(s) {
	if (isEmpty(s)) return true;
	var i;
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	}
	return true;
}

function isBlank(s) {
	if (!isEmpty(s)) return false;
	if (!isWhitespace(s)) return false;
	return true;
}

function isAlphaNumeric(s) {
	var i;
	var validchars = "abcdefghijklmnopqrstuvwxyz0123456789";
	for (i = 0; i < s.length; i++) {
		var c = s.charAt(i);
		var d = validchars.indexOf(c);
		if (d < 0) {
			return false;
		}
	}
	return true;
}

function validEmail(s) {

	if (isEmpty(s)) return false;
//	if (isWhitespace(s)) return false;

	var i = 1;
	var sLength = s.length;

	while ((i < sLength) && (s.charAt(i) != "@"))
	{ i++
	}

	if ((i >= sLength) || (s.charAt(i) != "@")) return false;
	else i += 2;

	while ((i < sLength) && (s.charAt(i) != "."))
	{ i++
	}

	if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
	else return true;
}

function validateInteger(s) {
	if (!isInteger(s.value)) {
		s.focus();
		s.select();
		alert("Please enter a number.");
		return false;
	}
	return true;
}

function validateDouble(s) {
	if (!isFloat(s.value)) {
		s.focus();
		s.select();
		alert("Please enter a number with two decimal places.");
		return false;
	}
	return true;
}

function checkDate(field) {

	var checkstr = "0123456789";
	var DateField = field;
	var Datevalue = "";
	var DateTemp = "";
	var seperator = "/";
	var day;
	var month;
	var year;
	var leap = 0;
	var err = 0;
	var i;
	err = 0;

	DateValue = DateField.value;

	for (i = 0; i < DateValue.length; i++) {
		if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
			DateTemp = DateTemp + DateValue.substr(i,1);
		}
	}

	DateValue = DateTemp;

	if (DateValue.length == 6) {
		DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2);
	}

	if (DateValue.length != 8) {
		err = 19;
	}

	year = DateValue.substr(4,4);

	if (year == 0) {
		err = 20;
	}

	month = DateValue.substr(2,2);

	if ((month < 1) || (month > 12)) {
		err = 21;
	}

	day = DateValue.substr(0,2);
	if (day < 1) {
		err = 22;
	}

	if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
		leap = 1;
	}

	if ((month == 2) && (leap == 1) && (day > 29)) {
		err = 23;
	}

	if ((month == 2) && (leap != 1) && (day > 28)) {
		err = 24;
	}

	if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
		err = 25;
	}

	if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
		err = 26;
	}

	if ((day == 0) && (month == 0) && (year == 00)) {
		err = 0; day = ""; month = ""; year = ""; seperator = "";
	}

	if (err == 0) {
		DateField.value = day + seperator + month + seperator + year;
	} else {
		alert("Date format is incorrect. Please enter another date.");
		DateField.select();
		DateField.focus();
		return false;
	}
}

function validateFeedbackForm() {

	x = window.document.FeedbackForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter a contact name.");
		return false;
	}

	x = window.document.FeedbackForm.Email;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter a valid email address (ie. info@mangoes.com.au).");
		return false;
	}
}

function validatePageForm() {

}

function validateArticleForm() {

}

function validateEventForm() {

}

function validateDocumentForm() {

}

function validateRecipeForm() {

}

function validateImageForm() {

}

function validateLinkForm() {

}

function validateLoginForm() {

	x = window.document.LoginForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

	x = window.document.LoginForm.Password;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your password.");
		return false;
	}

}

function validateCategoryForm() {

	x = window.document.CategoryForm.Name;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter category name.");
		return false;
	}

}

function validateGroupForm() {

	x = window.document.GroupForm.DisplaySeq;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter display sequence.");
		return false;
	}

	x = window.document.GroupForm.Name;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter group name.");
		return false;
	}

}

function validateProductForm() {

	x = window.document.ProductForm.Name;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter product name.");
		return false;
	}

	x = window.document.ProductForm.COST;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter COST.");
		return false;
	}
	
	x = window.document.ProductForm.RES;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter RES.");
		return false;
	}
	
	x = window.document.ProductForm.GOV;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter GOV.");
		return false;
	}

	x = window.document.ProductForm.RRP;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter RRP.");
		return false;
	}

	objField = window.document.ProductForm.COST;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("COST must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

	objField = window.document.ProductForm.RES;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("RES must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

	objField = window.document.ProductForm.GOV;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("GOV must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

	objField = window.document.ProductForm.RRP;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("RRP must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

}

function validateOptionForm() {

	x = window.document.OptionForm.Name;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter option name.");
		return false;
	}

	x = window.document.OptionForm.COST;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter COST.");
		return false;
	}
	
	x = window.document.OptionForm.RES;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter RES.");
		return false;
	}
	
	x = window.document.OptionForm.GOV;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter GOV.");
		return false;
	}

	x = window.document.OptionForm.RRP;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter RRP.");
		return false;
	}

	objField = window.document.OptionForm.COST;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("COST must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

	objField = window.document.OptionForm.RES;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("RES must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

	objField = window.document.OptionForm.GOV;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("GOV must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

	objField = window.document.OptionForm.RRP;
	var strField = new String(objField.value);
	var i = 0;
	for (i = 0; i < strField.length; i++)
		if ((strField.charAt(i) < '0' || strField.charAt(i) > '9') && (strField.charAt(i) != '.')) {
			alert("RRP must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
			objField.focus();
			objField.select();
			return false;
	}

}

function validateItemForm() {

	x = window.document.CategoryForm.Name;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter category name.");
		return false;
	}

}

function validateItemForm() {

	x = window.document.CategoryForm.Name;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter category name.");
		return false;
	}

}

function validateEmailForm() {

	x = window.document.EmailForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.EmailForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

	x = window.document.EmailForm.RecipientAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter the recipients address.");
		return false;
	}

}

function validateResellerInquiryForm() {

	x = window.document.ResellerInquiryForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.ResellerInquiryForm.BusinessName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter business name.");
		return false;
	}

	x = window.document.ResellerInquiryForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

}

function validateResellerOrderForm() {

	x = window.document.ResellerOrderForm.InvoiceTo;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter invoice to.");
		return false;
	}

	x = window.document.ResellerOrderForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.ResellerOrderForm.BusinessName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter business name.");
		return false;
	}

	x = window.document.ResellerOrderForm.Address1;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter street address.");
		return false;
	}

	x = window.document.ResellerOrderForm.Suburb;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter suburb.");
		return false;
	}

	x = window.document.ResellerOrderForm.State;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter state.");
		return false;
	}

	x = window.document.ResellerOrderForm.Postcode;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter post code.");
		return false;
	}

	x = window.document.ResellerOrderForm.Phone;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter phone number.");
		return false;
	}

	x = window.document.ResellerOrderForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

}

function validateGovernmentInquiryForm() {

	x = window.document.GovernmentInquiryForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.GovernmentInquiryForm.BusinessName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter government department.");
		return false;
	}

	x = window.document.GovernmentInquiryForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

}

function validateGovernmentOrderForm() {

	x = window.document.GovernmentOrderForm.InvoiceTo;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter invoice to.");
		return false;
	}

	x = window.document.GovernmentOrderForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.GovernmentOrderForm.BusinessName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter government department.");
		return false;
	}

	x = window.document.GovernmentOrderForm.Address1;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter street address.");
		return false;
	}

	x = window.document.GovernmentOrderForm.Suburb;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter suburb.");
		return false;
	}

	x = window.document.GovernmentOrderForm.State;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter state.");
		return false;
	}

	x = window.document.GovernmentOrderForm.Postcode;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter post code.");
		return false;
	}

	x = window.document.GovernmentOrderForm.Phone;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter phone number.");
		return false;
	}

	x = window.document.GovernmentOrderForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

}

function validatePublicInquiryForm() {

	x = window.document.PublicInquiryForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.PublicInquiryForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

}

function validatePublicOrderForm() {

	x = window.document.PublicOrderForm.InvoiceTo;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter invoice to.");
		return false;
	}

	x = window.document.PublicOrderForm.ContactName;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter contact name.");
		return false;
	}

	x = window.document.PublicOrderForm.Address1;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter street address.");
		return false;
	}

	x = window.document.PublicOrderForm.Suburb;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter suburb.");
		return false;
	}

	x = window.document.PublicOrderForm.State;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter state.");
		return false;
	}

	x = window.document.PublicOrderForm.Phone;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter phone number.");
		return false;
	}

	x = window.document.PublicOrderForm.Postcode;
	if (isBlank(x.value)) {
		x.focus();
		x.select();
		alert("Please enter post code.");
		return false;
	}

	x = window.document.PublicOrderForm.EmailAddress;
	if (!validEmail(x.value)) {
		x.focus();
		x.select();
		alert("Please enter your email address.");
		return false;
	}

}

function validateTextBox(objField, Message)
{
	if (isBlank(objField.value)) {
		objField.focus();
		objField.select();
		alert(Message);
		return false;
	}
	else {
		return true;
	}
}

function validateSelectBox(objField, Message)
{
	var myIndex = objField.selectedIndex;
	if (myIndex==0) {
		objField.focus();
		alert(Message);
		return false;
	}
	else {
		return true;
	}

}

function validateEmailBox(objField, Message)
{
	if (!validEmail(objField.value)) {
		objField.focus();
		objField.select();
		alert(Message);
		return false;
	}
	else {
		return true;
	}
}

function validateRegistrationForm() {
	
	if (!validateSelectBox(window.document.RegistrationForm.UserTypeID, "Please choose account type.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.ContactName, "Please enter contact name.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.BusinessName, "Please enter business name.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.Address1, "Please enter address.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.Suburb, "Please enter suburb.")) {
		return false;
	}
	if (!validateSelectBox(window.document.RegistrationForm.CountryID, "Please choose your country.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.Postcode, "Please enter post code.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.Phone, "Please enter phone number.")) {
		return false;
	}
	if (!validateEmailBox(window.document.RegistrationForm.EmailAddress, "Please enter a valid email address.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.Password, "Please enter password.")) {
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.Password2, "Please enter password confirmation.")) {
		return false;
	}
	if (window.document.RegistrationForm.Password2.value != window.document.RegistrationForm.Password.value) {
		window.document.RegistrationForm.Password.focus();
		window.document.RegistrationForm.Password.select();
		alert("Your passwords do not match. Please type more carefully.");
		return false;
	}
	if (!validateTextBox(window.document.RegistrationForm.captchacode, "Please enter security code.")) {
		return false;
	}

}

function validatePasswordForm() {
	if (!validateEmailBox(window.document.PasswordForm.EmailAddress, "Please enter a valid email address.")) {
		return false;
	}
}