﻿<!--
/**********************************************************************
	Manages the Popup feature.
**********************************************************************/
document.write('<div id="dLockdown" style="position:fixed; top:0px; left:0px; height:500px; width:500px; background-color:#a9a9a9; border: solid 1px #000000; display:none; filter:alpha(opacity=50); -moz-opacity:0.50; opacity:0.50; z-index:998;"></div>');
document.write('<iframe id="dPopup" style="position:absolute; top:0px; left:0px; height:0px; width:0px; border: solid 1px #000000; display:none; z-index:999;" frameborder="0" scrolling="yes" src=""></iframe>');

function showPopup(Page, Height, Width)
{
    if (typeof Height == 'undefined') Height = 600;
    if (typeof Width == 'undefined') Width = 800;

	var _ldOBJ = document.getElementById('dLockdown');
	var _puOBJ = document.getElementById('dPopup');

	if (_ldOBJ != null) {
		_ldOBJ.style['height'] = _getDocHeight() + 'px';
		_ldOBJ.style['width'] = _getDocWidth() + 'px';
		_ldOBJ.style['display'] = 'block';
	}
	
	if (_puOBJ != null) {
		_puOBJ.setAttribute('src', Page);		
		_puOBJ.style['top'] = ((_getWinHeight() / 2) - (Height / 2)) + 'px';
		_puOBJ.style['left'] = ((_getWinWidth() / 2) - (Width / 2)) + 'px';
		_puOBJ.style['height'] = Height + 'px';
		_puOBJ.style['width'] = Width + 'px';
		_puOBJ.style['display'] = 'block';
	}
}

function closePopup()
{
	var _ldOBJ = document.getElementById('dLockdown');
	var _puOBJ = document.getElementById('dPopup');

	if (_ldOBJ != null) {
		_ldOBJ.style['display'] = 'none';
	}
	
	if (_puOBJ != null) {
		_puOBJ.style['display'] = 'none';
	}
}

function _adjustLockdown()
{
	var _ldOBJ = document.getElementById('dLockdown');
	var _puOBJ = document.getElementById('dPopup');
	
	if (_ldOBJ.style['display'] != 'block') { return false; }
	
	if (_ldOBJ != null) {
		_ldOBJ.style['display'] = 'none';
		_ldOBJ.style['height'] = _getDocHeight() + 'px';
		_ldOBJ.style['width'] = _getDocWidth() + 'px';
		window.setTimeout('document.getElementById(\'dLockdown\').style[\'display\'] = \'block\';', 1);
	}
	
	if (_puOBJ != null) {
		var _puHeight = parseInt(_puOBJ.style['height']);
		var _puWidth = parseInt(_puOBJ.style['width']);
		
		_puOBJ.style['top'] = ((_getWinHeight() / 2) - (_puHeight / 2)) + 'px';
		_puOBJ.style['left'] = ((_getWinWidth() / 2) - (_puWidth / 2)) + 'px';
	}
}

function _getDocHeight() {
	return Math.max(
		document.body.scrollHeight,
		document.documentElement.scrollHeight,
		document.body.offsetHeight,
		document.documentElement.offsetHeight,
		document.body.clientHeight,
		document.documentElement.clientHeight
	);
}
function _getDocWidth() {
	return Math.max(
		document.body.scrollWidth,
		document.documentElement.scrollWidth,
		document.body.offsetWidth,
		document.documentElement.offsetWidth,
		document.body.clientWidth,
		document.documentElement.clientWidth
	);
}
function _getWinHeight() {
	return Math.min(
		document.body.scrollHeight,
		document.documentElement.scrollHeight,
		document.body.offsetHeight,
		document.documentElement.offsetHeight,
		document.body.clientHeight,
		document.documentElement.clientHeight
	);
}
function _getWinWidth() {
	return Math.min(
		document.body.scrollWidth,
		document.documentElement.scrollWidth,
		document.body.offsetWidth,
		document.documentElement.offsetWidth,
		document.body.clientWidth,
		document.documentElement.clientWidth
	);
}

if (window.attachEvent) {
	window.attachEvent('onresize', _adjustLockdown);
}
else if (window.addEventListener) {
	window.addEventListener('resize', _adjustLockdown, false);
}
else {
	window.onresize = _adjustLockdown;
}
//-->