application.loading = new function loading()
{
	var instance = this;
	loading.getInstance = function()
	{
		return instance;
	};
	
	this.create = function(){
		if(this.created){
			return;
		}
		
		// create the loading div.
		this.loading_div = document.createElement("div");
		this.loading_div.setAttribute("id","loading");
		
		// create the image tag and put it in the div;
		var img = document.createElement("img");
		img.setAttribute('src', 'application/common/loading/ajax-loader.gif');
		
		var txt = document.createElement('span');
		txt.innerHTML = 'Loading...';
		
		// Add the loading img and text to the loading div.
		this.loading_div.appendChild(img);
		this.loading_div.appendChild(txt);
		
		// add the loading div into the body block
		document.getElementsByTagName("body")[0].appendChild(this.loading_div);
		this.hide();
		
		this.created = true;
	},
	
	this.hide = function(){
		dojo.style(this.loading_div,{"display":"none"});
	},
	
	this.show = function(){
		dojo.style(this.loading_div,{"display":"block"});
	};
	
	return application.loading; 
};