var ALERT_TITLE = "Smithsonian Journeys";
var ALERT_BUTTON_TEXT = "Ok";
var CONTAINER = "alertContainer";

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

function customAlert( txt ){
	doc = document;
	if( doc.getElementById( CONTAINER  ) ){
		return;
	}
	obj = doc.getElementsByTagName("body")[0].appendChild( doc.createElement( "div" ) );
	obj.id = CONTAINER;
	obj.style.height = document.documentElement.scrollHeight + "px";
	
	alertDiv = obj.appendChild( doc.createElement( "div" ) );
	alertDiv.id = "alertBox";

	if( doc.all && !window.opera ){
		alertDiv.style.top = document.documentElement.scrollTop + "px";
	}

	alertDiv.style.left = ( doc.documentElement.scrollWidth - alertDiv.offsetWidth ) / 2 + "px";
	
	headerDiv = alertDiv.appendChild( doc.createElement("div") );
	headerDiv.id = "popHead";
    headerDiv.appendChild( doc.createTextNode( "  " ) );	
	
	containerDiv = alertDiv.appendChild( doc.createElement( "div" ) );
	containerDiv.id = "content";

	msg = containerDiv.appendChild( doc.createElement( "p" ) );
	msg.appendChild( doc.createTextNode( txt ) );

	btn = containerDiv.appendChild( doc.createElement( "a" ) );
	btn.id = "close";
	btn.appendChild( doc.createTextNode( ALERT_BUTTON_TEXT ) );
	btn.href = "#";
	
	btn.onclick = function(){
		removeAlert();
		return false;
	}
	
}

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

