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) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
		viewportwidth=window.innerWidth;
	} else {
		viewportheight = document.documentElement.clientHeight;
		viewportwidth=document.documentElement.clientWidth;
	}
	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';
	//alert(blanket.style.height);
	//blanket.style.width = document.body.parentNode.clientwidth + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-250;//150 is half popup's height
	popUpDiv.style.top = parseInt(popUpDiv_height)-150 + 'px';
}
function window_pos(popUpDivVar) {
	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-120;//150 is half popup's width
	popUpDiv.style.left =10;//parseInt(window_width)-150 + 'px';
}
function popup(windowname,csvobj) {
	//blanket_size(windowname);
	//window_pos(windowname);
	//toggle('blanket');
	toggle(windowname);		
	//setDivPos(,csvobj);
	//var csvobj1=document.getElementById(csvobj);
	xPos=250;
	yPos=findPosY(csvobj)-510;
	document.getElementById(windowname).style.left=xPos+"px";
	document.getElementById(windowname).style.top=yPos+"px";
}

function findPosX(obj)
{
var curleft = 0;

if(obj != null)
{
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
}
return curleft;
}

function findPosY(obj)
{
var curtop = 0;

if(obj!= null)
{
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
}
return curtop;
}


