var showLoadingWidth = 0;
var showLoadingHeight = 0;
	
function showLoading(message) {
	//var width = 0;
	//var height = 0;
 if(showLoadingWidth == 0 && showLoadingHeight == 0){
	if (window.innerHeight && window.scrollMaxY) { // Firefox
		showLoadingHeight = window.innerHeight + window.scrollMaxY;
		showLoadingWidth = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		showLoadingHeight = document.body.scrollHeight;
		showLoadingWidth = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		showLoadingHeight = document.body.offsetHeight;
		showLoadingWidth = document.body.offsetWidth;
  	}
}

	document.getElementById('loadingBox').style.top = "0px";
	document.getElementById('loadingBox').style.left = "0px";
	document.getElementById('loadingBox').style.width = "0px";
	document.getElementById('loadingBox').style.height = "0px";
	document.getElementById('loadingMessageBox').style.position = "absolute";
	document.getElementById('loadingMessageBox').style.zIndex = 1000;
	document.getElementById('loadingMessageBox').style.left = showLoadingWidth / 2 - 150 + "px";
	document.getElementById('loadingMessageBox').style.top = showLoadingHeight / 2 - 100 + "px";
	//document.getElementById('loadingMessageBox').style.top = "200 px";
	document.getElementById('loadingBox').style.visibility = "visible";
	if(message != null) {
		document.getElementById('loadingMessage').innerHTML = message;
	}
	$('#loadingBox').show();
}

function hideLoading() {
	document.getElementById('loadingBox').style.visibility = "hidden";
}
