﻿    function mouseOver(type, control, color) {
        if (type == "image") {
            control.style.cursor = "pointer";
        }
        if (type == "text") {
            control.style.cursor = "pointer";
            control.style.textDecoration = "underline";
            control.style.color = color;
        }
    }
    function mouseOut(type, control, color) {
        if (type == "image") {
            control.style.cursor = "default";
        }
        if (type == "text") {
            control.style.cursor = "default";
            control.style.textDecoration = "none";
            control.style.color = color;
        }
    }
    function hyperLink(path) {
        window.open(path, "", "menubar=yes,resizable=yes,location=yes,status=yes,scrollbars=yes,toolbar=yes")
    }
    function tools() {
        if (document.getElementById("tools").style.display == "none") {
            document.getElementById("tools").style.display = "";
        }
        else {
            document.getElementById("tools").style.display = "none";
        }
    }
    function moveScrollTo(size) {
        /*
        for(var i=0;i<size;i++){
            document.documentElement.scrollTop+=3;
            if(document.documentElement.scrollTop>size)break;
        }
        */
        $("html").animate({scrollTop:size},1000);
    }
    function lockControl(control) {
        if (control.value.indexOf("請稍候")>-1) {
            alert("資料儲存中...");
            return false;
        }
        else {
            control.value = "請稍候";
            setTimeout("effectControl('" + control.id + "',0)", 100)
            return true;
        }
    }
    function effectControl(controlID,setp) {
        var pc = new Array("｜", "／", "－", "＼", "｜", "／", "－", "＼");
        var control = document.getElementById(controlID);
        if (control.value.indexOf("請稍候")>-1) {
            control.value = "請稍候 " + pc[setp];
            setp+=1
            if (setp >= pc.length) setp = 0;
            setTimeout("effectControl('" + control.id + "'," + setp + ")", 100)
        }
    }
    function reciprocalTime(sec,title,url) {
        document.title = title + "(";
        if (parseInt(sec / 60) > 0) {
            document.title += parseInt(sec / 60) + "分";
        }
        document.title += (sec - (parseInt(sec / 60) * 60)) + "秒後登出!)";
        sec -= 1;
        if (sec < 0) {
            location.href = url;
        }
        setTimeout("reciprocalTime(" + sec + ",'" + title + "','" + url + "')", 1000);
    }
