﻿//创建遮罩半透明化页面 须定义.mask{background:url(/images/alpha.png); *background:#cccccc;*filter:alpha(opacity=50); }样式
        function Mask(width,height,url)
        {
            for(var i=0; i<document.getElementsByTagName("select").length;i++)
            {
                document.getElementsByTagName("select")[i].disabled = "disabled";
            }
            var mask = document.createElement("div");
            mask.setAttribute("style","text-align:center;");
            mask.style.position = "absolute";
            mask.style.width = "100%";
            mask.style.height = GetPageSize() + "px";
            mask.style.left = "0px";
            mask.style.top = "0px";
            mask.style.zindex = "98";
            mask.setAttribute("id","mask");
            mask.className = "mask";
            document.body.appendChild(mask);
            if(url != "")
            {
                var maskContent = document.createElement("div");
                maskContent.setAttribute("style","text-align:center;");
                maskContent.style.position = "absolute";
                maskContent.style.width = "100%";
                maskContent.style.left = "0px";
                maskContent.style.top = "0px";
                maskContent.style.zindex = "99";   
                maskContent.setAttribute("id","maskContent");
                maskContent.innerHTML = "<div style='height:200px;'></div><div style='margin:0 auto; text-align:right; width:"+width+"px;'><a href='#' onclick='unMask()'>X</a></div>";
                var innerWin = document.createElement("iFrame");
                innerWin.setAttribute("src",url);
                innerWin.setAttribute("width",width);
                innerWin.setAttribute("height",height);
                innerWin.setAttribute("align","center");
                innerWin.setAttribute("frameborder","0",0);
                innerWin.setAttribute("scrolling","no");
                innerWin.setAttribute("id","innerWin");
                maskContent.appendChild(innerWin);
                document.body.appendChild(maskContent);
            }
        }
        function unMask()
        {
            for(var i=0; i<document.getElementsByTagName("select").length;i++)
            {
                document.getElementsByTagName("select")[i].disabled = "";
            }
            if(document.getElementById("mask"))
            {
                document.body.removeChild(document.getElementById("mask"));
            }
            if(document.getElementById("maskContent"))
            {
                document.body.removeChild(document.getElementById("maskContent"));
            }
        }
        function GetPageSize()
        {
          var scrW, scrH;
          if(window.innerHeight && window.scrollMaxY) {
                // Mozilla
                scrW = window.innerWidth + window.scrollMaxX;
                scrH = window.innerHeight + window.scrollMaxY;
          } else if(document.body.scrollHeight > document.body.offsetHeight){
            // all but IE Mac
            scrW = document.body.scrollWidth;
            scrH = document.body.scrollHeight;
          } else if(document.body) { // IE Mac
            scrW = document.body.offsetWidth;
            scrH = document.body.offsetHeight;
          }
          
          var winW, winH;
          if(window.innerHeight) { // all except IE
            winW = window.innerWidth;
            winH = window.innerHeight;
          } else if (document.documentElement 
            && document.documentElement.clientHeight) {
            // IE 6 Strict Mode
            winW = document.documentElement.clientWidth; 
            winH = document.documentElement.clientHeight;
          } else if (document.body) { // other
            winW = document.body.clientWidth;
            winH = document.body.clientHeight;
          }
          
          // for small pages with total size less then the viewport
          var pageW = (scrW<winW) ? winW : scrW;
          var pageH = (scrH<winH) ? winH : scrH;
          
          //return {PageW:pageW, PageH:pageH, WinW:winW, WinH:winH};
          return pageH;
        }
