function toggle(boxid) {
	var el = document.getElementById(boxid);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_size(boxid) {
	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;
		}*/
		blanket_height = document.body.parentNode.clientHeight;
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	
	/*var popupbox = document.getElementById(boxid);
	var popupbox_top=(blanket_height-popupbox.style.height)/2 + 'px';
	var popupbox_top=(blanket_height-480)/2 + 'px';
	popupbox.style.top = popupbox_top;*/
}
function window_pos(boxid) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth;
	} else {
		viewportwidth = document.documentElement.clientWidth;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popupbox = document.getElementById(boxid);
	var boxwidth = popupbox.clientWidth;
	var boxleft = (window_width - boxwidth)/2;
	popupbox.style.left = boxleft;
}
function window_pos2(boxid) {
	var winW = 640, winH = 480;//initial values
	if (window.innerWidth && window.innerHeight) {
		winW = window.innerWidth;
		winH = window.innerHeight;
	}
	if (	document.compatMode=='CSS1Compat' &&
			document.documentElement &&
			document.documentElement.offsetWidth ) {
		winW = document.documentElement.offsetWidth;
		winH = document.documentElement.offsetHeight;
	}
	/*IE:*/
	if (document.body && document.body.offsetWidth) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	var popupboxwidth = 640;
	var popupboxheight = 480;
	var popupbox = document.getElementById(boxid);
	if(popupbox.className!='popuppicturebox'){
		popupboxwidth = 340;
		popupboxheight = 240;		
	}
	var popupboxleft = parseInt((winW - popupboxwidth)/2);
	popupbox.style.left = popupboxleft + 'px';
	
	var popupbox_top=parseInt((winH - popupboxheight)/2);
	popupbox.style.top = popupbox_top + 'px';
}
function popup(boxid) {
	blanket_size(boxid);
	window_pos2(boxid);
	toggle('blanket');
	toggle(boxid);		
}
function expand(contentid) {
	toggle(contentid);
}
