﻿/**
* @deprecated 定义窗口高、宽的全局变量
* @author zdz
*/
var winWidth = 0;
var winHeight = 0;
/**
* @deprecated 定义获取窗口高宽的空函数
* 
*/
var getWinSize = function () { };

/**
* @deprecated 获取窗口宽度
* 
*/
getWinSize.winWidth = function () {
    if (window.innerWidth)//for Firefox
    {
        winWidth = window.innerWidth;
    }
    else if ((document.body) && (document.body.clientWidth)) {
        winWidth = document.body.clientWidth;
    }

    //通过深入Document内部对body进行检测，获取窗口大小
    if (document.documentElement && document.documentElement.clientWidth) {
        winWidth = document.documentElement.clientWidth;
    }

    return winWidth;
}

/**
* @deprecated 获取窗口高度
* 
*/
getWinSize.winHeight = function () {
    if (top.window.innerHeight)//for Firefox
    {
        winHeight = top.window.innerHeight;
    }
    else if ((top.document.body) && (top.document.body.clientHeight)) {
        winHeight = top.document.body.clientHeight;
    }

    //通过深入Document内部对body进行检测，获取窗口大小
    if (top.document.documentElement && top.document.documentElement.clientHeight) {
        winHeight = top.document.documentElement.clientHeight;
    }
    return winHeight - 15;
}

/**
* @deprecated 窗口高宽的设值函数，根据实际业务修改
* @return winWidth winHeight
* 
*/
getWinSize.onresize = function () {
    getWinSize.winWidth();
    getWinSize.winHeight();
}

/**
* @deprecated 用window.onload在页面加载的时候加载,window.onresize监听窗口高宽的变化
* 
*/
window.onload = function () {
    getWinSize.onresize();
    window.onresize = getWinSize.onresize;
}


