﻿function ReloadPage() {
    location.reload(true);
}

function HideModal(ctrl) {
    $find(ctrl).hide();
}

function ShowModal(ctrl) {
    $find(ctrl).show();
}

function ShowAdmin(hoveritem, id, adminId) {
    //alert(id);
    var hp = document.getElementById(adminId + "_admin" + id.toString().substring(id.toString().lastIndexOf("_") + 1, id.toString().length));
    var regionPanel = document.getElementById(id);
    
    // Set position of hover-over popup
    //hp.style.left = findXLeft(hoveritem) + hoveritem.offsetWidth - (document.getElementById("admin" + id).offsetWidth + 10);

    regionPanel.style.background = "Gray";
    //regionPanel.style.filter = "alpha(opacity=70)";
    //regionPanel.style.opacity = "0.7";

    // Set popup to visible
    hp.style.visibility = "Visible";
    hp.style.zIndex = 9000;
}

function HideAdmin(id, adminId) {
    var hp = document.getElementById(adminId + "_admin" + id.toString().substring(id.toString().lastIndexOf("_") + 1, id.toString().length));
    var regionPanel = document.getElementById(id);

    regionPanel.style.background = "Transparent";
    //regionPanel.style.filter = "alpha(opacity=100)";
    //regionPanel.style.opacity = "1";

    hp.style.visibility = "Hidden";
}

//Get the left coordinate of the container
function findXLeft(obj) {
    var x = 0;
    while (obj) {
        x += obj.offsetLeft
        obj = obj.offsetParent;
    }

    return x;
}

//Get the top coordinate of the container
function findXTop(obj) {
    var x = 0;
    while (obj) {
        x += obj.offsetTop
        obj = obj.offsetParent;
    }

    return x;
}

function resizeFrame(ctrl) {
    var s;
    s = 100;
    ctrl.style.height = s;
    s = ctrl.contentWindow.document.body.scrollHeight + 35 + "px";
    ctrl.style.height = s;

    //ctrl.style.height = ctrl.contentWindow.document.body.scrollHeight;
}