var modal, modalBackground, elements

function openModal(modalID)
{
	elements=document.aspnetForm.elements;
	modalBackground=document.getElementById("modalBackground");
	modal=document.getElementById(modalID);
	showModal(modalID);
	hideDropDowns();
}

function hideDropDowns()
{
	for (var i=0; i<elements.length; i++)
	{
		if (elements[i].type.match(/select/i)=="select")
		{
			if (elements[i].id.indexOf("Provisioned")<0)
				elements[i].className="hide";
		}
	}
}

function showDropDowns()
{
	for (var i=0; i<elements.length; i++)
	{
		if (elements[i].type.match(/select/i)=="select")
		{
			if (elements[i].id.indexOf("Provisioned")<0)
				elements[i].className="show";
		}
	}
}

function showModal(modalID)
{
	modalBackground.className="showModalBackground";
	modalBackground.style.width=getBodyWidth()+"px";
	modalBackground.style.height=getBodyHeight()+"px";
	modal.className="modal showModal";
	modal.style.left=(getBodyWidth()-450)/2+"px";
	modal.style.top=200+"px";
}

function getBodyWidth()
{
	var width;
	
	width=window.innerWidth;
	if (width==null)
		width=document.documentElement.clientWidth;
	if (width==0)
		width=document.body.clientWidth;
	return width;
}

function getBodyHeight()
{
	var height;
	
	height=window.innerHeight;
	if (height==null)
		height=document.documentElement.clientHeight;
	if (height==0)
		height=document.body.clientHeight;
	return height;
}

function abortRequest(modalID)
{
	modalBackground.className="hideModalBackground";
	modal.className="modal hideModal";
	showDropDowns();
}