﻿function bgMask(DTitle,Url,Width,Height){
  var d=document.getElementById("mask");
  var pageHeight=document.body.clientHeight;
  var screenHeight=window.screen.availHeight-126;
  var scrollHeight=document.documentElement.scrollTop;
  
       if(d != null){ 
         document.body.removeChild(d);
        }
        var mbg=document.createElement("div");
        mbg.style.width=document.body.offsetWidth + "px";
		if(screenHeight>pageHeight){
		mbg.style.height=screenHeight + "px";
		}else{
		mbg.style.height=pageHeight + "px";
		}
		document.body.appendChild(mbg);
		
  		
		mbg.id="mask"
		mbg.className="mask";
		mbg.oncontextmenu=new Function("event.returnValue=false;");
		//mbg.onselectstart=new Function("event.returnValue=false;");
		
		if(!Width)
		{
		    Width = 720;
		}
		if(!Height)
		{
		    Height = 511;
		}
		var MBox=document.createElement("div");
		MBox.id="MBox"
		MBox.className="flowdiv";
		MBox.style.left=(screen.width)/2-(Width/2)+"px";
		MBox.style.top=(screen.height)/2-(Height/2)-50+scrollHeight+"px";
		MBox.innerHTML="<div style='position:relative'><table width='"+Width+"' height='"+(Height-21)+"' border='0' cellpadding='0' cellspacing='0' class='openwindow' style='position:absolute;left:0;top:0;z-index:100'><tr><td width='"+(Width-36)+"' height='30' bgcolor='#F7F2E4' class='titleL'><font color='#D83332' style='font-weight:bold;text-align:left; margin-left:10px'>"+DTitle+"</font></td><td width='34' valign='middle' bgcolor='#F7F2E4'><div class='closeBox' onmouseover='changeClass(this,1)' onmouseout='changeClass(this,2)' onclick='closeDivShow()' ><img src='../Images/close.gif'  style='margin:2px'/></div></td></tr><tr><td height='"+(Height-41)+"' colspan='2' align='center'style='margin-left:0px; text-align:center' valign='top' bgcolor='#F7F2E4'><iframe class='maskIframe' style='text-align:center' height='"+(Height-51)+"' width='"+(Width-20)+"' src='"+Url+"' style='background:#fff;background:#fff;border:1px solid #B26C21; overflow:visible!important; overflow:hidden;' frameborder=0 scrolling=auto></iframe></td></tr></table><iframe id='Shim' src='javascript:false;' scrolling='no' frameborder='0' style='width:"+Width+";height:"+(Height-21)+";position:absolute;left:0;top:0;z-index:99'></iframe></div>";
		document.body.appendChild(MBox);

}

function changeClass(obj,type){
	if( type == 1)
		obj.className = "closeBoxF";
	else{
		obj.className = "closeBox";
	   }
}

function closeDivShow(){
var d=document.getElementById("mask");
var m=document.getElementById("maskIframe");
var f=document.getElementById("MBox");
if(m != null){
	m.src = "";
	}
	if(d != null && f != null){
	 document.body.removeChild(d);  
	 document.body.removeChild(f); 
	}
	
}

window.onresize=function(){
  var d=document.getElementById("mask");
  //var yScroll = document.body.scrollTop;
  if(d){
	d.style.width=document.body.offsetWidth;
	//d.style.height=window.screen.availHeight-126+yScroll;
  }
}

function getOs(){
	
   var OsObject = ""; 
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; 
   } 
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; 
   } 
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
        return "Safari"; 
   } 
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
        return "Camino"; 
   } 
   if(isMozilla=navigator.userAgent.indexOf("Gecko")>0){ 
        return "Gecko"; 
   } 
   
}