function validateregistrantinfo()
{
var fToCheck = document.updateContactInfo;

var iMinLen;

var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var organization = fToCheck.organization;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalcode = fToCheck.postalcode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var phone2 = fToCheck.phone2;
var email = fToCheck.email;

	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}

	}

// check required fields		
	if(reqFieldsPopulated(name1, name2, organization, address1, city, state, postalcode, phone1, email) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}


	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

 	// check that fax is at leaset 7 chars long if it is there
	iMinLen = 7;
	if( (phone2.value != null && phone2.value != "") && (isMinLen(phone2, iMinLen) == false))
	{
		alert("The fax number must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check email
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}

	return true;
}
function validatePurchaseFormOrder() {
	
		var fToCheck = document.orderProcessing;
		var serviceBox = fToCheck.serviceBox;
		var infoBox = fToCheck.infoBox;
		var paymentMethod = fToCheck.paymentMethod;
		//var creditCardType = fToCheck.elements[2]; // Use "elements" because field name is dynamo-generated
		var cvv2 = fToCheck.cvv2;
		var salesRepCode = fToCheck.salesRepCode;
		var verisignOrderNumber = fToCheck.verisignOrderNumber;
		var purchaseOrderNumber = fToCheck.purchaseOrderNumber;
		var website = fToCheck.website;
		var selectCreditCardType = fToCheck.selectCreditCardType;
		var verisignAuthNeeded = fToCheck.verisignAuthNeeded;

		//alert("paymentMethod.value = " + paymentMethod.value);
		//alert("website.value = " + website.value);
		//alert("verisignAuthNeeded.value = " + verisignAuthNeeded.value);
		
		// check if Card ID Number is entered for cards that require it
		if(paymentMethod.value == "CREDIT CARD") {
			if (	(selectCreditCardType.value == "VISA") || (selectCreditCardType.value == "MASTERCARD") || (selectCreditCardType.value == "AMERICAN EXPRESS") ) {
					if (cvv2.value == "") {
							alert("For American Express, Visa, or MasterCard, please enter a Card ID Number.");
							return false;
					}
			}
		}
	
	
		// check Service Agreement box
		if( serviceBox != null && !(serviceBox.checked)) {
			alert("Please read and agree to the service agreement and click the checkbox.");
			return false;
		}
	}
	function convertToStateCodePayment()
	{
		
		var fToCheck = document.orderProcessing;

		var city = fToCheck.city;
		var state = fToCheck.state;
		var countryIndex = fToCheck.country.selectedIndex;
		var country = fToCheck.country.options[countryIndex].value;

		if(country == "US")
		{
			if(state.value.length > 2 && isValidUSStateName(state))
			{
				//alert(state.value)
				//alert(isValidUSStateName(state))
				//alert(convertState(state.value))
				state.value = convertState(state.value)
			}
			else if(state.value.length == 2 && isValidUSStateCode(state))
			{
				state.value = state.value.toUpperCase();
			}
		}
	}
function validatedomaindefault() {
	
		var fToCheck = document.domainDefaultConfig;
		var forwardToUrl = fToCheck.forwardToUrl;
		var staticIp = fToCheck.staticIp;
		var emailFwd = fToCheck.emailFwd;

		if(staticIp != null && staticIp.value!="" && isValidIP(staticIp.value) == false) {
			alert("IP address is not valid");		
			staticIp.focus();			
			return false;
		}

		if(forwardToUrl!=null && forwardToUrl.value!="" && isValidURL(forwardToUrl.value) == false) {
			alert("Not a valid URL");
			forwardToUrl.focus();
			return false;
		}

		if(emailFwd != null && emailFwd.value && isValidEmail(emailFwd.value) == false) {
			alert("The e-mail address you entered is not a valid address.");
			emailFwd.focus();
			return false;
		}

		return true;
	}
function validateforwardIPAddress()
{
	
	var fToCheck = document.StaticIP;
	var fwdIP = fToCheck.staticip;
	if(fwdIP == null || fwdIP.value == "")
		{
			alert("Please enter a valid IP address");
			return false;
		}

		/*alert("fwdIP.value " + fwdIP.value);*/
		if(isValidIP(fwdIP.value) == false)
		{
			alert("IP address is not valid");		
			fwdIP.focus();			
			return false;
		}
	
		return true;
}
function validateForwardURL()
{
	
	var fToCheck = document.fwdToURL;
	var fwdURL = fToCheck.newURL;
	
	if(fwdURL == null || fwdURL.value == "")
	{
		alert("Please enter a valid URL");
		return false;
	}
		
	if(isValidURL(fwdURL.value) == false)
	{
		alert("Not a valid URL");
		fwdURL.focus();
		return false;
	}
	return true;
}

