<!-- 
//******************** SUPPORT FUNCTIONS ********************/

function isAlphabetic(val){
	return (/^[A-Z]+$/i.test(val));}


function isAlphaNumeric(val){
	return (!/[^A-Z\d]/i.test(val) && /[A-Z]/i.test(val) && /[\d]/.test(val));}


function isDate(theField, pastOrFuture){
	var theDate = theField.value;
	// remove leading spaces
	while (theDate.indexOf(" ") == 0){
		theDate = theDate.substring(1);}
	// remove trailing spaces
	while (theDate.lastIndexOf(" ") == theDate.length-1){
		theDate = theDate.substring(0, theDate.length-1);}
	// check delimiters
	var delim1 = theDate.indexOf("/");
	if (delim1 == -1) delim1 = theDate.indexOf("-");
	if (delim1 == -1) delim1 = theDate.indexOf(" ");
	var delim2 = theDate.lastIndexOf("/");
	if (delim2 == -1) delim2 = theDate.lastIndexOf("-");
	if (delim2 == -1) delim2 = theDate.lastIndexOf(" ");
	if (delim1 == -1 || delim2 == -1 || delim1 == delim2) return false;
	
	var theDay = theDate.substring(0,delim1).toUpperCase();
	var theMonth = theDate.substring(delim1+1, delim2).toUpperCase();
	var theYear = theDate.substring(delim2+1);
	
	if (theDay.substring(theDay.length-2) == "ST" || theDay.substring(theDay.length-2) == "ND" || theDay.substring(theDay.length-2) == "RD" || theDay.substring(theDay.length-2) == "TH"){
		theDay = theDay.substring(0, theDay.length-2);}
	
	if (theDay <= 0 || theDay > 31 || isNaN(theDay)) return false;
	if ((theYear.length != 2 && theYear.length != 4) || isNaN(theYear)) return false;
	
	if (theYear < 70) theYear = "20" + theYear;
	else if (theYear < 100) theYear = "19" + theYear;

	var theMon = 0;
	var textMonth;
	if (theMonth == "JAN" || theMonth == "JANUARY" || theMonth == "01" || theMonth == "1") {
		theMon = 1;
		textMonth = "01";}
	else if (theMonth == "FEB"  || theMonth == "FEBRUARY"|| theMonth == "02" || theMonth == "2") {
		theMon = 2;
		textMonth = "02";}
	else if (theMonth == "MAR" || theMonth == "MARCH" || theMonth == "03" || theMonth == "3") {
		theMon = 3;
		textMonth = "03";}
	else if (theMonth == "APR" || theMonth == "APRIL" || theMonth == "04" || theMonth == "4") {
		theMon = 4;
		textMonth = "04";}
	else if (theMonth == "MAY" || theMonth == "05" || theMonth == "5") {
		theMon = 5;
		textMonth = "05";}
	else if (theMonth == "JUN" || theMonth == "JUNE" || theMonth == "06" || theMonth == "6") {
		theMon = 6;
		textMonth = "06";}
	else if (theMonth == "JUL" || theMonth == "JULY" || theMonth == "07" || theMonth == "7") {
		theMon = 7;
		textMonth = "07";}
	else if (theMonth == "AUG" || theMonth == "AUGUST" || theMonth == "08" || theMonth == "8") {
		theMon = 8;
		textMonth = "08";}
	else if (theMonth == "SEP" || theMonth == "SEPT" || theMonth == "SEPTEMBER" || theMonth == "09" || theMonth == "9") {
		theMon = 9;
		textMonth = "09";}
	else if (theMonth == "OCT" || theMonth == "OCTOBER" || theMonth == "10") {
		theMon = 10;
		textMonth = "10";}
	else if (theMonth == "NOV" || theMonth == "NOVEMBER" || theMonth == "11") {
		theMon = 11;
		textMonth = "11";}
	else if (theMonth == "DEC" || theMonth == "DECEMBER" || theMonth == "12") {
		theMon = 12;
		textMonth = "12";}
	if (theMon == 0) return false;
   
	if (theMon == 1 || theMon == 3 || theMon == 5 || theMon == 7 || theMon == 8 || theMon == 10 || theMon==12) {
		if (theDay > 31) return false;}
	else if (theMon == 2) {
		if ((parseInt(theYear/4) != parseFloat(theYear/4) || (parseInt(theYear/100) == parseFloat(theYear/100) && parseInt(theYear/400) != parseFloat(theYear/400))) && theDay > 28) return false; 
		else if (theDay > 29)	return false;}
	else if (theDay > 30) return false;

	var todayDate = new Date();
	if (pastOrFuture.toUpperCase() == "P"){
		theDate = new Date(theYear, theMon-1, theDay, 23, 59, 59); 
		if (theDate > todayDate) return false}
	if (pastOrFuture.toUpperCase() == "F"){
		theDate = new Date(theYear, theMon-1, theDay, 0, 0, 0); 
		if (theDate < todayDate) return false}
      
	if (theDay < 10 && theDay.substring(0,1) != 0) theDay = "0" + theDay;
	theField.value = theDay + "/" + textMonth + "/" + theYear; 
	return true;}


