 function JimetPageLoaderObj() { 
  	this.jimetAjaxObj = null;
 	this.toggleDivId = null;
 	this.postData = null;
 	this.url = null;
 	this.endFunc = null;
 	
 	this.init = function(divId,url,data){
 		this.toggleDivId = divId; 	
 		this.jimetAjaxObj = new JimetAjaxObj();
 		this.url = appRoot + url;
 		this.postData = data;
 	}
 	
 	this.doLoad = function (divId,url,data) {
 		this.init(divId,url,data);
 		
 		var self = this;
		
		this.jimetAjaxObj.setPostData(this.postData);
		this.loaderResult = function(result){
			self.loadDiv (result);
			if (self.endFunc)
				self.endFunc();
		};
		
		if ( !this.isLoadingDivOn() )
			this.toggleLoading();
		this.jimetAjaxObj.doPost(this.url,self.loaderResult);		
 	}
 	
 	this.loadDiv = function(result){
 
 		if ( this.isLoadingDivOn() )
 			this.toggleLoading();
 		
 		document.getElementById(this.toggleDivId).innerHTML = result;		
 	}
 	
 	this.setEndFunc = function(func) {
 		this.endFunc = func;
	};
	this.isLoadingDivOn = function(){
		var loadingDiv = document.getElementById('backgroungLoading');

		if ( loadingDiv.style.display == 'block' )
			return true;
		else
			return false;
	}
	
	this.toggleLoading = function(){
		
		var mainDiv = document.getElementById('bodyDiv');	
		var loadingDiv = document.getElementById('backgroungLoading');
		
		if (mainDiv && loadingDiv){
			var	height = document.body.clientHeight -2;
			var width = document.body.clientWidth -2 ;
			loadingDiv.style.height = height;
			loadingDiv.style.width = width;		
			//alert (mainDiv.offsetLeft + " : " + mainDiv.offsetTop + " : " + mainDiv.offsetHeight + " : " + mainDiv.offsetWidth);
			loadingDiv.style.display = loadingDiv.style.display == 'none'?'block':'none';		
			//alert (mainDiv.offsetLeft + " : " + mainDiv.offsetTop + " : " + mainDiv.offsetHeight + " : " + mainDiv.offsetWidth);
		}
	}; 	
 }