function setDefaultValue(element)
{
	if(element.value == '')
	{
		element.value = defaultLocationValue;
		if(!element.hasClassName('defaultValue'))
			element.addClassName('defaultValue');
	}
}

var defaultLocationValue = 'ZIP Code';
Event.observe(window, 'load', function() 
{
	if($('locationInput'))
	{
		$('locationInput').value = readCookie('cookie_location');
		setDefaultValue($('locationInput'));
		Event.observe('locationInput', 'focus', function(event) 
		{
			var element = Event.element(event);
			if(element.value == defaultLocationValue)
			{
				element.value = '';
				if(element.hasClassName('defaultValue'))
				element.removeClassName('defaultValue');
			}
		});
		
		Event.observe('locationInput', 'blur', function(event) 
		{	
				setDefaultValue(Event.element(event));
		});
		
		Event.observe('searchButton', 'click', function(event) 
		{	
				if($('locationInput').value == defaultLocationValue)
					$('locationInput').value = "";
		});
	}
});

