(function(page) {
	
	// public functions
	page.showpleasewait = function() {
		var static = arguments.callee;
		if (!static.div) {
			static.div = document.createElement('div');
			static.div.innerHTML = "please wait...";
			static.div.style.position = (private.browserIE6()) ? 'absolute' : 'fixed' ;
			static.div.style.zIndex = '2100';
			static.div.style.top = '0px';
			static.div.style.right = '0px';
			static.div.style.color = 'white';
			static.div.style.background = '#990000'
			static.div.style.padding = '5px';
		}
		document.body.appendChild(static.div);
	}
	page.hidepleasewait = function() {
		var static = page.showpleasewait;
		if (!static.div.parentNode) { return; }
		static.div.parentNode.removeChild( static.div );
	}
	page.pleasewait = function(func) {
		alert('show');
		page.showpleasewait();
		setTimeout(function() { func(); page.hidepleasewait(); },1);
	}
	
	// private
	var private = {};
	private.browserIE6 = function() {
		var search = "MSIE 6";
		var string = navigator.userAgent;
		if (!string) return false;
		var match = string.indexOf( search ) != -1;
		return match;
	}
	
})( window.page = (window.page) ? window.page : {} );