var ajax = new sack();

function Cargando(){
	var e = document.getElementById('status'); 
	e.innerHTML = "<p><img src='/imagenes/cargando.gif' border='0' /> Cargando ... </p>";
}

function whenCompleted(){
	var e = document.getElementById('status'); 
	if (ajax.responseStatus){
		var string = "<p>Status Code: " + ajax.responseStatus[0] + "</p><p>Status Message: " + ajax.responseStatus[1] + "</p><p>URLString Sent: " + ajax.URLString + "</p>";
		var string = "";
	} else {
		var string = "<p>URLString Sent: " + ajax.URLString + "</p>";
		var string = "";
	}
	e.innerHTML = string;	
}
function cargaAjax(link, lugar, accion){
	ajax.requestFile = link;
	ajax.setVar("act", accion);
	ajax.method = 'GET';
	ajax.element = lugar;
	ajax.onLoading = Cargando;
	ajax.onLoaded = Cargando; 
	ajax.onInteractive = Cargando;
	ajax.onCompletion = whenCompleted;
	ajax.runAJAX();
}

function rescultadosBusqueda(donde){
	var form = document.getElementById('isearch_form');
	ajax.requestFile = "busqueda/index.php";
	ajax.setVar("action", form.action.value);
	ajax.setVar("partial", form.partial.value);
	ajax.setVar("s", form.s.value);
	ajax.method = 'POST';
	ajax.element = 'resultados';
	ajax.onLoading = Cargando;
	ajax.onLoaded = Cargando; 
	ajax.onInteractive = Cargando;
	ajax.onCompletion = whenCompleted;
	ajax.runAJAX();
}
