// JavaScript Document
var xmlDocNoticias;
var sPathLupa="Iconos/lupa.jpg";
var sAltLupa="Ver Noticia Completa";
var sPathPag="noticia.htm";
var mozilla;
var ie;
var iIndexPagina = 0;
var iNoticiasPagina = 15;
var iLinksByLine = 20;
function importaXMLNoticia(fichero,funcion) {
  mozilla = (typeof document.implementation != 'undefined')
      && (typeof document.implementation.createDocument != 'undefined');
  ie = (typeof window.ActiveXObject != 'undefined');

  if (mozilla) {
    xmlDocNoticias = document.implementation.createDocument("", "", null)
    xmlDocNoticias.load(fichero);
    xmlDocNoticias.onload = function()
    {
      funcion(iIndexPagina);
    }
  } else if (ie) {
    xmlDocNoticias = new ActiveXObject("Microsoft.XMLDOM");
    xmlDocNoticias.async = false;
    xmlDocNoticias.load(fichero);
    if (xmlDocNoticias.readyState == 4) funcion(iIndexPagina);
  }
  else {
    alert('Tu navegador no puede manejar este script');
    return;
  }
}


function importaNoticiaXML(fichero) {
    importaXMLNoticia(fichero,PaintDataNoticiasPaginadas);
	}

//Función para pintar las noticias
function PaintDataNoticias(){
		try{
			var sNameNode;
			var sTextNode;
			var sPathImage;
			var sRutaNoticia="#"
			var sTituloNoticia="";
			var bNoticiaCompleta = false;
			var arDataNoticias = new Array();
			arDataNoticias = xmlDocNoticias.getElementsByTagName("noticia");
			for(i=0;i<arDataNoticias.length;i++){
				//Se mira si vamos a hacer enlace a ruta completa o no
				if (mozilla) {
					//Se mira si vamos a hacer enlace a ruta completa o no
					if(parseInt(arDataNoticias[i].childNodes.length)>=parseInt(9)){
						bNoticiaCompleta = true;
					}else{
						bNoticiaCompleta = false;
					}
				} else if (ie) {
					//Se mira si vamos a hacer enlace a ruta completa o no
					if(parseInt(arDataNoticias[i].childNodes.length)>=parseInt(4)){
						bNoticiaCompleta = true;
					}else{
						bNoticiaCompleta = false;
					}
				}else {
					alert('Tu navegador no puede manejar este script');
					return;
				}
				for(j=0;j<arDataNoticias[i].childNodes.length;j++){
					sNameNode=arDataNoticias[i].childNodes[j].nodeName;
					switch(sNameNode){
						case "rutaImagen":
							sPathImage = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
  							//WriteImagePiano(sPathImage);
  							break;
						case "rutaNoticia":
							sRutaNoticia = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
							break;
						case "tituloNoticia":
							sTituloNoticia = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
							break;
						case "textoNoticia":
							sTextNode = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
							WriteNoticia(sTextNode,sTituloNoticia,sRutaNoticia,i,bNoticiaCompleta);
  							break;
					}
				}
			}
		}catch(err){
			alert(err.message);
		}
	}
	
	
