var Ajax={
	POST	: "POST",
	GET		: "GET",
	getHTTPRequest:function() {
		return new XMLHttpRequest();
	},
	request:function( method, async, url, params, onsuccess, onerror ) {

		var ax=Ajax.getHTTPRequest();		
		// METHOD
		if( method == Ajax.GET ) 
		{
			ax.open( Ajax.GET, url += "?" + params, async );
		} else {
			ax.open( Ajax.POST, url, async );
			ax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			ax.setRequestHeader("Content-length", params.length);
			ax.setRequestHeader("Connection", "close");
		}
		
		// SYNCHRO
		if (async == true) 
		{		
			ax.onreadystatechange = function(){
				if (ax.readyState == 4 && ax.status == 200) {
					if (onsuccess) {
						onsuccess.call(ax);
					}
				}
				else {
					if (onerror) {
						onerror.call(ax);
					}
				}
			};
			// send
			if( method == Ajax.GET ) ax.send(null);
			else ax.send(params); 	
		} else {
			// send
			if( method == Ajax.GET ) ax.send(null);
			else ax.send(params);
			if (onsuccess) {
				onsuccess.call(ax);
			}
		}
	}
};
// http://www.aquafadas.com/php/news_elo.php?year=2009&operation=getcolumn



function trace( text ) {
	//if( document.getElementById("debugLogger") )
	//	document.getElementById("debugLogger").innerHTML += "<br/>"+text;
};

//////////////////SCROLL TO A POSITION///////////////////////////////

	
var UI={
	
	_it:null,
	
	scrollToYPosition:function(position){
		var n = 0;
		UI._it=setInterval(function() {
			
			if(n >= position){
				clearInterval(UI._it);
				return false;
			}
			window.scrollTo(0,n);
			n += 50;
		},1);
			
	}

};


