﻿/// <reference path="jquery-vsdoc.js" />
/// <reference path="jquery.corner.js" />

// **************************** 這些是專門處理前台的 script ****************************

function enableBookmark(anchor) {
    /// <summary> 將一個 link button 附與加入最愛的功能 </summary>
    // add a "rel" attrib if Opera 7+
    if (window.opera) {
        if ($(anchor).attr("rel") != "") { // don't overwrite the rel attrib if already set
            $(anchor).attr("rel", "sidebar");
        }
    }

    $(anchor).click(function(event) {
        event.preventDefault(); // prevent the anchor tag from sending the user off to the link
        var url = document.URL;
        var title = document.title;

        if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { // Mozilla Firefox Bookmark
            window.sidebar.addPanel(title, url, "");
        } else if ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4)) { // IE Favorite
            window.external.AddFavorite(url, title);
        } else if (window.opera) { // Opera 7+
            return false; // do nothing - the rel="sidebar" should do the trick
        } else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
            alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
        }

    });
}

