//estas dos funciones son para el rollover en dorado de las imágenes y de los textos como imagen que
//estén en la carpeta comun/ (si están en iconos, el idImagen será "iconos/mail", pej)
function cambiarIcono(idImagen,num) {
	var nomimagen=idImagen;
	if(num!=undefined) nomimagen=idImagen+num;
	document.getElementById(nomimagen).src = "/syv/images/comun/iconos/" + idImagen + "_over.gif";
}
	
function cambiarIconoOut(idImagen,num) {
	var nomimagen=idImagen;
	if(num!=undefined) nomimagen=idImagen+num;
	document.getElementById(nomimagen).src = "/syv/images/comun/iconos/" + idImagen + ".gif";
}

function favoritos() {
	if((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(window.document.location, window.document.title);
	}
	else {
		if(navigator.appName == "Netscape")
		alert ("Presiona Crtl+D para agregar esta web a tus Favoritos");
	}
}
//funciones para aumentar-reducir  fuente
var min=9;
var max=16;
var arrayetiquetas =new Array ("p", "td", "th","a");
function ampliar() {
	for(x=0;x<arrayetiquetas.length;x++){
    var p = document.getElementsByTagName(arrayetiquetas[x]);
		for(i=0;i<p.length;i++) {
			  if(p[i].style.fontSize) {
				 var s = parseInt(p[i].style.fontSize.replace("px",""));
			  } else {
				 var s = 12;
			  }
			  if(s!=max) {
				 s += 1;
			  }
			  p[i].style.fontSize = s+"px"
		  }
	}
}

function reducir() {
	for(x=0;x<arrayetiquetas.length;x++){
    var p = document.getElementsByTagName(arrayetiquetas[x]);
	   for(i=0;i<p.length;i++) {
		  if(p[i].style.fontSize) {
			 var s = parseInt(p[i].style.fontSize.replace("px",""));
		  } else {
			 var s = 12;
		  }
		  if(s!=min) {
			 s -= 1;
		  }
		  p[i].style.fontSize = s+"px"
	   }   
	}
}
function restauraTexto() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
     p[i].style.fontSize = 12+"px"
   }   
}
function ocultar() {
	document.body.innerHTML ="<table border='0' cellspacing='0' cellpadding='0'><tr><td>"+ document.getElementById("tablaImprimir").innerHTML+"</td></tr></table>";
}
function restablecer() {
	setTimeout("window.location.reload()", 50);
}
function correo(web,asunto){
	var url="mailto:?subject="+asunto+"&amp;body="+escape(web);
	window.location=url;
}
function buscarBuscador(loc) {
	if (document.getElementById("textBuscar").value == "" || document.getElementById("textBuscar").value.length<=3) {
		if (loc == "es") alert("Debe introducir una palabra de más de 3 caracteres"); 
		else if (loc=="en") alert("Debe introducir una palabra de más de 3 caracteres");
		else if (loc=="fr") alert("Veuillez saisir un mot de plus de 3 caractères");
	} else {
		window.location = "/syv/Door.do?OPERATION=portalGrupo&FUNCTION=13&locale=" + loc + "&param=" + document.getElementById("textBuscar").value;
		//window.location = "/syv/Door.do?OPERATION=portalGrupo&amp;FUNCTION=12&amp;locale=" + loc + "&amp;param=" + document.getElementById("textBuscar").value;
	}
}
function getkey(e, loc) {
	if (window.event)
		if (window.event.keyCode==13) {
			buscar(loc);
		}
	else if (e)
		if (e.which == 13) {
			buscar(loc);
		}
}
function changeidioma(idiNew){
	var cadena="locale="+idiNew;
	var pagina=""+window.location;
	var cadena1=pagina.substring(pagina.indexOf("locale"),pagina.indexOf("locale")+9);
	while(pagina.indexOf(cadena1)!=-1)
		pagina=pagina.replace(cadena1,cadena);
	if ((pagina.toLowerCase().indexOf("operation")!=-1) || (pagina.toLowerCase().indexOf(".jsp")!=-1))
		window.location.href=pagina;
	else
		window.location.href="/syv/Door.do?OPERATION=portalGrupo&FUNCTION=8&locale="+idiNew;
}
function abrirWebItinere(){
	webo_zpi(8,7,228455);
	window.open("http://www.grupoitinere.com","Itinere","");
	return true;
}
// QUIZAS QUITAR CUANDO SE IMPLANTE EL NUEVO DESARROLLO DE PATRIMONIO
function abrirWebTesta(idioma){
	
		if(idioma == "es"){
		  window.open("http://www.testainmo.com/testa/cambioIdioma.do?language=es","Testa","");
		  return true;
		}  
		if(idioma == "en"){
		  window.open("http://www.testainmo.com/testa/cambioIdioma.do?language=en","Testa","");
		  return true;
		}  
		if(idioma == "fr"){
		  window.open("http://www.testainmo.com/testa/cambioIdioma.do?language=fr","Testa","");
		  return true;
		}  
	}
