/**************************************************************
Menú desplegable vertical. Script creado por Tunait! (4/jun/2006)
Script de libre uso siempre y cuando se mantengan las correspondientes líneas de créditos de autor.
Distribución no autorizada sin previo permiso.
http://javascript.tunait.com/
tunait@yahoo.com 
****************************************************************/
var anMenu = 120 //<-- anchura del menú
var totalMen = 6 //<-- total de botones principales
var imaflecha = 'url()' //<-- ruta de la imagen de flecha
function tunMen(tex,enl,dest,subOp,an){
this.tex = tex;
this.enl = enl;
this.dest = dest;
this.subOp = subOp;
this.an = an;
}
/* Configurar las opciones aquí */
Op_0 = new tunMen('¿QUIENES SOMOS?',null,null,4,150)
	Op_0_0 = new tunMen('HISTORIA DE LA SMF Y RH',"historia.html",null,0,100)
	Op_0_1 = new tunMen('MISION Y VISION',null,null,0)
	Op_0_2 = new tunMen('EXPRESIDENTES',null,null,0,100)
	Op_0_3 = new tunMen('COMITES',null,null,0,100)
	Op_0_4 = new tunMen('CAPITULOS',null,null,0,100)
Op_1 = new tunMen('MESA DIRECTIVA',"mesa_directiva.html",null,0,150)
Op_2 = new tunMen('BASES LEGALES',null,null,5,150)
	Op_2_0 = new tunMen('PROTOCOLIZACION',null,null,0,100)
	Op_2_1 = new tunMen('REQUISITOS DE INGRESO',null,null,0,100)
	Op_2_2 = new tunMen('REGISTROS LOCALES',null,null,0,100)
	Op_2_3 = new tunMen('ESTATUTOS',"estatutos_a.html",null,0,100)
	Op_2_4 = new tunMen('REGLAMENTOS',null,null,0,100)
Op_3 = new tunMen('ACTIVIDADES',null,null,6,150)
	Op_3_0 = new tunMen('SESIONES ORDINARIAS',"sesion_ordinaria.html",null,0,100)
	Op_3_1 = new tunMen('CONGRESO NACIONAL',null,null,0,100)
	Op_3_2 = new tunMen('REUNION NACIONAL DE CAPITULOS',"reunion_capitulos.html",null,0,100)
	Op_3_3 = new tunMen('JORNADAS DE RESIDENTES',null,null,0,100)
	Op_3_4 = new tunMen('CURSOS',null,null,0,100)
	Op_3_5 = new tunMen('TALLERES',null,null,0,100)
Op_4 = new tunMen('PUBLICACIONES',null,null,0,150)
Op_5 = new tunMen('SOCIEDADES AFINES',"sociedades_afines.html",null,0,150)
	/*Op_5_0 = new tunMen('COLEGIO MEX DE ORTOPEDIA Y TRAUMATOLOGIA',"www.smo.edu.mx",'_blank',0,100)
	Op_5_1 = new tunMen('ASOC. MEXICANA DE QUEMADURAS',"www.amq.ac",'_blank',0,100)
	Op_5_2 = new tunMen('ASOC. CIRUGIA PLASTICA, ESTETICA Y RECONS.',"www.cirugiaplastica.org.mx",'_blank',0,100)
	Op_5_3 = new tunMen('ASOC. MEXICANA DE MEDICAS',"mailto:asociaciondemedicas1926@prodigy.net.mx",null,0,100)*/

/* Fin de configuración.
   No tocar a partir de aquí */
