/*       _    _ _  __  _____  _      _____ 
   ____ | |  | | |/ / |  __ \| |    / ____|
  / __ \| |  | | ' /  | |__) | |   | |     
 / / _` | |  | |  <   |  ___/| |   | |     
| | (_| | |__| | . \  | |    | |___| |____ 
 \ \__,_|\____/|_|\_\ |_|    |______\_____|
  \____/
*/

/**
 * Add a bookmark us link to the page.
 * @version 0.1
 * @author Damien Churchill
 **/

document.addEvent('domready', function(e) {
    if (!window.sidebar && !window.external) return; // We don't want the link displaying in unsupported browsers.
    
    if ($('topLinks').get('rel') == 'no_bookmark') return; // Bookmark link is not wanted.
    
    $('topLinks').set('html', $('topLinks').get('html') + '');
    var link = new Element('a', {
        html: 'Bookmark Us',
        href: '#'
    }).inject('topLinks');
    link.addEvent('click', function(e) {
        if (window.sidebar) {
            window.sidebar.addPanel(document.title, location.href, '')
        } else if (window.external) {
            window.external.AddFavorite(location.href, document.title);
        }
    });
});