// QUIZAS QUITAR CUANDO SE IMPLANTE EL NUEVO DESARROLLO DE PATRIMONIO
	
// PATRIMONIO	
function abrirEnlace(url) {
		
	window.open(url, "", "toolbar=yes, menubar=yes,height=400, width=600,resizable=yes, screenX=10 , screenY=10,scrollbars=yes");

}	
// PATRIMONIO	



function informacion(idNoticia,idioma) {
		window.location.href="/syv/Door.do?OPERATION=gestorAcc&FUNCTION=820&web_Nnotas="+idNoticia+"&id1=20&navegador=&locale="+idioma+"&posicion2=1";
	}
	
//funciones para la navegacion de actualidad

	function AbrirEnlaceActualidad(url,locale){
		if (url.indexOf("http") == -1) {
			window.open("http://"+url, "", "toolbar=yes, menubar=yes,height=400, width=600,resizable=yes, screenX=10 , screenY=10,scrollbars=yes");
		} else {
			window.open(url, "", "toolbar=yes, menubar=yes,height=400, width=600,resizable=yes, screenX=10 , screenY=10,scrollbars=yes");
		}
    }
		
	function AbrirNotaActualidad(idNoticia,locale) {
		if (idNoticia == "suscripcion_sala") {
			window.parent.location.href="/syv/Door.do?OPERATION=gestorAcc&amp;FUNCTION=667&amp;locale=<%=idi%>&amp;alta=1";
		} else {
			window.parent.location.href="/syv/Door.do?OPERATION=gestorAcc&amp;FUNCTION=920&amp;web_Nnotas="+idNoticia+"&amp;id1=20&amp;navegador=ie&amp;locale=<%=idi%>";
		}
	}
	
	var capaActiva=0;
	function precarga(path){
		ar = new Image(); 
		ar.src = arguments[path]; 
	}
	function mostrar(nombreCapa){
		document.getElementById(nombreCapa).style.display="";
	}

	function ocultar(nombreCapa){
		document.getElementById(nombreCapa).style.display="none";
	}
	
	
	function notAnterior(totalNoticias) {
		ocultar("actualidad"+capaActiva);
		if (capaActiva!=0){
			capaActiva=capaActiva-1;
		}else{
			capaActiva=totalNoticias-1;
		}
		mostrar("actualidad"+capaActiva);
		contadorNotas(totalNoticias);
		
	}
	function contadorNotas(totalNoticias){
		document.getElementById ("contadorNotas").innerHTML= (capaActiva+1)+ " de " +totalNoticias;
		document.getElementById("imgactualidad").setAttribute("src",arraynoticias[capaActiva]);
	}
		
	function notSiguiente(totalNoticias) {
		ocultar("actualidad"+capaActiva);
		if (capaActiva!=totalNoticias-1){
			capaActiva=capaActiva+1;
		}else{
			capaActiva=0;
		}
		mostrar("actualidad"+capaActiva);
		contadorNotas(totalNoticias);
	}
	
function abrePdfOurl(pdf,url,locale) {
	if(url!="") {
		if (url.indexOf('http://')!=-1 || url.indexOf('https://')!=-1) {
			window.open(url.substring(1,url.length),'','width=900,height=600,resizable=yes');
		} else {
			window.open(url,"","width=800,height=600,resizable=yes");
		}
	} else {
		//window.open("/syv/base/downloadInter2.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
		window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
	}
}
//fin modificación

function openPdfOurl(pdf,url,locale) {
	if(url!="") {
			window.open(url,"","width=800,height=600,resizable=yes,scrollbars=yes");
	} else {
		//window.open("/syv/base/downloadInter2.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
		window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
	}
}
function escribeFigura()
{
	var maximo_figuras = 3;

	figura = Math.round(Math.random() * (maximo_figuras - 1)) + 1;

	document.write ('<img src="/syv/images/home/foto' + figura + '.jpg" width="195" height="110">');
}

function imprimirXSL()
{
		window.open(document.location.href+"&imprimir=1", "infoPrint" , "width=600,height=300");
}

function imprimirXSL2(valor)
{
	window.open(window.location+"&imprimir=1&posicion="+valor, "infoPrint" , "width=600,height=300");
}

