﻿// JScript 文件

var address = function (obj, url, title) {
/*
嘿嘿，从BlueDestiny的BLOG里搜刮了一篇添加收藏夹的代码，不过那个貌似偶合太高。。
看的迷糊。。所以单独做出来了。。。并且可以兼容热点使用。。。
BlueDestiny前辈的源文：http://www.never-online.net/blog/article.asp?id=108
*/
    var e = window.event || arguments.callee.caller.arguments[0];
    
    var B = {
        IE : /MSIE/.test(window.navigator.userAgent) && !window.opera
        , FF : /Firefox/.test(window.navigator.userAgent)
        , OP : !!window.opera
    };
    
    obj.onmousedown = null;
    
    if (B.IE) {
        obj.attachEvent("onmouseup", function () {
            try {
                window.external.AddFavorite(url, title);
                window.event.returnValue = false;
            } catch (exp) {}
        });
    } else {
        if (B.FF || obj.nodeName.toLowerCase() == "a") {
            obj.setAttribute("rel", "sidebar"), obj.title = title, obj.href = url;
        } else if (B.OP) {
            var a = document.createElement("a");
            a.rel = "sidebar", a.title = title, a.href = url;
            obj.parentNode.insertBefore(a, obj);
            a.appendChild(obj);
            a = null;
        }
    }
};
