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 BlanketSize(PopUpDivVar,BlanketName) 
{

	if (typeof window.innerWidth != 'undefined') 
	{

		viewportheight = window.innerHeight;
		
	}
	else 
	{

		viewportheight = document.documentElement.clientHeight;
		
	}


	
	BlanketHeight=document.body.clientHeight;
	
	var Blanket = document.getElementById(BlanketName);
	Blanket.style.height = BlanketHeight + 'px';
	Blanket.style.width = document.body.clientWidth +'px';
	

	
	var PopUpDiv = document.getElementById(PopUpDivVar);
	PopUpDiv_height=BlanketHeight/2-(DivHeight/2) ;//150 is  popup's height
	PopUpDiv.style.top = PopUpDiv_height + 'px';

}

function WindowPos(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)) 
	{

		WindowWidth = viewportwidth;
		
	}
	else 
	{

		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) 
		{

			WindowWidth = document.body.parentNode.clientWidth;
			
		}
		else 
		{

			WindowWidth = document.body.parentNode.scrollWidth;
			
		}

		
	}

	var PopUpDiv = document.getElementById(PopUpDivVar);
	WindowWidth=WindowWidth/2-300;//300 is half popup's width
	PopUpDiv.style.left = WindowWidth + 'px';

}

function popup(WindowName,BlanketName) 
{
	document.body.scroll="no";
	BlanketSize(WindowName,BlanketName);
	WindowPos(WindowName);
	toggle(BlanketName);
	toggle(WindowName);		
}

