//Dirección del site IGN

var serverIGN="http://dign.ign.fomento.es/des_ign_ign/";

//Dirección del site MFOM

var serverMFOM="http://dmfom.ign.fomento.es/des_ign_mfom/";

//Dirección del site OAN

var serverOAN="http://doan.ign.fomento.es/des_ign_oan/";


// Se especifica el path en el que se encuentra la aplicación

var pathAbsoluto=serverIGN+"ign/home/";
var pathAbsolutoRaiz=serverIGN+"ign/";

//se establece el path del servidor MFOM en el cual estan ubicadas las páginas principales de cada seccion
var pathAbsolutoMFOM=serverMFOM+"ign/home/";


// Nombres de las imagenes que componen el menu principal (do_menu)

var imagen1="Image1";		
var imagen2="Image2";
var imagen3="Image3";
var imagen4="Image4";
var imagen5="Image5";
var imagen6="Image6";
var imagen7="Image7";


// Se especifica el path en el que se encuentra las imagenes del menu principal (do_menu)
var path1=pathAbsoluto+"images/datos2.gif";
var path2=pathAbsoluto+"images/teledeteccion2.gif";
var path3=pathAbsoluto+"images/astronomia2.gif";
var path4=pathAbsoluto+"images/cartografia2.gif";
var path5=pathAbsoluto+"images/geofisica2.gif";
var path6=pathAbsoluto+"images/geodesia2.gif";
var path7=pathAbsoluto+"images/cnig2.gif";

// Se especifica el path en el que se encuentra las paginas a las que va a enlazar el menu principal (do_menu)

var raiz1=pathAbsolutoMFOM+"ide.htm";
var raiz2=pathAbsolutoMFOM+"teledeteccion.htm";
var raiz3=pathAbsolutoMFOM+"astronomia.htm";
var raiz4=pathAbsolutoMFOM+"cartografia.htm";
var raiz5=pathAbsolutoMFOM+"geofisica.htm";
var raiz6=pathAbsolutoMFOM+"geodesia.htm";



var blanco="";
var cad="";
var uno="1";
var hija="0";

//Función que realiza la redirección a la 1ª página de mapas
function redirige_mapa(){

	if (navigator.appName == "Microsoft Internet Explorer"){

		document.location   = serverIGN+"cartografia/Documentos/mapa/mapa.asp";
	}

	else { 
		location.href = serverIGN+"cartografia/Documentos/mapa/mapa.asp";
	}		
}


//Función que realiza la redirección a la página que se indica en el parametro p

function redirige(p){

	if (navigator.appName == "Microsoft Internet Explorer"){
		document.location   = p;
	}

	else { 
		location.href = p;

	}		
}

//Abre una nueva ventana 
function Abrir_Ventana(theURL,w,h) { 

var winName="ign";
var windowprops ="top=0,left=0,toolbar=no,location=no,status=no, menubar=no,scrollbars=yes, resizable=no,width=" + w + ",height=" + h;
window.open(theURL,winName,windowprops); 
} 


function abrir(ruta){
	//hija=h;
	parent.frames[1].window.open(ruta,'IGN','menubar=no,toolbar=no,scrollbars=yes,status=yes,resizable=yes');
}

function abrirUnMarco(ruta){
	window.open(ruta,"IGN",'menubar=yes,toolbar=yes,scrollbars=yes,status=yes,resizable=yes');

}

function abrirTodo(ruta){
	parent.frames[1].window.open(ruta,'IGN','menubar=yes,toolbar=yes,scrollbars=yes,status=yes,location=yes,resizable=yes');
}

//Estable que pagina se carga en cada frame
function inicio1(){	

	frames[0].location=serverIGN+"ign/home/marco_completo_home.htm";
	frames[1].location=pathAbsoluto + "areas.htm";	

}

//Estable que pagina se carga en cada frame
function inicio2(){

	frames[0].location= pathAbsoluto + "t_geografico.htm";
	frames[1].location= pathAbsoluto + "marco_interior_home.htm";

}


//Pinta el pie de página

