//-----------------------------------------------------------
// 文件名称: Web25175_Hotel2.image v1.1.js
// 页面名称: Web25175_Hotel2.image v1.1
//　
// 描    述: 图象浮层
// 版　　本: 1.1
// 兼容情况: IE6+,Chrome,Mozilla, Netscape, Firefox,Maxthon3+,
// 创建标识: Add By 吴希 2011-12-07
//------------------------------------------------------------------------------------------
// 2011/12/28 Id$WuXi 更新日志： 1、Move 修正移动偏移申明错误。
//------------------------------------------------------------------------------------------
uiTipImg = function() {
    this.InitImg();
}
uiTipImg.prototype = {
    InitImg: function() {
        this.offsetXpoint = -60;
        this.offsetYpoint = 20;
        this.EnableTip = false;
    },
    elebody: function() {
        return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement: document.body;
    },
    Init: function(src) {
        this.Del();
        var div = document.createElement("div");
        div.id = "TipImg";
        with(div.style) {
            fontSize = "9px";
            borderTop = "gray 1px solid";
            borderRight = "gray 1px solid";
            borderLeft = "gray 1px solid";
            borderBottom = "gray 1px solid";
            paddingLeft = "4px";
            paddingRight = "4px";
            zIndex = "100";
            filter = "progid:dximagetransform.microsoft.shadow(color=gray,direction=120)";
            visibility = "hidden";
            paddingBottom = "4px";
            position = "absolute";
            backgroundColor = "#ffffff";
            div.innerHTML = src;
        }
        this.EnableTip = true;
        document.body.appendChild(div);
        document.onmousemove = this.Move;
    },
    Del: function() {
        var div = uiGet("TipImg");
        if (div) {
            document.body.removeChild(div);
        }
        this.EnableTip = false;
    },
    Move: function(e) {
        var divTipImg = document.getElementById("TipImg");
        if (divTipImg != null && TipImg.EnableTip) {
            var CurrX = (document.getElementById && !document.all) ? e.pageX: event.x + TipImg.elebody().scrollLeft;
            var CurrY = (document.getElementById && !document.all) ? e.pageY: event.y + TipImg.elebody().scrollTop;
            var rightedge = document.all && !window.opera ? TipImg.elebody().clientWidth - event.clientX - TipImg.offsetXpoint: window.innerWidth - e.clientX - TipImg.offsetXpoint - 20;
            var bottomedge = document.all && !window.opera ? TipImg.elebody().clientHeight - event.clientY - TipImg.offsetYpoint: window.innerHeight - e.clientY - TipImg.offsetYpoint - 20;
            var leftedge = (TipImg.offsetXpoint < 0) ? TipImg.offsetXpoint * ( - 1) : -1000

            if (rightedge < divTipImg.offsetWidth) {
                divTipImg.style.left = document.all ? TipImg.elebody().scrollLeft + event.clientX - divTipImg.offsetWidth + "px": window.pageXOffset + e.clientX - divTipImg.offsetWidth + "px";
            } else if (CurrX < leftedge) {
                divTipImg.style.left = "5px";
            } else {
                if (window.ActiveXObject) {
                    divTipImg.style.left = event.clientX + "px";
                } else {
                    divTipImg.style.left = CurrX + TipImg.offsetXpoint + "px";
                }
            }
            if (bottomedge < divTipImg.offsetHeight) {
                divTipImg.style.top = document.all ? TipImg.elebody().scrollTop + event.clientY - divTipImg.offsetHeight - TipImg.offsetYpoint + "px": window.pageYOffset + e.clientY - divTipImg.offsetHeight - TipImg.offsetYpoint + "px";
            } else {
                divTipImg.style.top = CurrY + TipImg.offsetYpoint + "px";
            }
            divTipImg.style.visibility = "visible";
        }
    }
}
var TipImg = new uiTipImg();