function setButtonClicked(btn)
{
	buttonClicked.value = btn.name;
}

function validateArecord(fToCheck)
{
	
var ip=fToCheck.ip;

	if(buttonClicked.value = "update")
	{
		// all are required
		if(reqFieldsPopulated(ip) == false)
		{
			alert("Please fill out all required fields.");
			return false;
		}

		if(isValidIP(ip.value) == false)
		{
			ip.focus();
			return false;
		}
	}

	return true;
}

function validateAddArecord()
{
	
var fToCheck = document.addArecord;
var hostname=fToCheck.hostname;
var ip=fToCheck.ip;

	if(reqFieldsPopulated(hostname, ip) == false)
	{
		alert("Please fill out all required fields.");
		return false;
	}

	if(isAlphaNumericDotOrDash(hostname.value) == false)
	{
		alert("Please enter a valid host name.");
		hostname.focus();
		return false;
	}

	if(isValidIP(ip.value) == false)
	{
		ip.focus();
		alert("Please enter a valid IP address.");
		return false;
	}

	//alert("validation was successful");
	return true;
}

function validateCname(fToCheck)
{
	
var pointsto=fToCheck.pointsto;

	if(buttonClicked.value = "update")
	{
		// all are required
		if(reqFieldsPopulated(pointsto) == false)
		{
			alert("Please fill out all required fields.");
			return false;
		}

		if(isValidHostName(pointsto.value) == false)
		{
			pointsto.focus();
			return false;
		}
	}

	return true;
}

function validateAddCname()
{
	alert ("In validateAddCname");
var fToCheck = document.addCname;
var hostname=fToCheck.hostname;
var pointsto=fToCheck.pointsto;

		//alert("hostname = " + hostname);
		//alert("pointsto = " + pointsto);

	if(reqFieldsPopulated(hostname, pointsto) == false)
	{
		alert("Please fill out all required fields.");
		return false;
	}

	if(isAlphaNumericDotOrDash(hostname.value) == false)
	{
		hostname.focus();
		alert("Please enter a valid host name.");
		return false;
	}

	if(isValidHostName(pointsto.value) == false)
	{
		pointsto.focus();
		return false;
	}


	return true;
}
function validateMXUpdate(fToCheck)
{
	
var pointsto=fToCheck.newmailgoesto;
var preference=fToCheck.preference;

	if(buttonClicked.value = "update")
	{
		// all are required
		if(reqFieldsPopulated(pointsto, preference) == false)
		{
			// we have a problem so let the user know and get out
			alert("Please fill out all required fields.");
			return false;
		}

		if(isValidHostName(pointsto.value) == false)
		{
			// we have a problem so let the user know and get out
			alert("That is not a valid hostname.");
			pointsto.focus();
			return false;
		}

		if(isNumeric(preference.value) == false)
		{
			// we have a problem so let the user know and get out
			alert("Preference must be a number.");
			preference.focus();
			return false;
		}

		//preference must be numeric
		if(isNumeric(preference.value) == false)
		{
			// we have a problem so let the user know and get out
			alert("Preference must be a number between 0 and 999.");
			preference.focus();
			return false;
		}
	}

	return true;
}

function validateMXAdd()
{
	
var fToCheck = document.addMX;
var hostname=fToCheck.hostname;
var pointsto=fToCheck.pointsto;
var preference=fToCheck.preference;



	// all are required
	if(reqFieldsPopulated(pointsto, preference) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	//preference must be numeric
	if(isNumeric(preference.value) == false)
	{
		// we have a problem so let the user know and get out
		alert("Preference must be a number between 0 and 999.");
		preference.focus();
		return false;
	}

	if(isValidHostName(pointsto.value) == false)
	{
		// we have a problem so let the user know and get out
		alert("That is not a valid hostname.");
		pointsto.focus();
		return false;
	}

	return true;
}
function validateModifyNameServers()
{
	
	var ns = document.newNameServer.nameserver;
	var ip =	document.newNameServer.ipAddr;
	if(ip.value != "emptyIP")
	{
		if(reqFieldsPopulated(ns,ip) == false)
		{
			alert("You must enter a valid host name or valid IP Address.");
			return false;
		}
	}// check required fields		
	else 
	{
		if(reqFieldsPopulated(ns) == false)
		{
			alert("You must enter a valid host name.");
			return false;
		}
	}
	
	var dns1 = "dns1.namesecure.com";
	var dns2 = "dns2.namesecure.com";
	if( (ns.value.toLowerCase() == dns1) || (ns.value.toLowerCase() == dns2) ) 
	{
		alert("You cannot forward to NameSecure's nameservers manually.");
		ns.focus();
		return false;
	}


	if(isValidHostName(ns.value) == false)
	{
		//alert("That Host Name is not valid.");
		// the validation routine has alert messages in it
		ns.focus();
		return false;
	}
	if(ip.value != "emptyIP")
	{
		if(isValidIP(ip.value) == false)
		{
			alert("The IP Address is not valid.");
			// the validation routine has alert messages in it
			ip.focus();
			return false;
		}
	}
}

function validatePop3()
{
	
	var fToCheck = document.additionalEmail;
	var mailbox=fToCheck.alias.value;
	if(!isValidMailBox(mailbox))
	{
		// alert("Invalid Mail Box name.");
		mailbox.value = "";
		return false;
	}

	return true;
}

function checkAllSynchServ(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("sync") != -1  ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAllSynchServ(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("sync") != -1  ) {
			theElement.checked = false;
		}	
	}
}
// for updateMultipleDomains.jhtml
function checkAllUpdateMultipledomain(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("domain") != -1  ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAllUpdateMultipledomain(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("domain") != -1  ) {
			theElement.checked = false;
		}	
	}
}


