var oRegLink = null;		//if web description is opened with a GroupID/ClassID value, show REGISTER link for that item.

function itemDescription_init(nCourse_ID, showHours, oRegLinkStr) {
	if (oRegLinkStr) { oRegLink = oRegLinkStr; } else { oRegLink = null; }
	sURL = "/WebSite/Register/_Util_ItemData.asp?mode=descript&cid=" + nCourse_ID + "&showHours=" + showHours;
	htRequest(sURL, 'itemDescription_display');		//htRequest is from _Utils.js
}
function itemDescription_display(msg) {
	msg = msg.replace("<RESULTS><![CDATA[", "");
	msg = msg.replace("]]></RESULTS>", "");
	toggleDescriptBox(msg);
}
function toggleDescriptBox(sAlert) {
	var d = document.getElementById("WebDescriptBox");		//elements written to page by /inc/WebDescriptionUtil_Bot.inc
	var oContent = document.getElementById("WebDescriptContent");
	if (sAlert == "") {
		toggleGrayOut(false);
		d.className = "AlertBoxHidden";
	} else {
		var h = f_clientHeight(false);
		var w = f_clientWidth();
		var s = f_scrollTop();
		var nDivTop = 0;
		if (sAlert.length > 200) {
			oContent.style.height = "300px";
			oContent.style.overflow = "auto";
		} else {
			oContent.style.height = "150px";
			oContent.style.overflow = "visible";
		}
		if (oRegLink != null) {
			sAlert = "<a href=\"/WebSite/Register/Reg.asp?" + oRegLink.toString() + "\" style=\"float:right; font-weight:bold;\">Enroll Now</a>" + sAlert;
		}
		oContent.innerHTML = sAlert;
		toggleGrayOut(true);
		d.className = "AlertBox";
		nDivTop = (Math.floor(h / 2) - 225 + s);
		if (nDivTop <= 100) { nDivTop = 100; }
		d.style.top = nDivTop + "px";
		d.style.left = (Math.floor(w / 2) - 300) + "px";
	}
}
function toggleGrayOut(bOn) {
	// note: also called by Reg page for other grayouts (find my info, alert messages)
	var bg = document.getElementById("GrayOutBG");
	bg.style.visibility = (bOn) ? "visible" : "hidden";
	bg.style.display = (bOn) ? "" : "none";
	bg.style.height = f_clientHeight(true) + "px";
}

