/**
 * Пакет для ссылок "добавить в избранное" и "сделать стартовой"
 * @namespace GlobalREsources
 */
GlobalResources.MetaLinks = function() {

    /**
     * Добавить страницу в закладки
     */
    function addToBookmarksHandler(e) {
        var url = this.href;
        var title = document.title;
        if (jQuery.browser.mozilla) {
            window.sidebar.addPanel (title, url, "");
        } else if (jQuery.browser.msie) {
            window.external.AddFavorite(url, title);
        } else if (jQuery.browser.opera) {
            this.setAttribute('rel', 'sidebar');
            return true;
        } else {
            var w = new $G.Window({
                align          : 'center-center',
                width          : 300,
                height         : 36,
                animation      : true
            });
            w.attachEventListener('draw', function(_window) {
                _window.$content.html('<div style="font-size: 1.2em; text-align: center">Нажмите Ctrl+D, чтобы добавить сайт в избранное</div>');
            });
            w.show();
        }
        return false;
    }

    return {
        /**
         * Инициализация
         */
        init : function() {
            $(document.getElementById('bookmark-link')).click(addToBookmarksHandler);
        }
    }
}()