//for makePayment.jhtml
function convertToStateCodePayment()
	{
		
		var fToCheck = document.makePayment;

		var city = fToCheck.city;
		var state = fToCheck.state;
		var countryIndex = fToCheck.country.selectedIndex;
		var country = fToCheck.country.options[countryIndex].value;

		if(country == "US")
		{
			if(state.value.length > 2 && isValidUSStateName(state))
			{
				//alert(state.value)
				//alert(isValidUSStateName(state))
				//alert(convertState(state.value))
				state.value = convertState(state.value)
			}
			else if(state.value.length == 2 && isValidUSStateCode(state))
			{
				state.value = state.value.toUpperCase();
			}
		}
	}

	function validatePurchaseFormPayment() {
	
	var fToCheck = document.makePayment;
	var serviceBox = fToCheck.serviceBox;
	var creditCardType = fToCheck.creditCardType;
	//alert("******* creditCardType = " + creditCardType.value );
	var cvv2 = fToCheck.cvv2;

	// check Service Agreement box
		if(!(serviceBox.checked)) {
			alert("Please read and agree to the service agreement and click the checkbox.");
			return false;
		}
	
	//alert( "cc type = " + creditCardType.value );
	// check if Card ID Number is entered for cards that require it
		if (	(creditCardType.value == "VISA") ||
					(creditCardType.value == "MASTERCARD") ||
					(creditCardType.value == "AMERICAN EXPRESS") ) {
				// alert(creditCardType.value);
				if (cvv2.value == "") {
						alert("For American Express, Visa, or MasterCard, please enter a Card ID Number.");
						return false;
				}
		}
	}
function checkMaxLength(txtArea, maxChars)
{
	
	if (txtArea.value.length >= maxChars) {
		alert("The Message max length is 255 characters.");
		txtArea.blur();
	}
}

function validateSupport()
{
	
var iMinLen;

var fToCheck = document.supportForm;

var category = fToCheck.category;

var firstName = fToCheck.firstName;
var lastName = fToCheck.lastName;
var email = fToCheck.email;
var comment = fToCheck.comment;

	// check category menu
	if(category.options[category.selectedIndex].value == null || category.options[category.selectedIndex].value == "")
	{
		// we have a problem so let the user know and get out
		alert("Please select a category from the menu.");
		return false;
	}

	// check required fields
	if(reqFieldsPopulated(firstName, lastName, email, comment) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}
	
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}
	
	// check length of comment (needs to be fewer than 3000 characters)
	if(comment.value.length > 2999)
	{
		alert("Please limit your question or comment to fewer than 3000 characters.");
		return false;
	}

	return true;
}

//for billingInfo.jhtml
function validateBilling()
{

var fToCheck = document.billingInfoUpdate;

var iMinLen;

var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalCode = fToCheck.postalCode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var email = fToCheck.email;
var saveCC = fToCheck.saveCC;
var creditCard = fToCheck.creditCard;
var creditCardType = fToCheck.creditCardType;


	// check required fields		
	if(reqFieldsPopulated(name1, name2, address1, city, state, postalCode, phone1, email) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}


	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check email
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}
	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}

	}


	return true;
}

	function convertToStateCodeBilling()
	{
		
		var fToCheck = document.billingInfoUpdate;

		var city = fToCheck.city;
		var state = fToCheck.state;
		var countryIndex = fToCheck.country.selectedIndex;
		var country = fToCheck.country.options[countryIndex].value;

		if(country == "US")
		{
			if(state.value.length > 2 && isValidUSStateName(state))
			{
				//alert(state.value)
				//alert(isValidUSStateName(state))
				//alert(convertState(state.value))
				state.value = convertState(state.value)
			}
			else if(state.value.length == 2 && isValidUSStateCode(state))
			{
				state.value = state.value.toUpperCase();
			}
		}
	}

