	var g_PopupIFrame;
	var divPopup=document.getElementById("centre_popup");
	
	function vIE(){return (navigator.appName=='Microsoft Internet Explorer')?parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]):-1;}
	
	function show_popup(file,w,h,opts) {
		divPopup.innerHTML = "";
		
		var scrolledX, scrolledY;
		if( self.pageYOffset ) {
		  scrolledX = self.pageXOffset;
		  scrolledY = self.pageYOffset;
		} else if( document.documentElement && document.documentElement.scrollTop ) {
		  scrolledX = document.documentElement.scrollLeft;
		  scrolledY = document.documentElement.scrollTop;
		} else if( document.body ) {
		  scrolledX = document.body.scrollLeft;
		  scrolledY = document.body.scrollTop;
		}
		
		// Determine the coordinates of the center of the page
		
		var centerX, centerY;
		if( self.innerHeight ) {
		  centerX = self.innerWidth;
		  centerY = self.innerHeight;
		} else if( document.documentElement && document.documentElement.clientHeight ) {
		  centerX = document.documentElement.clientWidth;
		  centerY = document.documentElement.clientHeight;
		} else if( document.body ) {
		  centerX = document.body.clientWidth;
		  centerY = document.body.clientHeight;
		}
		
		var leftOffset = scrolledX + (centerX - w) / 2;
		var topOffset = scrolledY + (centerY - h) / 2;
		
		divPopup.style.top = topOffset + "px";
		divPopup.style.left = leftOffset + "px";
		divPopup.style.width = w + "px";
		divPopup.style.height = h + "px";
		if (file != '')
			AJPostData(opts,file,"centre_popup");
		divPopup.style.display = "block";
		divPopup.style.zIndex = 9998;
		if (vIE()>0 && vIE()<=6) {
			try {
				document.body.removeChild(g_PopupIFrame);
	            g_PopupIFrame=null;
			} catch (e) {}
			 //Increase default zIndex of div by 1, so that DIV appears before IFrame
	        divPopup.style.zIndex=divPopup.style.zIndex+1;
			
	        var iFrame = document.createElement("IFRAME");
	        iFrame.setAttribute("src", "");
			
	        //Match IFrame position with divPopup
	        iFrame.style.position="absolute";
	        iFrame.style.left =divPopup.offsetLeft + 'px';
	        iFrame.style.top =divPopup.offsetTop + 'px';
	        iFrame.style.width =divPopup.offsetWidth + 'px';
	        iFrame.style.height =divPopup.offsetHeight + 'px';
	
	        document.body.appendChild(iFrame);
				//Store iFrame in global variable, so it can get removed when divPopup is hidden
	        g_PopupIFrame=iFrame;
        }
	}
	
	function close_popup() {
		divPopup.style.display = "none";
		if (vIE()>0 && vIE()<=6) {
            document.body.removeChild(g_PopupIFrame);
            g_PopupIFrame=null;
        }
	}

