				var popupWidth, popupHeight, originalDocumentWidth;
		
		function showPopup(title, rID, width, height)
		{
			// Specific for password in guldmann popup
			var word = document.getElementById('lPassword').value;

			var elSource = document.getElementById('popupSource');
			var el = document.getElementById('popupMask');
			var elContent = document.getElementById('popupContent');
		
			// Store input dimensions
			popupWidth = width;
			popupHeight = height;
			originalDocumentWidth = document.documentElement.scrollWidth;
			
			// Copy source html into elContent
			elContent.innerHTML = elSource.innerHTML.split("<!--@Title-->").join(title);
			
			// Write reqID
			document.getElementById('regID').value = rID;

			// Set dimensions
			setPopupDimensions(el, elContent, width, height);
			
			// Set visibility
			el.style.display = '';
			elContent.style.display = '';
			
			// Specific for password in guldmann popup
			document.getElementById('lPassword').value = word;

			// Detect resizes
			window.onresize = setPopupDimensions;
			window.onscroll = setPopupDimensions;
		}
		
		function setPopupDimensions(el, elContent)
		{	
			var elSource = document.getElementById('popupSource');
			var el = document.getElementById('popupMask');
			var elContent = document.getElementById('popupContent');
			
			// Get stored dimensions
			width = popupWidth;
			height = popupHeight;
		
			// The SWF needs some extra margins
			width = width + 12;
			height = height + 2;
			
			// Get scroll position
			var scrollY = document.documentElement.scrollTop;
			var scrollX = document.documentElement.scrollLeft;
			
			// Get document dimensions
			var documentHeight = document.body.clientHeight > document.documentElement.clientHeight ? document.body.clientHeight : document.documentElement.clientHeight;
			var documentWidth = originalDocumentWidth < document.documentElement.scrollWidth ? originalDocumentWidth : document.documentElement.scrollWidth;
			
			// Get browser dimensions
			if(self.innerHeight)
				var innerHeight = self.innerHeight;
			else
				var innerHeight = document.documentElement.clientHeight;
			var innerWidth = document.documentElement.clientWidth < document.body.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
			
			if(documentWidth < innerWidth)
				documentWidth = innerWidth;
			
			// Set dimensions of background mask
			el.style.width = documentWidth + 'px';
			el.style.height = documentHeight + 'px';
			el.style.top = scrollY + 0;
			el.style.left = scrollX + 0;
			
			// Set dimensions of content
			elContent.style.width = width + 'px';
			elContent.style.height = height + 'px';
			elContent.style.top = (scrollY + innerHeight / 2 - height / 2 - 48 / 2) + 'px';
			elContent.style.left = (scrollX + innerWidth / 2 - width / 2) + 'px';
		}
		
		function cancelPopup()
		{
			// Hide view
			document.getElementById('popupMask').style.display = 'none';
			document.getElementById('popupContent').style.display = 'none';
			document.getElementById('swfFlvPlayer').innerHTML = '';
			
			// Don't handle resizes
			window.onresize = null;
			window.onscroll = null;
		}
