/****************************************************
* custom alert box by http://slayeroffice.com       *
* with many thanks                                  *
* customized by noRiddle of http://www.revilonetz.de*
****************************************************/

var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok";

if(document.getElementById) {
	window.alert = function(txt) {
		createCustomAlert(txt);
	}
}

function createCustomAlert(txt) {
	d = document;

	if(d.getElementById("modalContainer")) return;

	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	mObj.style.height = document.documentElement.scrollHeight + "px";

	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "styledAlertBox";
	// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
	//if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
        //commented out because of IE7 problem, noRiddle

	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";

	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(ALERT_TITLE));

	msg = alertObj.appendChild(d.createElement("p"));
	msg.innerHTML = txt.replace(/\n/g,"<br />");  /*regex NEW noRiddle*/
	
	btn = alertObj.appendChild(d.createElement("a"));
	btn.id = "closeBtn";
	btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
	btn.href = "#";
	btn.onclick = function() { removeCustomAlert();return false; }

	
}

function removeCustomAlert() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}

