//////////////////////////////////////////
// ajax.js
//////////////////////////////////////////

// ----------------------------------------------------
// ajax
// ----------------------------------------------------
function ajax(){
	
	var req,self=this;
	
	if(window.XMLHttpRequest){
	
		// Mozilla, Safari, ...
		req=new XMLHttpRequest()
	
	} else if(window.ActiveXObject){
	
		// IE
		try{req=new ActiveXObject("Msxml2.XMLHTTP");}
		catch(e){req=new ActiveXObject("Microsoft.XMLHTTP"); }
	
	} else return false;

	//req.onload=function(){if(self.onload) self.onload(this.responseText) } 
	//req.onabort=function(){alert('error en la carga!')}
	
	req.onreadystatechange=function () {

		if (req.readyState==4){

			if(req.status==200){if(self.onload) self.onload(req.responseText)}
				else alert('error al cargar!')

		}

	}

	this.get=function(url){

		req.open('GET',url,true);
		req.send(null)

	}

}