//Función que pinta las noticias paginadas
function PaintDataNoticiasPaginadas(iIndex){
		try{
			var sNameNode;
			var sTextNode;
			var sPathImage;
			var sRutaNoticia="#"
			var sTituloNoticia="";
			var bNoticiaCompleta = false;
			var arDataNoticias = new Array();
			arDataNoticias = xmlDocNoticias.getElementsByTagName("noticia");
			var iNumNotice;
			var iIni = parseInt(iIndex) * parseInt(iNoticiasPagina);
			var iFin = (parseInt(iIndex) + parseInt(1)) * parseInt(iNoticiasPagina);
			iNumNotice = arDataNoticias.length;
			if(parseInt(iFin)>parseInt(iNumNotice)){
				iFin=iNumNotice;
			}
			var docBody = document.getElementsByTagName("body").item(0);
			docBody.appendChild(document.createElement("br"));	
			docBody.appendChild(document.createElement("br"));	
			docBody.appendChild(document.createElement("br"));	
			if (mozilla) {
				docBody.appendChild(document.createElement("br"));	
			} 		
			for(i=iIni;i<iFin;i++){
				//Se mira si vamos a hacer enlace a ruta completa o no
				if (mozilla) {
					if(parseInt(arDataNoticias[i].childNodes.length)>=parseInt(9)){
						bNoticiaCompleta = true;
					}else{
						bNoticiaCompleta = false;
					}
				} else if (ie) {
					if(parseInt(arDataNoticias[i].childNodes.length)>=parseInt(4)){
						bNoticiaCompleta = true;
					}else{
						bNoticiaCompleta = false;
					}
				}else {
					alert('Tu navegador no puede manejar este script');
					return;
				}
				for(j=0;j<arDataNoticias[i].childNodes.length;j++){
					sNameNode=arDataNoticias[i].childNodes[j].nodeName;
					switch(sNameNode){
						case "rutaImagen":
							sPathImage = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
  							//WriteImagePiano(sPathImage);
  							break;
						case "rutaNoticia":
							sRutaNoticia = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
							break;
						case "tituloNoticia":
							sTituloNoticia = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
							break;
						case "textoNoticia":
							sTextNode = arDataNoticias[i].childNodes[j].childNodes[0].nodeValue;
							WriteNoticia(sTextNode,sTituloNoticia,sRutaNoticia,i,bNoticiaCompleta);
  							break;
					}
				}
			}
			var iNumPag = parseInt(arDataNoticias.length)/parseInt(iNoticiasPagina)
			var iLinksPag = Math.floor(iNumPag);
			var bMultiplo;
			if((parseInt(arDataNoticias.length)) % (parseInt(iNoticiasPagina))==0){
				bMultiplo = true;
			}else{
				bMultiplo = false;
			}
			PaintPaginado(iLinksPag,bMultiplo);
		}catch(err){
			alert(err.message);
		}
	}
	
//Funcion que pinta los enlaces de paginado para las noticias
function PaintPaginado(iLinksPag,bMultiplo){
		try{
			var oTable = document.createElement("table");
			var oTbody=oTable.appendChild(document.createElement("tbody"));
			var oTr = oTbody.appendChild(document.createElement("tr"));
			var oTd;
			var oLink;
			var oText;
			var oLink;
			var iTextLink;
			var iMax = iLinksPag;
			if(bMultiplo){
				iMax = iMax - 1;
			}
			
			for(var i=0;i<=iMax;i++){
				if(i!=0){
					if((parseInt(i)%parseInt(iLinksByLine))==0){
						oTr = oTbody.appendChild(document.createElement("tr"));
					}
				}
				oTd = oTr.appendChild(document.createElement("td"));
				if (mozilla) {
					oTd.setAttribute("class","tdLinksPaginas");
					//oTd.setAttribute("idLink",i);
				} else if (ie) {
					oTd.setAttribute("className","tdLinksPaginas");
					//oTd.setAttribute("idLink",i);
				}else {
					alert('Tu navegador no puede manejar este script');
					return;
				}
				oLink = oTd.appendChild(document.createElement("a"));
				oLink.setAttribute("idLink",i);
				oLink.setAttribute("href","#_ancla");
				//Se añaden los eventos
				if(ie){
					oLink.attachEvent("onclick",ChangePage);
				}else{ 
					 if (mozilla) {
						oLink.onclick=new function(){
							oLink.addEventListener("click",ChangePageFirefox, false);
						}
					  }else {
						alert('Tu navegador no puede manejar este script');
						return;
					  }
			    }
				iTextLink = parseInt(i) + parseInt(1);
				oText = oLink.appendChild(document.createTextNode(iTextLink));
			}
			var docBody = document.getElementsByTagName("body").item(0); 
			docBody.appendChild(oTable);
		}catch(err){
			alert(err.message);
		}
	}
	
function ChangePage(){
	try{
		PaintMessage(true);
		var iLink = event.srcElement.getAttribute("idLink");
		var docBody = document.getElementsByTagName("body").item(0);
		var oChildAux;
		var iIndexIni = docBody.childNodes.length;
		var iIndexFin = 3;
		for(var i=iIndexIni;i>=iIndexFin;i--){
			oChildAux = docBody.childNodes[i-1];
			docBody.removeChild(oChildAux);
		}
		PaintDataNoticiasPaginadas(iLink);
	}catch(err){
		alert(err.message);
	}	
}

