﻿var anterior = asignar('Anterior');
var siguiente = asignar('Següent');

function abrirPopup(htmlFile) {
 var instancia;
	//alert("El contenido ser&aacute; cargado en una ventana emergente.");
	instancia=window.open(htmlFile,"PopUp","width=790,height=359");
}
function abreVentana(uFile,uX,uY,uWidth,uHeight) {
 var instacia;
 //alert("El contenido ser&aacute; cargado en una ventana emergente.");
 instancia=window.open(uFile,"PopUp","status=yes,alwaysRaised,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=" + uWidth + ",height=" + uHeight + ",top=" + uY + ",left=" + uX );
}

//Abre una ventana popup peque&ntilde;a
function openWindow(fichero) {
	var win=null;
    win=window.open (fichero,"Fremap","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=140,top=191,width=640,height=380");
    win.focus();
}

//Abre una ventana popup peque&ntilde;a
function openWindowPDF(fichero) {
	var win=null;
    win=window.open (fichero,"PDF","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=170,top=231,width=640,height=380");
    win.focus();
}

//funci&oacute;n encargada de pintar el enlace para ver el plano de situaci&oacute;n de una direcci&oacute;n de centro.
//texto que aparece en el literal del enlace.
var literal = asignar('Veure mapa');

function asignar(texto)
{
   return texto;
}

function carga_plano(indice, comunidad)
{
	document.write('<a href=javascript:abreVentana("'+comunidad[indice]+'",0,0,788,539)>'+literal+'</a>')
}


//sobrecarga de la anterior funci&oacute;n para que reciba el texto del enlace.
function carga_plano_texto(indice, comunidad, texto)
{
	document.write("<a href=javascript:abreVentana('"+comunidad[indice]+"',0,0,788,539)>"+texto+"</a>")
}


//funciones utilizadas en servicio de prevenci&oacute;n para mostrar y ocultar iframe.
function oculta()
{
	document.all["cur_oficina"].style.display="none";
	document.all["oficina"].src="";
	document.all["catalogo_cursos"].style.display="none";							
	document.all["catalogo"].src="";
	document.all["programa_jornadas"].style.display="none";							
	document.all["programa"].src="";
}
			
function muestra_cursosCC()
{
	if(document.all["cur_oficina"].style.display=="block")
	{
		document.all["cur_oficina"].style.display="none";
		document.all["oficina"].src="";
	}
	else
	{
		document.all["cur_oficina"].style.display="block";
		document.all["oficina"].src="http://195.235.104.240/Aplicaciones/Web/catcurso.nsf/InternetCuotasOficinas?OpenView&CollapseView";		
	}
}
					
function muestra_catalogoCC()
{
	if(document.all["catalogo_cursos"].style.display=="block")
	{
		document.all["catalogo_cursos"].style.display="none";
	}
	else
	{
		document.all["catalogo_cursos"].style.display="block";
		document.all["catalogo"].src="http://195.235.104.240/Aplicaciones/Web/catcurso.nsf/InternetCuotasCursos?OpenView&CollapseView";				
	}
}

function muestra_cursosSS()
{
	if(document.all["cur_oficina"].style.display=="block")
	{
		document.all["cur_oficina"].style.display="none";
		document.all["oficina"].src="";
	}
	else
	{
		document.all["cur_oficina"].style.display="block";
		document.all["oficina"].src="http://195.235.104.240/Aplicaciones/Web/catcurso.nsf/InternetProfssOficinas?OpenView&CollapseView";		
	}
}
					
function muestra_catalogoSS()
{
	if(document.all["catalogo_cursos"].style.display=="block")
	{
		document.all["catalogo_cursos"].style.display="none";
	}
	else
	{
		document.all["catalogo_cursos"].style.display="block";
		document.all["catalogo"].src="http://195.235.104.240/Aplicaciones/Web/catcurso.nsf/InternetProfssCursos?OpenView&CollapseView";				
	}
}


function muestra_programa()
{
	if(document.all["programa_jornadas"].style.display=="block")
	{
		document.all["programa_jornadas"].style.display="none";
	}
	else
	{
		document.all["programa_jornadas"].style.display="block";
		document.all["programa"].src="projorpre.htm";				
	}
}

//hace que un campo de texto s&oacute;lo acepte valores num&eacute;ricos.
var nav4 = window.Event ? true : false;
function SoloNum(evt)
{
	// Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	var key = nav4 ? evt.which : evt.keyCode;
	return (key <= 13 || (key >= 48 && key <= 57));
}

/* marca las opciones iniciales del menu de modulo.*/
function inicio(opcion, subopcion)
{
	document.getElementById('opcion_'+opcion).style.color = "#770025";

	
	document.getElementById('opcion_'+opcion+'_'+subopcion).style.color = "#770025";

	if(document.getElementById('subopciones_'+opcion))
	{
		document.getElementById('subopciones').innerHTML = document.getElementById('subopciones_'+opcion).innerHTML;
		document.getElementById('subopciones').className = "subopciones";		
	}
	else
	{
		document.getElementById('subopciones').innerHTML = "";
		document.getElementById('subopciones').className = "subopciones_vacia";
	}

}

/* funcion asociada al evento onclick de cada elemento de la lista del menu de modulo*/
function muestra_opciones(id)
{

	var continuar = true;
	var i = 1;

	while(continuar)
	{
		if(document.getElementById('opcion_'+i) == null)
		{
			continuar = false;
		}
		else
		{
			document.getElementById('opcion_'+i).style.color = "#656565";
		}
		i++;
	}
	document.getElementById('opcion_'+id).style.color = "#770025";
		
	if(document.getElementById('subopciones_'+id))
	{
		document.getElementById('subopciones').innerHTML = document.getElementById('subopciones_'+id).innerHTML;
		document.getElementById('subopciones').className = "subopciones";		
	}
	else
	{
		document.getElementById('subopciones').innerHTML = "";
		document.getElementById('subopciones').className = "subopciones_vacia";
	}
}

function reposicionaMenu(){
	var pos = (document.body.scrollTop)?document.body.scrollTop:document.documentElement.scrollTop;
	document.getElementById("menapr").style.bottom = parseInt(pos + 25) + "px";
}

function MenuFijo(){
if(document.getElementById && !window.getComputedStyle){
	document.getElementById("menapr").style.position = "absolute";
	window.onscroll = reposicionaMenu;
	}
}

function redirEntrada(ruta)
{
	window.name=ruta; 
  window.location='frame.htm'; 
	
/*	var htmlout = '<form method="post" action="/prueba/index_calidad3.htm" id="formruta" name="formruta">'+
	'	<input type="hidden" name="ruta" value=ruta>'+
	'</form>';
	document.write(htmlout);
	document.getElementById('formruta').submit();
	alert("enviado");*/
//	location.href='/prueba/index_calidad3.htm';
}

/*function redirSalida()
{
	alert("ruta"+rutaRed);
	return rutaRed;
}*/

function FechaCopy()
{
	now = new Date();
	
	y = now.getFullYear();

	document.write("&copy; Fremap "+y+". Tots els drets reservats.");
}

