﻿// JScript 文件

function showDialog(strDialogName){
    $('fixed').style.width = (parseInt(window.screen.width) + 42).toString() + "px";
    $('fixed').style.height = (parseInt(document.body.scrollHeight) + 100).toString() + "px";
    $('fixed').style.display = 'block';
    $(strDialogName).style.display = 'block';
    centerDialog(strDialogName);
    //alert($('mainBody').
}
function closeDialog(strDialogName){
    //id为fixed的div是半透明的Mask
    $('fixed').style.display = 'none';
    $(strDialogName).style.display = 'none';
}
function centerDialog(strDialogName){
    var winWidth = getViewportWidth();
    var winHeight = getViewportHeight();
    var theBody = document.documentElement;
    var scTop = parseInt(theBody.scrollTop,10);
    var scLeft = parseInt(theBody.scrollLeft,10);
    var w = $(strDialogName).style.width;
    var h = $(strDialogName).style.height;
    $(strDialogName).style.top = parseInt(winHeight,10)/2 - parseInt(h,10)/2 + scTop + 'px';
    $(strDialogName).style.left = parseInt(winWidth,10)/2 - parseInt(w,10)/2 + scLeft + 'px';
}
function getViewportHeight() {
    if (window.innerHeight!=window.undefined) return window.innerHeight;
    if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
    if (document.body) return document.body.clientHeight; 
    return window.undefined; 
}
function getViewportWidth() {
    if (window.innerWidth!=window.undefined) return window.innerWidth; 
    if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
    if (document.body) return document.body.clientWidth; 
    return window.undefined; 
}