function imprimirXSL3(valor,i)
{
	window.open(window.location+"&imprimir=1&posicion="+valor+"&posicion2="+i, "infoPrint" , "width=600,height=300");
}

function verInfo(alto,ancho)
{
	window.open(window.location+"&posicion=1", "GrupoSyV" , "width="+ancho+",height="+alto);
}
function abrirPDF(pdf)
{
	window.open("/syv/repositorio/syv"+escape(pdf), "PDF", "width=800,height=600,resizable=yes");
}



// Se incluyen estas nuevas funciones para poder crear galerias independientes (Audientia)
function abrirPDFJunta(pdf,locale)
{
	//window.open("/syv/base/downloadInter.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
	window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
}
function abrirPDFPFinancieras(pdf,locale)
{
	//window.open("/syv/base/downloadInter.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
	window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
}
function abrirPDFVActivos(pdf,locale)
{
	//window.open("/syv/base/downloadInter.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
	window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
}

function abrirPDFVMemoria(pdf,locale)
{
	//window.open("/syv/base/downloadInter.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
	window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
}
function abrirPDFVInfTrimestrales(pdf,locale)
{
	//window.open("/syv/base/downloadInter.jsp?ID="+escape(pdf)+"&locale="+locale, "PDF", "width=800,height=600,resizable=yes");
	window.open("/syv/repositorio/syv"+escape(pdf),"PDF", "width=600,height=300,resizable=yes");
}

/*************************************************/


function abrirFoto(path)
{
	window.open("/syv/Door.do?OPERATION=promo&FUNCTION=25&ID=" +escape(path)+ "&TABLA=MULTIMEDIA", "popupFoto", "width=300,height=140,resizable=yes");
}

function abrirFotoSyV(path,imprimir,titulo)
{
	window.open("/syv/Door.do?OPERATION=gestorNew&FUNCTION=104&ID=" +escape(path)+ "&imprimir="+imprimir+"&titulo="+titulo, "popupFoto", "width=300,height=140,resizable=yes");
}

function abrirGraficoSyV(path,imprimir,titulo)
{
	window.open("/syv/Door.do?OPERATION=gestorNew&FUNCTION=105&ID=" +escape(path)+ "&imprimir="+imprimir+"&titulo="+titulo, "PDF", "width=600,height=600,resizable=yes");
}

function imprimir(){
	
	if(document.getElementById("tablaImprimir")){
		document.body.innerHTML ="<table border='0' cellspacing='0' cellpadding='0'><tr><td>"+ document.getElementById("tablaImprimir").innerHTML+"</td></tr></table>";
		window.print();
		setTimeout("window.location.reload()", 100);
	}else
		window.print();
}

function enlacesHome(estadistica,popup,id){
	
	if(popup=="on"){
		document.getElementById(id).target="_blank";
	}else
		document.getElementById(id).target="_self";
		
	if(estadistica!="0"){
		webo_zpi(1,estadistica,228455);
		return true;
	}
	
	return false;	
}

function validarEmail(campo,ms){
	valor=campo.value;
	if ( /^\w(\.?\w)*@\w(\.?\w)*$/.test(valor)==false ) {
		window.alert(ms);
		return false;
	}else
		return true;
}

var menuAbierto=-1;
var numMenus=0;
function menuInterior(numMenu){
	for(var i=1;i<numMenus+1;i++){
		if(numMenu!=i){
			document.getElementById("menu"+i).style.display="none";
			document.getElementById("flecha"+i).src = "/syv/gruposyv/img/flecha.gif";
			document.getElementById("submenu"+i).style.color = "#6a7c8a";
		}else{
			if(document.getElementById("menu"+i).style.display=="block"){
					document.getElementById("menu"+i).style.display="none";
					document.getElementById("flecha"+i).src = "/syv/gruposyv/img/flecha.gif";
					document.getElementById("submenu"+i).style.color = "#6a7c8a";
			}else{
					document.getElementById("menu"+i).style.display="block";
					document.getElementById("flecha"+i).src = "/syv/gruposyv/img/flecha_over.gif";
					document.getElementById("submenu"+i).style.color = "#bda251";
			}
		}
	}
}
function ponerdorado(i){
			document.getElementById("submenu"+i).style.color = "#bda251";
}
function quitardorado(i){
	if(document.getElementById("menu"+i).style.display!="block")
	document.getElementById("submenu"+i).style.color = "#6a7c8a";
}
function popUpVideo(theURL) {

		url=unescape(theURL);
		window.open(url, 'Video', 'location=0,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=419,height=450');
	}