﻿function size_popup(popUpDivVar, blanketVar) 
{
	if (typeof window.innerHeight != '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;
		}
	}
	
	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 blanket = document.getElementById(blanketVar);
	blanket.style.height = blanket_height + 'px';
	
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv.style.display = 'block';
	
	popUpDiv_height = (viewportheight / 2) - (popUpDiv.clientHeight / 2);
	popUpDiv.style.top = popUpDiv_height + 'px';
	popUpDiv_width = (window_width / 2) - (popUpDiv.clientWidth / 2);
	popUpDiv.style.left = popUpDiv_width + 'px';
}

var buttons_disabled = false;

function clickButton(buttonID)
{
    if (buttons_disabled == false)
    {
        document.getElementById(buttonID).click();
        buttons_disabled = true;
    } 
}

