contMenu = new Array(
//OPCION 1: Empresa
	[
		"quienes_off.gif","quienes_on.gif","/quienes.htm",
		"productos_off.gif","productos_on.gif","/productos.htm",
		"red_ventas_off.gif","red_ventas_on.gif","/red_ventas.htm",
		"enlaces_off.gif","enlaces_on.gif","/enlaces.htm",
		"atencion_off.gif","atencion_on.gif","/atencion.htm"
	],
//OPCION 2: Congresos
	[
		"localizacion_off.gif","localizacion_on.gif","/localizacion.htm",
		"instalaciones_off.gif","instalaciones_on.gif","/instalaciones.htm",
		"cursos_off.gif","cursos_on.gif","/cursos.htm",
		"alquiler_off.gif","alquiler_on.gif","/alquiler.htm"
	]
)
posMenu = new Array(160,343);
difMenu0=[-230,160] //Para el index.htm (menú vertical)
difMenu1=[-230,-73] //Para el resto de la web (menú horizontal)
var actual='';
function crearMenu(opcion,subopcion){
   var imgRuta='/img/caste/interior/';
   var contHTML='';
   for (var i=0;i<contMenu.length;i++){
     contHTML+='<div id="lyrmenu'+i+'" style="position:absolute; width:343px; height:27px; z-index:'+(1000+i)+'; top: 88px; left: '+posMenu[i]+'px; visibility: hidden;"><table border="0" cellspacing="0" cellpadding="0"><tr>';
     for (var j=0;j<contMenu[i].length;j+=3){
       num=(j/3);
       if (opcion==i&&subopcion==num){
         contHTML+='<td><a href="'+contMenu[i][j+2]+'"><img src="'+imgRuta+contMenu[i][j+1]+'" border="0"></a></td>';
       }else{
         contHTML+='<td><a href="'+contMenu[i][j+2]+'" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'imgmenu'+i+'opt'+num+'\',\'\',\''+imgRuta+contMenu[i][j+1]+'\',1)"><img src="'+imgRuta+contMenu[i][j]+'" name="imgmenu'+i+'opt'+num+'" border="0"></a></td>';
       }
     }
     contHTML+='</tr></table></div>\n';
   }
   document.open();
   document.write(contHTML);
   document.close();
   if (opcion!==''){
     actual=opcion;
     abrir(opcion);
   }
}

  var ie=document.all?true:false;
  var ns6=document.getElementById&&!ie?true:false;
  var ns4=document.layers&&!ns6&&!ie?true:false;
  var ocultar,mostrar,mover,ancho;
  if (ie){
    ocultar="document.all['lyrmenu'+numenu].style.visibility='hidden'";
    mostrar="document.all['lyrmenu'+numenu].style.visibility='visible'";
    mover="document.all['lyrmenu'+num].style.left=posX"
    moverCiudad="document.all['capaCiudad'].style.left=posX"
    ancho="document.body.clientWidth";
  }else if (ns6){
    ocultar="document.getElementById('lyrmenu'+numenu).style.visibility='hidden'";
    mostrar="document.getElementById('lyrmenu'+numenu).style.visibility='visible'";
    mover="document.getElementById('lyrmenu'+num).style.left=posX"
    moverCiudad="document.getElementById('capaCiudad').style.left=posX"
    ancho="window.innerWidth";
  }else if (ns4){
    ocultar="document.layers['lyrmenu'+numenu].visibility='hide'";
    mostrar="document.layers['lyrmenu'+numenu].visibility='show'";
    mover="document.layers['lyrmenu'+num].left=posX"
    moverCiudad="document.layers['capaCiudad].left=posX"
    ancho="window.innerWidth";
  }

function recolocar(numero){
  num=numero;
  anchoP=eval(ancho);
  if (anchoP<780) anchoP=780
  if (tipo_menu==0) diferencia = difMenu0[num];
  if (tipo_menu==1) diferencia = difMenu1[num];
  posX=anchoP/2+diferencia;
  if (posMenu[num]!=posX){
    eval(mover);
    posMenu[num]=posX;
  }
}

function recarga(){
  for (i=0;i<contMenu.length;i++){
    recolocar(i);
  }
}
onresize=recarga;

var numenu='';
var tipo_menu='';

function abrir(num,op){
  if (numenu!==num&&numenu!==''){
    document.onmousemove=null;
    eval(ocultar);
    document.images['imgmenu'+numenu].src=document.images['imgmenu'+numenu].src.replace('_on.gif','_off.gif')
  }   
  numenu=num;
  tipo_menu=op;
  recolocar(numenu);
  eval(mostrar);
  document.images['imgmenu'+numenu].src=document.images['imgmenu'+numenu].src.replace('_off.gif','_on.gif')
}

var opcion='';
function cerrar(num){
  if (!ie) document.captureEvents(Event.MOUSEMOVE);
  opcion=num;
  document.onmousemove=cierre;
}

function cierre(e){
  var y=ie?document.body.scrollTop+event.clientY:e.pageY;
  if (opcion == 0) 	
  if (y>125){
    document.onmousemove=null;
    if (actual!=='') abrir(actual);
    else if (numenu!=='') eval(ocultar);
  }
  if (opcion == 1) 	
  if (y<280 || y>400){
    document.onmousemove=null;
    if (actual!=='') abrir(actual);
    else if (numenu!=='') eval(ocultar);
  }  
  
  
}