function getBrowser() {
  var ua = navigator.userAgent.toLowerCase();

  if (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1 && ua.indexOf("webtv") == -1) {
    return 'msie';
  }
  else if (ua.indexOf("opera") != -1) {
    return 'opera';
  }
  else if (ua.indexOf("gecko") != -1) {
    return 'gecko';
  }
  else if (ua.indexOf("safari") != -1) {
    return 'safari';
  }
  else if (ua.indexOf("konqueror") != -1) {
    return 'konqueror';
  } else {
    return false;
  }
  
}

function AddFavorite() {

  ua = getBrowser();

  if (ua == 'msie') {
    window.external.AddFavorite(document.location.href,document.title);
  }
  else if(ua == 'gecko') {
    if (typeof window.sidebar == "object")
      window.sidebar.addPanel (document.title, document.location.href, "");
  }
  else if(ua == 'opera') {
    var a = document.createElement('A');
    alert(a);
    if (!a) return false;
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',document.location.href);
    a.setAttribute('title',document.title);
    a.click();
  }
}
