/* search form */
var Search = Class.create();

Search.prototype = {
	text: '',
	id: '',
	
	initialize: function(id, text) {
		this.text = text;
		this.id = id;
		
		Event.observe($(this.id), "focus", this.onFocus.bind(this), false);
		Event.observe($(this.id), "blur", this.onBlur.bind(this), false);
	},
	
	onFocus: function(e) {
		var element = Event.element(e);
		
		if ($F(element)==this.text) {
			$(element).value = '';
		}
	},
	
	onBlur: function(e) {
		var element = Event.element(e);
		
		if ($F(element)=='') {
			$(element).value = this.text;
		}
	}
}


Event.observe(window, "load", function() {new Search('search', 'Search this site')});
