pageRequest = 
{
	_agt : navigator.userAgent.toLowerCase(),
	 
	is_op  : function(){ return (this._agt.indexOf("opera") != -1)},
	is_ie  : function(){ return (this._agt.indexOf("msie") != -1) && document.all && !this.is_op},
	is_ie5 : function(){ return (this._agt.indexOf("msie 5") != -1) && document.all && !this.is_op},
	is_mac : function(){ return (this._agt.indexOf("mac") != -1)},
	is_gk  : function(){ return (this._agt.indexOf("gecko") != -1)},
	is_sf  : function(){ return (this._agt.indexOf("safari") != -1)},
	
	conn:null,
	text:null,
	
	_xmlRequest:[
		'MSXML2.XMLHTTP.3.0',
		'MSXML2.XMLHTTP',
		'Microsoft.XMLHTTP'
	],
	
	getXmlRequest:function(){
		var obj;
		try{
			obj = new XMLHttpRequest();
		}
		catch(e){
			for(var i = 0;i < this._xmlRequest.length;i++){
				try{
					obj = new ActiveXObject(this._xmlRequest[i]);
				}
				catch(e){}
			}
		}
		finally{
			return obj;
		}
	},
	
	handleReadyState:function(callback){
		var o = this;
		var t_id = window.setInterval(
			function(){
		 		if(o.conn.readyState == 4){
		 			window.clearInterval(t_id);
		 			var responseObj = o.createResponseObject(o,callback);
		 			if(typeof callback.arg != undefined)
		 				callback.func(responseObj,callback.arg);
		 			else
		 				callback.func(responseObj);
		 			o.hideloading();
		 		}
		 	}
		)
	},
	
	createResponseObject:function(o,callback){
		var obj = {};
		obj.status = o.conn.status;
		obj.responseText = o.conn.responseText;
		obj.responseXML = o.conn.responseXML;
		
		return obj;
	},
	
	send:function(method,uri,data,callback){
		this.conn = this.getXmlRequest();
		this.conn.open(method,uri);
		this.conn.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
		this.conn.send(data);
		
		this.showloading();
		
		this.handleReadyState(callback);
	
	},
	
	showloading:function(){
		var loading = document.getElementById('loading');
		if(loading == null){
			var div = document.createElement('div');
			div.id = 'loading';
			div.style.zIndex = '10';
			div.style.display = 'block';
			div.style.position = 'absolute';
			div.style.width = '50px';
			div.style.top = '0px';
			div.style.left = '95%';
			div.style.backgroundColor = 'blue';
			div.style.color = 'white';
			div.style.fontSize = '12px';
			div.innerHTML = '載入中...';
			
			var n = document.firstChild;
			while(n != null){
				if(n.nodeName == 'HTML'){
					n = n.firstChild;
				}
				else if(n.nodeName == 'BODY'){
					n.appendChild(div);
					break;
				}
				n = n.nextSibling;
			}
			//document.write('<div id="loading" style="z-index:10;display:none;position:absolute;width:50px;top:0px;left:95%;background-color:blue;color:white;font-size:12px;">載入中...</div>');
		}
		else{
			loading.style.display = 'block';
		}
	},
	
	hideloading:function(){
		var loading = document.getElementById('loading');
		if(loading != null)
			loading.style.display = 'none';
	}
	
};