function toggle(div_id, sAction) {
	var el = document.getElementById(div_id);
	if ( sAction == 'open' ) { el.style.display = 'block'; }
	else {el.style.display = 'none';}
}

function window_pos(popUpDivVar, divHeight, divWidth) {
 var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 else // older versions of IE
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
	
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}

	var blanket = document.getElementById('blanket');
	var popUpDiv = document.getElementById(popUpDivVar);
	
	blanket.style.height = blanket_height + 'px';

	if (!divHeight) divHeight = 0;
	if (!divWidth) divWidth = 0;
	
	popUpDiv_top=viewportheight/2-divHeight/2;
	popUpDiv.style.top = popUpDiv_top + 'px';

	popUpDiv_left=viewportwidth/2-divWidth/2;
	popUpDiv.style.left = popUpDiv_left + 'px';
}
function popup(windowname, sAction, divHeight, divWidth) {
	window_pos(windowname, divHeight, divWidth);
	toggle('blanket', sAction);
	toggle(windowname, sAction);		
}
