var isIE6 = (navigator.userAgent.indexOf("MSIE 6.0")>-1) ? 1 :  0;
function showPopup() {
	var popupContainer = document.getElementById("dhtml_popupcontainer");
	if (!popupContainer) {
		var container = document.createElement("div");
		container.id = "dhtml_popupcontainer";
		container.className = "dhtml_popupcontainer";
		
		var background = document.createElement("div");
		background.id = "dhtml_popupbackground";
		background.className = "dhtml_popupbackground";
		
		var popup = document.createElement("div");
		popup.id = "dhtml_popup";
		popup.className = "dhtml_popup";
		
		container.appendChild(background);
		container.appendChild(popup);
		
		document.body.appendChild(container);
		
		var popupContainer = document.getElementById("dhtml_popupcontainer");
	}
	
	popupContainer.style.display = "block";
	
	var background = document.getElementById("dhtml_popupbackground");
	var popup = document.getElementById("dhtml_popup");
	
	var pageX = pageWidth();
	var pageY = pageHeight();
	
	var pageX2 = document.body.clientWidth;
	var pageY2 = document.body.clientHeight;
	
	//if (isIE6) {
//		background.style.width = pageX2+"px";
		background.style.height = (pageY2)+"px";
	//}
	
	popup.style.left = (pageX/2-(popup.clientWidth/2))+"px";
	popup.style.top = (pageY/2-(popup.clientHeight/2))+"px";
	
	var popupcontent = document.getElementById("dhtml_popupcontent");
	if (popupcontent) popup.innerHTML = popupcontent.innerHTML;
	
	window.onresize = function () {
		showPopup();
	}
}

function hidePopup() {
	var popupContainer = document.getElementById("dhtml_popupcontainer");
	if (popupContainer) {
		popupContainer.style.display = "none";
	}
	window.onresize = function () {
	}
}

function pageWidth() {return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;}
function pageHeight() {return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;}