function pie(nivel){

document.write('<table border="0" cellspacing="0" cellpadding="0" width="592">');
document.write('<tr>'); 
document.write('<td align="RIGHT" valign="MIDDLE" width="221"><a href="http://www.mfom.es" target="_top"><font face="Arial" size="1" color="Black"><b>INICIO</b></font></a></td>');
document.write('<td align="RIGHT" valign="TOP" width="72"><a href="http://www.mfom.es" target="_top"><img src="'+pathAbsolutoRaiz+'ns-icons/bv2_inicio.gif" width="72" height="48" border="0" hspace="3"></a></td>');
document.write('<td align="CENTER" valign="TOP" width="5"></td>');
document.write('<td align="LEFT" valign="TOP" width="72"><a href=' + serverMFOM + '/ign/cuerpo_home.htm><img src="'+pathAbsolutoRaiz+'ns-icons/bv_geografico.gif" width="72" height="48" border="0"></a></td>');
document.write('<td align="LEFT" valign="MIDDLE" width="221"><a href=' + serverMFOM + '/ign/cuerpo_home.htm><font face="Arial" size="1" color="Black"><b>INSTITUTO<br>'); 
document.write('GEOGR&Aacute;FICO NACIONAL</b></font></a></td>');
document.write('</tr>');
document.write('</table>');
document.write('<font face="Arial" color="#0A0466" size="1"><b>&copy; Ministerio de Fomento</b></font>');

}


//Pinta el pie de página de sismología
function pie_sismologia(){

	
	document.write('<td align="left" valign="middle"> ');
	document.write('<dt> ');
	document.write('<div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><i><font size="1">General ');
	document.write('Ib&aacute;&ntilde;ez Ibero n: 3, 28003 MADRID</font></i></font></div>');
	document.write('</dt>');
	document.write('<dt>'); 
	document.write('<div align="center"><i><font face="Arial, Helvetica, sans-serif" size="1">TEL&Eacute;FONOS: '); 
	document.write('34 - 91597 9443 / 34 - 91597 9446</font></i></div>');
	document.write('</dt>');
	document.write('<dt>'); 
	document.write('<div align="center"><i><font face="Arial, Helvetica, sans-serif" size="1">FAX:');
	document.write('34 - 91597 9758 </font></i></div>');
	document.write('</dt>');
	document.write('<dt>'); 
	document.write('<div align="center"><i><font face="Arial, Helvetica, sans-serif" size="1">E-MAIL:<a href="mailto:sismologia@mfom.es">'); 
	document.write('</a>sismologia@mfom.es</font></i></div>');
	document.write('</dt>');
	document.write('</td>');	

}	

function menu_ing (opcion) 
{
	switch(opcion){
		case 1:
			do_menu();
			break;	
	}
}

//Pinta el menu principal el cual esta compuestos por "Infraestructura de datos especiales, teledetección, ..."
function do_menu(nivel){

	var str="../";

	if (nivel!=1){	
		document.write('<TD> <a href="'+raiz1+'" onMouseOver="MM_swapImage(imagen1,blanco,path1,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/datos1.gif" ALT="" name="Image1" WIDTH="115" HEIGHT="28" border="0" id="Image1"></a></TD>');
	}else{
		document.write('<TD> <a href="'+raiz1+'" ><IMG SRC="'+pathAbsoluto+'images/datos2.gif" ALT="" name="Image1" WIDTH="115" HEIGHT="28" border="0" id="Image1"></a></TD>');
	}	

	if (nivel!=2){
		document.write('<TD> <a href="'+raiz2+'" onMouseOver="MM_swapImage(imagen2,blanco,path2,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/teledeteccion1.gif" ALT="" name="Image2" WIDTH=84 HEIGHT=28 border="0" id="Image2"></a></TD>');
	}else{
		document.write('<TD> <a href="'+raiz2+'"><IMG SRC="'+pathAbsoluto+'images/teledeteccion2.gif" ALT="" name="Image2" WIDTH=84 HEIGHT=28 border="0" id="Image2"></a></TD>');
	}
	if (nivel!=3){		
		document.write('<TD> <a href="'+raiz3+'" onMouseOver="MM_swapImage(imagen3,blanco,path3,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/astronomia1.gif" ALT="" name="Image3" WIDTH=84 HEIGHT=28 border="0" id="Image3"></a></TD>');
	}else{
		document.write('<TD> <a href="'+raiz3+'"><IMG SRC="'+pathAbsoluto+'images/astronomia2.gif" ALT="" name="Image3" WIDTH=84 HEIGHT=28 border="0" id="Image3"></a></TD>');
	}

	if (nivel!=4){
		document.write('<TD> <a href="'+raiz4+'" onMouseOver="MM_swapImage(imagen4,blanco,path4,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/cartografia1.gif" ALT="" name="mage4" WIDTH=84 HEIGHT=28 border="0" id="Image4"></a></TD>');
	}else{
		document.write('<TD> <a href="'+raiz4+'"><IMG SRC="'+pathAbsoluto+'images/cartografia2.gif" ALT="" name="mage4" WIDTH=84 HEIGHT=28 border="0" id="Image4"></a></TD>');
	}
	if (nivel!=5){
		document.write('<TD> <a href="'+raiz5+'" onMouseOver="MM_swapImage(imagen5,blanco,path5,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/geofisica1.gif" ALT="" name="Image5" WIDTH=74 HEIGHT=28 border="0" id="Image5"></a></TD>');
	}else{
		document.write('<TD> <a href="'+raiz5+'"><IMG SRC="'+pathAbsoluto+'images/geofisica2.gif" ALT="" name="Image5" WIDTH=74 HEIGHT=28 border="0" id="Image5"></a></TD>');	
	}

	if (nivel!=6){
	    document.write('<TD> <a href="'+raiz6+'" onMouseOver="MM_swapImage(imagen6,blanco,path6,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/geodesia1.gif" ALT="" name="Image6" WIDTH=74 HEIGHT=28 border="0" id="Image6"></a></TD>');
	}else{
    	document.write('<TD> <a href="'+raiz6+'"><IMG SRC="'+pathAbsoluto+'images/geodesia2.gif" ALT="" name="Image6" WIDTH=74 HEIGHT=28 border="0" id="Image6"></a></TD>');
	}
		
	document.write('<TD> <a href="http://www.cnig.es" target="_blank" onMouseOver="MM_swapImage(imagen7,blanco,path7,uno)" onMouseOut="MM_swapImgRestore()"><IMG SRC="'+pathAbsoluto+'images/cnig1.gif" ALT="" name="Image7" WIDTH=77 HEIGHT=28 border="0" id="Image7"></a></TD>');

}

