<!--
//Misc utilities for use in site


/****************************************************
	FORM VALIDATION FUNCTIONS
	***************************************************/
	
function validateForm(formName,requiredFieldsArray) {
	var ret=true;
	
	//loop through fields array
	for (i in requiredFieldsArray){
		var fieldName = requiredFieldsArray[i];
		var fieldSource = document[formName][fieldName];
		
		if((fieldSource.value.length < 1 || fieldSource.value == 'required') && fieldSource.selectedIndex != 0 ){
			setTextFocus(fieldSource);
			//alert(fieldName + " is required.");
			ret=false;
		}/**/
		if(fieldSource.selectedIndex == 0){
			setSelectFocus(fieldSource);
			//alert(fieldName " is required.");
			ret=false;
		}
	}
	
	if(ret==false){
		alert("Please fill in all required fields.");
	}
	return ret;
}
function setTextFocus(source){
	source.style.backgroundColor = 'FFFFCC';
	source.style.color = 'red';
	source.value = 'required';
}
function resetFocus(source){
	if (source.style.color=='red'  ){/*|| source.selectedIndex == 0*/
		source.parentNode.style.display = '';
		source.style.backgroundColor='';
		source.style.color = '';
		source.value = '';
	}
}
function setSelectFocus(source){
	//source = document.ClientInfo.BreedID;
	source.parentNode.style.display = '';
	source.style.color = 'red';
	source.style.backgroundColor = 'FFFFCC';
	//source.text = 'required';
}

	/***** for updating passwords **********/
	
function confirmPassword(formName,field1,field2){
	/* 	The fields should follow the following format:
			document.Form_Name.Field_Name */
	pNew = field1.value; //document.formName.field1.value
	pConf = field2.value;// document.formName.field2.value
	
	// confirm that the passwrod is at least 4 chars long
	confirmPasswordLength(pNew,pConf);
	
	// confirm that the passwords match
	if (pNew != pConf){
		field2.value = '';
		alert("The passwords did not match.  Please re-confirm your password.");
		return false;
	}
}

function confirmPasswordLength(field1value,field2value){
	// confirm that the password is at least 4 chars long
	if (field1value.length < 4 ){
		field2value = '';
		alert("Your Password must be at least 4 characters long.");
		return false;
	}
}

//-->