//******************************
// onClick behaviour for the search bar
// Jon Burton 2008-12-01
//******************************

function clickReact (textBoxId,defaultValue)
{
	var textBox;
	//check that we've been given an ID of a text box to manipulate
	if (textBoxId != "" && textBoxId != 0)
	{
		//find our textbox
		textBox = document.getElementById(textBoxId);
		//does its value match the defaultValue?
		if (textBox.value == defaultValue)
		{
			//blank the value
			textBox.value = "";
		}
	}
	
}

function releaseReact (textBoxId,defaultValue)
{
	var textBox;
	//check we've been given an ID to try
	if (textBoxId != "" && textBoxId != 0)
	{
		//get our textbox
		textBox = document.getElementById(textBoxId);
		//is it blank?
		if (textBox.value == "")
		{
			//re-add the default value
			textBox.value = defaultValue;
		}
	}
}

function submitIfNotDefaultValue (formId,textBoxId,defaultValue)
{
	var textBox = document.getElementById(textBoxId);
	var thisForm = document.getElementById(formId);
	
	//check we've found some objects
	if (thisForm != null && textBox != null && defaultValue != "" )
	{
		//if the default text is still in the box, empty it
		if (textBox.value == defaultValue)
		{
			textBox.value = '';
		}
		thisForm.submit();
	}
}
