<!--
/********Main Objects********/

/****Popup Manager****/
function PopupDivsMan()
{
	/**Manager Variables**/
	this.NumPopups = 0;

	/**Manager Functions**/
	this.CreatePopup = CreatePopupFunction;
	this.ClosePopup = ClosePopupFunction;
	this.PopBack = PopBackFunction;
	this.ToTop = ToTopFunction;

	/**Manager Objects**/
	this.PopupDivList = Array();
};

/****Popup Window****/
function PopupWindow(iNewId)
{
	/**Popup Variables**/
	this.PopupId = iNewId;
	this.Width = 0;
	this.Height = 0;
	this.Left = 0;
	this.Top = 0;
	this.Title = "";
	this.Source = "";
	this.Status = "";
	this.Div = document.createElement("div");

	/**Popup Functions**/
	this.LoadMe = LoadMeFunction;
	this.CloseMe = CloseMeFunction;

	/**Popup Objects**/
};

/********Popup Manager Functions********/

/**** ****/
function CreatePopupFunction(iWidth, iHeight, iX, iY, sTitle, sSrc, sStatus)
{
	var iOffset = 0;
	var sPopupSrc = "";
	this.PopupDivList[this.NumPopups] = new PopupWindow(this.NumPopups);

	if (sSrc.indexOf("?") > 0) {
		sSrc += "&popup="+this.NumPopups;
	}
	else {
		sSrc += "?popup="+this.NumPopups;
	}

	with (this.PopupDivList[this.NumPopups]) {
		Width = iWidth;
		Height = iHeight;
		Left = iX;
		Top = iY;
		Title = sTitle;
		Source = sSrc;
		Status = sStatus;

		iOffset = (PopupId % 6) * 20;
		Div.id = "PopupDiv_"+PopupId;
		Div.className = "AllEdge";
		Div.style.width = (Width + 6)+"px";
		Div.style.height = (Height + 6)+"px";
		Div.style.position = "Absolute";
		Div.style.left = (Left + iOffset)+"px";
		Div.style.top = (Top + iOffset)+"px";

		sPopupSrc = "<div id=\"OutBorder\" class=\"PopWinOutEdge\">";
			sPopupSrc += "<div id=\"MidBorder\" class=\"PopWinMidEdge\">";
				sPopupSrc += "<div id=\"PopWinInside\">";
					sPopupSrc += "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" height=\"100%\">";
						sPopupSrc += "<tr>";
							sPopupSrc += "<td width=\"98%\"><div id=\"TitlePart_"+PopupId+"\" class=\"PopWinTitlePart\">"+Title+"</div></td>";
							sPopupSrc += "<td width=\"20\"><div id=\"CloseButton\" class=\"PopWinCloseButton PopWinOutEdge\" OnClick=\"PopupManager.ClosePopup("+PopupId+");\">X</div></td>";
						sPopupSrc += "</tr>";
						sPopupSrc += "<tr>";
							sPopupSrc += "<td colspan=\"2\" class=\"PopWinInEdge PopWinContent\" OnClick=\"PopupManager.ToTop('PopupDiv_"+PopupId+"');\" height=\"100%\" align=\"left\" valign=\"top\">";
								sPopupSrc += "<div id=\"InBorder\">";
									sPopupSrc += sSrc;
								sPopupSrc += "</div></td>";
						sPopupSrc += "</tr>";
						sPopupSrc += "<tr>";
							sPopupSrc += "<td><div id=\"FooterPart\" class=\"PopWinInEdge PopWinFooter\" OnClick=\"PopupManager.ToTop('PopupDiv_"+PopupId+"');\">"+Status+"</div></td>";
							sPopupSrc += "<td width=\"20\"><div id=\"WinResize_"+PopupId+"\" class=\"PopWinResize PopWinInEdge\">//</div></td>";
						sPopupSrc += "</tr>";
					sPopupSrc += "</table>";
				sPopupSrc += "</div>";
			sPopupSrc += "</div>";
		sPopupSrc += "</div>";

		Div.innerHTML = sPopupSrc;

		document.body.appendChild(Div);
		//document.getElementById("PopupFrame_"+PopupId).src = Source;
	}

	return this.NumPopups++;
};

function PopBackFunction()
{
	for (var i = 0; i < this.NumPopups; i++) {
		if (document.getElementById("PopupDiv_"+i)) {
			document.getElementById("PopupDiv_"+i).style.zIndex = 0;
		}
	}
}

function ToTopFunction(PopupId)
{
	this.PopBack();
	if (document.getElementById(PopupId)) {
		document.getElementById(PopupId).style.zIndex = this.NumPopups;
	}
}

function ClosePopupFunction(iPopupId)
{
	oTmpDiv = document.getElementById("PopupDiv_"+iPopupId);
	document.body.removeChild(oTmpDiv);
	this.PopupDivList[iPopupId] = null;
};

/********Popup Window Functions********/

/**** ****/
function LoadMeFunction()
{
};

function CloseMeFunction()
{
	oTmpDiv = document.getElementById("PopupDiv_"+this.PopupId);
	document.body.removeChild(oTmpDiv);
}

/********Popup Manager Declaration********/
var PopupManager = new PopupDivsMan();
//-->
