var popup = {
	$:function(id){
		return document.getElementById(id);
	},
	closePopup:function(obj,bgdiv){
		popup.$(obj).style.display = "none";
		popup.$(bgdiv).style.display = "none";
	},
	openPopup:function(obj,bgdiv,width,height){
		var windowwidth = common.getWindowWidth();
		var windowheight = common.getWindowHeight();
		var style = "width:100%; height:"+windowheight+"px; background-color:gray; z-index:9000; top:0px; position:absolute; opacity:1;";
		if(popup.$(bgdiv)){
			popup.$(bgdiv).style.display = "";			
		}else{
			var bg = document.createElement("div");
			bg.setAttribute('id',bgdiv);
		    bg.style.position="absolute";
		    bg.style.top="0";
		    bg.style.opacity="11";
			bg.style.backgroundColor = "gray";
		    bg.style.left="0";
		    bg.style.width=windowwidth + "px";
		    bg.style.height=windowheight + "px";
		    bg.style.zIndex=8999;
			bg.style.filter = "Alpha(Opacity=50)";
			//bg.setAttribute("style",style);
			document.body.appendChild(bg);
			//bg.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=20)";
		}
		popup.$(obj).style.left = (windowwidth-width)/2 +"px";
		//popup.$(obj).style.top = 100 +"px";
		popup.$(obj).style.top = (document.documentElement.scrollTop + (windowheight-height)/2) +"px";
		popup.$(obj).style.display = "";;
	}
};
var common = {
	$:function(id){
		return document.getElementById(id);
	},
	getWindowWidth:function(){
		return document.documentElement.scrollWidth;
	},
	getWindowHeight:function(){		
			return document.documentElement.scrollHeight;		
	}
}
