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 blanket_size(popUpDivVar, newtop, newleft) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.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');
	blanket.style.height 	= 	blanket_height + 'px';
	blanket.style.top		= 	- newtop	+  'px';
	blanket.style.left      =   - newleft   +  'px';
}
function window_pos(popUpDivVar, newtop, newleft,  popupmargin) {
	
	var popUpDiv 		= document.getElementById(popUpDivVar);
	left_width			= newleft -popupmargin;
	popUpDiv.style.left = - left_width 			+ 'px';
	popUpDiv.style.top  = - newtop  	+  150  + 'px';

}
function popup(windowname, currenttop, currentleft, popupmargin) {
	blanket_size(windowname, currenttop, currentleft);
	window_pos(windowname, currenttop, currentleft,  popupmargin);
	toggle('blanket');
	toggle(windowname);		
}

