
var Search = {
	
	get: function(id) {
		return document.getElementById(id);
	},
	
	event: function( o, e, f ) {
		if(o) {
			if( o.addEventListener ) o.addEventListener(e, f, false );
			else if( o.attachEvent ) o.attachEvent( 'on'+e , f);
		}
	},
	
	open: function(options) {

		var defaults = {
			'form' : null,
			'input': null
		};
		
		for( key in defaults ) {
			this[key] = (options[key]) ? options[key] : defaults[key] ;
		}

		this.form = this.get(this.form);
		this.input = this.get(this.input);
		
		// events
		this.event( this.input, "focus", function() {
			if(this.value == " ") {
				this.value = "";
			}
			Search.input.select();
		});
		this.event( this.input, "blur", function() {
			if(this.value == "") {
				this.value = " ";
			}
		});
		
		if(!this.input.value) {
			this.input.value = " ";
		}

	}
	
};