//for changepassword.jhtml
function validateChangePasswordModify()
{
	
var iMinLen;

var fToCheck = document.changePassword;

var currentPassword = fToCheck.currentPassword;
var password = fToCheck.password;
var confirmPassword = fToCheck.confirmPassword;
//var email = fToCheck.email;

	// check required fields
	if(reqFieldsPopulated(currentPassword, password, confirmPassword) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	// check for spaces in password
	if(password.value.indexOf(" ") >= 0)
	{
		// password contains at least one space
		alert("Your password cannot contain spaces.");
		password.value = "";
		confirmPassword.value = "";
		password.focus();

		return false;		
	}
	// check that passwords match
	if(fieldsAreEqual(password, confirmPassword) == false)
	{
		// we have a problem so let the user know and get out
		alert("The passwords do not match.");
		return false;
	}

	// check that passwords are at leaset 4 chars long
	iMinLen = 4;
	if(isMinLen(password, iMinLen) == false)
	{
		// we have a problem so let the user know and get out
		alert("The password must be at least " + iMinLen + " characters long.");
		//the password was already cleared
		confirmPassword.value = "";
		return false;
	}


	return true;
}
//for nsregistration.jhtml
function prepopulate(fieldToCopy)
{
	
	sConvertVal = fieldToCopy;	
	return sConvertVal;
}

function convertToStateCodensregistration()
{
	
var fToCheck = document.register;

var city = fToCheck.city;
var state = fToCheck.state;
var countryIndex = fToCheck.country.selectedIndex;
var country = fToCheck.country.options[countryIndex].value;

	if(country == "US")
	{
		if(state.value.length > 2 && isValidUSStateName(state))
		{
			//alert(state.value)
			//alert(isValidUSStateName(state))
			//alert(convertState(state.value))
			state.value = convertState(state.value)
		}
		else if(state.value.length == 2 && isValidUSStateCode(state))
		{
			state.value = state.value.toUpperCase();
		}
	}
}

function validatensregistration()
{
	
var iMinLen;

var fToCheck = document.register;

var login = fToCheck.login;
var email = fToCheck.email;
var secretAns = fToCheck.secretAnswer;
var password = fToCheck.password;
var confirmPassword = fToCheck.password2;
var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var organization = fToCheck.organization;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalcode = fToCheck.postalcode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var phone2 = fToCheck.phone2;

	// check required fields
	if(reqFieldsPopulated(login, email, secretAns, password, confirmPassword) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}
	
	// check for spaces in password
	if(password.value.indexOf(" ") >= 0)
	{
		// password contains at least one space
		alert("Your password cannot contain spaces.");
		password.value = "";
		confirmPassword.value = "";
		password.focus();

		return false;		
	}
	// check for spaces in password
	if(login.value.indexOf(" ") >= 0)
	{
		// password contains at least one space
		alert("Your user name cannot contain spaces.");
		login.value = "";
		login.focus();

		return false;		
	}

	// check that user name is at leaset 3 chars long
	iMinLen = 3;
	if(isMinLen(login, iMinLen) == false)
	{
		alert("The user name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that passwords match
	if(fieldsAreEqual(password, confirmPassword) == false)
	{
		alert("The passwords do not match.  Please try again.");
		return false;
	}

	// check that passwords are at leaset 4 chars long
	iMinLen = 4;
	if(isMinLen(password, iMinLen) == false)
	{
		alert("The password must be at least " + iMinLen + " characters long.");
		//the password was already cleared
		confirmPassword.value = "";
		return false;
	}

	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}
	//ensures user didn't change the corrected input
	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("Please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}
	}
	

// check required fields

	if(reqFieldsPopulated(name1, name2, address1, city, state, postalcode, phone1) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}


	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The first name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The last name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}


	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

 	// check that fax is at leaset 7 chars long if it is there
	iMinLen = 7;
	if( (phone2.value != null && phone2.value != "") && (isMinLen(phone2, iMinLen) == false))
	{
		alert("The fax number must be at least " + iMinLen + " characters long.");
		return false;
	}

	return true;
}
//for requestLoginInfo.jhtml
function validateRequestInfo()
{
	
var iMinLen;

var fToCheck = document.faxForm;

var oldEmail = fToCheck.oldEmail;
var newEmail = fToCheck.newEmail;
var domainName = fToCheck.domainName;
var phoneNumber = fToCheck.phoneNumber;
var fullname = fToCheck.fullname;

	// check required fields
	if(reqFieldsPopulated(oldEmail, newEmail, domainName, fullname, phoneNumber) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}
	

	if(isValidDomainName(domainName.value) == false)
	{
		alert("The domain name you entered is not valid.");
		domainName.focus();
		return false;
	}	
	
	if(isValidEmail(oldEmail.value) == false)
	{
		alert("The old e-mail address you entered is not a valid address.");
		oldEmail.focus();
		return false;
	}

		if(isValidEmail(newEmail.value) == false)
	{
		alert("The new e-mail address you entered is not a valid address.");
		newEmail.focus();
		return false;
	}

	return true;
}
//for updatePassword.jhtml
function validateChangePasswordUpdate()
{
	
var iMinLen;

var fToCheck = document.changePassword;

var password = fToCheck.password;
var confirmPassword = fToCheck.confirmPassword;
//var email = fToCheck.email;

	// check required fields
	if(reqFieldsPopulated(password, confirmPassword) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	// check for spaces in password
	if(password.value.indexOf(" ") >= 0)
	{
		// password contains at least one space
		alert("Your password cannot contain spaces.");
		password.value = "";
		confirmPassword.value = "";
		password.focus();

		return false;		
	}
	// check that passwords match
	if(fieldsAreEqual(password, confirmPassword) == false)
	{
		// we have a problem so let the user know and get out
		alert("The passwords do not match.");
		return false;
	}

	// check that passwords are at leaset 4 chars long
	iMinLen = 4;
	if(isMinLen(password, iMinLen) == false)
	{
		// we have a problem so let the user know and get out
		alert("The password must be at least " + iMinLen + " characters long.");
		//the password was already cleared
		confirmPassword.value = "";
		return false;
	}


	return true;
}

//for validateSecretQuestion.jhtml
function validateSecretQuestion()
{
	
	var fToCheck = document.changePassword;
	var secretAnswer = fToCheck.secretAnswer;
	
	if(reqFieldsPopulated(secretAnswer) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	return true;
}
// for autoRenew.jhtml & lockProtect.jhtml
function checkAll(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAll(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null) {
			theElement.checked = false;
		}	
	}
}
//for namePrivacySettings.jhtml
function checkAllPrivacySettings(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("cstatus-") != -1  ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAllPrivacySettings(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("cstatus-") != -1  ) {
			theElement.checked = false;
		}	
	}
}
//for renewalCenter.jhtml
function checkAllRenewalCenter(form)
{
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("renew") != -1  ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAllRenewalCenter(form)
{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("renew") != -1  ) {
			theElement.checked = false;
		}	
	}
}
//for metatag_update.jhtml
function foundInvalidChar(fieldToCheck)
{
	
	// check for < 
	if(fieldToCheck.value.indexOf("<",0) >= 0)
	{
		alert("You cannot enter the character < in the " + fieldToCheck.name + " field.");
		fieldToCheck.focus();
		return true;
	}

	// check for >
	if(fieldToCheck.value.indexOf(">",0) >= 0)
	{
		alert("You cannot enter the character > in the " + fieldToCheck.name + " field.");
		fieldToCheck.focus();
		return true;
	}

	// check for /
	if(fieldToCheck.value.indexOf("/",0) >= 0)
	{
		alert("You cannot enter the character / in the " + fieldToCheck.name + " field.");
		fieldToCheck.focus();
		return true;
	}
	
	// check for "
	if(fieldToCheck.value.indexOf('\"',0) >= 0)
	{
		alert("You cannot enter the character \" in the " + fieldToCheck.name + " field.");
		fieldToCheck.focus();
		return true;
	}

	return false;
}

