<!--

// Function to check if a field string is empty
	
	function isEmptyField(srcField) {
		srcText = srcField.value;
		srcText = srcText.replace(/^\s+/g, '').replace(/\s+$/g, '');
		if(srcText == "") {
			srcField.value = "";
			return true;
		} else return false;
	}


// header search form

	function enterField(srcField,iniText) {
		if(srcField.value == iniText) srcField.value = "";
	}

	function exitField(srcField,iniText) {
		if(isEmptyField(srcField)) srcField.value = iniText;
	}

	function checkFormInput(srcField,iniText) {
		srcField = document.getElementById(srcField);
		if(isEmptyField(srcField) || srcField.value == iniText) {
			alert("You need to enter something!");
			return false;
		} else return true;
	}


// Print function

	function printPage() {
		if(window.print) {
			window.print();
		} else {
			alert("Your browser does not support the javascript 'print' function.\nPlease use your operating system's print menu to print this page.")
		}
		return false;
	}
	
	
// Image size checking + resizing

	function checkImageSize(srcImage,maxWidth,maxHeight) {
		if(document.images) {
			getWidth = srcImage.width;
			getHeight = srcImage.height;
			if(getWidth>maxWidth || getHeight>maxHeight) {
				widthVariance = maxWidth/getWidth;
				heightVariance = maxHeight/getHeight;
				if(widthVariance<=heightVariance) scalePercentage = getWidth/maxWidth;
				else scalePercentage = getHeight/maxHeight;
				srcImage.width = getWidth/scalePercentage;
				srcImage.height = getHeight/scalePercentage;
			}
		}
	}


//-->
