﻿function getElementWidth(objectId) {
    x = objectId;
    return x.offsetWidth;
}

function getAbsoluteLeft(objectId) {
    // Get an object left position from the upper left viewport corner
    o = objectId;
    oLeft = o.offsetLeft            // Get left position from the parent object
    while (o.offsetParent != null) {   // Parse the parent hierarchy up to the document element
        oParent = o.offsetParent    // Get parent object reference
        oLeft += oParent.offsetLeft // Add parent left position
        o = oParent
    } 

    return oLeft
}

function getAbsoluteTop(objectId) {
    // Get an object top position from the upper left viewport corner
    o = objectId;
    oTop = o.offsetTop            // Get top position from the parent object
    while (o.offsetParent != null) { // Parse the parent hierarchy up to the document element
        oParent = o.offsetParent  // Get parent object reference
        oTop += oParent.offsetTop // Add parent top position
        o = oParent
    }
    return oTop
}

function onMouseOv(obj) {

    $("#tip").css({ left: getAbsoluteLeft(obj) + getElementWidth(obj) + 10 + "px", top: getAbsoluteTop(obj) + "px", display: "block" });
    var st = "";

    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;产品名称：' + $(obj).attr("pname") + '</li>';
    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;编　　号：' + $(obj).attr("pbianhao") + '</li>';
    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;型　　号：' + $(obj).attr("pxinhao") + '</li>';
    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;标准价格：' + $(obj).attr("pprice") + '元/台</li>';
    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;促销价格：' + $(obj).attr("ptrueprice") + '元/台</li>';
    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;更新时间：' + $(obj).attr("paddtime") + '</li>';
    st = st + '<li ><img src="/Images/Arrow_01.gif" align="absmiddle">&nbsp;&nbsp;出品单位：' + $(obj).attr("pmaker") + '</li>';
    $("#tip ul").html(st);
  
    $("#tip").show();


}

function onMouseOut(obj) {
    $("#tip").css({ display: "none" });
}