function validateMetaTag()
{
var fToCheck = document.metaTags;
var desc = fToCheck.description;
var title = fToCheck.title;
var keywords = fToCheck.keyword;

	// check for < > / "
	if(foundInvalidChar(title) == true)
	{
		return false;
	}

	if(foundInvalidChar(desc) == true)
	{
		return false;
	}

	if(foundInvalidChar(keywords) == true)
	{
		return false;
	}

	return true;
}
//for mxrecords_change.jhtml
function validateUpdateMxChange(fToCheck)
{
var pointsto=fToCheck.newmailgoesto;
var preference=fToCheck.preference;

	if(buttonClicked.value = "update")
	{
		// all are required
		if(reqFieldsPopulated(pointsto, preference) == false)
		{
			// we have a problem so let the user know and get out
			alert("Please fill out all required fields.");
			return false;
		}

		if(isValidHostName(pointsto.value) == false)
		{
			// we have a problem so let the user know and get out
			alert("That is not a valid hostname.");
			pointsto.focus();
			return false;
		}

		if(isNumeric(preference.value) == false)
		{
			// we have a problem so let the user know and get out
			alert("Preference must be a number.");
			preference.focus();
			return false;
		}

		//preference must be numeric
		if(isNumeric(preference.value) == false)
		{
			// we have a problem so let the user know and get out
			alert("Preference must be a number between 0 and 999.");
			preference.focus();
			return false;
		}
	}

	return true;
}