//submenu para la opción de cartografía
function submenu_car(nivel){
	var src=serverMFOM+"/ign/home/cartografia";
	var src1=serverMFOM+"/ign/home/teledeteccion";

	document.write('<td><img src="'+pathAbsoluto+'cartografia/images/menu_inf.gif" width="592" height="18" usemap="#mapCart" border="0"></td>');
	document.write('<map name="mapCart">');
	document.write('<area shape="rect" coords="5,1,47,17" href="'+pathAbsolutoMFOM+'/cartografia.htm" title="">');
	document.write('<area shape="rect" coords="52,1,92,17" href="'+src+'/atlas.htm" title="Atlas nacional de España">');
	document.write('<area shape="rect" coords="97,1,246,17" href="'+src+'/doccar.htm" title="">');
	document.write('<area shape="rect" coords="250,1,377,17" href="'+src+'/vuelosfot.htm" title="">');
	document.write('<area shape="rect" coords="382,1,468,17" href="'+src1+'/productos/ortoimgesp.htm" title="">');
	document.write('<area shape="rect" coords="473,1,546,17" href="'+src+'/modelos3d.htm" title="">');
	document.write('<area shape="rect" coords="551,1,591,17" href="'+src+'/bcn.htm" title="Bases de datos cartográficos numéricos">');
	document.write('<area shape="default" nohref>');
	document.write('</map>');
}

//submenu para la opción de geodesia
function submenu_geo(nivel){
	var src=serverMFOM+"/ign/home/geodesia";
	var src1=serverIGN+"/ign/home/geodesia";

	document.write('<td><img src="'+pathAbsoluto+'geodesia/images/menu_inf.gif" width="592" height="18" usemap="#mapGeo" border="0"></td>');
	document.write('<map name="mapGeo">');
	document.write('<area shape="rect" coords="5,1,115,17" href="'+src1+'/serdag/red_geodes.jsp" title="">');
	document.write('<area shape="rect" coords="119,1,207,17" href="'+src1+'/gravimetria.htm" title="">');
	document.write('<area shape="rect" coords="212,1,328,17" href="'+src+'/redes_geodesicas.htm" title="">');
	document.write('<area shape="rect" coords="336,1,488,17" href="'+src+'/rima.htm" title="">');
	document.write('<area shape="rect" coords="493,1,588,17" href="'+src+'/gnss.htm" title="">');
	document.write('<area shape="default" nohref>');
	document.write('</map>');
}

//submenu para la opción de astronomia
function submenu_ast(nivel){
	var src=serverMFOM + "ign/home/astronomia";

	document.write('<td><img src="'+pathAbsoluto+'astronomia/images/menu_inf.gif" width="592" height="18" usemap="#mapAst" border="0"></td>');
	document.write('<map name="mapAst">');
	document.write('<area shape="rect" coords="5,1,122,17" href="'+src+'/infgeneral.htm" title="">');
	document.write('<area shape="rect" coords="128,1,259,17" href="'+src+'/infpublico.htm" title="">');
	document.write('<area shape="rect" coords="264,1,350,17" href="'+src+'/investigacion.htm" title="">');
	document.write('<area shape="rect" coords="356,1,442,17" href="'+src+'/instalaciones.htm" title="">');
	document.write('<area shape="rect" coords="447,1,533,17" href="'+src+'/museovirtual.htm" title="">');
	document.write('<area shape="default" nohref>');
	document.write('</map>');
}