function ChangePageFirefox(){
	try{
		var iText = this.innerHTML;
		var iLink;
		iLink = parseInt(iText) - parseInt(1);
		var docBody = document.getElementsByTagName("body").item(0);
		var oChildAux;
		var iIndexIni = docBody.childNodes.length;
		var iIndexFin = 3;
		for(var i=iIndexIni;i>=iIndexFin;i--){
			oChildAux = docBody.childNodes[i-1];
			docBody.removeChild(oChildAux);
		}
		PaintDataNoticiasPaginadas(iLink);
		PaintMessage(true);
	}catch(err){
		alert(err.message);
	}
}	
	
//Función que escribe la imagen del piano	
function WriteImagePiano(sPathImage){
		try{
			var divImage = document.createElement("div");
			divImage.className='imgPiano'; 
			var oInputImage = divImage.appendChild(document.createElement("img"));
			oInputImage.setAttribute("src",sPathImage);
			divImage.appendChild(oInputImage);
			var docBody = document.getElementsByTagName("body").item(0); 
			docBody.appendChild(divImage);
		}catch(err){
			alert(err.message);
		}
	}
//Función que escribe el div y la noticia
function WriteNoticia(sTextNode,sTituloNoticia,sRutaNoticia,index,bNoticiaCompleta){
		try{
			//Div t
			var divT = document.createElement("div");
			divT.className='t';
			//Div b
			var divB = divT.appendChild(document.createElement("div"));
			divB.className='b';
			//Div l
			var divL = divB.appendChild(document.createElement("div"));
			divL.className='l';		
			//Div r
			var divR = divL.appendChild(document.createElement("div"));
			divR.className='r';		
			//Div bl
			var divBl = divR.appendChild(document.createElement("div"));
			divBl.className='bl';
			//Div br
			var divBr = divBl.appendChild(document.createElement("div"));
			divBr.className='br';
			//Div tl
			var divTl = divBr.appendChild(document.createElement("div"));
			divTl.className='tl';		
			//Div tr
			var divTr = divTl.appendChild(document.createElement("div"));
			divTr.className='tr';		
			//Div Títulos noticias
			var divTitNoticias = divTl.appendChild(document.createElement("div"));
			divTitNoticias.className='titNoticiaLink';
			//divTitNoticias.onmouseover=function(){this.style.backgroundColor="#CCCC66";};
			//divTitNoticias.onmouseout=function(){this.style.backgroundColor="#FFFFFF";};
			//Se crea el título de la noticia
			var oAlink = document.createElement('a');
			oAlink.setAttribute("href",sRutaNoticia);
			oAlink.setAttribute("target", "_blank");
			oAlink.appendChild(document.createTextNode(sTituloNoticia));
			divTitNoticias.appendChild(oAlink);
			//H3 con el texto de la noticia
			var oH3;
			var arBlock = new Array();
			arBlock = GetBlocks(sTextNode);
			var sTextToWrite;
			if(arBlock.length>0){
				for(var i=0;i<arBlock.length-1;i++){
					oH3 = divTitNoticias.appendChild(document.createElement("h3"));
					sTextToWrite=sustituir(arBlock[i],"euros","€");
					oH3.appendChild(document.createTextNode(sTextToWrite));
					//divTitNoticias.appendChild(document.createElement("br"));
				}
			}else{
				sTextToWrite=sustituir(arBlock[i],"euros","€");
				oH3.appendChild(document.createTextNode(sTextToWrite));
			}
			//Se pina el gráfico
			if(bNoticiaCompleta){
				var oAlinkNoticia = document.createElement('a');
				oAlinkNoticia.setAttribute("href",sPathPag+"?index="+index);
				oAlinkNoticia.setAttribute("target", "_blank");
				//var oInputImage = oAlinkNoticia.appendChild(document.createElement("img"));
				//oInputImage.setAttribute("src",sPathLupa);
				//oInputImage.setAttribute("alt",sAltLupa);
				//oInputImage.setAttribute("border","0");
				var oTextAmpliar = oAlinkNoticia.appendChild(document.createTextNode("ampliar..."));
				if (mozilla) {
					oAlinkNoticia.setAttribute("class","tdlupa");
				} else if (ie) {
					oAlinkNoticia.setAttribute("className","tdlupa");
				}else {
					alert('Tu navegador no puede manejar este script');
					return;
				}	
			}
			//Se enlazan hacia arriba
			//
			//divTitNoticias.appendChild(oH3);
			if(bNoticiaCompleta){
				divTitNoticias.appendChild(oAlinkNoticia);
			}		
			divTr.appendChild(divTitNoticias);
			divTl.appendChild(divTr);
			divBr.appendChild(divTl);
			divBl.appendChild(divBr);
			divR.appendChild(divBl);
			divL.appendChild(divR);
			divB.appendChild(divL);
			divT.appendChild(divB);
			var divEspacio = document.createElement("div");
			divEspacio.className='espacio';
			var docBody = document.getElementsByTagName("body").item(0);
			docBody.appendChild(divEspacio);
			//docBody.appendChild(document.createElement("br"));
			//if(index==0){
			//	docBody.appendChild(document.createElement("br"));	
			//	docBody.appendChild(document.createElement("br"));
			//}
			docBody.appendChild(divT);
		}catch(err){
			alert(err.message);
		}
	}
	