function validateAddMxChange()
{
var fToCheck = document.addMX;
var hostname=fToCheck.hostname;
var pointsto=fToCheck.pointsto;
var preference=fToCheck.preference;



	// all are required
	if(reqFieldsPopulated(pointsto, preference) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	//preference must be numeric
	if(isNumeric(preference.value) == false)
	{
		// we have a problem so let the user know and get out
		alert("Preference must be a number between 0 and 999.");
		preference.focus();
		return false;
	}

	if(isValidHostName(pointsto.value) == false)
	{
		// we have a problem so let the user know and get out
		alert("That is not a valid hostname.");
		pointsto.focus();
		return false;
	}

	return true;
}
//for AdminContactInfo.jhtml
function convertToStateCodeInsertAdmin()
{
	convertToStateCodeMultipleAdmin(document.insertContactInfo);
}



function convertToStateCodeMultipleAdmin(aForm)
{
	
var fToCheck = aForm;

var city = fToCheck.city;
var state = fToCheck.state;
var countryIndex = fToCheck.country.selectedIndex;
var country = fToCheck.country.options[countryIndex].value;
var email = fToCheck.email;

	if(country == "US")
	{
		if(state.value.length > 2 && isValidUSStateName(state))
		{
			//alert(state.value)
			//alert(isValidUSStateName(state))
			//alert(convertState(state.value))
			state.value = convertState(state.value)
		}
		else if(state.value.length == 2 && isValidUSStateCode(state))
		{
			state.value = state.value.toUpperCase();
		}
	}
}

function validateInsertAdmin()
{
	return validateMultipleAdmin(document.insertContactInfo);
}

function validateMultipleAdmin(fToCheck)
{
	
var iMinLen;

var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var organization = fToCheck.organization;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalcode = fToCheck.postalcode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var phone2 = fToCheck.phone2;
var email = fToCheck.email;

	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}
	}

// check required fields		
	if(reqFieldsPopulated(name1, name2, address1, city, state, phone1, email) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

 	// check that fax is at leaset 7 chars long if it is there
	iMinLen = 7;
	if( (phone2.value != null && phone2.value != "") && (isMinLen(phone2, iMinLen) == false))
	{
		alert("The fax number must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check email
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}

	return true;
}

//for ModifyAccount.jhtml
function convertToStateCodeInsertModify()
{
	convertToStateCodeMultipleModify(document.insertContactInfo);
}



function convertToStateCodeMultipleModify(aForm)
{
	
var fToCheck = aForm;

var city = fToCheck.city;
var state = fToCheck.state;
var countryIndex = fToCheck.country.selectedIndex;
var country = fToCheck.country.options[countryIndex].value;
var email = fToCheck.email;

	if(country == "US")
	{
		if(state.value.length > 2 && isValidUSStateName(state))
		{
			//alert(state.value)
			//alert(isValidUSStateName(state))
			//alert(convertState(state.value))
			state.value = convertState(state.value)
		}
		else if(state.value.length == 2 && isValidUSStateCode(state))
		{
			state.value = state.value.toUpperCase();
		}
	}
}


function validateInsertModify()
{
	return validateMultipleModify(document.insertContactInfo);
}

function validateMultipleModify(fToCheck)
{
	
var iMinLen;

var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var organization = fToCheck.organization;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalcode = fToCheck.postalcode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var phone2 = fToCheck.phone2;
var email = fToCheck.email;

	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}
	}

// check required fields		
	if(reqFieldsPopulated(name1, name2, address1, city, state, postalcode, phone1, email) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

 	// check that fax is at leaset 7 chars long if it is there
	iMinLen = 7;
	if( (phone2.value != null && phone2.value != "") && (isMinLen(phone2, iMinLen) == false))
	{
		alert("The fax number must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check email
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}

	return true;
}
//for TechContactInfo.jhtml
function validateUpdateTech()
{
	return validateTech(document.updateContactInfo);
}

function validateTech(fToCheck)
{
	
var iMinLen;

var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var organization = fToCheck.organization;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalcode = fToCheck.postalcode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var phone2 = fToCheck.phone2;
var email = fToCheck.email;

	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}
	}
	

	
