function AddErrorMessage(Message, Source, Testmode)
{
	if (Testmode == true)
	{
		var obj = document.getElementById('LogicErrorBox');

		//console.info(obj);

		if (Message != "" && obj != null)
		{
			var time = new Date();
			time = time.toLocaleString();
			obj.style.display = "block";
			obj.innerHTML += "<b>"+time+"</b> <i>"+Source+"</i> "+unescape(Message.replace(/\+/g, " "))+"<br>";
		}
		obj = null;
	}
	else if (Testmode == "NOTICE_NODATA")
	{

		document.getElementById('LogicNoticeBox').style.left = getCoord("x")+15;

		var top = 0;
		top =  (Stuff.Browser.isIE) ? document.documentElement.scrollTop : window.pageYOffset;
		document.getElementById('LogicNoticeBox').style.top = getCoord("y");
		document.getElementById('LogicNoticeBox').style.position = "absolute";
		document.getElementById('LogicNoticeBox').style.zIndex = 10;
		document.getElementById('LogicNoticeBox').style.display = 'block';
	}

}
function ClearErrorMessageBox(Control)
{
	var obj = document.getElementById(Control);

	//alert(obj);
	if (obj != null)
	{
		obj.style.display = "none";

		if (Control == 'LogicErrorBox')
		{
			obj.innerHTML = "<div id=\"DebugInfo\" align=\"left\"></div><a href=\"javascript:ClearErrorMessageBox()\">Clear</a><hr noshade>";
		}
	}
	obj = null;
}

function DebugBreakMessage(ActionID, ActionName, ControlID, Event)
{
	var ErrorBox = document.getElementById('LogicErrorBox');
	if(ErrorBox != null)
	{
		ErrorBox.style.display = "block";
	}

	var obj = document.getElementById('DebugInfo');
	if(obj != null)
	{
		obj.innerHTML = "Break at <b>"+ActionName+"</b> <a onclick=\"javascript:DebugNextStep('"+ActionID+"', '"+ControlID+"', '"+Event+"');\" style=\"cursor:pointer\"><img src=\"../../templates/modules/BerkeWebflowStyle/images/go-next.png\"></a><br>";
	}
	obj = null;
	ErrorBox = null;
}
function DebugNextStep(ActionID, ControlID, Event)
{
	document.getElementById('cwAutoControl[DebugAction]').innerHTML = ActionID;

	//document.getElementById('LogicErrorBox').style.display = "none";
	document.getElementById('DebugInfo').innerHTML = "";

	var obj = GetElementByCWId(ControlID);

	if(obj != null)
	{
		if(Stuff.Browser.isIE)
		{
			obj.fireEvent(Event);
		}
		else
		{
			var evt = document.createEvent("MouseEvents");
			evt.initEvent(Event.substr(2), true, true);
			obj.dispatchEvent(evt);
			evt = null;
		}
	}

	document.getElementById('cwAutoControl[DebugAction]').innerHTML = "";
	
	obj = null;
}
