﻿var now, hours, minutes, seconds, timeValue;

function showtime() {
    var clock = document.getElementById("clock");
    now = new Date();
    years = now.getFullYear();
    monthes = now.getMonth()+1;
    day = now.getDate();
    hours = now.getHours();
    minutes = now.getMinutes();
    seconds = now.getSeconds();
    timeValue = years + "年" + monthes + "月" + day + "日 ";
    //timeValue += (hours >= 12) ? "下午 " : "上午 ";
    //timeValue += ((hours > 12) ? hours - 12 : hours) + " :";
    //timeValue += ((minutes < 10) ? " 0" : " ") + minutes;
    //timeValue += ((seconds < 10) ? " 0" : " ") + seconds + " 秒";
    clock.innerHTML = timeValue;
    setTimeout("showtime()",60000);
}

function bookmarksite(title, url) {
    if (document.all) {
        window.external.AddFavorite(url, title);
    }
    else if (window.sidebar) {
        window.sidebar.addPanel(title, url, '');
    }
}

function setHomepage() {
    if (document.all) {
        document.body.style.behavior = 'url(#default#homepage)';
        document.body.setHomePage('http://www.yamazoo.com.tw');
    }
    else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert("此操作被您的瀏覽器拒絕，如果想啟用該功能，請在網址欄內輸入 about:config，然後將 signed.applets.codebase_principal_support 值該為 true");
            }
        }
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage', 'http://www.yamazoo.com.tw');
    }
}
