
///////////////////////////////////////////
// Site-wide Form Functions
// Adds focus & blur javascripts to all form elements
///////////////////////////////////////////
document.observe('dom:loaded', function(){
	var text_field_values = {};
	var el = $(document.body).getElementsBySelector('input[type="text"]');

	$$('textarea').each(function(el2){
		el[el.length] = el2;
	});

	el.each(function(el2){
		if(el2.id)
		{	
			var index = el2.id;
			var value = $F(el2);

			text_field_values[index] = value;

			el2.observe('focus', function(){
				if($F(el2) == text_field_values[el2.id])
					el2.value = '';
			});

			el2.observe('blur', function(){
				if($F(el2) == '')
					el2.value = text_field_values[el2.id];
			});
		}
	});
});


///////////////////////////////////////////
// Site search validator
// Checks for required items in site search
///////////////////////////////////////////

function validateSiteSearchForm(searchForm){

// Set background color for all form fields to default white

	// Set the default error message
	errmsg = "What do you want to search for?";
	
	// check search field value
	if (searchForm.q.value=="" || searchForm.q.value=="SEARCH"){
		errmsg += "\n\nEnter your keyword(s) in the search box\nat the top of the page.\n\n";
	}
	//Check to see if we added anything to the default error message
	if (errmsg != "What do you want to search for?"){
		alert(errmsg);
		return false;
	}

return true;
}




