function OBJETO(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function enviaGET(URL, PARAMS, http) {
	myRand=parseInt(Math.random()*99999999);
	http.open("GET", URL+'?'+PARAMS+'&rand='+myRand, true);
	http.send(null);
}

function execute(FUNCION, item) {
	eval(FUNCION + '(item)');
}

function error(numero){
	var err='';
	numero = parseInt(numero);
	switch(numero){
		case 404: err = 'Página no encontrada';	
	}
	alert("Ha habido un problema al acceder al servidor: " + err);
}

function AJAX(URL, PARAMS, FUNCION, METOD, XML, combo){
	var http = OBJETO();

	http.onreadystatechange = function(){
		if(http.readyState == 4){
   			if(http.status == 200){
      			if(FUNCION != ''){
					execute(FUNCION, http.responseText);
				}
				http = null;
    		}else{	
				error(http.status);
				http = null;
			}
  		}
	}
	enviaGET(URL, PARAMS, http);
}
function SEND(PAGE){
	document.getElementById('left_side').innerHTML = "<center><br><br><br><h3>Cargando</h3><br><img align='absmiddle' src='img/progress.gif' /></center>";
	AJAX('contenido/' + PAGE, '', '_SEND', '', '');
}
function _SEND(X){
	document.getElementById('left_side').innerHTML = X;
	X = "";
}