/* Open popup window */
function openPopUp(width, height)
{
	/* Background Filter */

	//set size for background filter
	var docSize = xDocSize();
	document.getElementById('backgroundFilter').style.height = docSize.h;

	//place background filter over background
	document.getElementById('backgroundFilter').style.display = 'block';


	/* Popup Window */

	//get popup window element
	var popupWindow = document.getElementById('popupWindow');

	//set dimensions
    popupWindow.style.width = width;
    popupWindow.style.height = height;

	//set position (x)
	var x = document.body.scrollTop + 25;
    popupWindow.style.top = x+'px';

	//set position (y)
	var y = document.body.clientWidth;
	y = y - width;
	y = parseInt(y / 2);
    popupWindow.style.left = y+'px';

	//make visible
	popupWindow.style.display = 'block';
}



/* Close popup window */
function closePopUp()
{
	parent.document.getElementById('backgroundFilter').style.display = 'none';
	parent.document.getElementById('popupWindow').style.display = 'none';
	parent.document.getElementById('popupWindow').innerHTML = '';
}




// xDocSize r1, Copyright 2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xDocSize()
{
  var b=document.body, e=document.documentElement;
  var esw=0, eow=0, bsw=0, bow=0, esh=0, eoh=0, bsh=0, boh=0;
  if (e) {
    esw = e.scrollWidth;
    eow = e.offsetWidth;
    esh = e.scrollHeight;
    eoh = e.offsetHeight;
  }
  if (b) {
    bsw = b.scrollWidth;
    bow = b.offsetWidth;
    bsh = b.scrollHeight;
    boh = b.offsetHeight;
  }
//  alert('compatMode: ' + document.compatMode + '\n\ndocumentElement.scrollHeight: ' + esh + '\ndocumentElement.offsetHeight: ' + eoh + '\nbody.scrollHeight: ' + bsh + '\nbody.offsetHeight: ' + boh + '\n\ndocumentElement.scrollWidth: ' + esw + '\ndocumentElement.offsetWidth: ' + eow + '\nbody.scrollWidth: ' + bsw + '\nbody.offsetWidth: ' + bow);
  return {w:Math.max(esw,eow,bsw,bow),h:Math.max(esh,eoh,bsh,boh)};
}
