// ajax class
// by zzxworld 2006-10-4
function ajax(){
	var ajaxobj = false;
	var cloneobj = this;
	
	try{ajaxobj = new ActiveXObject("MSXML2.XMLHTTP");} catch(e){}
	try{ajaxobj = new ActiveXObject("Microsoft.XMLHTTP");} catch(e){}
	try{ajaxobj = new XMLHttpRequest();} catch(e){}
	
	if(!ajaxobj) return false;
	this.url;
	this.method = "POST";
	this.async = true;
	this.content;
	this.callback = function(o){return;}
	this.send = function(){
		if(!this.method || !this.url || !this.async) return false;
		ajaxobj.open(this.method,this.url,this.async);
		if(this.method == "POST") ajaxobj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		
		ajaxobj.onreadystatechange = function(){
			if(ajaxobj.readyState == 4){
				if(ajaxobj.status == 200){
					cloneobj.callback(ajaxobj);
					}
				}
			}
		if(this.method == "POST"){
			ajaxobj.send(this.content);
			}else{
			ajaxobj.send(null);
			}
		}
	}
	
/*
//Demo//
var ajax = new ajax();
ajax.url = "url.php";
ajax.callback = function(o){
	alert(o.responseText);
	}
ajax.send();
*/
