/*Created by Luke Ciantar 2007 - 2008. Separated button control from main code to standardise across forms
Some code based on GDC framework. The button cursor style is set in the style.css style sheet*/

function ClearFormRefinedSearch(thisForm) { // ALTERED CODE. added function to clear top form
		thisForm.Name.value = "";
		thisForm.Number.value = "";
		thisForm.Road.value = "";
		thisForm.Town.value = "";
		thisForm.Postcode.value = "";
	}

	function submitForm(thisForm) { // ALTERED CODE. added function to submit form
		thisForm.submit();
	}

	function stripPlus(text) { // ALTERED CODE. added function to replace + signs in form after a refresh
		
	text = text.replace(/\+/g," ");
	return text;
	}

	function stripSpace(text) { // ALTERED CODE. added function to replace + signs in form after a refresh	
	text = text.replace(/\+/g,"");
	return text;
	}

	function stripWhiteSpace(text) { // ALTERED CODE. added function to replace + signs in form after a refresh
	   if (text == ""){
		return "";
	   }

	   while ((text.charAt(0)) == "+" || (text.charAt(0)) == "%20"){
	      text = text.substring(1);
	   }

	   while ((text.charAt(text.length-1) == "+") || (text.charAt(text.length-1) == "%20")){
	      text = text.substring(0,text.length-1);
	   }
	return text;
	}


	function submitFormEnter(thisForm) { // ALTERED CODE. added function to submit form
		if (window.event && window.event.keyCode ==13){
			thisForm.submit();
		}
	}

	function overImage(id){
		if (id == "searchButton") {
			document.getElementById('searchButton').src =  "images/search_over.gif";
		} else if (id == "clearButton") {
			document.getElementById('clearButton').src =  "images/clear_over.gif";

		}

	}


	function outImage(id){
		if (id == "searchButton") {
			document.getElementById('searchButton').src =  "images/search_up.gif";
		} else if (id == "clearButton") {
			document.getElementById('clearButton').src =  "images/clear_up.gif";

		}



	}