//submenu para la opción de teledetección
function submenu_tel(){
	document.write('<td><img src="'+pathAbsoluto+'teledeteccion/images/sub_teledeteccion.gif" width="592" height="18" border="0" usemap="#maptele"></td>');

}

//submenu para la opción IDE
function submenu_ide(nivel){
	document.write('<td><img src="'+pathAbsoluto+'ide/images/sub_datos_espaciales.gif" width="592" height="18" border="0" usemap="#mapedit"></td>');	
}


//submenu para la opción de geofísica
function submenu_geofisica(nivel){
	document.write('<td><img src="'+pathAbsoluto+'geofisica/images/sub_geofisica.gif" width="592" height="18" border="0" usemap="#mapGeoF"></td>');
}

/*realiza un enlace contra el servidor IGN y en el path indicado, tambien se indica el texto que desea que 
aparecezca en el enlace*/
function enlace(path,texto){

	//document.write('<a href="'+ serverIGN +'ign/home/'+path+'">' + texto + '</a>');
	if (texto=="IDE-IGN"){document.write('<a href="'+ pathAbsoluto +path+'">' + texto + '</a>');}	
	else{document.write('<a href="'+ serverIGN +path+'">' + texto + '</a>');}
}


/*realiza un enlace contra el servidor OAN y en el path indicado, tambien se indica el texto que desea que 
aparecezca en el enlace*/
function enlaceOAN(path,texto){

	cad = serverOAN + "ign/home/" +path;

	document.write('<a href="'+cad+'" >' + texto + '</a>');	

}

/*realiza un enlace contra el servidor MFOM y en el path indicado, tambien se indica el texto que desea que 
aparecezca en el enlace*/

function enlaceMFOM(path,texto){

	cad = serverMFOM + path;
	document.write('<a href="'+cad+'">' + texto + '</a>');	

}

function enlaceIGN(path,texto){

	cad = serverIGN + path;
	document.write('<a href="'+cad+'">' + texto + '</a>');	

}

function enlaceIDEE(path,texto){
	
	cad=pathAbsoluto +path;
	
	//document.write('<a href="'+ serverIGN +'ign/home/'+path+'">' + texto + '</a>');	
	//document.write('<a href="'+cad+'">' + texto + '</a>');
	document.write('<a href="javascript:;" onClick="abrirUnMarco(cad)">' + texto + '</a>');
	//window.open(ruta,'IDEE','menubar=no,toolbar=no,scrollbars=yes,status=yes,resizable=yes');
}

function enlaceDIGA(texto){
	
	cad = "http://ign.ign.fomento.es/idee";
	//document.write('<a href="http://ign.ign.fomento.es/idee">' + texto + '</a>');	
	document.write('<a href="javascript:;" onClick="abrirUnMarco(cad)">' + texto + '</a>');
}

function insertarTit(pathTit,x,y){

	if ((x!="") && (y!="")){	

		document.write('<img src="'+ pathTit+'" width="'+x+'" height="'+y+'">');	

	}else{

		document.write('<img src="'+ pathTit+'" width="592" height="31">');

	}	

}

//Realiza el mapeo del submenu_ide
function mapaIDE(){
	document.write('<map name="mapedit">');
	document.write('<area shape="rect" coords="1,0,49,14" href="'+ pathAbsolutoMFOM +'ide/ide_ign.htm" title="">');
	document.write('<area shape="rect" coords="50,1,122,14" href="'+ pathAbsolutoMFOM +'ide/idee.htm" title="">');
	document.write('<area shape="default" nohref>');
	document.write('</map>');	

}

//Realiza el mapeo del submenu_tele
function mapaTELE(){
	document.write('<map name="maptele">');
	document.write('<area shape="rect" coords="5,2,86,14" href="'+ pathAbsolutoMFOM +'teledeteccion/presenta.htm" title="">');
	document.write('<area shape="rect" coords="93,2,161,14" href="'+ pathAbsolutoMFOM +'teledeteccion/productos.htm" title="">');
	document.write('<area shape="rect" coords="168,2,239,14" href="'+ pathAbsolutoMFOM +'teledeteccion/corine.htm" title="">');
	document.write('<area shape="rect" coords="245,2,312,14" href="'+ pathAbsolutoMFOM +'teledeteccion/proyectos.htm" title="">');
	document.write('<area shape="rect" coords="317,2,400,14" href="'+ pathAbsolutoMFOM +'teledeteccion/bdimag.htm" title="">');
	document.write('<area shape="rect" coords="406,2,556,14" href="'+ pathAbsolutoMFOM +'teledeteccion/cnr.html" title="">');
	document.write('<area shape="default" nohref>');
	document.write('</map>');
}


