var appEventProcessors = new Array();

function registerAppEventProcessor( wnd, fname ) {

    var fullwnd = "";
    var currwnd = wnd;
    while( currwnd != currwnd.parent ) {
        fullwnd = currwnd.name + "." + fullwnd;
        currwnd = currwnd.parent;
    }

    var el = appEventProcessors.length;
    for( var i = 0; i < el; i++ ) {
        if( appEventProcessors[i].wnd == wnd && appEventProcessors[i].fname == fname ) {
            return;
        }
    }
    appEventProcessors[ el ] = {
        wnd   : fullwnd
      , fname : fname
    };

} // function registerAppEventProcessor()



function dispatchAppEvent( ev ) {

    var wnd;
    var fname;
    var func;
    var el = appEventProcessors.length;
    var i = 0;
    while( i < el ) {

        wnd   = appEventProcessors[i].wnd;
        fname = appEventProcessors[i].fname;
        try {
            func  = eval( wnd + fname );
            func( ev );
            i++;
        } catch( e ) {
//            appEventProcessors.splice( i, 1 );
//            el--;
            i++;
        }

    } // while( i < el )

} // function dispatchAppEvent()






function atxt_click(id, event) {
    if (event.ctrlKey) {
        window.open("/admin/locale-edit/" + id, "_blank");
    }
}

function addBookmark(x)
{

    if (document.all && !window.opera && (typeof window.external == "object")) {
        window.external.AddFavorite(document.location, document.title);
        return false;
    } else {
        x.href  = document.location;
        x.title = document.title;
        x.rel   = "sidebar";
        return true;
    }

}
