<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="_p_personal.aspx.cs"   Inherits="Web25175_Hotel2.Web._p_personal"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>个人权限</title>
    <script language="javascript" src="js/Web25175_Hotel2.v1.1.js" type="text/javascript"></script>
    <script src="js/permissions.js" type="text/javascript"></script>
    <script src="jQuery/Alert/jquery.js" type="text/javascript"></script>
    <script src="jQuery/Alert/jquery.ui.draggable.js" type="text/javascript"></script>
    <script src="jQuery/Alert/jquery.alerts.js" type="text/javascript"></script>
    <link href="jQuery/Alert/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="css/_p.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="OperateTitle" style="width:1300px;">
        <div>个人权限</div>
    </div>
    <div id="msg"></div>
    <div style="width:1300px; margin-left:10px;">
    <div style="width:220px; float:left;">
        <input id="Button1" type="button" value="编辑用户" class="opbtn" />
        <input id="Checkbox2" type="checkbox" /> 单独
        <div id="userdiv" class="formdiv">
        <div id="userdivtool" class="formdivtool"><input id="Checkbox1" type="checkbox" />全选/取消 <input id="Button3" type="button" value="确定" class="subbtn"/></div>
        <div id="userlist"></div>
        <div id="user_pinyin"></div>
        </div>
        <div id="userblock"></div>
    </div>
    <div style="width:100px; float:left; vertical-align:middle;text-align:center">
        <div><input id="chkcontinuous" type="checkbox" onclick="_continuous_(this)" checked="true" />连选</div>
        <div style="margin-top:30px;">
        <input id="Button2" type="button" class="bigbtn t0"/></div>
        <div style="margin-top:30px;">
        <input id="Button5" type="button" class="bigbtn t1"/></div>
       <div style="margin-top:30px;">
        <input id="Button6" type="button" class="bigbtn t2" /></div>
    </div>
    <div style="width:800px; float:left;">
        <div id="infotools">
        <input id="Button8" type="button" value="全选/反选" />
        <input id="Button9" type="button" value="取消" />
        <input id="Button10" type="button" value="全展开" />
        <input id="Button11" type="button" value="全折叠" />
        </div>
        <div id="info"></div>
    </div>
    <div style="clear:both"></div>
    </div>

    <div id="tip">
     <b>个人权限</b>:一个或多个用户可以附加、更改一个或多个用户权限。
     <br />
     <b>附加权限</b>:在原来存在的权限上附加当前操作的权限。示例：如存在 1->附加 1，结果 1；如存在 1->附加 2，结果 1、2
     <br />
     <b>更改权限</b>:取消原来存在权限更改当前操作的权限。示例：如存在 1->更改 1，结果 1；如存在 1、2->更改 2，结果 2
      <br />
   </div>
<script type="text/javascript">
document.onselectstart = function(){return false;}
var msg_ = ["正在加载数据,请稍等...", "正在保存数据,请稍等..."];
var server = "";
var arrayuser = null;
var execute = false;
var executeuserid = 0;
var isfun=false;
var istip=false;
init();

