var background;
var loading;

function getSize(elem){
  var s = [0, 0];

    s =  [Math.max(
        document.documentElement["clientWidth"],
        document.body["scrollWidth"], document.documentElement["scrollWidth"],
        document.body["offsetWidth"], document.documentElement["offsetWidth"]
      ), Math.max(
        document.documentElement["clientHeight"],
        document.body["scrollHeight"], document.documentElement["scrollHeight"],
        document.body["offsetHeight"], document.documentElement["offsetHeight"]
      )];

return s;
}

function show_loading(){
	if(!background){
		var MSIE = navigator.userAgent.indexOf("MSIE");
		if(MSIE == -1)
			window.onload();
		else
			window_onload();
	}

background.style.display='block';
}

	function window_onload() {
		if(background){
		return;
		}
	
	background=document.createElement('div');
	background.className='bg_style';
	background.innerHTML='';
	background.style.height=getSize(document)[1]+'px';
	background.style.display='none';
	
		window.onresize=function(e){
		background.style.height=getSize(document)[1]+'px';
		}
	
	document.body.appendChild(background);
	
	var loading=document.createElement('div');
	loading.className='loading_style';
	loading.innerHTML='<img src="'+rapppath+'templates/images/loading.gif" />';
	
	background.appendChild(loading);
	}

