
jQuery(document).ready(function(){
	// Make a copy of the default text, for future use.
	var searchBoxDefaultValue = jQuery('#searchBox').val();

	// Empty the box if it contains only default text.
	jQuery('#searchBox').focus(function(event){
		var currentValue = jQuery(this).val();

		if(currentValue == searchBoxDefaultValue)
		{
			jQuery(this).val('');
		}
	});

	// Put back the default text if the box is empty.
	jQuery('#searchBox').blur(function(event){
		var currentValue = jQuery(this).val();
		var currentValue = jQuery.trim(currentValue);

		if(currentValue == '')
		{
			jQuery(this).val(searchBoxDefaultValue);
		}
	});

	
	// Don't allow empty search queries.
	jQuery('#searchButton').parents('form:first').submit(function(even){
		var currentValue = jQuery('#searchBox').val();
		var currentValue = jQuery.trim(currentValue);
		
		if(currentValue == searchBoxDefaultValue || currentValue == '')
		{
			return false;
		}
	});
	
	
	// Fix positioning of the search button because Opera fails to calculate its position
	//  correctly (a bug report DSK-329729 is filed with Opera for this).
	if(jQuery.browser.opera)
	{
		var offset = jQuery('#searchButton').offset();
		offset.left -= 7;
		jQuery('#searchButton').offset(offset);
	}
});
