// VARIABLES

var estado=0;

var URL0="";
var URL1="";
var Activo=-1;

var divisiones = new Array(); 
	divisiones[0]="proyectos/Bio-";
	divisiones[1]="proyectos/Cog-";
	divisiones[2]="proyectos/Cen-";
	divisiones[3]="proyectos/Oper-";
var maximos = new Array();
	maximos[0]= 6;
	maximos[1]= 36;
	maximos[2]= 9;
	maximos[3]= 8;


// CAMBIAR IMAGEN SEGUN PULSACION

function Menu(Num,URL){

  if(Num==estado)
    {top.frames[0][1].location.href = URL;}
  else
    {
    top.frames[0][1].location.href = URL;
    if(estado!=0){ON(document.images[estado]);}
    ON(document.images[Num]);estado=Num;}
 }


// ELECCION DE PAGINAS

function Activar_Div(){
  cadena = top.frames[0].location.href;
  i = cadena.indexOf("?");
  if((i < (cadena.length-1)) & (i>=0))	
	{cadena=cadena.substring(i+1,cadena.length);}
  else {						
	cadena = top.location.href;
	i = cadena.indexOf("?");
  	if((i < (cadena.length-1)) & (i>=0))	
		{cadena=cadena.substring(i+1,cadena.length);}
 	else {cadena="1";} }

  switch(cadena){
  //case "1":  {Img=1;URL="Div-Bio.html";estado=1;break;}
  case "11": {Img=1;URL="Div-Info-Bio.html";estado=1;break;}
  case "12": {Img=1;URL="Div-Refer-Bio.html";estado=1;break;} 
  //case "2":  {Img=2;URL="Div-Cog.html";estado=2;break;}
  case "21": {Img=2;URL="Div-Info-Cog.html";estado=2;break;}
  case "22": {Img=2;URL="Div-Refer-Cog.html";estado=2;break;} 
  //case "3":  {Img=3;URL="Div-Ter.html";estado=3;break;}
  case "31": {Img=3;URL="Div-Info-Ter.html";estado=3;break;}
  case "32": {Img=3;URL="Div-Refer-Ter.html";estado=3;break;} 
  //case "4":  {Img=4;URL="Div-O&M.html";estado=4;break;}
  case "41": {Img=4;URL="Div-Info-O&M.html";estado=4;break;}
  case "42": {Img=4;URL="Div-Refer-O&M.html";estado=4;break;} 
  default:   {estado=0;}
  }

  if(estado>0) 
	{if(top.frames[0].length == 2){top.frames[0][1].location.href = URL;}
 	 else	{top.frames[1].location.href = URL;} }
 }


// Menus de desplazamiento

function Menu_Div(div, sentido){

    Activo = Activo + sentido;
    if ((Activo==-1) || (Activo >=maximos[div])) 
	{Activo=-1;URL  = divisiones[div] + "Resumen.html"; }
    else if (Activo <-1) 
	{Activo=maximos[div]-1;URL  = divisiones[div] + Activo + ".html";}
    else 
	{URL  = divisiones[div] + Activo + ".html"; }
    
    		
    open(URL,"inf");
 }
 

// ACTIVAR MENUS DE REFERENCIAS

function Activar_Clas(){

  cadena = top.frames[0].location.href;
  i = cadena.indexOf("?");
  if((i < (cadena.length-1)) & (i>=0))	
	{cadena=cadena.charAt(i+1);}
  else {						
	cadena = top.location.href;
	i = cadena.indexOf("?");
  	if((i < (cadena.length-1)) & (i>=0))	
		{cadena=cadena.charAt(i+1);}
 	else {cadena="1";} }

  switch(cadena){
  case "1":  {URL="Clas-Ubi.html";break;}
  case "2":  {URL="Clas-Tec.html";break;}
  case "3":  {URL="Clas-Div.html";break;}
  default:   {URL="Clas-Portada.html";}
  }

  if(estado>0) 
	{if(top.frames[0].length == 2){top.frames[0][1].location.href = URL;}
 	 else	{top.frames[1].location.href = URL;} }

 }
