// JavaScript Document
/************************************

	Custom Alert Demonstration
	version 1.0
	last revision: 02.02.2005
	steve@slayeroffice.com

	Should you improve upon this source please
	let me know so that I can update the version
	hosted at slayeroffice.

	Please leave this notice in tact!

************************************/

// constants to define the title of the alert and button text.
var ALERT_TITLE = "Login Help";
var ALERT_BUTTON_TEXT = "Ok";

if(document.getElementById) {
	window.alert = function(txt1, txt2, txt3, txt4, txt5, txt6, txt7) {
		createCustomAlert(txt1, txt2, txt3, txt4, txt5, txt6, txt7);
	}
}

function createCustomAlert(txt1, txt2, txt3, txt4, txt5, txt6, txt7) {
	d = document;

	if(d.getElementById("modalContainer")) return;

	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	mObj.style.height = d.documentElement.scrollHeight + "px";
	
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
	alertObj.style.visiblity="visible";

	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(ALERT_TITLE));

	msg = alertObj.appendChild(d.createElement("h2"));
	msg.appendChild(d.createTextNode(txt1));
	
	msg = alertObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt2));

	msg = alertObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt3));
	
	msg = alertObj.appendChild(d.createElement("h2"));
	msg.appendChild(d.createTextNode(txt4));
	
	msg = alertObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt5));

	msg = alertObj.appendChild(d.createElement("p"));
	msg.appendChild(d.createTextNode(txt6));
	
	msg = alertObj.appendChild(d.createElement("h3"));
	msg.appendChild(d.createTextNode(txt7));

	btn = alertObj.appendChild(d.createElement("a"));
	btn.id = "closeBtn";
	btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
	btn.href = "#";
	btn.focus();
	btn.onclick = function() { removeCustomAlert();return false; }

	alertObj.style.display = "block";
	
}

function removeCustomAlert() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}