function ajax_div(){
	this.menu	= null;
	this.obj	= null
	this.init();
}
ajax_div.prototype = {
	init : function(){ //创建层
		this.menu = document.createElement('div');
		document.body.insertBefore(this.menu,document.body.firstChild);
	},
	guide : function(){ // 初始化层
		read.menu.innerHTML = '<div style="padding:100px 100px"><img src="../templates/golf/images/loading.gif" align="absbottom" /> Loading...</div>';
		read.menu.className = 'menu';
		read.menupz(read.obj,1);
	},
	move : function(e){  // 移动层
		if(is_ie){
			document.body.onselectstart = function(){return false;}
		}
		var e  = is_ie ? window.event : e;
		var o  = read.menu;
		var x  = e.clientX;
		var y  = e.clientY;
		read.w = e.clientX - parseInt(o.offsetLeft);
		read.h = e.clientY - parseInt(o.offsetTop);
		document.onmousemove = read.moving;
		document.onmouseup   = read.moved;
	},

	moving : function(e){
		var e  = is_ie ? window.event : e;
		var x  = e.clientX;
		var y  = e.clientY;
		read.menu.style.left = x - read.w + 'px';
		read.menu.style.top  = y - read.h + 'px';
	},

	moved : function(){
		if(is_ie){
			document.body.onselectstart = function(){return true;}
		}
		document.onmousemove = '';
		document.onmouseup   = '';
	},
	close : function(){ // 关闭层
		read.menu.style.display = 'none';
		getObj('formstable').style.display='block';
	},
	menupz : function(obj,type){ // 定位层
		read.menu.onmouseout = '';
		read.menu.style.display = '';
		read.menu.style.cssText = 'FILTER:Alpha(opacity=95);opacity:0.95;left:-500px;z-index:3000';
		if(typeof obj == 'string'){
			obj = getObj(obj);
		}
		if(obj == null){
			read.menu.style.top  = (ietruebody().clientHeight - read.menu.offsetHeight)/2 + ietruebody().scrollTop + 'px';
			read.menu.style.left = (ietruebody().clientWidth - read.menu.offsetWidth)/2 + 'px';
		} else{
			var top  = getObjY(obj);
			var left = getObjX(obj);
			if(top < ietruebody().clientHeight/2 || type>3){
				top += ietruebody().scrollTop + obj.offsetHeight - 145;
			} else{
				top += ietruebody().scrollTop - read.menu.offsetHeight + 210;
			}
			if(left > (ietruebody().clientWidth)*3/5){
				left -= read.menu.offsetWidth - obj.offsetWidth + 120;
			}
			read.menu.style.top  = top  + 'px';
			read.menu.style.left = left + 'px';
		}
	}
}
var read = new ajax_div();

function XMLhttp(){
	this.xmlHttp = null;
	this.request = null;
	this.iframe  = null
	this.init();
}

XMLhttp.prototype = {
	init : function(){
		try{ 
			this.xmlHttp=new XMLHttpRequest(); 
		}catch(e){ 
			try{ 
				this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
			}catch(e){ 
				this.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
			} 
		} 
	},
	get : function(url){
		var nowtime	= new Date().getTime();
		url	+= (url.indexOf("?") >= 0) ? "&nowtime=" + nowtime : "?nowtime=" + nowtime;
		ajax.xmlHttp.open("POST",url,true);
		//ajax.xmlHttp.setRequestHeader("Content-Type","text/xml");
		ajax.xmlHttp.onreadystatechange = function(){
				if(ajax.xmlHttp.readyState==4&&ajax.xmlHttp.status==200){
					//getElementsByTagName("ajax").data.firstChild.nodeValue);
					if(is_ie){
						read.menu.innerHTML = ajax.xmlHttp.responseXML.documentElement.text;
					}else{
						read.menu.innerHTML = ajax.xmlHttp.responseXML.documentElement.textContent;
					}
				}
			};
		ajax.xmlHttp.send(null);
	},
	create : function(){
		var s = document.createElement('div');
		s.style.display = 'none';
		s.innerHTML = '<iframe id="ajaxiframe" name="ajaxiframe" width="0" height="0"></iframe>';
		document.body.appendChild(s);
		this.iframe = s.firstChild;
	},
	submit : function(obj){
		if(this.request == null){ this.request = new ajax.create();}
		if(typeof obj == 'object'){
			obj.target = 'ajaxiframe';
			obj.submit();
			obj.reset();
		}
		read.close();
	}
}
var ajax = new XMLhttp();