//Realiza el mapeo del submenu_GeoF
function mapaGeoF(){
	document.write('<map name="mapGeoF">');
	document.write('<area shape="rect" coords="5,2,78,17" href="'+ pathAbsoluto +'geofisica/sismologia.htm" title="">');
	document.write('<area shape="rect" coords="83,2,184,17" href="'+ pathAbsoluto +'geofisica/geomagnetismo.htm" title="">');
	document.write('<area shape="rect" coords="189,2,273,17" href="'+ pathAbsoluto +'geofisica/volcanologia.htm" title="">');
        	document.write('<area shape="rect" coords="278,2,335,17" href="'+ pathAbsoluto +'geofisica/enlaces.htm" title="">');
	document.write('<area shape="rect" coords="340,2,429,17" href="'+ pathAbsoluto +'geofisica/publicaciones.htm" title="">');
	document.write('<area shape="rect" coords="434,2,497,17" href="'+ pathAbsoluto +'geofisica/noticias.htm" title="">');
	document.write('<area shape="default" nohref>');	
	document.write('</map>');	
}



function mapaFPMap1(){

	document.write('<map name="FPMap1">');
 	document.write('<area alt="Murbandy-Bilbao" href="'+ pathAbsolutoMFOM +'teledeteccion/proyectos/MURBANDY.htm" shape="rect" coords="287, 39, 302, 53">');
 	document.write('<area alt="Lacoast" href="'+ pathAbsolutoMFOM +'teledeteccion/proyectos/lacoast.htm" shape="polygon" coords="276, 54, 276, 66, 293, 65, 294, 72, 315, 72, 313, 52">');
 	document.write('<area alt="FPI" href="'+ pathAbsolutoMFOM +'teledeteccion/proyectos/fpi.htm" shape="polygon" coords="256, 72, 295, 71, 295, 94, 257, 96">');
 	document.write('<area alt="Medgeobase-Marruecos" href="'+ pathAbsolutoMFOM +'teledeteccion/proyectos/MEDGEOBASE.htm" shape="polygon" coords="299, 101, 319, 101, 321, 128, 282, 128, 282, 101">');
 	document.write('<area alt="Siggal" href="'+ pathAbsolutoMFOM +'teledeteccion/proyectos/siggal.htm" shape="rect" coords="86, 178, 116, 202"></map>');

}

function Organigrama(){

	document.write('<map name="Organigrama">');
	document.write('<area shape="rect" coords="384,87,551,148" href="'+ pathAbsolutoMFOM +'organigrama/centro_nacional_info.htm">');
	document.write('<area shape="rect" coords="233,85,351,172" href="'+ pathAbsolutoMFOM +'organigrama/ign.htm">');
	document.write('<area shape="rect" coords="146,254,301,299" href="'+ pathAbsolutoMFOM +'organigrama/geodesia.htm">');
	document.write('<area shape="rect" coords="312,254,438,298" href="'+ pathAbsolutoMFOM +'organigrama/sub_cartografica.htm">');
	document.write('<area shape="rect" coords="13,254,134,274" href="'+ pathAbsolutoMFOM +'organigrama/secretaria.htm">');
	document.write('<area shape="rect" coords="357,167,570,226" href="'+ pathAbsolutoMFOM +'organigrama/servicios_regionales.htm" >');
	document.write('<area shape="rect" coords="444,253,570,299" href="'+ pathAbsolutoMFOM +'organigrama/sub_apli_geo.htm" >');
	document.write('</map>');
}


//--------------------------------------------------------------------------------------------------------
//Funciones de precarga

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function changeImages() {

	if (document.images) {

		for (var i=0; i<changeImages.arguments.length; i+=2) {

			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];

		}

	}

}


/*realiza un enlace contra el servidor IGN y en el path indicado, tambien se indica el texto que desea que 
aparecezca en el enlace. Se diferencia con el anterior en que este enlace aparece en una nueva ventana*/

function enlace_target(path,texto){

	//document.write('<a href="'+ serverIGN +'ign/home/'+path+'">' + texto + '</a>');
	if (texto=="IDE-IGN"){document.write('<a target=_blank href="'+ pathAbsoluto +path+'">' + texto + '</a>');}	
	else{document.write('<a target=_blank href="'+ serverIGN +path+'">' + texto + '</a>');}
}






	
