/********************* CUSTOM ALRT BOX ******************
This is the custom alert box, the paramaters are passed in an array. They are as follows:
titleStr - string The title that will appear at the top of the alert
contentStr - string The text/html that will populate the internal part of the alert
acceptTextStr - string The text to place on the "accept" button - optional
denyTextStr - string The text to place on the "deny" button - optional
acceptLinkLocationStr - string The page to which the "accept" button redirects
denyLinkLocationStr - string The page to which the "deny" button redirects
********************************************************/

function createDocumentInputPopOver(titleStr, contentStr, widthInt, heightInt, acceptTextStr, denyTextStr, acceptLinkLocationStr, denyLinkLocationStr)
{
	if(widthInt == '')
		widthInt = 300;
	if(heightInt == '')
		heightInt = 120;

	//make sure the width and height are actual integers
	widthInt = parseInt(widthInt);
	heightInt = parseInt(heightInt);


	// Assign default values to links if necessary
	if (acceptLinkLocationStr == null)
		acceptLinkLocationStr = '#';

	if (denyLinkLocationStr == null)
		denyLinkLocationStr = '#';

	// if the alertContainer object already exists in the DOM, bail out.
	if(document.getElementById("alertContainer"))
		return false;

	// get the window height for proper placing later on, do some weird stuff depending on browser support...
	var innerHeight = 0;
	if(window.innerHeight != null)
		innerHeight = window.innerHeight;
	else if(document.documentElement.clientHeight != null && document.documentElement.clientHeight > 0)
		innerHeight = document.documentElement.clientHeight;
	else
		innerHeight = document.body.clientHeight;

	// create the alertContainer div as a child of the BODY element
	alertContainerObj = document.getElementsByTagName("body")[0].appendChild(document.createElement("div"));
	alertContainerObj.id = "alertContainer";

	 // make sure its as tall as it needs to be to overlay all the content on the page
	 if (innerHeight > document.documentElement.scrollHeight)
		alertContainerObj.style.height = innerHeight + "px";
	else
		alertContainerObj.style.height = document.documentElement.scrollHeight + "px";


	// create the DIV that will be the alert
	alertObj = alertContainerObj.appendChild(document.createElement("div"));
	alertObj.id = "alertBox";

	// set the alert's window size...
	alertObj.style.width = widthInt + "px";
	alertObj.style.height = heightInt + "px";

	// center the alert box
	alertObj.style.left = (document.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
	if(document.documentElement.scrollWidth - alertObj.offsetWidth < 0)
		alertObj.style.left = 0;
	alertObj.style.top = (innerHeight - alertObj.offsetHeight) / 2 + "px";
	if(innerHeight - alertObj.offsetHeight < 0)
		alertObj.style.top = 0;

	// create an H1 element as the title bar
//	titleObj = alertObj.appendChild(document.createElement("div"));
//	titleObj.className = 'alertBoxTitle';
//	titleObj.appendChild(document.createTextNode(titleStr));

	// create a paragraph element to contain the txt argument
	contentObj = alertObj.appendChild(document.createElement("div"));
	contentObj.className = 'alertBoxContent';
	contentObj.innerHTML = contentStr;

	buttonContainerOb = alertObj.appendChild(document.createElement("div"));
	buttonContainerOb.id = "buttonContainer";


//	 Create deny button if button text has been passed
//	if (denyTextStr != null)
//	{
//		 create an anchor element to use as the deny button.
//		denyBtnObj = buttonContainerOb.appendChild(document.createElement("a"));
//		denyBtnObj.className = "alertButton";
//		denyBtnObj.appendChild(document.createTextNode(denyTextStr));
//		denyBtnObj.href = denyLinkLocationStr;
//		 set up the onclick event to remove the alert when the anchor is clicked
//		denyBtnObj.onclick = function() { removeCustomAlert();return false; }
//	}
//
//	 Create accept button if button text has been passed
//	if (acceptTextStr != null)
//	{
//		 create an anchor element to use as the confirmation button.
//		acceptBtnObj = buttonContainerOb.appendChild(document.createElement("a"));
//		acceptBtnObj.className = "alertButton";
//		acceptBtnObj.appendChild(document.createTextNode(acceptTextStr));
//		acceptBtnObj.href = acceptLinkLocationStr;
//		 set up the onclick event to remove the alert when the anchor is clicked
//		acceptBtnObj.onclick = function() { removeCustomAlert();return true; }
//		 set the focus on the "accept" button if there is not a deny option
//		if(denyTextStr != null)	//don't want to default to yes if there are two options like with delete confirmations
//			acceptBtnObj.focus();
//	}


}

// removes the custom alert from the DOM
function removeDocumentInputPopOver() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("alertContainer"));
}
