// Create an object that is used to searchField form fields
searchField = {
	// ++++++++++++++++++ Object properties (Tip: You can change the values to fit in with your html page but DON'T change the property names)
	// ID of form
	fieldID:'search_top',
	// CSS Style for searchFielded textbox
	calendarheadingClass:'highlight_field',
	fieldText:'Enter a keyword...',
	
	/************************************* Initialise functionality (called after page has loaded using addEvent() method ********************************************************/
  	// Initilise object
  	init:function()
  	{
  		/****************** Checks to see if the DOM is available (the browser supports it) AND the element is available ******/
		// Check to see if W3C DOM is available - if not terminate script (object detection)
		if(!document.getElementById || !document.createTextNode){return;}
		var container = document.getElementById(searchField.fieldID); // Find form element
		// If form element is available, initialise functunality
		if(container)
		{
			if(container.value == '')
				container.value = searchField.fieldText;
			// Add the onclick event behaviour - detects if user clicks into form
			helper.addEvent(container,'click', searchField.searchFieldField, false);
			// Add the focus event behaviour - detects if user tabs into form (if left off, the form field will not searchField if a user 'tabs' into the field)
			helper.addEvent(container,'focus', searchField.searchFieldField, false);
			// Add the onclick event behaviour to the link
			helper.addEvent(container,'blur', searchField.removeFieldsearchField, false);

		};
  	},
  	// Function to searchField form field (adds a class to the input)
  	searchFieldField:function(e)
	{
		// Get the target (the element we want to assign the class to) using getTarget() helper method
		var target = helper.getTarget(e);
		if(target.value == searchField.fieldText)
			target.value = '';
		
		// Use css() helper method to assign class calendarheadingClass
		helper.cssjs('add', target , searchField.calendarheadingClass);
    },
    // Function to remove searchField from form field (removes a class from the input)
    removeFieldsearchField:function(e)
	{
		var target = helper.getTarget(e);
		if(target.value == '') {
			target.value = searchField.fieldText;
			helper.cssjs('remove', target ,searchField.calendarheadingClass);
		}
    }
}
// start the show.
helper.addEvent(window, 'load', searchField.init, false);