﻿//Requires:
//- Namespaces

if (!Library) {
    var Library = {};
    Library.Browser = {};
} else if (!Library.Browser) {
    Library.Browser = {};
}

Library.Browser.AddFavorite = function(title, addCurrentPage) {
    try {
        addCurrentPage = (addCurrentPage == null ? false : addCurrentPage); //default is homepage
        var url = (addCurrentPage ? location.href : "http://" + location.host);

        if (document.all) { //IE Favorite		
            window.external.AddFavorite(url, title);
        } else if (window.sidebar) { //Mozilla Firefox Bookmark		
            window.sidebar.addPanel(title, url, "");
        } else if (window.opera && window.print) { //Opera Hotlist
            return true;
        }
    } catch (e) {

    }
}
