// manualBookmarkText - Default text for the manual bookmark instructions.
var manualBookmarkText = 'This function is not supported by your browser';

// 
// DisplayBookmarkText - Displays an alert box to the user displaying directions for how to manually add a bookmark
//
function displayBookmarkText()
{
  alert(manualBookmarkText);
}

//
// bookmarkPage - adds a bookmark for the current page and title into the browser. 
//
function bookmarkPage()
{
  
  var bookmarkTitle = document.title; 
  var currentUrl = location.href;
  
  if (window.sidebar)
  {
    displayBookmarkText();
  }
  else if (window.external)
  {
    // ie browser..
    try
    {
      window.external.AddFavorite(currentUrl, bookmarkTitle);
    }
    catch (e)
    {
      displayBookmarkText();
    }
  }
  else if (window.opera)
  {
    // opera browser..  
    try
    {
      var bookmarkElement = document.createElement('a');
      bookmarkElement.setAttribute('rel', 'sidebar');
      bookmarkElement.setAttribute('href', currentUrl);
      bookmarkElement.setAttribute('title', bookmarkTitle);
      bookmarkElement.click();
    }
    catch (e)
    {
      displayBookmarkText();
    }
  }
  else
  {
    // safari
    displayBookmarkText();
  }
}