function rnd() {
    server = "_p_server.aspx?t=" + new Date() + "&";
}
function wait(msg) {
    uiGet("msg").innerHTML = msg;
    uiGet("msg").style.display = "block";
}
function wait_c() {
    uiGet("msg").innerHTML = "";
    uiGet("msg").style.display = "none";
}
function init() {
    usersite("userblock");
    uiGet("Button1").onclick = function() {
        btnStatus(true);
        adduser(function() {
            usersite("userblock");
        });
        initcheckbox_all_cancel("Checkbox1", "userlist");
        initsubmit("Button3", "userlist", "userdivtool",
        function() {
            usersite("userdiv");
            btnStatus_c();
        },
        "user", "user_pinyin");
    }
    uiGet("Button2").onclick = function() {
        saveuser("cancel");
    }
    uiGet("Button5").onclick = function() {
        saveuser("append");
    }
    uiGet("Button6").onclick = function() {
        saveuser("modify");
    }
    initpingyin("user_pinyin");
    initinfo();
    initinfotools();
    initfun();
}
function initinfo() {
    this.rnd();
    var url = server + "action=getinfolist&isadmin=true";
    this.wait(msg_[0]);
    uiAjaxGet(url,
    function(e) {
        var data = eval("(" + e + ")");
        uiGet("info").innerHTML = data;
        this.wait_c();
        initdtip();
    });
}
function initinfotools() {
    var div = uiGet("info");
    var btn1 = uiGet("Button8");
    var btn2 = uiGet("Button9");
    var btn3 = uiGet("Button10");
    var btn4 = uiGet("Button11");

    btn1.onclick = function() {
        ChkALLSelRef("info");
    }
    btn2.onclick = function() {
        ChkALLCancel("info");
    }
    btn3.onclick = function() {
        ChkALLOpen("info");
    }
    btn4.onclick = function() {
        ChkALLClose("info");
    }
}
function initfun() {
    var chk = uiGet("Checkbox2");
    isfun = chk.checked == true ? true: false;
    chk.onclick = function() {
        isfun = this.checked == true ? true: false;
        if (!isfun) {
            menu_c();
            executeuser_c();
        }
    }
}
function fun_c() {
    var chk = uiGet("Checkbox2");
    chk.checked = false;
    isfun = false;

    menu_c();
    executeuser_c();
}
function btnStatus(flag) {
    uiGet("Button1").disabled = flag;
}
function btnStatus_c() {
    uiGet("Button1").disabled = false;
}
function usercontains(value) {
    if (arrayuser != null) {
        return arrayuser.contains(value);
    }
    return false;
}
var userdata = null;
function adduser(fun) {
    this.rnd();
    this.shade();
    this.fun_c();
    var url = server + "action=getuserlist";
    this.wait(msg_[0]);
    uiAjaxGet(url,
    function(e) {
        if (typeof(fun) == "function") {
            fun();
        }
        var data = null;
        try {
            data = eval("(" + e + ")");
        } catch(e) {
            jAlert('解析数据失败', "提示");
            btnStatus_c();
        }
        if (data != null) {
            var div = uiGet("userdivtool");
            div.style.display = "block";
            var div_py = uiGet("user_pinyin");
            div_py.style.display = "block";
            var li_contains = "";
            var li_default = "";
            userdata = data;
            for (i = 0; i < data.Rows.length; i++) {
                var item = data.Rows[i].UserName_S;
                var value = data.Rows[i].UserId_S;
                var flag = usercontains(value);
                if (flag) {
                    var style = "style='border:1px #0099CC solid;background:#89BAE7'";
                    li_contains += "<div item=" + item + " value=" + value + " " + style + " onclick=\"div_sel(this)\" name='user'><input type='checkbox' value=" + item + "  onclick='checkbox_sel(this)' checked />&nbsp;" + item + "</div>";
                } else {
                    li_default += "<div item=" + item + " value=" + value + " onclick=\"div_sel(this)\" name='user'><input type='checkbox' value=" + item + "  onclick='checkbox_sel(this)' />&nbsp;" + item + "</div>";
                }
            }

            var div = uiGet("userdiv");
            with(div.style) {
                position = "absolute";
                height = "580px";
                width = "200px";
                top = "50%";
                left = "50%";
                marginLeft = -(200 / 2) + "px";
                marginTop = -(580 / 2) + "px";
                border = "1px #999999 solid";
                padding = "2px";
                zIndex = 101;
                background = "#dddddd";
            }
            var div2 = uiGet("userlist");
            with(div2.style) {
                overflow = "auto";
                height = "470px";
                width = "190px";
                padding = "2px";
            }
            div2.innerHTML = li_contains + li_default;
            div2.setAttribute("ms", "true");
        }
        this.wait_c();
    });
}
function checkbox_sel(obj) {
    var div = obj.parentElement;
    div.setAttribute("onclick","");
    var value = div.getAttribute("value");
    var name = div.getAttribute("name");
    if (obj.checked) {
        with(div.style) {
            border = "1px #0099CC solid";
            background = "#89BAE7";
        }
        push(name, value);
    } else {
        with(div.style) {
            border = "1px #999999 solid";
            background = "#F9F9F9";
        }
        remove(name, value);
    }
}
function div_sel(obj) {
    var box = obj.getElementsByTagName("input")[0];
    var value = obj.getAttribute("value");
    var name = obj.getAttribute("name");
    menu(obj);
    if (box == null) return;
    if (box.checked) {
        box.checked = false;
        with (obj.style) {
            border = "1px #999999 solid";
            background = "#F9F9F9";
        }
        remove(name, value);
    } else {
        box.checked = true;
        with (obj.style) {
            border = "1px #0099CC solid";
            background = "#89BAE7";
        }
        push(name, value);
    }
}
function remove(name, value) {
    if (name == "user") {
        if (arrayuser != null) {
            arrayuser.remove(value);
        }
    }
}
function push(name, value) {
    if (name == "user") {
        if (arrayuser == null) arrayuser = new Array();
        if (arrayuser != null) {
            var flag2 = usercontains(value);
            if (!flag2) {
                arrayuser.push(value);
            }
        }
    }
}
function initcheckbox_all_cancel(chkbtn, chklist) {
    var obj = uiGet(chkbtn);
    obj.onclick = function() {
        var box = uiGetTag(uiGet(chklist), "input");
        if (box != null) {
            for (i = 0; i < box.length; i++) {
                if (box[i].getAttribute("type") == "checkbox") {
                    box[i].checked = this.checked;
                    checkbox_sel(box[i]);
                }
            }
        }
    }
}
function initsubmit(subbtn, chklist, chktools, fun, arrayname, pinyin) {
    var obj = uiGet(subbtn);
    obj.onclick = function() {
        shade_c();
        var arrayuser_t = null;
        var arraygroup_t = null;
        switch (arrayname) {
        case "user":
            arrayuser_t = new Array();
            pingyin_user(null, ".");
            break;
        }
        var box = uiGetTag(uiGet(chklist), "input");
        var movesdiv = new Array();
        var movesbox = new Array();
        if (box != null) {
            for (i = 0; i < box.length; i++) {
                if (box[i].getAttribute("type") == "checkbox" && box[i].checked) {
                    var item = box[i].parentElement.getAttribute("item");
                    var value = box[i].parentElement.getAttribute("value");
                    switch (arrayname) {
                    case "user":
                        arrayuser_t.push(value);
                        break;
                    }
                    movesbox.push(box[i]);
                } else {
                    movesdiv.push(box[i].parentElement);
                }
            }
        }
        switch (arrayname) {
        case "user":
            arrayuser = arrayuser_t;
            break;
        }
        var div = uiGet(chklist);
        for (i = 0; i < movesdiv.length; i++) {
            div.removeChild(movesdiv[i]);
        }
        div.setAttribute("ms", "false");
        for (i = 0; i < movesbox.length; i++) {
            var p = movesbox[i].parentElement;
            p.setAttribute("name", "");
            initgtip(p);
            p.removeChild(movesbox[i]);
        }
        div.style.height = "590px";
        if (typeof(fun) == "function") {
            fun();
        }
        cancelsite(arrayname + "block");
        var div3 = uiGet(chktools);
        div3.style.display = "none";

        var div4 = uiGet(pinyin);
        div4.style.display = "none";
    }
}
function usersite(div) {
    var div2 = uiGet(div);
    with(div2.style) {
        position = "";
        height = "600px";
        width = "200px";
        top = "";
        left = "";
        marginLeft = "0px";
        marginTop = "0px";
        border = "1px #CCCCCC solid";
        padding = "2px";
    }
}
function cancelsite(div) {
    var div2 = uiGet(div);
    with(div2.style) {
        position = "";
        height = "";
        width = "";
        top = "";
        left = "";
        marginLeft = "0px";
        marginTop = "0px";
        border = "";
        padding = "";
    }
}
var divuser = uiGet("userlist");

