window.project = (window.project) ? window.project : {};

(function($)
{

project.SearchBehaviour = function(dom_element, options)
{
    this.dom_element = dom_element;
    this.search_box = dom_element.find("input.text").first();
    
    this.options = {
            "search_text": "Suchen"
    };

    $.extend(this.options, options);
    this.initialize();
};

project.SearchBehaviour.prototype.initialize = function()
{
    var that = this;
    this.search_box.val(this.options.search_text);
    
    this.search_box.bind({
        "focusin": function(event)
        {
            if($(this).val() === that.options.search_text)
            {
                $(this).val("");
            }
        },
        "focusout": function(event)
        {
            if($(this).val() === "")
            {
                $(this).val(that.options.search_text);
            }
        }
    });
};

JsBehaviourToolkit.registerHandler("search", project.SearchBehaviour);

})(jQuery);