// check required fields
	if(reqFieldsPopulated(name1, name2, address1, city, state, phone1, email) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}


	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

 	// check that fax is at leaset 7 chars long if it is there
	iMinLen = 7;
	if( (phone2.value != null && phone2.value != "") && (isMinLen(phone2, iMinLen) == false))
	{
		alert("The fax number must be at least " + iMinLen + " characters long.");
		return false;
	}


	// check email
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}

	return true;
}
function convertToStateCodeInsertTech()
{
	convertToStateCodeMultipleTech(document.insertContactInfo);
}

function convertToStateCodeMultipleTech(aForm)
{
var fToCheck = aForm;

var city = fToCheck.city;
var state = fToCheck.state;
var countryIndex = fToCheck.country.selectedIndex;
var country = fToCheck.country.options[countryIndex].value;

	if(country == "US")
	{
		if(state.value.length > 2 && isValidUSStateName(state))
		{
			//alert(state.value)
			//alert(isValidUSStateName(state))
			//alert(convertState(state.value))
			state.value = convertState(state.value)
		}
		else if(state.value.length == 2 && isValidUSStateCode(state))
		{
			state.value = state.value.toUpperCase();
		}
	}
}

function newWindow(minisitegif) {
		minisiteWindow = window.open(minisitegif, 'minisiteWin', 'width=787,height=790')
		minisiteWindow.focus()
	}

function trim(str){
		while (str.charAt(str.length-1)==' ')
			{str=str.substring(0,str.length-1);}
		while (str.charAt(0)==' ')
			{str=str.substring(1);}
		return str;
	}

function validateDomainSearchBox()
	{
		var fToCheck = document.selection;
		var domainname = fToCheck.search;
		var domainnameStr = trim(domainname.value);

		if(domainname == null || domainname.value == "" || domainnameStr == "")
		{
			alert("Please enter a Domain Name.");
			return false;
		}
			
		return true;
	}
	function validateDomainSearchBoxName()
	{
		var fToCheck = document.selection;
		var domainname = fToCheck.search;
		var domainnameStr = trim(domainname.value);
		var domainname2 = fToCheck.search2;
		var domainnameStr2 = trim(domainname2.value);

		if((domainname == null || domainname.value == "" || domainnameStr == "") || (domainname2 == null || domainname2.value == "" || domainnameStr2 == "")) 
		{
			alert("Please enter two names.");
			return false;
		}
			
		return true;
	}
function convertToStateCodeUpdate()
{
	convertToStateCodeMultipleAdmin(document.updateContactInfo);
}

function validateUpdate()
{
	return validateMultipleAdmin(document.updateContactInfo);
}

function validatecart()
{

var fToCheck = document.existingDomain;
var domainName = fToCheck.search;

 if(!isValidDomainName(domainName.value)) {
	alert("The domain name provided is invalid.");
	return false;
 }
}


   
//for cartCustomizeReg.jhtml
function checkAllPrivateReg(form)
{
	
	if(form.checkAll.checked == true)
	{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("checkBoxPrivacy") != -1  ) {
			theElement.checked = true;
		}	
	}
	
	}else{
		for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("checkBoxPrivacy") != -1  ) {

			theElement.checked = false;
		}	
	}


	}
}

//for cartAddServiceBody
function checkAllServiceBody(form)
{
	if(form.checkAll.checked == true)
	{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];
		if(theElement.name.indexOf("hostingPackage")!= -1){
		if( theElement.name != null) {
			theElement.checked = true;
		}	
		}
	}
	}else{
		for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];
		if(theElement.name.indexOf("hostingPackage")!= -1){
		if( theElement.name != null) {

			theElement.checked = false;
		}	
	}
	}


	}
}
function checkAllEmailBoxes(form)
{
	if(form.checkAllEmail.checked == true)
	{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];
		 if (theElement.name.indexOf("emailPackage")!= -1)
		{
			if( theElement.name != null) {
				theElement.checked = true;
			}	
		}
	}
	}else{
		for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];
		 if (theElement.name.indexOf("emailPackage")!= -1)
		{
		if( theElement.name != null) {

			theElement.checked = false;
		}	
		}
	}


	}
}

