function IsNumeric(strString)

   //  check for valid numeric strings	

   {

   var strValidChars = "0123456789";

   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 formCheck(formobj){

	// Enter name of mandatory fields

	var fieldRequired = Array("arg");



	// Enter field description to appear in the dialog box

	var fieldDescription = Array("Keywords");

	// dialog message

	var alertMsg = "Please complete the following fields:\n";

	

	var l_Msg = alertMsg.length;

	

	for (var i = 0; i < fieldRequired.length; i++){

		var obj = formobj.elements[fieldRequired[i]];

		if (obj){

			switch(obj.type){

			case "select-one":

				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){

					alertMsg += " - " + fieldDescription[i] + "\n";

				}

				break;

			case "select-multiple":

				if (obj.selectedIndex == -1){

					alertMsg += " - " + fieldDescription[i] + "\n";

				}

				break;

			case "text":

			case "textarea":

				if (obj.value == "" || obj.value == null){

					alertMsg += " - " + fieldDescription[i] + "\n";

				}

				break;

			default:

			}

			if (obj.type == undefined){

				var blnchecked = false;

				for (var j = 0; j < obj.length; j++){

					if (obj[j].checked){

						blnchecked = true;

					}

				}

				if (!blnchecked){

					alertMsg += " - " + fieldDescription[i] + "\n";

				}

			}

		}

	}



	if(formobj.mode[0].checked){

		

		if(IsNumeric(formobj.arg.value)){

			

		} else { 

		alertMsg = (alertMsg.length == l_Msg)?"When searching by postcode, search term must be a number\n\n":alertMsg+"\n\nWhen searching by postcode, search term must be a number.\n";

	}

	}



	if (alertMsg.length == l_Msg){

		return true;

	}else{

		alert(alertMsg);

		return false;

	}

}

