<!--

	function IsNumeric(strString)
	//  check for valid numeric strings	
	{
		var strValidChars = "0123456789-Xx";
		var strChar;
		var blnResult = true;	

		if (strString.length == 0) return false;

		//  test strString consists of valid characters listed above
		for (i = 0; i < strString.length && blnResult == true; i++)
			{
			strChar = strString.charAt(i);
			if (strValidChars.indexOf(strChar) == -1)
				{
					blnResult = false;
				}
			}
		return blnResult;
	}
	
	function validateThenSubmit() 
	{
					//if form is empty then display error
					if((document.getElementById('smallForm').search_isbn.value=="ISBN" || document.getElementById('smallForm').search_isbn.value=="") && (document.getElementById('smallForm').search_title.value=="title" || document.getElementById('smallForm').search_title.value=="") && (document.getElementById('smallForm').search_author.value=="author" || document.getElementById('smallForm').search_author.value=="") && (document.getElementById('smallForm').search_keyword.value=="keywords" || document.getElementById('smallForm').search_keyword.value=="")) {
						alert("You did not include any search criteria.\nPlease try again.");
						return false;
					}
					else if(!IsNumeric(document.getElementById('smallForm').search_isbn.value) && document.getElementById('smallForm').search_isbn.value!='ISBN' && document.getElementById('smallForm').search_isbn.value!='') {
						alert("The ISBN search criteria must be numeric.");
						return false;
					}
					else {
						clearFieldsandValidate();
						return true;
					}
	}
	
	function clearFieldsandValidate()
	{
		if (document.getElementById('smallForm').search_title.value == 'title') {document.getElementById('smallForm').search_title.value='';}
		if (document.getElementById('smallForm').search_author.value == 'author') {document.getElementById('smallForm').search_author.value='';}
		if (document.getElementById('smallForm').search_keyword.value == 'keywords') {document.getElementById('smallForm').search_keyword.value='';}
		if (document.getElementById('smallForm').search_isbn.value == 'ISBN') {document.getElementById('smallForm').search_isbn.value='';}
		document.getElementById('smallForm').search_isbn.value = stringFilter(document.getElementById('smallForm').search_isbn.value);
		
		document.getElementById('smallForm').submit();
	}
	
	function submitenter(myfield,e)
	{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13)
	   {
	   validateThenSubmit();
	   return false;
	   }
	else
	   return true;
	}
	
	//Strip out dashes from ISBN value
	function stringFilter(inputValue) {
		s = inputValue;
		filteredValues = "-";     // Characters stripped out
		var i;
		var returnString = "";
		for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
		var c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}
// -->