function toggle_lighbox(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, div_width , div_height) {
	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';
	var popUpDiv = document.getElementById(popUpDivVar);
	//popUpDiv_height=blanket_height/2 +50;//150 is half popup's height
	popUpDiv_height=50;//150 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
	popUpDiv.style.width = div_width + 'px';
	popUpDiv.style.height = div_height + 'px';
}
function window_pos(popUpDivVar, div_width , div_height) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	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 popUpDiv = document.getElementById(popUpDivVar);
	//window_width=window_width/2-50;//150 is half popup's width
	window_left = (window_width - div_width) / 2;
	popUpDiv.style.left = window_left + 'px';
	document.getElementById('blanket').style.width = window_width;
}

function popup_lightbox(windowname, div_width , div_height){	
	blanket_size(windowname, div_width , div_height);
	window_pos(windowname, div_width , div_height);
	toggle_lighbox('blanket');
	toggle_lighbox(windowname);
	
	// set the height and width of the iframe process
//	var objDivProcess = document.getElementById('process');
//	objDivProcessHg = objDivProcess.scrollHeight;
//	document.getElementById(objDivProcess).style.height = objDivHg + 'px';
	
	// set the height and width of the div according to the content
	var objDiv = document.getElementById(windowname);
	objDivHg = objDiv.scrollHeight + 25;
	document.getElementById(windowname).style.height = objDivHg + 'px';
	document.getElementById(windowname).style.width = objDiv.scrollWidth + 'px';
	//alert(document.getElementById(windowname).style.height);
	//alert(objDiv.scrollHeight);
}

function hideAllDiv() {
	document.getElementById('popUpDiv').style.display = "none";
	document.getElementById('popUpDiv2').style.display = "none";
	document.getElementById('blanket').style.display = "none";
}

function toggleDiv( div_id1, div_id2 ){
	if (document.getElementById(div_id1).style.display == "none") {
		document.getElementById(div_id2).style.display = "none";
		document.getElementById(div_id1).style.display = "block";
	} else {
		document.getElementById(div_id1).style.display = "none";
		document.getElementById(div_id2).style.display = "block";
	}
}
