//初始化：是否开启DIV弹出窗口功能
//0 表示开启; 1 表示不开启;
var popupStatus = 0;
var popupObj = null;

//使用Jquery加载弹窗  
function blockUI(popupId){    
//仅在开启标志popupStatus为0的情况下加载

if(popupStatus==0){
popupObj = "#" + popupId;
$("#blockUIBg").css({    
"opacity": "0.7"   
});      
$("#blockUIBg").fadeIn(0,"slow");
$(popupObj).fadeIn("slow");
centerPopup();
popupStatus = 1;    
}
else if(popupStatus==1){
    $(popupObj).fadeOut("slow");
    popupObj = "#" + popupId;
    $(popupObj).fadeIn("slow");
    centerPopup();
}
}

//使用Jquery报载弹窗
function unblockUI(){

if(popupStatus==1)
{
    $("#blockUIBg").fadeOut("slow");
    $(popupObj).fadeOut(0,"slow");
    popupStatus=0;
    popupObj=null;
}
}   

//将弹出窗口定位在屏幕的中央 
function centerPopup(){    
//获取系统变量 
var windowWidth = document.documentElement.clientWidth;    
var windowHeight = document.documentElement.clientHeight;    
var popupHeight = $(popupObj).height();    
var popupWidth = $(popupObj).width();    
//居中设置    
$(popupObj).css({    
"position": "absolute",
"left": windowWidth/2-popupWidth/2    
}); 
}