function SearchBox()
{
	this.inherit = EventDispatcher;
	this.inherit();
	this.ON_SEND = "onSend";
	this.value = "";
	
	var level = this;
	var search_default_value;
	
	var send = function(){
		level.value = $("#search_val").val();
		if(level.value != search_default_value)
		{
			level.dispatchEvent(new Event(level.ON_SEND));
		}else{
			$("#search_val").focus();
		}
	}
	this.start = function()
	{
		search_default_value = $('#search_val').metadata().val;
		$('#search_val').val(search_default_value);
		$('#search_val').focus( function(){
			if( $(this).val() == search_default_value )
			{
				$(this).val('');
			}
		})
		.blur( function(){

			if( $(this).val() == "" )
			{
				$(this).val(search_default_value);
			}
		}).keydown(function(event){
			if(event.keyCode == 13) {
				send();
			}
		});
		
		$('#search_btn').click(function(){
			send();
			return false;
		});
	}

}

