/**
 * @author Administrator
 */
var D = new Function('obj', 'return document.getElementById(obj);')
function htmlbody(){
    return (document.documentElement.clientHeight <= document.body.clientHeight &&
    document.documentElement.clientHeight != 0) ? document.documentElement : document.body;
}

function scrollLeft(){
    return (!window.pageYOffset) ? htmlbody().scrollLeft : window.pageXOffset;
}

function scrollTop(){
    return (!window.innerHeight) ? htmlbody().scrollTop : window.pageYOffset;
}


function getleft(strobjs, strLeftType, strleft){
    var temp_getleft = 0;
    if (strLeftType == "left") {
        temp_getleft = scrollLeft() * 1 + strleft * 1;
    }
    else 
        if (strLeftType == "mid") {
            (strleft * 1 < 0) ? temp_getleft = scrollLeft() * 1 + strleft * 1 +
            htmlbody().clientWidth * 1 / 2 -
            strobjs.offsetWidth * 1 : temp_getleft = (scrollLeft() * 1 + strleft * 1 + htmlbody().clientWidth * 1 / 2);
        }
        else 
            if (strLeftType == "right") {
                temp_getleft = scrollLeft() * 1 + htmlbody().clientWidth * 1 -
                strleft * 1 -
                strobjs.offsetWidth * 1;
            }
    return temp_getleft;
}

function moveTips(strobj, theTop, theLeft, theLeftType, tt){
    var nowobj = D(strobj);
    var nowleft = nowobj.style.left.replace("px", "") * 1;
    var temp_left = getleft(nowobj, theLeftType, theLeft);
    var re_theTop = theTop;
    if (temp_left != nowleft) {
        (Math.abs(temp_left - nowleft) > 3 && Math.abs(temp_left - nowleft) < 600) ? ((temp_left > nowleft) ? nowleft += Math.abs(temp_left - nowleft) / 5 : nowleft -= Math.abs(temp_left - nowleft) / 5) : nowleft = temp_left;
        nowobj.style.left = nowleft + "px";
    }
    if (!openweb) {
        old = re_theTop;
        var openweb;
    };
    var pos = 50;
    pos = scrollTop() * 1 - nowobj.offsetTop * 1 + re_theTop * 1;
    pos = nowobj.offsetTop + pos / 10;
    if (pos < re_theTop) 
        pos = re_theTop;
    if (pos != old) {
        nowobj.style.top = pos + "px";
    }
    old = pos;
    setTimeout("moveTips('" + strobj + "','" + theTop + "','" + theLeft + "','" + theLeftType + "')", tt);
}

function fixPng(){
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    
    if ((version >= 5.5 && version < 7.0) && (document.body.filters)) {
        for (var i = 0; i < document.images.length; i++) {
            var img = document.images[i];
            var imgName = img.src.toUpperCase();
            if (imgName.indexOf(".PNG") > 0) {
                var width = img.width;
                var height = img.height;
                var sizingMethod = (img.className.toLowerCase().indexOf("scale") >= 0) ? "scale" : "image";
                img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src.replace('%23', '%2523').replace("'", "%27") + "', sizingMethod='" + sizingMethod + "')";
                img.src = "/images/blank.gif";
                img.width = width;
                img.height = height;
            }
        }
    }
}
//参数说明：moveTips(对象ID,距顶部像素,距左边像素,样式类型(left/mid/right)，函数延时(单位为毫秒));