	function abrirventana(direccion, nombre, ancho, alto ,posX ,posY) {
		var xwin = window.open(direccion, nombre, 'width=' + ancho +', height=' + alto + ', left='+posX+', top='+posY+', resizable=no, scrollbars=yes');
		xwin.focus();
		// No parece funcionar ya el moveTo
		//if (posX !== null && posY !== null) {
			//xwin.moveTo(posX, posY); 
		//}
	}

	function abrirMenu(pagina) {
		if (pagina==1){
			abrirventana('/pie/informacion.jsp?promo=info','Informacion',620, 724, 50, 50);
		} else if (pagina==2){
			abrirventana('/clientes/forms/rve.jsp','CortalConsorsRVE',625, 415, 50, 50);
		}
	}

	function Busqueda() {
		document.buscarEmpresa.submit();
	}
	
	function desconectar() {
		document.location = "/sd/?S=LOGOUT";
	}

	function abrirPopUp(numero_impresiones,nombre_cookie, url, nombre_ventana, ventana) {
		valor = getCookie( nombre_cookie );
		if (isNaN(valor))
			valor = 0;
		valor = parseInt(valor) + 1;
		if (valor <= numero_impresiones) {
			window.open(url,nombre_ventana,ventana);
//			window.open('/popNY.jsp','Contactaconnosotros','left=150,top=50');
//			window.open('/popNY.jsp','Contacta con nosotros','left=448,top=532');
			//window.open('/popupHome.htm', 'CortalConsors', 'left=150, top=50, resizable=no, scrollbars=no');
			//window.open('/formacion/cursosyconferencias/popupFormacion.htm', 'CortalConsors', 'left=150, top=50, resizable=no, scrollbars=no');
		}
		setCookie(nombre_cookie, valor);
//		setCookie(nombre_cookie, valor, fecha_limite,'/','cortalconsors.es','true');
//		setCookie(nombre_cookie, valor, 'Mon,5 Oct 2008 12:00:00 GMT');
	} // abrirPopUpHome
	
	function getCookie(Name) {
		var search = Name + "=";
		if (document.cookie.length > 0) { // if there are any cookies
			offset = document.cookie.indexOf(search);
			if (offset != -1) { // if cookie exists
				offset += search.length; // set index of beginning of value
				end = document.cookie.indexOf(";", offset); // set index of end of cookie value
				if (end == -1)
					end = document.cookie.length;
				return unescape( document.cookie.substring(offset, end) );
			}
		}
	}
	
	function setCookie( name, value, path, domain, secure ) {
		var expires ="";
		fecha = new Date();
		fecha = new Date(fecha.getYear(), fecha.getMonth(), fecha.getDate() + 1, 1, 0, 0, 0);
		//var expires = fecha.toGMTString()
		var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires : "") +
		    ((path) ? "; path=" + path : "") +
		    ((domain) ? "; domain=" + domain : "") +
		    ((secure) ? "; secure" : "");
		if ((name + "=" + escape(value)).length <= 4000)
			document.cookie = curCookie;
		else
			if (confirm("Cookie excede de 4KB y ser&aacute; cortado"))
				document.cookie = curCookie;
	}	
	
	/**
	 * Ofusca la pantalla para que el usuario no toque nada mientras se carga
	 * @return
	 */
	function ofuscar_pantalla_web() { 
		var thediv=document.getElementById('div_ocultacion');
		if(thediv.style.display == "none"){
			thediv.style.display = "";
			thediv.innerHTML = '<img src="/images/engranajes.gif"/>';
		}else{
			thediv.style.display = "none";
			thediv.innerHTML = '';
		}
	}

	/**
	* Cambia el fondo de toda una fila a pasandole una de sus columnas. 
	*/
		
	function cambiaFondo(color, columna) {
		/* comprobar el tipo de navegador */
		  var ie  = document.all;
		 
		  /* ie uses parentElement to get traverse nodes; mozilla uses parentNode */
		  var fila = ie? columna.parentElement : columna.parentNode ;
	
	
		for(var i = 0; i < fila.childNodes.length; i++) {
			fila.childNodes[i].bgColor=color;
		}
	}

	/**
	* Cambia el idioma actual, lo guarda en la sesion, y vuelve ala pagina actual 
	*/
		
	function cambiaIdioma(select,url) {
		var lang=select.options[select.selectedIndex].value;
		url=url.replace('.jsp','/jsp/');
		if (
				(url=='/infomercados/cotizaciones_cuerpo/jsp/') || 
				(url=='/infomercados/cotizaciones_buscar/jsp/')
			) {
			url='/infomercados/cotizaciones/jsp/';
		} else if (
				(url=='/infomercados/cotizaciones_acciones/jsp/') || 
				(url=='/infomercados/cotizaciones_empresa/jsp/') ||  
				(url=='/infomercados/cotizaciones_empresa_noticias/jsp/') ||  
				(url=='/infomercados/cotizaciones_empresa_graficos/jsp/')
			) {
			url='/infomercados/mercado-continuo';
		} else if (
				(url=='/infomercados/cotizaciones_indice/jsp/') ||
				(url=='/infomercados/cotizaciones_indice_acciones/jsp/') ||
				(url=='/infomercados/cotizaciones_indice_noticias/jsp/') ||
				(url=='/infomercados/cotizaciones_indice_graficos/jsp/') ||
				(url=='/infomercados/cotizaciones_indices/jsp/') 
			) {
			url='/infomercados/indices';
		} else if (
				(url=='/infomercados/cotizaciones_divisas/jsp/')) {
			url='/infomercados/divisas';
		} else if (
				(url=='/infomercados/noticias-cuerpo/jsp/') ||
				(url=='/infomercados/noticias-detalle/jsp/') ||
				(url=='/infomercados/noticias-masnoticias/jsp/') 
			) {
			url='/infomercados/noticias/jsp/';
		} else if (
				(url=='/infomercados/cotizaciones_empresa_analisis/jsp/') ||
				(url=='/infomercados/analisis-chartista-detalle/jsp/') ||
				(url=='/infomercados/analisis-chartista-acciones/jsp/')) {
			url='/infomercados/analisis-chartista-acciones';
		} else if (
				(url=='/infomercados/cotizaciones_indice_analisis/jsp/') ||
				(url=='/infomercados/analisis-chartista-indices/jsp/')) {
			url='/infomercados/analisis-chartista-indices';
		} else if (
				(url=='/infomercados/analisis-chartista-divisas/jsp/')) {
			url='/infomercados/analisis-chartista-divisas';
		} else if (
				(url=='/infomercados/analisis-chartista-bonos/jsp/')) {
			url='/infomercados/analisis-chartista-bonos';
		} else if (
				(url=='/infomercados/cotizaciones_personalizar_indices/jsp/')) {
			url='/infomercados/personalizar-indices';
		} else if (
				(url=='/infomercados/cotizaciones_personalizar_acciones/jsp/')) {
			url='/infomercados/personalizar-acciones';
		} else if (
				(url=='/infomercados/curso-detalle/jsp/')) {
			url='/infomercados/formacion/jsp/';
		} else if (
				(url=='/clientes/miscuentas/derivados_consulta/jsp/') ||
				(url=='/clientes/miscuentas/operativa-result/jsp/')) {
			url='/clientes/miscuentas/operativa/jsp/';
		}
		
		
		document.location='/navegacion/cambiaidioma.jsp?idioma='+lang+'&url='+url;
	}
	
	function temporizador() {
		document.getElementById("multibanner_"+c).style.visibility = "visible";
		var i;
		for(i=0;i<num_banners;i++) {
			if (i!=c) {
				document.getElementById("multibanner_"+i).style.visibility = "hidden";
			}
		}
		if (c>=(num_banners-1)) {
			c=0;
		} else {
			c=c+1;
		}
		t=setTimeout("temporizador()",10000);
	}
	
	function activarTemporizador() {
		if (!contador_activado) {
	  		contador_activado=1;
			t=setTimeout("temporizador()",10000);
	  	}
	}		
		
	function abreGraficaDinamica(id) {
		window.open('https://flashchart.webfg.com/cortalconsors/openChart.php?cf='+id+'&key=9cdaaed716080cf038f191fb40196f76','GraficaDinamica','width=600,height=500,left=20,top=20,scrollbars=yes,resizable=yes');
		
	}
	function abreGraficaDinamicaAcciones(id,sesion,desc) {
		window.open('https://flashchart.webfg.com/flashchartMini.php?key='+sesion+'&symbolID='+id+'_acciones_55_df&symbolName='+desc,'GraficaDinamica','width=600,height=500,left=20,top=20,scrollbars=yes,resizable=yes');
	}
	
	function verValor(idvalor, idmercado) {
		location=document.forms["cambiarURL"].elements["url"].value+'?opcion=1&IdValor='+idvalor+'&IdMercado='+idmercado;
	}
	function verIbex() {
		location=document.forms["cambiarURL"].elements["url"].value+'?opcion=3&ibex35=true';
	}
	
	function paginar(i, f) {
		document.buscador.inicio.value=i;
		document.buscador.fin.value=f;
		document.buscador.submit();
	}
	
	function resizeFrame(f) {
		if (f!=null)
			f.style.height = (f.contentWindow.document.body.scrollHeight+10) + 'px';
	}
	
	// Espera el id del div (p.e. en divop_2 seria 2
	function detalleOperativa(id) {
		var midiv=document.getElementById('divop_'+id);
		if (midiv!=null) {
			// Mostrar
			if (midiv.style.display=='none') { 
				midiv.style.display='block';
				if (document.getElementById('img_'+id)!=null) {
					var temp = new Image();
					temp.src = "/images/reducir.gif";
					document.getElementById('img_'+id).src="/images/reducir.gif";
				} else {
					alert('no existe img_'+id);
				}
			// Ocultar
			} else { 
				midiv.style.display='none';
				if (document.getElementById('img_'+id)!=null) {
					var temp = new Image();
					temp.src = "/images/reducir.gif";
					document.getElementById('img_'+id).src="/images/ampliar.gif";
				} else {
					alert('no existe img_'+id);
				}
			}
		}
	}	
	
	// Espera el id del div (p.e. en divop_2 seria 2
	function muestraCriteriosBusqueda(id) {
		// Abono de Intereses
		if(id=='0') {		cambiaCriteriosBusqueda(0,'block','block','none','none','none');} 
		// Adeudo de Intereses
		else if(id=='1') {	cambiaCriteriosBusqueda(0,'block','block','none','none','none');}
		// Boletas/ Renta Variable Nacional
		else if(id=='2') {	cambiaCriteriosBusqueda(1,'none','none','none','block','none');}
		// Credito
		else if(id=='3') {	cambiaCriteriosBusqueda(0,'block','block','none','none','none');}
		// Fondos
		else if(id=='4') {	cambiaCriteriosBusqueda(0,'block','block','none','none','none');}
		// Derivados MEFF
		else if(id=='5') {	cambiaCriteriosBusqueda(0,'none','none','none','none','block');}
		// Derivados EUREX
		else if(id=='6') {	cambiaCriteriosBusqueda(0,'none','none','none','none','block');}
		// Renta Variable Internacional
		else if(id=='7') {	cambiaCriteriosBusqueda(0,'block','block','none','none','none');}
		// Repos
		else if(id=='8') {	cambiaCriteriosBusqueda(0,'block','none','block','none','none');}
		// Depositos
		else if(id=='9') {	cambiaCriteriosBusqueda(0,'block','block','none','none','none');}
	}	

	function cambiaCriteriosBusqueda(id,tr1,tr2,tr3,tr4,tr5) {
		document.form_consulta.busq[id].checked=true;
		document.getElementById('tr_ult_mov').style.display=	tr1;
		document.getElementById('tr_fechas').style.display=		tr2;
		document.getElementById('tr_fecharepos').style.display=	tr3;
		document.getElementById('tr_fecharvn').style.display=	tr4;
		document.getElementById('tr_dia').style.display=		tr5;
	}

	function paginaAnterior() {
		document.forms["data"].elements["pag"].value=document.forms["data"].elements["pagPre"].value;
	    document.data.submit();
	}
	function paginaSiguiente() {
		document.getElementById('pag').value=document.getElementById('pagPost').value;
	    document.data.submit();
	}	
	
	
