function Browser() {

  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
  s = "Opera"
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    return;
  }
}
var browser = new Browser();

function bookmarkMe(myUrl, myTitle)
{
        if(browser.isNS)
        {
            window.sidebar.addPanel(myTitle, myUrl, '');
        }
        else if(browser.isOP) // Opera
        {
            var bkmark = document.createElement('a');
            bkmark.setAttribute('rel','sidebar');
            bkmark.setAttribute('href', myUrl);
            bkmark.setAttribute('title', myTitle);
            bkmark.click();
        }
        else if(browser.isIE) // IE
        {
           window.external.AddFavorite(myUrl, myTitle);
        }
}

function setAsHome(myLink)
{
        if(browser.isIE)
        {
               // IE
               myLink.style.behavior='url(#default#homepage)';
               myLink.setHomePage(location.href);
        }
        else if(browser.isNS)
        {
               // Netscape / firefox browsers
               var msg = "Just drag this link onto your 'home' ";
               msg += "button to set this page as your ";
               msg += "default homepage!";
               alert(msg);
        }
        else if(browser.isOP)
        {
               // Opera
               var msg = "Please go to Tools - Preferences ";
               msg += "- General and click 'Use current' ";
               msg += "to set this as your homepage! ";
               alert(msg);
        }
        else
        {
               // Other browsers
               var msg = "Sorry, your browser doesn't allow ";
               msg += "scripts to set the default homepage. ";
               msg += "Please use your browser's 'options' dialog ";
               msg += "to do it! Thank you for your patience. ";
               alert(msg);
        }
}
