﻿/* Global script for MGB screens */

function showDetailsPopup(gmId) {
    var totalPopupHeight = $(window).height() * 0.9;
    $("#divDetailsPopup").css({
        width: ($(window).width() * 0.8).toString() + "px"
    });
    // 50 represents different the height of different other div and paddings
    $("#divPopupContent").css({
        height: (totalPopupHeight - 50).toString() + "px"
    });

    $("#divPopupContent").html("");
    $.ajax({
        type: "GET",
        async: false,
        data: { geomarkId: gmId },
        url: "GeoMarkPopupDetails.aspx",
        success: function(returnData) { $("#divPopupContent").html(returnData); }
    });

    $.openPopupLayer({
        name: "detailsPopup",
        target: "divDetails"
    });
}

function btnCloseDetailsPopupClick() {
    $.closePopupLayer();
}

function computeContentSize() {
    var newHeight = $(window).height() - $('#divFooter').height();
    // fix for IE 6.0 which counts the hight for "display: none" elements
    if ($('#divHeader').css('display').toLowerCase() !== 'none') {
        newHeight -= $('#divHeader').height();
    }

    var result = { width: $(window).width(), height: newHeight };
    return result;
}

$.setupJMPopups({
    screenLockerBackground: "#000",
    screenLockerOpacity: "0.3"
});
