
function Loading(frame) {
    var fm1 = window.frames[frame.id];
    var divloading = document.getElementById("divLoading");
    if (divloading == null) {
        loading(frame);
    }
    else {
    try
    {
        if (fm1.document.readyState == 'interactive' || fm1.document.readyState == 'loading') {
            loading(frame);
        }
        }catch(ex){}
    }
    void (0);
}

function loading(frame) {

    var offsetLeft = __getLeft(frame);
    var offsetTop = __getTop(frame);

    var divloading = document.getElementById("divLoading");
    if (divloading == null) {
        fdivCount = 0;
        divloading = foundDiv(parent);
    }

    if (divloading != null) {
        divloading.style.left = (offsetLeft + frame.offsetWidth / 2 - divloading.offsetWidth / 2) + "px";
        divloading.style.top = (offsetTop + frame.offsetHeight / 2 - divloading.offsetHeight / 2 - 60) + "px";
        divloading.style.visibility = "visible";
    }
}

function Loadend() {
    var divloading = document.getElementById("divLoading");
    if (divloading == null) {
        fdivCount = 0;
        divloading = foundDiv(parent);
    }

    if (divloading != null) {
        divloading.style.visibility = "hidden";
    }
}

var fdivCount = 0;
function foundDiv(baseParent) {
    fdivCount++;
    if (baseParent != null) {
        var div = baseParent.document.getElementById("divLoading");
        if (div == null) {
            if (fdivCount < 5)
                foundDiv(baseParent.parent);
        } else {
            return div;
        }
    } else
    { return null; }
}

function __getTop(e) {
    var t = e.offsetTop
    while (e = e.offsetParent) t += e.offsetTop;
    return t;
}

function __getLeft(e) {
    var l = e.offsetLeft
    while (e = e.offsetParent) l += e.offsetLeft;
    return l;
}