﻿function DoScrollJqry(idpopup,idoverlay,js_estCnt)
{
        $("#"+idoverlay).height( $(document).height());
        $("#"+idoverlay).width( $(document).width());        
        var Position=$("#pos_"+(parseInt(js_estCnt).toString())).offset();
        var ver = navigator.appVersion;
        if (ver.indexOf("MSIE") != -1)
        {
        var isIE5Min = getIEVersionNumber();
        if( isIE5Min> 7)
        {
        document.getElementById(idpopup).style.top=(parseInt(Position.top)-160)+"px";
        document.getElementById(idpopup).style.left=(parseInt(Position.left)-625)+"px";
        }
        else
        {
        document.getElementById(idpopup).style.top=(parseInt(Position.top)-150);
        document.getElementById(idpopup).style.left=(parseInt(Position.left)-960);
        }
        }
        else
        {
        document.getElementById(idpopup).style.top=(parseInt(Position.top)-160)+"px";
        document.getElementById(idpopup).style.left=(parseInt(Position.left)-625)+"px";
        }
}

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}


function findPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
    while(1)
    {
    curleft += obj.offsetLeft;
    if(!obj.offsetParent)
    break;
    obj = obj.offsetParent;
    }
    else if(obj.x)
    curleft += obj.x;
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
    while(1)
    {
    curtop += obj.offsetTop;
    if(!obj.offsetParent)
    break;
    obj = obj.offsetParent;
    }
    else if(obj.y)
    curtop += obj.y;
    return curtop;
}