var tunIex=navigator.appName=="Microsoft Internet Explorer"?true:false;
if(tunIex && navigator.userAgent.indexOf('Opera')>=0){tunIex = false}
var Opera = navigator.userAgent.indexOf('Opera')>=0 ? true : false;
var manita = tunIex ? 'hand' : 'pointer'
var subOps = new Array()
function construye(){
cajaMenu = document.createElement('ul')
cajaMenu.style.width = anMenu + "px"
cajaMenu.style.zIndex = 1
cajaMenu.style.marginLeft = 0
cajaMenu.style.paddingLeft = 0
document.getElementById('me').appendChild(cajaMenu)
for(m=0; m < totalMen; m++){
	opchon = eval('Op_'+m)
	boton = document.createElement('li')
	boton.style.marginLeft = 0
	boton.style.paddingLef = 0
	boton.style.listStyleType = 'none'
	boton.style.position = 'relative'
	boton.style.zIndex = (100 - m)
	boton.className = 'botones'
	boton.style.cursor = manita
	boton.id = 'op_' + m
	if(opchon.enl){
		lin = document.createElement('a')
		lin.className = 'enlacesmenu'
		lin.href = opchon.enl
		if(opchon.dest){
			lin.target = opchon.dest
		}
	boton.appendChild(lin)
	lin.appendChild(document.createTextNode(opchon.tex))
	}
	else{
		boton.appendChild(document.createTextNode(opchon.tex))
	}
	boton.onmouseover = function(){
		mostrar(this)
		}
	boton.onmouseout=function(){
		ocultar(this)
		}
	cajaMenu.appendChild(boton)
	if(opchon.subOp > 0 ){
		espan = document.createElement('span')
		espan.style.position = 'absolute'
		espan.style.right = 0
		boton.style.backgroundImage = imaflecha
		boton.style.backgroundPosition = 'center right'
		boton.style.backgroundRepeat = 'no-repeat'
		espan.className = 'espan'
		boton.appendChild(espan)
		subOps[subOps.length] = boton.id.replace(/o/,"O")
		}
	}
if(subOps.length >0){subMes()}
}
function subMes(){
lar = subOps.length
for(t=0;t<subOps.length;t++){
	opc =eval(subOps[t])
	for(v=0;v<opc.subOp;v++){
		if(eval(subOps[t] + "_" + v + ".subOp") >0){
			subOps[subOps.length] = subOps[t] + "_" + v
			}
		}
	}
construyeSub()
}
function construyeSub(){
for(y=0; y<subOps.length;y++){
opchon = eval(subOps[y])
capa = document.createElement('ul')
capa.className = 'subMe'
capa.style.width = opchon.an + "px"
capa.style.visibility = 'hidden'
capa.style.position = 'absolute'
capa.style.marginLeft = 0
capa.style.paddingLeft = 0
document.getElementById(subOps[y].toLowerCase()).firstChild.nextSibling.appendChild(capa)
	for(s=0;s < opchon.subOp; s++){
		sopchon = eval(subOps[y] + "_" + s)
		opc = document.createElement('li')
		opc.style.marginLeft = 0
		opc.style.paddingLeft = 0
		opc.style.listStyleType = 'none'
		opc.className = 'botones'
		opc.id = subOps[y].toLowerCase() + "_" + s
		if(sopchon.enl){
			lin = document.createElement('a')
			lin.className = 'enlacesmenu'
			lin.href = sopchon.enl
			if(sopchon.dest){
				lin.target = sopchon.dest
			}
		opc.appendChild(lin)
		lin.appendChild(document.createTextNode(sopchon.tex))
		}
		else{
			opc.appendChild(document.createTextNode(sopchon.tex))
		}
		capa.appendChild(opc)
		opc.style.cursor = manita
		opc.onmouseover = function(){
			mostrar(this)
			}
		opc.onmouseout=function(){
			ocultar(this)
			}
		if(sopchon.subOp > 0 ){
			espan = document.createElement('span')
			espan.style.position = 'absolute'
			espan.style.right = 0
			opc.style.backgroundImage = imaflecha
			opc.style.backgroundPosition = 'center right'
			opc.style.backgroundRepeat = 'no-repeat'
			espan.className = 'espan'
			opc.appendChild(espan)
			}
		}
	}
}
function mostrar(cual){
if(Opera || (document.styleSheets.length > 0 && !document.styleSheets[0].disabled)){
	if(tunIex){cual.className = 'botonesHover'}
	if(cual.childNodes.length > 1){
		cual.firstChild.nextSibling.firstChild.style.visibility = 'visible'
		}
	}
}
function ocultar(cual){
	if(Opera || (document.styleSheets.length > 0 && !document.styleSheets[0].disabled)){
	if(tunIex){cual.className = 'botones'}
		if(cual.childNodes.length > 1){
		cual.firstChild.nextSibling.firstChild.style.visibility = 'hidden'
		}
	}
}
function enlace(cual){
enla = eval('O' + cual.substr(1)).enl
targ = eval('O' + cual.substr(1)).dest
if(targ && targ.toLowerCase() == '_blank'){
	window.open(enla,'','')
	}
else{
	location.href = enla
	}

}