//Funciones para leer la noticia completa	
	function importaXMLNoticiaCompleta(fichero,funcion,index) {
  mozilla = (typeof document.implementation != 'undefined')
      && (typeof document.implementation.createDocument != 'undefined');
  ie = (typeof window.ActiveXObject != 'undefined');

  if (mozilla) {
    xmlDocNoticias = document.implementation.createDocument("", "", null)
    xmlDocNoticias.load(fichero);
    xmlDocNoticias.onload = function()
    {
      funcion(index);
    }
  } else if (ie) {
    xmlDocNoticias = new ActiveXObject("Microsoft.XMLDOM");
    xmlDocNoticias.async = false;
    xmlDocNoticias.load(fichero);
    if (xmlDocNoticias.readyState == 4) 
		funcion(index);
  }
  else {
    alert('Tu navegador no puede manejar este script');
    return;
  }
}

function importaNoticiaCompletaXML(fichero,index) {
    importaXMLNoticiaCompleta(fichero,PaintNoticiaCompleta,index);
	}
	
function PaintNoticiaCompleta(index){
		if (mozilla) {
			PaintFireFox(index);			
		} else if (ie) {
			PaintIe(index);
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
	}
	
function PaintIe(index){
	try{
		var arDataNoticias = new Array();
		arDataNoticias = xmlDocNoticias.getElementsByTagName("noticia");
		var sTextTit =arDataNoticias[index].childNodes[1].childNodes[0].nodeValue;
		var oDivTitulo = document.getElementById("divTitulo");
		var oTextTit=oDivTitulo.appendChild(document.createTextNode(sTextTit))
		if (mozilla) {
			oDivTitulo.setAttribute("class","titNoticiaCompleto");			
		} else if (ie) {
			oDivTitulo.setAttribute("className","titNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
		
		var sText =arDataNoticias[index].childNodes[3].childNodes[0].nodeValue;
		var oDiv = document.getElementById("divTexto");
		var arBlock = new Array();
		var oText;
		sTextAux = sustituir(sText,"\n","<br>");
		if(arDataNoticias[index].childNodes.length>4){
			sText = "<img src='FotosNoticias/"+arDataNoticias[index].childNodes[4].childNodes[0].nodeValue+"' align='right' vspace='5' hspace='5' valign='top'> ";
			sText = sText + "<p>" + sTextAux + "<p>"
			
		}else{
			sText = sTextAux;
		}	
		//arBlock = GetBlocks(sText);
		//if(arBlock.length>0){
		//	for(var i=0;i<arBlock.length-1;i++){
		//		oH3 = oDiv.appendChild(document.createElement("h5"));
		//		oH3.appendChild(document.createTextNode(arBlock[i]));
		//	}
		//}else{
		//	oText=oDiv.appendChild(document.createTextNode(sText))
		//}			
		//oText=oDiv.appendChild(document.createTextNode(sText));
		oDiv.innerHTML=sText;
		if (mozilla) {
			oDiv.setAttribute("class","textoNoticiaCompleto");			
		} else if (ie) {
			oDiv.setAttribute("className","textoNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
	}catch(err){
		alert(err.message);
	}	
}

function PaintFireFox(index){
	try{
		var arDataNoticias = new Array();
		arDataNoticias = xmlDocNoticias.getElementsByTagName("noticia");
		var sTextTit =arDataNoticias[index].childNodes[3].childNodes[0].nodeValue;
		var oDivTitulo = document.getElementById("divTitulo");
		var oTextTit=oDivTitulo.appendChild(document.createTextNode(sTextTit))
		if (mozilla) {
			oDivTitulo.setAttribute("class","titNoticiaCompleto");			
		} else if (ie) {
			oDivTitulo.setAttribute("className","titNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
		
		var sText =arDataNoticias[index].childNodes[7].childNodes[0].nodeValue;
		var oDiv = document.getElementById("divTexto");
		var arBlock = new Array();
		var oText;
		sTextAux = sustituir(sText,"\n","<br>");
		if(arDataNoticias[index].childNodes.length>9){
			sText = "<img src='FotosNoticias/"+arDataNoticias[index].childNodes[9].childNodes[0].nodeValue+"' align='right' vspace='5' hspace='5' valign='top'> ";
			sText = sText + "<p>" + sTextAux + "<p>"
			
		}else{
			sText = sTextAux;
		}	
		//arBlock = GetBlocks(sText);
		//if(arBlock.length>0){
		//	for(var i=0;i<arBlock.length-1;i++){
		//		oH3 = oDiv.appendChild(document.createElement("h3"));
		//		oH3.appendChild(document.createTextNode(arBlock[i]));
		//	}
		//}else{
		//	oText=oDiv.appendChild(document.createTextNode(sText))
		//}			
		oDiv.innerHTML=sText;
		if (mozilla) {
			oDiv.setAttribute("class","textoNoticiaCompleto");			
		} else if (ie) {
			oDiv.setAttribute("className","textoNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
	}catch(err){
		alert(err.message);
	}	
}
	
function GetBlocks(texto){
	try{
		var arBloques = new Array();
		arBloques  =texto.split("\n");
		return arBloques;
	}catch(err){
		alert(err.message);
	}
}

function sustituir(texto,s1,s2){
	return texto.split(s1).join(s2);
}

//Funciones para leer la noticia completa Buscada	
	function importaXMLNoticiaCompletaSearch(fichero,funcion,titulo) {
  mozilla = (typeof document.implementation != 'undefined')
      && (typeof document.implementation.createDocument != 'undefined');
  ie = (typeof window.ActiveXObject != 'undefined');

  if (mozilla) {
    xmlDocNoticias = document.implementation.createDocument("", "", null)
    xmlDocNoticias.load(fichero);
    xmlDocNoticias.onload = function()
    {
      funcion(titulo);
    }
  } else if (ie) {
    xmlDocNoticias = new ActiveXObject("Microsoft.XMLDOM");
    xmlDocNoticias.async = false;
    xmlDocNoticias.load(fichero);
    if (xmlDocNoticias.readyState == 4) 
		funcion(titulo);
  }
  else {
    alert('Tu navegador no puede manejar este script');
    return;
  }
}

function importaNoticiaCompletaSearchXML(fichero,titulo) {
    importaXMLNoticiaCompletaSearch(fichero,PaintNoticiaCompletaSearch,titulo);
	}
	
function PaintNoticiaCompletaSearch(titulo){
		if (mozilla) {
			PaintFireFoxSearch(titulo);			
		} else if (ie) {
			PaintIeSearch(titulo);
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
	}

function PaintIeSearch(titulo){
	try{
		var arDataNoticias = new Array();
		arDataNoticias = xmlDocNoticias.getElementsByTagName("noticia");
		var index = getNoticiaSearch(arDataNoticias,titulo);
		var sTextTit =arDataNoticias[index].childNodes[1].childNodes[0].nodeValue;
		var oDivTitulo = document.getElementById("divTitulo");
		var oTextTit=oDivTitulo.appendChild(document.createTextNode(sTextTit))
		if (mozilla) {
			oDivTitulo.setAttribute("class","titNoticiaCompleto");			
		} else if (ie) {
			oDivTitulo.setAttribute("className","titNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
		
		var sText =arDataNoticias[index].childNodes[3].childNodes[0].nodeValue;
		var oDiv = document.getElementById("divTexto");
		var arBlock = new Array();
		var oText;
		sTextAux = sustituir(sText,"\n","<br>");
		if(arDataNoticias[index].childNodes.length>4){
			sText = "<img src='FotosNoticias/"+arDataNoticias[index].childNodes[4].childNodes[0].nodeValue+"' align='right' vspace='5' hspace='5' valign='top'> ";
			sText = sText + "<p>" + sTextAux + "<p>"
			
		}else{
			sText = sTextAux;
		}	
		//arBlock = GetBlocks(sText);
		//if(arBlock.length>0){
		//	for(var i=0;i<arBlock.length-1;i++){
		//		oH3 = oDiv.appendChild(document.createElement("h5"));
		//		oH3.appendChild(document.createTextNode(arBlock[i]));
		//	}
		//}else{
		//	oText=oDiv.appendChild(document.createTextNode(sText))
		//}			
		oDiv.innerHTML=sText;
		if (mozilla) {
			oDiv.setAttribute("class","textoNoticiaCompleto");			
		} else if (ie) {
			oDiv.setAttribute("className","textoNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
	}catch(err){
		alert(err.message);
	}	
}

function PaintFireFoxSearch(titulo){
	try{
		var arDataNoticias = new Array();
		arDataNoticias = xmlDocNoticias.getElementsByTagName("noticia");
		var arSep = titulo.split('%20');
		var sTit='';
		if(arSep.length>1){//Para el caso de Firefox que mete %20 en los espacios en blanco
			for(var i=0;i<arSep.length;i++){
				sTit = sTit + arSep[i] + ' ';
			}
			sTit = sTit.replace(/^\s*|\s*$/g,"");
			sTit=unescape(sTit);
		}
		var index = getNoticiaSearchFirefox(arDataNoticias,sTit);
		var sTextTit =arDataNoticias[index].childNodes[3].childNodes[0].nodeValue;
		var oDivTitulo = document.getElementById("divTitulo");
		var oTextTit=oDivTitulo.appendChild(document.createTextNode(sTextTit))
		if (mozilla) {
			oDivTitulo.setAttribute("class","titNoticiaCompleto");			
		} else if (ie) {
			oDivTitulo.setAttribute("className","titNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
		
		var sText =arDataNoticias[index].childNodes[7].childNodes[0].nodeValue;
		var oDiv = document.getElementById("divTexto");
		var arBlock = new Array();
		var oText;
		sTextAux = sustituir(sText,"\n","<br>");
		if(arDataNoticias[index].childNodes.length>9){
			sText = "<img src='FotosNoticias/"+arDataNoticias[index].childNodes[9].childNodes[0].nodeValue+"' align='right' vspace='5' hspace='5' valign='top'> ";
			sText = sText + "<p>" + sTextAux + "<p>"
			
		}else{
			sText = sTextAux;
		}	
		//arBlock = GetBlocks(sText);
		//if(arBlock.length>0){
		//	for(var i=0;i<arBlock.length-1;i++){
		//		oH3 = oDiv.appendChild(document.createElement("h3"));
		//		oH3.appendChild(document.createTextNode(arBlock[i]));
		//	}
		//}else{
		//	oText=oDiv.appendChild(document.createTextNode(sText))
		//}			
		oDiv.innerHTML=sText;	
		if (mozilla) {
			oDiv.setAttribute("class","textoNoticiaCompleto");			
		} else if (ie) {
			oDiv.setAttribute("className","textoNoticiaCompleto");
		}else {
			alert('Tu navegador no puede manejar este script');
			return;
		}	
	}catch(err){
		alert(err.message);
	}	
}

function getNoticiaSearch(arDataNoticias,titulo){
	try{
		var iIndex = -1;
		for(var i=0;i<arDataNoticias.length;i++){
			if(arDataNoticias[i].childNodes[1].childNodes[0].nodeValue==titulo){
				iIndex=i;
				break;
			}
		}
		return iIndex;
	}catch(err){
				
	}
	
}

function getNoticiaSearchFirefox(arDataNoticias,titulo){
	try{
		var iIndex = -1;
		for(var i=0;i<arDataNoticias.length;i++){
			if(arDataNoticias[i].childNodes[3].childNodes[0].nodeValue==titulo){
				iIndex=i;
				break;
			}
		}
		return iIndex;
	}catch(err){
				
	}
	
}


	