function toggle(div_id) {
	var el = document.getElementById(div_id);
	
	if (el.style.display === 'none') {
		el.style.display = 'block';
	}
	else {
		el.style.display = 'none';
	}
}

function create_blanket() {
	var height = 0, blanket_height = 0;
	
	if (typeof window.innerHeight !== 'undefined') {
		height = window.innerHeight;
	}
	else {
		height = document.documentElement.clientHeight;
	}
	if ((height > document.body.parentNode.scrollHeight)
		&& (height > document.body.parentNode.clientHeight)) {
		
		blanket_height = height;
	}
	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');
	blanket.style.height = blanket_height + 'px';
}

function create_popup(popUpDivVar) {
	var popUpDiv = document.getElementById(popUpDivVar);
	
	var scroll_width = 0, scroll_height = 0;
	if( typeof( window.pageYOffset ) === 'number' ) {
		//Netscape compliant
		scroll_height = window.pageYOffset;
		scroll_width = window.pageXOffset;
	} 
	else if( document.body
		&& ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scroll_height = document.body.scrollTop;
		scroll_width = document.body.scrollLeft;
	} 
	else if( document.documentElement
		&& ( document.documentElement.scrollLeft
		    || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scroll_height = document.documentElement.scrollTop;
		scroll_width = document.documentElement.scrollLeft;
	}
	
	var client_height = document.body.parentNode.clientHeight;
	var client_width  = document.body.parentNode.clientWidth;
	
	var popup_height = parseInt(443)
	var popup_width  = parseInt(800)
	
	var left    = client_width  / 2 + scroll_width  - (popup_width / 2);
	var top     = client_height / 2 + scroll_height - (popup_height / 2);
	
	popUpDiv.style.left  = left + 'px';
	popUpDiv.style.top   = top + 'px';
}

function popup(windowname) {
	create_blanket(windowname);
	create_popup(windowname);
	toggle('blanket');
	toggle(windowname);		
}
