 
function popupPaymentPlan(url)
{	
	popupFrame(url, 490, 340, 'contentDiv', 'divPopup');
}

function popupFrame(url, x, y, contentDiv, popupDiv)
{
	var ifrm, placeHolder;		
		
	ifrm = top.document.createElement("IFRAME"); 
	ifrm.setAttribute("src", url);
	ifrm.setAttribute('frameBorder', '0');
	ifrm.style.width = x + "px";
	ifrm.style.height = y + "px";
		
	placeHolder = top.document.getElementById(contentDiv);
	while(placeHolder.childNodes[0])
		placeHolder.removeChild(placeHolder.childNodes[0]);
		
	placeHolder.appendChild(ifrm);

	tmpDiv = top.document.getElementById(popupDiv);

	tmpDiv.style.width = x + 'px';	
		
	positionThePopup(x, y, popupDiv);
		
	tmpDiv.style.visibility = 'visible';	
}

function popupCheckbox(divText)
{
	popupDiv(divText, 490, 200, 'contentDiv', 'divPopup');
}

function popupDiv(srcDiv, x, y, contentDiv, popupDiv)
{
	var placeHolder, newDiv;
	
	newDiv = top.document.createElement("DIV");
	
	src = top.document.getElementById(srcDiv);
	newDiv.innerHTML = src.innerHTML;
	
	placeHolder = top.document.getElementById(contentDiv);
	while(placeHolder.childNodes[0])
		placeHolder.removeChild(placeHolder.childNodes[0]);
		
	placeHolder.appendChild(newDiv);

	tmpDiv = top.document.getElementById(popupDiv);

	tmpDiv.style.width = x + 'px';	
		
	positionThePopup(x, y, popupDiv);
		
	tmpDiv.style.visibility = 'visible';	
}

function positionThePopup(x, y, theDiv)
{
	var scrolledX, scrolledY, posX;
	
	if( self.pageYOffset )
	{
		scrolledX = self.pageXOffset;
		scrolledY = self.pageYOffset;
	}
	else if( top.document.documentElement && top.document.documentElement.scrollTop )
	{
		scrolledX = top.document.documentElement.scrollLeft;
		scrolledY = top.document.documentElement.scrollTop; 
	}
	else if( top.document.body )
	{
		scrolledX = top.document.body.scrollLeft;
		scrolledY = top.document.body.scrollTop;
	}
		
	//offset from top of page
	if(scrolledY < 200)
		scrolledY = 200;
	
	posX = (getPageWidth() - x) / 2.0;
		
	tmpDiv = top.document.getElementById(theDiv);
	tmpDiv.style.position = 'absolute';
	tmpDiv.style.top = (scrolledY + 3) + 'px';
	tmpDiv.style.left = posX + 'px';		
}

var supressed = 0;

function suppressNextClose()
{	
	supressed = 1;
}

function closePopup()
{
	if(top.document.getElementById('divPopup').style.visibility='visible' && supressed == 0)
	{
		placeHolder = top.document.getElementById('contentDiv');
		while(placeHolder.childNodes[0])
			placeHolder.removeChild(placeHolder.childNodes[0]);
		top.document.getElementById('divPopup').style.visibility='hidden';
	}	
	supressed = 0;
}

function getPageWidth()
{
	return top.document.body.clientWidth;
}