function updateSelectBoxes(index,form)
{
	
	if(form.checkAll.checked == true)
	{
		
	for( i=0; i<document.cc2.elements.length; i++) {
		theElement = cc2.elements[i];
		 if (theElement.name.indexOf("droplets")!= -1 && theElement.name.indexOf("_")== -1)
		{
			theElement.selectedIndex = index;
		}
	}
	}
}

function updateEmailBoxes(index,form)
{
	if(form.checkAllEmail.checked == true)
	{
		
	for( i=0; i<document.cc2.elements.length; i++) {
		theElement = cc2.elements[i];
		 if (theElement.name.indexOf("emailItemSelected")!= -1 && theElement.name.indexOf("_")== -1)
		{
			theElement.selectedIndex = index;
		}
	}
	}
}


function updateEmailQuantityBoxes(index,form)
{
	if(form.checkAllEmail.checked == true)
	{
		for( i=0; i<document.cc2.elements.length; i++)
		{
			theElement = cc2.elements[i];
			if (theElement.name.indexOf("attributeValue")!= -1 && theElement.name.indexOf("services")!= -1)
			{
				theElement.selectedIndex = index;
			}
		}
	
	}
}
//for Clearing the contents in the textbox
function clearContents(form)
{
	form.search.value = "";
}


//for autoRenew.jhtml
function checkAllAutoRenewItems(form)
{
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("checkboxRenew") != -1  ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAllAutoRenewItems(form)
{
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("checkboxRenew") != -1  ) {
			theElement.checked = false;
		}	
	}
}

//for manageAutoRenew.jhtml
function validateBillingInfo()
{

var fToCheck = document.autoRenew;

var iMinLen;

var name1 = fToCheck.name1;
var name2 = fToCheck.name2;
var address1 = fToCheck.address1;
var city = fToCheck.city;
var state = fToCheck.state;
var postalCode = fToCheck.postalCode;
var country = fToCheck.country;
var phone1 = fToCheck.phone1;
var email = fToCheck.email;
var saveCC = fToCheck.saveCC;
var creditCard = fToCheck.creditCard;
var creditCardType = fToCheck.creditCardType;


	// check required fields		
	if(reqFieldsPopulated(name1, name2, address1, city, state, postalCode, phone1, email, creditCard, creditCardType) == false)
	{
		// we have a problem so let the user know and get out
		alert("Please fill out all required fields.");
		return false;
	}


	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name1, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that name is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(name2, iMinLen) == false)
	{
		alert("The name must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that city is at leaset 1 chars long
	iMinLen = 1;
	if(isMinLen(city, iMinLen) == false)
	{
		alert("The city must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that state is at leaset 2 chars long
	iMinLen = 2;
	if(isMinLen(state, iMinLen) == false)
	{
		alert("The state must be at least " + iMinLen + " characters long.");
		return false;
	}
	// check that phone is at leaset 7 chars long
	iMinLen = 7;
	if(isMinLen(phone1, iMinLen) == false)
	{
		alert("The phone number must be at least " + iMinLen + " characters long.");
		return false;
	}

	// check email
	if(isValidEmail(email.value) == false)
	{
		alert("The e-mail address you entered is not a valid address.");
		email.focus();
		return false;
	}
	if(country.value == "US")
	{
		if(state.value.length > 2)
		{
			alert("please use the 2 digit state code.");
			state.value = "";
			state.focus();
			return false;
		}
		else if(isValidUSStateCode(state) == false)
		{
			alert(state.value + " is not a valid US state code.");
			state.value = "";
			state.focus();
			return false;
		}
		if(isValidUSPostalCode(postalcode) == false) {
			alert("The postal code you entered is invalid.");
			return false;		
		}

	}


	return true;
}


//for manageBulkDNS.jhtml
function checkAllBulkDNSItems(form)
{
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("checkboxNS") != -1  ) {
			theElement.checked = true;
		}	
	}
}

function uncheckAllBulkDNSItems(form)
{
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

		if( theElement.name != null && theElement.name.indexOf("checkboxNS") != -1  ) {
			theElement.checked = false;
		}	
	}
}

// For Renewal Notifications

function checkAllRenewalNotices(form)
{
	if(form.checkAll.checked == true)
	{
	
	for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];
			theElement.checked = true;
		}
	}
	else{
		for( i=0; i<form.elements.length; i++) {
		theElement = form.elements[i];

			theElement.checked = false;
	}
	}
}

function disableTextBox(form)
{
	var isDisabled = form.alternateEmail.disabled;
	if(isDisabled == true)
	{
		form.alternateEmail.disabled = false;
	}else{
		form.alternateEmail.disabled =true;
		form.alternateEmail.value="";
	}
}
