//************************//
//-----RICK HADLEY--------//
//---mongooseDesign.com---//
//-------02.04.04---------//
//************************//
function validateForm(){
	theForm = document.forms[0]
	theForm.submit()
	//alert("Form Submitted")
}

//************************//
//-----RICK HADLEY--------//
//---mongooseDesign.com---//
//-------02.04.04---------//
//************************//
function imageResize(imageSource, imageID){
	
	//alert('calling imageResize! imageID is: ('+imageID+') location: ('+imageSource+') !');
	//alert('original dimensions: ' + document.images[imageID].width + ' x ' + document.images[imageID].height);
	
	document.images[imageID].src = imageSource;
	imageWidth = document.images[imageID].width;
	imageHeight = document.images[imageID].height;

	if (imageWidth > 150){
		imageNewHeight = imageHeight*150/imageWidth;
		if (imageNewHeight > 100){
			imageNewWidth = imageWidth*100/imageHeight;
			imageNewHeight = 100;
		}else{
			imageNewWidth = 150;
			imageNewHeight = imageHeight*150/imageWidth;
		}
	}else{
		if(imageHeight > 100){
		imageNewWidth = imageWidth*100/imageHeight;
		imageNewHeight = 100;
		}else{
			//---SET THE NEW HEIGHT AND WIDTH VARABLES TO THE ORIGINAL VALUES---//
			imageNewHeight = imageHeight;
			imageNewWidth = imageWidth;
		};
	}
	imageNewHeight = Math.round(imageNewHeight);
	imageNewWidth = Math.round(imageNewWidth);
	
	document.images[imageID].width = imageNewWidth;
	document.images[imageID].height = imageNewHeight;
	document.images[imageID].style.visibility = "visible";
	
//************************//
//************************//
//
//---USE THE CODE BELOW TO CALL THE FUNCTION---//
//imageResize('PUT IMAGESOURCE INSIDE SINGLE QUOTES')
}

//************************//
//-----RICK HADLEY--------//
//---mongooseDesign.com---//
//-------05.16.05---------//
//************************//
function highlightField(fieldName, yesNo){
	//alert(fieldName)
	currentField = document.getElementById(fieldName)
	//IF SELECTED, CHANGE CLASSNAME
	if(yesNo==true){currentField.className = "formFieldSelected"}
	//IF UNSELECTED, RESTORE CLASSNAME
	if(yesNo!=true){currentField.className = "formField"}
}

//************************//
//-----RICK HADLEY--------//
//---mongooseDesign.com---//
//-------05.16.05---------//
//************************//
function formatField(fieldName, formatType){
	//--FORMAT TYPE CAN BE EITHER 'phone' OR 'dateStamp'
	currentField = document.getElementById(fieldName)
	originalValue = currentField.value
	currentValue = originalValue
	//FORMAT FOR A PHONE NUMBER
	if(formatType=="phone"){
		//REMOVE COMMONE EXTRAS
		matchExpArray = new Array(5)
		matchExpArray[0] = /\-/gi
		matchExpArray[1] = /\//gi
		matchExpArray[2] = /\./gi
		matchExpArray[3] = /\)/gi
		matchExpArray[4] = /\(/gi
		for(x=0;x<matchExpArray.length;x++){
			currentValue = currentValue.replace(matchExpArray[x], '')
		}
		//REMOVE THE FIRST '1' IF IT EXISTS
		if(currentValue.substr(0,1)==1){currentValue=currentValue.substr(1,currentValue.length)}
		if(currentValue.length==10){
			areaCode = currentValue.substr(0,3)
			cityCode = currentValue.substr(3,3)
			localCode = currentValue.substr(6,4)
			newValue = "(" + areaCode + ") " + cityCode + " - " + localCode
		}else{
			newValue = originalValue
		}
		//UPDATE FORM FIELD
		currentField.value = newValue
	}
	//FORMAT FOR A DATE
	if(formatType=="dateStamp"){
		newValue = currentValue
		//UPDATE FORM FIELD
		currentField.value = newValue
	}
}

