﻿
var Browser_Name = navigator.appName;
var is_IE = (Browser_Name == "Microsoft Internet Explorer"); //

var wWidth = parent.parent.document.all ? parent.parent.document.getElementsByTagName("html")[0].offsetWidth : parent.parent.window.innerWidth;
var wHeight = parent.parent.document.all ? parent.parent.document.getElementsByTagName("html")[0].offsetHeight : parent.parent.window.innerHeight;

var heightMsg = 0;
var heightDialog = 0;

wWidth = wWidth * 0.6;

if (is_IE) {
    wHeight = wHeight * 0.6 + 100;
    heightMsg = +100;
    heightDialog = +100;
} else {
    wHeight = wHeight * 0.6;
    heightMsg = 0;
    heightDialog = -80;
}
function StrMsg(title, msg, width, height) {
    document.getElementById("divMsg").innerHTM = "";
    document.getElementById("divMsg").innerHTML = "<div id='dialog-message' title='" + title + "'><p>" + msg + "</p></div>";

    $("#dialog-message").dialog({
        resizable: false,
        height: height + heightMsg,
        width: width,
        modal: true,
        buttons: {
            "关闭": function () {
                $(this).dialog("close");
            }
        }
    });
}

function StrMsg(title, msg, object, width, height) {
    document.getElementById("divMsg").innerHTM = "";
    document.getElementById("divMsg").innerHTML = "<div id='dialog-message' title='" + title + "'><p>" + msg + "</p></div>";

    $("#dialog-message").dialog({
        resizable: false,
        height: height + heightMsg,
        width: width,
        modal: true,
        buttons: {
            "关闭": function () {
                eval(object);
                $(this).dialog("close");
            }
        }
    });
}



function StrConfirm(title, msg,object, width, height) {
    document.getElementById("divMsg").innerHTM = "";
    document.getElementById("divMsg").innerHTML = "<div id='dialog-message' title='" + title + "'><p>" + msg + "</p></div>";

    $("#dialog-message").dialog({
        resizable: false,
        height: height + heightMsg,
        width: width,
        modal: true,
        buttons: {
            "确定": function () {
                eval(object);
                $(this).dialog("close");
            },
            "取消": function () {
                $(this).dialog("close");
            }
        }
    });
}



function ShowDialog(title, url, id) {

    url = url + "?";
    try {
        document.getElementById("dialog-form").innerHTML = "<iframe src='" + url + "&FormData=id," + id + "' width='100%' height='100%' scrolling='Auto' frameborder='0'></iframe>";
    } catch (e) {
        document.getElementById("divDialog").innerHTML = "<div id='dialog-form' title='" + title + "'><iframe src='" + url + "&FormData=id," + id + "' width='100%' height='100%' scrolling='Auto' frameborder='0'></iframe></div>";
    }

    $("#dialog-form").dialog({
        autoOpen: false,
        height: wHeight + heightDialog,
        width: wWidth,
        modal: true,
        resizable: false
    });
    $("#dialog-form").dialog("open");
}

function CloseDialog() {
    $("#dialog-form").dialog("close");
}

function ShowDialog(title, url, id,width,height) {

    url = url + "?";
    try {
        document.getElementById("dialog-form").innerHTML = "<iframe src='" + url + "&FormData=id," + id + "' width='100%' height='100%' scrolling='Auto' frameborder='0'></iframe>";
    } catch (e) {
        document.getElementById("divDialog").innerHTML = "<div id='dialog-form' title='" + title + "'><iframe src='" + url + "&FormData=id," + id + "' width='100%' height='100%' scrolling='Auto' frameborder='0'></iframe></div>";
    }

    $("#dialog-form").dialog({
        autoOpen: false,
        height: height + heightDialog,
        width: width,
        modal: true,
        resizable: false
    });
    $("#dialog-form").dialog("open");
}
