function zipCheck(field, country, zipForm) {

	//var zipCheck = /^\d{5}(-\d{4})?$/;
	// the ZipCheck array sequence is: <not used>, USA, Canada, AUS (so far...append as needed)
	//var zipCheck = new Array (/[\da-zA-Z]/,/^\d{5}\b$/,/^[a-zA-Z]\d[a-zA-Z]\s\d[a-zA-Z]\d\b$/,/^\d{4}\b$/);
	//var zipErrorMsg = new Array ('<this country not used>','USA','Canadian','Australian');
	if (!zipForm.test(field.value)) {
		alert('Your Zip code is formatted incorrectly.  Please enter a valid zip code for ' + country + '.');
		field.focus();
		return false;
	}
	return true;
}


function checkNum(field,length,title) {

	var digits = "0123456789";
	var tempVal = field.value;

	for (i = 0; i < length; i++) {
		if (digits.indexOf(tempVal.charAt(i)) <= -1) {
			alert("You have a non-numeric character in the " + title + " field.  Please re-enter it.");
			field.value = "";
			field.focus();
			return false;
		}
	}
	return true;
}


function swapClass(field,newClass) {

	if (document.getElementById) {
		document.getElementById(field).className = newClass;
	} else {
		return;
	}
}



function formatPhone(fieldName, format, countryID) {
	var regEx = /[^\d]/gi;
	var basePhone	= 	fieldName.value;
	var oldPhone	= 	basePhone.replace(regEx,'');

	var phACOpen	= 	format.substr(0,1);
	var phACDig	= 	parseInt(format.substr(1,1));
	var phACClose	= 	format.substr(2,1) + ' ';
	var phExDigit	= 	parseInt(format.substr(3,1));
	var phExSep	= 	format.substr(4,1);
	var phLastDg	= 	parseInt(format.substr(5,1));

	var newPhone	= 	phACOpen;
	newPhone 	+=	oldPhone.substr(0,phACDig);
	newPhone	+= 	phACClose;
	newPhone 	+=	oldPhone.substr(phACDig,phExDigit);
	newPhone	+= 	phExSep;
	newPhone 	+=	oldPhone.substr(phACDig + phExDigit,phLastDg);

	if(countryID != 4)  {
		fieldName.value	=	newPhone;
	}
}


function checkEmail(field) {

	var tempStr = field.value;

	var atCheck = 0;

	for (i = 0; i < tempStr.length; i++) {
		if (tempStr.charAt(i) == "@") {
			atCheck++;
		}
	}

	if (atCheck != 1) {
		alert("You have entered an invalid email address.  Please try again.");
		field.focus();
		return false;
	} else {
		return true;
	}
}


function phoneFormat(obj) {

	var tempnum = obj.value;
	var tnLen = tempnum.length;
	var numArray = new Array();
	var digits = "0123456789";
	var num = "";

	for (i = 0; i < tnLen; i++) {
		if (digits.indexOf(tempnum.charAt(i)) != -1) {
			num += tempnum.charAt(i);
		}
	}

	var result = "";

	if (num.length != 0)  {
		result = "(";
		var ini = num.substring(0,3);
		result += ini+") ";
		var st = num.substring(3,6);
		result += st+"-";
		var end = num.substring(6,10);
		result += end;
		if (num.length > 10) {
			var ext = num.substring(10,num.length);
			result += " ext. " + ext;
		}
	}

	obj.value = result;
}


function hasClass(obj) {

	var result = false;


	if (obj.className != null) {


		result = obj.className.value;
	}


	return result;

}