function mostrar(nombreCapa){ 
//document.getElementById(nombreCapa).style.visibility="visible"; 
document.getElementById(nombreCapa).style.display="block"; 
} 

function ocultar(nombreCapa){ 
//document.getElementById(nombreCapa).style.visibility="hidden"; 
document.getElementById(nombreCapa).style.display="none"; 
} 

function ficha(url,capa){
//Nifty("div#porta");
//document.getElementById(capa).style.left=10;
//document.getElementById(capa).style.top;
mostrar(capa);
openpag(url,capa);
}
		 
function vernoticia(num){
for (i=1;i<=3;i++){
	 if(i==num){
	 	capanoti="noti"+num;
	 	mostrar(capanoti);
		}
	 else{
	 	capanoti="noti"+i;
		ocultar(capanoti);
		if(i!=1){
			mostrar("noticia"+i);
			}
		}
	if(num!=1){
		ocultar("noticia"+num);
		}
}
}

function cerrarnota(num){
if(num==1){
	ocultar("noti"+num);
	}
else{
	ocultar("noti"+num);
	mostrar("noticia"+num);
	}
}


//Funcion AJAX para todos los formularios
function AJAXCrearObjeto(){
var obj;
if(window.XMLHttpRequest) { // no es IE
obj = new XMLHttpRequest();
} else { // Es IE o no tiene el objeto
try {
obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert('El navegador utilizado no está soportado');
}
}
return obj;
}

function openpag(url,objID)
{
capa = document.getElementById(objID);
oXML = AJAXCrearObjeto();
//alert(url);
oXML.open('GET', url);
oXML.onreadystatechange = function() {
		if (oXML.readyState == 1) {
			capa.innerHTML = "Espere.... Cargando.....";
			}
		else if (oXML.readyState == 4) {
			txtrecibido=oXML.responseText;
			capa.innerHTML = txtrecibido;
			}
		//else{
		//	capa.innerHTML = "Cargando la página......";
		//	}
		}
oXML.send('');
}


function leernoticia1(){
//comprobamos que el estado de la peticion sea 4 (completado, listo para otra peticion)
  if (oXML.readyState == 4) {
		txtrecibido=oXML.responseText;
		//alert(txtrecibido);
		document.getElementById('noticia1').innerHTML = txtrecibido;
  }
}

function buscanoticia1(url)
{
oXML = AJAXCrearObjeto();
alert(url);
oXML.open('GET', url);
oXML.onreadystatechange = leernoticia1;
oXML.send('');
}


function leernoticia2(){
//comprobamos que el estado de la peticion sea 4 (completado, listo para otra peticion)
  if (oXML.readyState == 4) {
		txtrecibido=oXML.responseText;
		//alert(txtrecibido);
		document.getElementById('noticia2').innerHTML = txtrecibido;
  }
}

function buscanoticia2(url)
{
oXML = AJAXCrearObjeto();
alert(url);
oXML.open('GET', url);
oXML.onreadystatechange = leernoticia2;
oXML.send('');
}


function leernoticia3(){
//comprobamos que el estado de la peticion sea 4 (completado, listo para otra peticion)
  if (oXML.readyState == 4) {
		txtrecibido=oXML.responseText;
		//alert(txtrecibido);
		document.getElementById('noticia3').innerHTML = txtrecibido;
  }
}

function buscanoticia3(url)
{
oXML = AJAXCrearObjeto();
alert(url);
oXML.open('GET', url);
oXML.onreadystatechange = leernoticia3;
oXML.send('');
}




