function showLoadingDialog(){
	var boxObject = document.getElementById("loading-box");
	var bgObject = document.getElementById("background-box");
	centerObject(boxObject);
	centerObject(bgObject);
	bgObject.style.display = "";
	boxObject.style.display = "";		
}

function hideLoadingDialog(){
	document.getElementById("loading-box").style.display = "none";
	document.getElementById("background-box").style.display = "none";
}

function centerObject( obj ) {
	var theSize = getWindowSize();
	obj.style.left = Math.round( (theSize[0] / 2) - (obj.style.width.replace("px", "") / 2) ) + "px";
}

function setObjectPosition( obj , offsetTop, offsetLeft) {
	var theSize = getWindowSize();
 	obj.style.top = Math.round( (theSize[1] / 3) - offsetTop ) + "px";
	obj.style.left = Math.round( (theSize[0] / 2)- offsetLeft ) + "px";
}

function getWindowSize(){
	var myWidth = 0;
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [myWidth,myHeight];
}


function showMessage(title, msg, buttons){
	if(!buttons)
		buttons = "<img src=\"img/ok.gif\" class=\"buttonImage\" border=\"0\" alt=\"OK\" onclick=\"hideMessage()\" />";
	
	var bgObject = document.getElementById("background-box");
	var boxObject = document.getElementById("message-box");
	document.getElementById("message-box-title").innerHTML = title;
	document.getElementById("message-box-content").innerHTML = msg;
	document.getElementById("message-box-buttons").innerHTML = buttons;
	
	setObjectPosition(boxObject, 50, 175);
	centerObject(bgObject);

	boxObject.style.display = "";
	bgObject.style.display = "";

	// If an error occured while loading, we want to hide the loading box
	var lBox = document.getElementById("loading-box");
	if(lBox)
		lBox.style.display='none';
}

function hideMessage(){
	document.getElementById("message-box").style.display = "none";
	document.getElementById("background-box").style.display = "none";
}

function showInfoDiv( div ){
	showInfo( document.getElementById(div).innerHTML );
}

function showInfo( info ){
	var boxObject = document.getElementById("info-box");
	var boxContent = document.getElementById("info-box-content");
	var bgObject = document.getElementById("full-background-box");
	
	boxContent.innerHTML = info;
	boxContent.scrollTop = 0;

	setObjectPosition(boxObject, 175, 365);

	boxObject.style.display = "";
	bgObject.style.display = "";
}

function hideInfoBox(){
	document.getElementById("info-box").style.display = "none";
	document.getElementById("full-background-box").style.display = "none";
}