function isEmail(val){
	var i;
	// check for only 1 '@' in the address and split into username and domain
	var arrEmail = val.split('@');
	if (arrEmail.length != 2){
		return false;}
	var strUser = arrEmail[0];
	var strDomain = arrEmail[1];
	// check for invalid characters
	for (i=0; i<val.length; i++){
		if (val.charCodeAt(i) > 127){
			return false;}}
	// split username at '.' and then test each section for invalid characters or quoted
	var arrUser = strUser.split(".");
	for (i=0; i<arrUser.length; i++){
		if (arrUser[i].search(/^([^\s\\\(\)<>,;:\"\[\]]|(\"[^\"]+\"))+$/) == -1){
			return false;}}
	// check if domain is an IP address '[10.123.34.5]' and if so check it's valid
	var arrIPdom = strDomain.match(/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/);
	if (arrIPdom != null){
		var int255 = 0;
		var int0 = 0;
		// exclude '0.0.0.0' and '255.255.255.255'
		for (i=1; i<arrIPdom.length; i++){
			if (arrIPdom[i] > 255){
				return false;}
			if (arrIPdom[i] == 255){
				int255 += 1;}
			if (arrIPdom[i] == 0){
				int0 += 1;}}
		if (int255 == 4 || int0 == 4){
			return false;}
		return true;}
	// if standard domain split at '.' and check at least 2 parts and no invalid characters
	var arrDom = strDomain.split(".");
	if (arrDom.length < 2){
		return false;}
	for (i=0; i<arrDom.length; i++){
		if (arrDom[i].search(/^[^\s\\\(\)<>,;:\"\[\]]+$/) == -1){
			return false;}}
	return true;}


function isEmpty(val){
	return (val == null || val.length == 0 || isWhitespace(val));}


function isFloat(val){
	return (/^[\d]+\.?[\d]+$/.test(val));}


function isNumeric(val){
	return (/^[\d]+$/.test(val));}


function isWhitespace(val){
	return (/^[\s]+$/.test(val));}


//********** strip characters

function stripInitialWhitespace(val){
	var i = 0;
	while (i < val.length && isWhitespace(val.charAt(i)))
		i++;
	return val.substring (i, val.length);}


function stripInitialZeroes(val){
	var i = 0;
	while (i < val.length && val.charAt(i) == "0")
		i++;
	return val.substring (i, val.length);}


function stripCharsInBag(val, bag){
	var returnString = "";
	for (var i=0; i<val.length; i++){
		var c = val.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;}
	return returnString;}


function stripCharsNotInBag(val, bag){
	var returnString = "";
	for (var i=0; i<val.length; i++){
		var c = val.charAt(i);
		if (bag.indexOf(c) != -1) returnString += c;}
	return returnString;}


//********** re-format

function reformat(val){
	var arg;
	var valPos = 0;
	var resultString = "";
	
	for (var i=1; i<reformat.arguments.length; i++){
		arg = reformat.arguments[i];
		if (i%2 == 1) resultString += arg;
		else {
			resultString += val.substring(valPos, valPos + arg);
			valPos += arg;}}
	return resultString;}


function reformatUSZIPCode(val){
	if (val.length == 5) return val;
	else return reformat(val, "", 5, "-", 4);}


//********** warning messages

function warnEmpty(theField, theName){
	theField.value = "";
	theField.focus();
	alert("Please enter " + theName + "\nso we can submit your idea. \nThanks.");
	return false;}


function warnInvalid(theField, strMessage, emptyField){
	if (warnInvalid.arguments.length < 3) emptyField = false;
	if (emptyField == true)	theField.value = "";
	theField.focus();
	theField.select();
	alert(strMessage);
	return false;}


function warnLength(theField, theName, minLen, maxLen, exactLen, emptyField){
	if (warnLength.arguments.length < 6) emptyField = false;
	if (emptyField == true)	theField.value = "";
	theField.focus();
	if (exactLen != ""){
		alert("The " + theName + " field should be exactly " + exactLen + " characters in length.");}
	if (minLen != ""){
		alert("The " + theName + " field should be at least " + minLen + " characters in length.");}
	if (maxLen != ""){
		alert("The " + theName + " field should be no more than " + maxLen + " characters in length.");}
	return false;}


function warnNumeric(theField, theName, emptyField){
	if (warnNumeric.arguments.length < 3) emptyField = false;
	if (emptyField == true) theField.value = "";
	theField.focus();
	theField.select();
	alert("The " + theName + " field must be numeric.");
	return false;}


function warnValue(theField, theName, minVal, maxVal, emptyField){
	if (warnValue.arguments.length < 5) emptyField = false;
	if (emptyField == true)	theField.value = "";
	theField.focus();
	if (minVal != ""){
		alert("The smallest allowable value for the " + theName + " field is " + minVal + ".");}
	if (maxVal != ""){
		alert("The largest allowable value for the " + theName + " field is " + maxVal + ".");}
	return false;}

//******************** END SUPPORT FUNCTIONS ********************/


//******************** PUBLIC FUNCTIONS ********************/

//********** validate single field

function checkCheckbox(theField, theName){
	if(theField.length){
		for (var i=0; i<theField.length; i++){
			if (theField[i].checked) return true;
		}
		theField[0].focus();
	} else {
		if (theField.checked) return true;
		theField.focus();
	}
	alert("Please make a selection for '" + theName + "'");
	//alert("cbs :" + theField.length);
	return false;
}

function checkCheckboxCustom(theField, theName){
	if(theField.length){
		for (var i=0; i<theField.length; i++){
			if (theField[i].checked) return true;
		}
		theField[0].focus();
	} else {
		if (theField.checked) return true;
		theField.focus();
	}
	alert(theName);
	//alert("cbs :" + theField.length);
	return false;
}


function checkDate(theField, theName, pastOrFuture, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	if (pastOrFuture == "") pastOrFuture = "A";
	if (!isDate(theField, pastOrFuture)){
		return warnInvalid(theField, "The " + theName + " field must contain a valid date.");}	
	return true;}


function checkEmail(theField, theName, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	if (!isEmail(theField.value)){
		return warnInvalid(theField, "The " + theName + " field appears to contain an invalid email address.");}
	return true;}


function checkLength(theField, theName, minLen, maxLen, exactLen, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	if (exactLen != ""){
		if (theField.value.length != exactLen){
			return warnLength(theField, theName, "", "", exactLen);}}
	if (minLen != ""){
		if (theField.value.length < minLen){
			return warnLength(theField, theName, minLen, "", "");}}
	if (maxLen != ""){
		if (theField.value.length > maxLen){
			return warnLength(theField, theName, "", maxLen, "");}}
	return true;}


function checkNumeric(theField, theName, minVal, maxVal, floatOK, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	if (isNaN(theField.value)){
		return warnNumeric(theField, theName);}
	if (floatOK == false){
		if (!isNumeric(stripCharsInBag(theField.value,"-."))){
			return warnNumeric(theField, theName);}}			
	if (minVal != ""){
		if (parseFloat(theField.value) < minVal){
			return warnValue(theField, theName, minVal, "");}}
	if (maxVal != ""){
		if (parseFloat(theField.value) > maxVal){
			return warnValue(theField, theName, "", maxVal);}}
	return true;}


function checkPassword(theField, theName){
	if (!checkLength(theField, theName, 5, 12, "", false)) return false;
	if (!isAlphaNumeric(theField.value)){
		return warnInvalid(theField, "The " + theName + " field must be alphanumeric.\n(Contain only numbers and letters).");}
	return true;}


function checkPostcode(theField, theName, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	var arrPostcode = theField.value.split(' ');
	if (arrPostcode.length != 2){
		return warnInvalid(theField, "The " + theName + " entered is invalid. It must be a U.K. postcode (e.g. SN5 8RS)");}
	var strOutcode = arrPostcode[0];
	var strIncode = arrPostcode[1];
	if (!isAlphaNumeric(strOutcode) || !isAlphaNumeric(strIncode)){
		return warnInvalid(theField, "The " + theName + " entered is invalid.");}
	theField.value = theField.value.toUpperCase();
	return true;}


function checkPostcodeSection(theField, theName, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	theField.value = stripCharsInBag(theField.value," ");
	if (!isAlphaNumeric(theField.value)){
		return warnInvalid(theField, "The " + theName + " entered is invalid.");}
	theField.value = theField.value.toUpperCase();
	return true;
}


function checkSelect(theField, theName){
	//alert(theName);
	//if (theField.options[theField.selectedIndex].value == "" || theField.options[theField.selectedIndex].value.toLowerCase() == "null"){
	if (theField.selectedIndex==0) {
		alert("Please select an option for '" + theName + "'.\n");
		theField.focus();
		return false;
	}
	return true;
}


function checkRadio(theField, theName){

	checked = false;
	
	for (var i = 0; i < theField.length; i++)
	{
		if (theField[i].checked) {
			checked = true;
		}	
	}
	
	if (checked) {
		return true;
	} else {
		alert("Please select an option for '" + theName + "'.\n");
		theField[0].focus();
		return false;
	}
				
}


function checkString(theField, theName, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	return true;}


function checkTelephoneNumber(theField, theName, emptyOK){
	
	//further checking added by jon 
	//(it must stip () +- chars first)
	var testTelString = stripCharsInBag(theField.value,"() +-")
	var testTel = /(?:44|0)[127]\d{8,13}/.test(testTelString)
	//This checks for 44 OR 0, then 1, 2, (residential) or 7 mobile, then length of 8 or 13
	//alert(testTel);
	
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	if (!isNumeric(stripCharsInBag(theField.value,"() +-"))){
		return warnInvalid(theField, "The " + theName + " field contains invalid characters.\nThis field can only contain numbers and the following characters - () +-");}
	
	//further checking continuted, check after isNumeric, as it will pick up many of the errors that would trip this up.
	if (testTel == false){
		return warnInvalid(theField, "Please check that the primary telephone number you have provided is correct");}
		
	return true;}


function checkUSZIPCode (theField, theName, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	var ZIPCode = stripCharsInBag(theField.value, "-");
	if (!(isNumeric(ZIPCode) && (ZIPCode.length == 5 || ZIPCode.length == 9)))
		return warnInvalid(theField, "The " + theName + " field must be a 5 or 9 digit U.S. ZIP Code (e.g. 94043).");
	else {
		theField.value = reformatUSZIPCode(ZIPCode);
		return true;}}


//********** compare two fields

function checkCompareValues(fromField, toField, fromName, toName, equalOK, valType){
	var fromVal = fromField.value;
	var toVal = toField.value;
	
	if (valType == "numeric"){
		fromVal = parseFloat(fromVal);
		toVal = parseFloat(toVal);
		
		if (equalOK == true){
			if (toVal < fromVal){
				alert("The " + fromName + " field must be less than or equal to the " + toName + " field.");
				fromField.focus();
				return false;}
			return true;}
		else {
			if (toVal <= fromVal){
				alert("The " + fromName + " field must be less than the " + toName + " field.");
				fromField.focus();
				return false;}
			return true;}}
	if (valType == "date"){
		var fromDateArray = fromVal.split("/");
		var toDateArray = toVal.split("/");
	
		var fromDate = new Date(fromDateArray[2], parseInt(fromDateArray[1]) - 1, fromDateArray[0]);
		var toDate = new Date(toDateArray[2], parseInt(toDateArray[1]) - 1, toDateArray[0]);
	
		if (equalOK == true){
			if (toDate < fromDate){
				alert("The " + fromName + " field must be less than or equal to the " + toName + " field.");
				fromField.focus();
				return false;}
			return true;}
		else {
			if (toDate <= fromDate){
				alert("The " + fromName + " field must be less than the " + toName + " field.")
				fromField.focus();
				return false;}
			return true;}}}


function checkIdenticalValues(theField1, theName1, theField2, theName2, emptyField){
	if (theField1.value != theField2.value){
		if (emptyField == true){
			theField1.value = "";
			theField2.value = "";}
		theField1.focus();
		theField1.select();
		alert("The " + theName1 + " and " + theName2 + " fields must contain identical values.");
		return false;}
	return true;}


function checkEitherOrValues(theField1, theName1, theField2, theName2){
	if (isEmpty(theField1.value) && isEmpty(theField2.value)){
		alert("You must enter a value for either the " + theName1 + " field or the " + theName2 +" field.")
		theField1.focus();
		return false;}
	return true;}


function checkOptionalValues(theField1, theField2, theName1, theName2){
	if (isEmpty(theField1.value) && !(isEmpty(theField2.value))){
		alert("The " + theName1 + " field must also be entered if the " + theName2 + " field is filled in.");
		theField1.focus();
		return false;}
	if (isEmpty(theField2.value) && !(isEmpty(theField1.value))){
		alert("The " + theName2 + " field must also be entered if the " + theName1 + " field is filled in.");
		theField1.focus();
		return false;}
	return true;}


function checkOptionalValuesCheckbox(checkField, valField, checkName, valName){
	if (checkField.checked && isEmpty(valField.value)){
		alert("You must enter a value into the " + valName + " field when the " + checkName + " field has been selected.");
		valField.focus();
		return false;}
	else if(!checkField.checked && !isEmpty(valField.value)){
		alert("You have entered a value into the " + valName + " field, but haven't selected the " + checkName + " field.");
		checkField.focus();
		return false;}	
	return true;}


function checkOptionalValuesSelect(selField, valField, selName, valName){
	if (selField.options[selField.selectedIndex].value != "" && selField.options[selField.selectedIndex].value.toLowerCase() != "null" && isEmpty(valField.value)){
		alert("You must enter a value into the " + valName + " field when the " + selName + " field has been selected.");
		valField.focus();
		return false;}
	else if((selField.options[selField.selectedIndex].value == "" || selField.options[selField.selectedIndex].value.toLowerCase() == "null") && !isEmpty(valField.value)){
		alert("You have entered a value into the " + valName + " field, but haven't selected a value from the " + selName + " field.");
		selField.focus();
		return false;}	
	return true;}


//********** image upload

function checkImageUpload(theField, theName, maxSize, maxTotalSize, minWidth, minHeight, maxWidth, maxHeight, saveSize, saveTotalSize, saveWidth, saveHeight, saveValid, loadImage, clearSelect, emptyOK){
	if (emptyOK == true && isEmpty(theField.value)){
		theField.value = "";
		return true;}
	if (emptyOK == false && isEmpty(theField.value)) return warnEmpty(theField, theName);
	re = new RegExp(".(gif|jpg|jpeg|png)$","i");
	if (!re.test(theField.value)){
		alert("This image file type is not allowed.\nOnly the following file extensions are allowed: .gif, .jpg, .jpeg, .png");
		theField.focus();
		return false;}
	document.v5_form = theField.form;
	if (!document.layers){
		var imgURL = 'file:///' + theField.value.replace(/\\/gi,'/').replace(/:/gi,'|').replace(/"/gi,'').replace(/^\//,'');
		theField.gp_img = new Image();
		with (theField){
			gp_img.maxSize = maxSize*1024;
			gp_img.maxTotalSize = maxTotalSize;
			gp_img.minWidth = minWidth;
			gp_img.minHeight = minHeight;
			gp_img.maxWidth = maxWidth;
			gp_img.maxHeight = maxHeight;
			gp_img.saveSize = saveSize;
			gp_img.saveTotalSize = saveTotalSize;
			gp_img.saveWidth = saveWidth;
			gp_img.saveHeight = saveHeight;
			gp_img.saveValid = saveValid;
			gp_img.loadImage = loadImage;
			gp_img.clearSelect = clearSelect;
			gp_img.onload = imageLoaded;
			gp_img.src = imgURL;}}}


function imageLoaded(){
	var img = this;
	if (img.width > 0 && img.height > 0){
		document.v5_form[img.saveValid].value = "false";
		if (img.saveWidth != ''){
			document.v5_form[img.saveWidth].value = '';}
		if (img.saveHeight != ''){
			document.v5_form[img.saveHeight].value = '';}
		if (img.saveSize != ''){
			if (img.saveTotalSize != '' && document.v5_form[img.saveSize].value > 0){
				document.v5_form[img.saveTotalSize].value = parseInt(document.v5_form[img.saveTotalSize].value) - document.v5_form[img.saveSize].value;}}
		if (img.maxSize != '' && img.fileSize > img.maxSize){
			alert('The image file size is too large! (' + parseInt(img.fileSize/1024) + ' KBytes)\nIt should be no more than ' + (img.maxSize/1024) + ' KBytes');
			return;}
		if (img.maxTotalSize != '' && img.saveTotalSize != ''){
			if ((parseInt(document.v5_form[img.saveTotalSize].value) + parseInt(img.fileSize/1024)) > img.maxTotalSize){
				alert('The image file size is too large! (' + parseInt(img.fileSize/1024) + ' KBytes)\nYou can only upload a total image file size of ' + img.maxTotalSize + ' KBytes at any one time.\nYou have already selected images with a total size of ' + document.v5_form[img.saveTotalSize].value + ' KBytes, leaving ' + (img.maxTotalSize - document.v5_form[img.saveTotalSize].value) + ' KBytes available.\n\nIf you need to load more images please click the \'Save Changes + Return To This Property\' button below.');
				if (img.clearSelect != ''){
					document.v5_form[img.clearSelect].selectedIndex = 0;
					document.v5_form[img.clearSelect].onchange();}
				return;}
			else {
				document.v5_form[img.saveTotalSize].value = parseInt(document.v5_form[img.saveTotalSize].value) + parseInt(img.fileSize/1024);}}
		if (img.saveSize != ''){
			document.v5_form[img.saveSize].value = parseInt(img.fileSize/1024);}
		if (img.saveWidth != ''){
			document.v5_form[img.saveWidth].value = img.width;}
		if (img.saveHeight != ''){
			document.v5_form[img.saveHeight].value = img.height;}
		if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight != '' && img.minHeight > img.height)){
			alert('This image is too small!\nIt should be at least ' + img.minWidth + ' x ' + img.minHeight + ' (pixels)');
			return;}
		if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight != '' && img.height > img.maxHeight)){
			alert('This image is too big!\nIt should be no more than ' + img.maxWidth + ' x ' + img.maxHeight + ' (pixels)');
			return;}
		if (img.loadImage != ''){
			document.v5_form[img.loadImage].src = img.src;}
		document.v5_form[img.saveValid].value = "true";}}


//********** textarea counter

function textCounter(theField, maxLen, theCountField){
	if (theField.value.length > maxLen){
		theField.value = theField.value.substring(0, maxLen);
		theCountField.value = 0;
		alert("You have exceeded the maximum character limit for this field.");}
	else {
		theCountField.value = maxLen - theField.value.length;}}


//******************** END PUBLIC FUNCTIONS ********************/
// -->
