/*function AbreURL(dir,div){
    var outputArea = document.getElementById(div);
    var ajp = new AjaxPages();
    ajp.load(dir);
    var processor = ajp.getProcessor();
    outputArea.innerHTML = processor();
}*/

function nuevoAjax(){
	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 borrarIMG(id,imagen){
   if(confirm('Seguro que quieres eliminar esta imagen?')){
	AbreURL('noticias/imagenes/borrar.php','divVERIMG'+id,'img='+imagen+'&id='+id);
   }
}

/*
function confirmaractividad(id){
   if(confirm('Seguro que quieres eliminar esta actividad?')){
	location='index2.php?id=mata&&num='+id;
   }
}

function BuscaLibro(num){
	var contenedor;
	contenedor = document.getElementById('divbuscador');
	ajax=nuevoAjax();
	ajax.open("POST", 'seccions_web/biblioteca/buscar.php',true);
	ajax.onreadystatechange=function() {
		if(ajax.readyState==1){
                        contenedor.innerHTML = "<img src=\"img/cargando.gif\" border=0/>";
		} else if (ajax.readyState==4) {
			var xml = ajax.responseText;
			contenedor.innerHTML = xml;
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	if(num=='1'){
	    dato = document.getElementById('idtitol').value;
	    ajax.send("nom="+dato);
	}else{
	    sel = document.getElementById('idcategoria');
	    indice = sel.selectedIndex;
	    dato = sel.options[indice].value;
	    ajax.send("cat="+dato);
	}
}

function AddLibro(){
   //
   txttitulo = document.getElementById('txttitulo').value;
   txtautor = document.getElementById('txtautor').value;
   txteditorial = document.getElementById('txteditorial').value;
   txtcategoria = document.getElementById('txtcategoria').value;
   txtedicion = document.getElementById('txtedicion').value;
   txtejemplares = document.getElementById('txtejemplares').value;
   cadena="titulo="+txttitulo+"&&autor="+txtautor+"&&editorial="+txteditorial+"&&categoria="+txtcategoria+"&&edicion="+txtedicion+"&&ejemplares="+txtejemplares;
   AbreURL('/CELL/admin/biblio/addlibro.php','divaddlibro',cadena);
}*/

function AbreURL(dir,div,cadena){
	var contenedor;
	contenedor = document.getElementById(div);
	/*n1 = document.getElementById('num1').value;
	n2 = document.getElementById('num2').value;*/
	ajax=nuevoAjax();
	ajax.open("POST", dir,true);
	ajax.onreadystatechange=function() {
		if(ajax.readyState==1){
                        contenedor.innerHTML = "<img src=\"img/cargando.gif\" border=0/>";
		} else if (ajax.readyState==4) {
			var xml = ajax.responseText;
			contenedor.innerHTML = xml;
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(cadena);
}