divuser.onmousedown = function(e1) {
    ms_userdown(e1);
}
divuser.onscroll = function() {
    menu_c();
}
function ms_userdown(e1) {
    var ms_ = divuser.getAttribute("ms");
    if (ms_ != "true") return;
    if (divuser.setCapture) {
        divuser.setCapture();
    }
    if (window.captureEvents) {
        window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
    }
    var x0 = uiGetX(e1);
    var y0 = uiGetY(e1);

    var obj = uiGetPosition(divuser);
    var mix = obj.x;
    var max = obj.x + obj.width - 20;
    /* 20 滚动条 */
    if (x0 >= mix && x0 <= max) {} else {
        return;
    }

    var ms = uiGet("ms_panel");
    ms.style.display = "block";
    ms.style.left = x0 + "px";
    ms.style.top = y0 + "px";

    var divs_ms = uiGetTag(uiGet("userlist"), "div");
    var scrollTop = parseInt(divuser.scrollTop, 10);
    divuser.onmousemove = function(e2) {
        try {
            var x1 = uiGetX(e2);
            var y1 = uiGetY(e2);

            /* 当 y0<y1时,正选 */
            /* 当 y0>y1时,反选 */
            if (y0 > y1) {
                ms.style.top = y1 + "px";
                ms.style.left = x1 + "px";
            }
            ms.style.width = Math.abs(x1 - x0) + 'px';
            ms.style.height = Math.abs(y1 - y0) + 'px';
            for (i = 0; i < divs_ms.length; i++) {

                var item = divs_ms[i];
                var item_pos = uiGetPosition(item);
                var dom_y1 = item_pos.y;
                var dom_y2 = item_pos.height + dom_y1;

                var flag = false;

                /* 对元素所在位置的获取控制 */
                if (y0 < y1) {
                    var y_1 = y0 + scrollTop;
                    var y_2 = y1 + scrollTop;
                    if (y_1 >= dom_y1 && y_1 <= dom_y2) {
                        flag = true;
                    }
                    if (y_2 >= dom_y1 && y_1 <= dom_y1) {
                        flag = true;
                    }
                } else {
                    var y_1 = y0 + scrollTop;
                    var y_2 = y1 + scrollTop;
                    if (y_2 >= dom_y1 && y_2 <= dom_y2) {
                        flag = true;
                    }
                    if (y_1 >= dom_y1 && y_2 <= dom_y1) {
                        flag = true;
                    }
                }
                if (flag) {
                    var box = item.getElementsByTagName("input")[0];
                    var value = item.getAttribute("value");
                    if (y0 < y1) {
                        /* 正选 */
                        box.checked = true;
                        with(box.parentElement.style) {
                            border = "1px #0099CC solid";
                            background = "#89BAE7";
                        }
                        if (arrayuser == null) arrayuser = new Array();
                        if (arrayuser != null) {
                            var flag2 = usercontains(value);
                            if (!flag2) {
                                arrayuser.push(value);
                            }
                        }
                    } else {
                        /* 反选 */
                        box.checked = false;
                        with(box.parentElement.style) {
                            border = "1px #999999 solid";
                            background = "#F9F9F9";
                        }
                        if (arrayuser != null) {
                            arrayuser.remove(value);
                        }

                    }
                }
            }
        } catch(e) {
            //window.alert(e);
        }

    }
}
document.onmouseup = function() {
    if (divuser.releaseCapture) {
        divuser.releaseCapture();
    }
    if (window.captureEvents) {
        window.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP);
    }
    if (divuser != null) {
        divuser.onmousedown = null;
        divuser.onmousemove = null;
        divuser.onmousedown = function(e1) {
            ms_userdown(e1);
        }
        divuser.onscroll = function() {
            menu_c();
        }
    }
    var ms = uiGet("ms_panel");
    ms.style.display = "none";
    ms.style.width = "0px";
    ms.style.height = "0px"
}
function msg_debug(msg) {
    uiGet("btnmsg").innerHTML = msg;
}
function saveuser(action) {
    var dialog = "";
    if (action == "append") {
        dialog = "附加权限";
    } else if (action == "modify") {
        dialog = "更改权限";
    } else if (action == "cancel") {
        dialog = "撤消权限";
    }
    if (arrayuser == null) {
        jAlert('请选择用户', dialog);
        return;
    }
    this.rnd();
    var url = server + "action=saveuser&info=" + action;
    var senddata = "";
    senddata += "userid=" + (execute == true ? executeuserid: getuserarg());
    senddata += "&data=" + getdataarg();
    senddata += "&admin=" + getadminarg();
    this.wait(msg_[1]);
    uiAjaxPost(url, senddata,
    function(e) {
        var data = null;
        try {
            data = eval("(" + e + ")");
        } catch(x) {
            jAlert('解析数据失败' + e, "提示");
        }
        if (data != null) {
            if (data == "success") {
                jAlert(dialog + "成功.", dialog);
            } else if (data == "fail") {
                jAlert(dialog + "失败.", dialog);
            } else if (data == "argerror") {
                jAlert("参数错误.", dialog);
            }
        }
        this.wait_c();
    });
}
function getuserarg() {
    var valstr = "";
    for (i = 0; i < arrayuser.length; i++) {
        valstr += arrayuser[i] + ",";
    }
    return valstr;
}
function getdataarg() {
    var chk = uiGetTag(uiGet("info"), "input");
    var valstr = "";
    if (chk != null) for (i = 0; i < chk.length; i++) {
        if (chk[i].getAttribute("type") == "checkbox" && chk[i].checked) {
            valstr += chk[i].getAttribute("value") + ",";
        }
    }
    return valstr;
}
function getadminarg() {
    var chk = uiGetTag(uiGet("info"), "input");
    var valstr = "";
    if (chk != null) for (i = 0; i < chk.length; i++) {
        if (chk[i].getAttribute("type") == "checkbox" && chk[i].checked) {
            if (chk[i].getAttribute("name").toLowerCase() == "isadmin") {
                valstr += chk[i].getAttribute("value") + ",";
            }
        }
    }
    return valstr;
}
function initpingyin(pydiv) {
    var py = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.";
    var div = uiGet(pydiv);
    var item = "";
    for (var i = 0; i < py.length; i++) {
        var str = py.charAt(i);
        var name = str == "." ? "全": str;
        if (pydiv == "user_pinyin") {
            item += "<div class='div' onclick='pingyin_user(this)' value='" + str + "'>" + name + "</div>";
        } else if (pydiv == "group_pinyin") {
            item += "<div class='div' onclick='pingyin_group(this)'value='" + str + "'>" + name + "</div>";
        }
    }
    item += "<div style='clear:both;height:0px;display:none;'></div>";
    div.innerHTML = item;
}
function pingyin_user(obj, value) {
    var py = null;
    if (obj == null && value != null) {
        py = value;
    } else if (obj != null && value == null) {
        py = obj.getAttribute("value");
    }
    if (userdata != null && py != null) {
        var data = userdata;
        var li_default = "";
        var li_contains = "";

        for (i = 0; i < data.Rows.length; i++) {
            var item = data.Rows[i].UserName_S;
            var value = data.Rows[i].UserId_S;
            var itemshort = data.Rows[i].UserShortName_S;
            var flag2 = usercontains(value);
            var flag = false;
            if (itemshort.substring(0,1).toLowerCase() == py.toLowerCase()) {
                flag = true;
            }
            if (py == ".") {
                flag = true;
            }
            if (flag) {
                if (flag2) {
                    var style = "style='border:1px #0099CC solid;background:#89BAE7'";
                    li_contains += "<div item=" + item + " value=" + value + " " + style + " onclick='div_sel(this)' name='user'><input type='checkbox' value=" + item + "  onclick='checkbox_sel(this)' checked />&nbsp;" + item + "</div>";
                } else {
                    li_default += "<div item=" + item + " value=" + value + " onclick='div_sel(this)' name='user'><input type='checkbox' value=" + item + "  onclick='checkbox_sel(this)' />&nbsp;" + item + "</div>";
                }
            }
        }
        var html = li_contains + li_default;
        if (html == "") {
            html = "<font style='font-size:14px;'>无法获取 <b>" + py + "</b> 字母用户</font>";
        } else {
            if (py != ".") html = "<font style='font-size:14px;'>以下 <b>" + py + "</b> 字母用户</font>" + html;
        }
        uiGet("userlist").innerHTML = html;
    }
}
function menu(obj) {
    var value = obj.getAttribute("value");
    var name = obj.getAttribute("name");
    if (name == "" && isfun) {
        var scrollTop = parseInt(divuser.scrollTop, 10);

        var obj_pos = uiGetPosition(obj);
        var div = uiGet("menu");
        var left = obj_pos.x + obj_pos.width;
        var top = obj_pos.y;
        div.style.left = left + "px";
        div.style.top = (top - scrollTop) + "px";
        div.style.height = "70px";
        div.style.display = "block";

        var html = "";
        html += "<div onclick='getuserinfo(" + value + ")'>查看</div>";
        html += "<div onclick='executeuser(" + value + ")'>操作</div>";
        html += "<div onclick='executeuser_c()'>取消</div>";
        div.innerHTML = html;
    }
}
function menu_c() {
    var div = uiGet("menu");
    div.style.display = "none";
}
function getuserinfo(userid) {
    this.rnd();
    var url = server + "action=getuserlist&userid=" + userid;
    this.wait(msg_[0]);
    uiAjaxGet(url,
    function(e) {
        var data = eval("(" + e + ")");
        uiGet("info").innerHTML = data;
        wait_c();
        initdtip();
    });
}
function executeuser(userid) {
    var div = uiGetTag(uiGet("userlist"), "div");
    for (i = 0; i < div.length; i++) {
        if (div[i].getAttribute("value") == userid) {
            with(div[i].style) {
                border = "1px red solid";
                background = "#FFF0F0";
            }
            execute = true;
            executeuserid = userid;
        } else {
            with(div[i].style) {
                border = "1px #0099CC solid";
                background = "#89BAE7";
            }
        }
    }
}
function executeuser_c() {
    var div = uiGetTag(uiGet("userlist"), "div");
    for (i = 0; i < div.length; i++) {
        with(div[i].style) {
            border = "1px #0099CC solid";
            background = "#89BAE7";
        }
    }
    execute = false;
    executeuserid = 0;
}
function shade() {
    var div = uiGet("shade");
    var Height = parseInt(document.documentElement.scrollHeight, 10);
    var Width = parseInt(document.documentElement.scrollWidth, 10);
    div.style.top = 0 + "px";
    div.style.left = 0 + "px";
    div.style.width = Width + "px";
    div.style.height = Height + "px";
    div.style.display = "block";
}
function shade_c() {
    var div = uiGet("shade");
    div.style.display = "none";
}
function initdtip() {
    var span = uiGetTag(uiGet("info"), "span");
    if (span != null) {
        for (i = 0; i < span.length; i++) {
            span[i].onmouseover = function() {
                var pos = uiGetPosition(this);
                var value = this.innerHTML;
                var scrollTop = parseInt(uiGet("info").scrollTop, 10);
                var scrollLeft = parseInt(uiGet("info").scrollLeft, 10);
                var div = uiGet("spantip");
                div.style.display = "block";
                div.style.top = pos.y - scrollTop - 30 + "px";
                div.style.left = pos.x + scrollLeft + "px";
                div.style.width = 90 + "px";
                div.innerHTML = value;
            }
            span[i].onmouseout = function() {
                var div = uiGet("spantip");
                div.style.display = "none";
            }
        }
    }
}
function initgtip(obj) {
    var name = obj.getAttribute("name");
    var item = obj.getAttribute("item");
    var value = obj.getAttribute("value");
    if (name == "") {
        obj.onmouseover = function() {
            var pos = uiGetPosition(this);
            rnd();
            var scrollTop = parseInt(divuser.scrollTop, 10);
            var url = server + "action=getusergrouplist&userid=" + value;
            wait(msg_[0]);
            uiAjaxGet(url,
            function(e) {
                var data = eval("(" + e + ")");
                var value = data;
                var div = uiGet("gtip");
                div.style.display = "block";
                div.style.top = (pos.y- scrollTop) + "px";
                div.style.left = pos.x + pos.width + 40 + "px";
                value = value.trim() == "" ? "无法获取“" + item + "”用户组权限": "“" + item + "”：" + value;
                div.innerHTML = value;
                wait_c();
            });
        }
        obj.onmouseout = function() {
            var div = uiGet("gtip");
            div.style.display = "none";
        }
    }
}
initdivpos();
function initdivpos() {
    var divs = ["groupdiv", "userdiv"];
    for (i = 0; i < divs.length; i++) {
        var id = divs[i];
        var div = uiGet(id);
        if (div != null) {
            if (div.style.position == "absolute") {
                var obj_pos = uiGetPosition(div);
                if (obj_pos.y <= 0) {
                    div.style.top = "0px";
                    div.style.marginTop = "0px";
                }
                if (obj_pos.x <= 0) {
                    div.style.left = "0px";
                    div.style.marginLeft = "0px";
                }
            }
        }
    }
    setTimeout("initdivpos()", 1000);
}
</script>

<div id="btnmsg"></div>
<div id="ms_panel"></div>
<div id="menu"></div>
<div id="shade"></div>
<div id="spantip"></div>
<div id="gtip"></div>
</body>
</html>
