﻿// ---------------------------------------------------------------------
// Description:		QuickSearch.js
//					ClientSide Script for QuickSearch.cs Control
// 
// Autor:			Herbert Granofszky
// Date:			06.12.2007
// 
// (c) by team ModulAcht. All rights reserved
// ---------------------------------------------------------------------

var QuickSearch =
{
    searchBoxCtrlId : null,
    searchButtonCtrlId : null,
    
    initialize : function()
    {
        Event.observe(this.searchBoxCtrlId, 'keydown', this._onSearchBoxKeyDown.bindAsEventListener(this));
    },
    
    focusDefaultElement : function()
    {
        $(this.searchBoxCtrlId).select();
    },
    
    _onSearchBoxKeyDown : function(e)
    {
        switch(e.keyCode)
        {
            case Event.KEY_RETURN:
                $(this.searchButtonCtrlId).focus();
                $(this.searchButtonCtrlId).click();
                Event.stop(e);
                break;
        }
    }
};


