/**************************************************************
Menú en arbol. Script creado por Tunait! (31/7/2004)
Si quieres usar este script en tu sitio eres libre de hacerlo con la condición de que permanezcan intactas estas líneas, osea, los créditos, pero esta es una bersión beta en fase de pruebas.
No autorizo a publicar y/o distribuír el código en sitios de script sin previa autorización
Si quieres publicarlo, por favor, contacta conmigo.
http://javascript.tunait.com/
tunait@yahoo.com 
****************************************************************/
var anMenu = 190
var totalMen = 2
var anImas = 17
var alImas = 15
var direc = 'imasmenu'
var mas = '/mast.gif'
var menos = '/menost.gif'
var puntos = '/puntost.gif'
var puntosv = '/puntosvt.gif'
/*var carpeab = '/carpabiertat.gif'
var carpece = '/carpcerradat.gif'*/
var carpeab = '/spacer.gif'
var carpece = '/spacer.gif'
var puntosu = '/puntosut.gif'
/*var doc = '/doct.gif'
var docsel = '/docselt.gif'*/
var doc = '/spacer.gif'
var docsel = '/spacer.gif'


var carpeabsel = '/spacer.gif'
var carpecesel = '/spacer.gif'

/*var carpeabsel = '/carpabiertasel.gif'
var carpecesel = '/carpcerradasel.gif'*/

/*var icHome = '/home.gif'*/
var icHome = '/spacer.gif'
var puntosh = '/puntosh.gif'
function tunMen(tex,enl,dest,subOp,an){
this.tex = tex;
this.enl = enl;
this.dest = dest;
this.subOp = subOp;
this.an = an;
this.secAc = false
}
Op_0 = new tunMen('Divisions','index.php',null,0)


Op_1 = new tunMen('Technology',null,null,5,100)
	Op_1_0 = new tunMen('Self Service',null,null,4,0)	
			
		Op_1_0_0 = new tunMen('Security',null,null,5,0)
			Op_1_0_0_0 = new tunMen('Locks','index.php?pg=locks',null,0)			
			Op_1_0_0_1 = new tunMen('Host Security Modules','index.php?pg=erosafe',null,0)
			Op_1_0_0_2 = new tunMen('Key Management','index.php?pg=keymanag',null,0)			
			Op_1_0_0_3 = new tunMen('Fraud Detection','index.php?pg=frauddetection',null,0)
			Op_1_0_0_4 = new tunMen('Payment Card Security','index.php?pg=pcidss',null,0)			
		Op_1_0_1 = new tunMen('ATMs & Parts',null,null,4,0)
			Op_1_0_1_0 = new tunMen('NCR/Diebold','index.php?pg=ncrdiebold',null,0)
			Op_1_0_1_1 = new tunMen('GRG ATMs','http://www.techimportpr.com','_blank',0)
			Op_1_0_1_2 = new tunMen('Others','#',null,0)
			Op_1_0_1_3 = new tunMen('3DES Upgrades',null,null,2,0)
				Op_1_0_1_3_0 = new tunMen('NCR','index.php?pg=ncr',null,0)
				Op_1_0_1_3_1 = new tunMen('Diebold','index.php?pg=diebold',null,0)
		
		Op_1_0_2 = new tunMen('Pneumatic Tellers',"http://www.hamiltonsafe.com/driveUps/driveUpSystems.html",'_blank',0)	
		
		Op_1_0_3 = new tunMen('Services','index.php?pg=ncr',null,3,0)
			Op_1_0_3_0 = new tunMen('Overview','index.php?pg=service',null,0)
			Op_1_0_3_1 = new tunMen('First Line Support','index.php?pg=firstline',null,0)
			Op_1_0_3_2 = new tunMen('Maintenance','index.php?pg=maint',null,0)
			
			

	Op_1_1 = new tunMen('Corporate Applications',null,null,4,0)
		Op_1_1_0 = new tunMen('Document/Item Management',null,null,3,0)
				Op_1_1_0_0 = new tunMen('Overview','index.php?pg=management',null,0)
				Op_1_1_0_1 = new tunMen('Enterprise System','index.php?pg=enterprise',null,0)
				Op_1_1_0_2 = new tunMen('Small Business','index.php?pg=business',null,0)		
		Op_1_1_1 = new tunMen('Report Delivery','index.php?pg=report',null,0,0)		
		Op_1_1_2 = new tunMen('Network Security','index.php?pg=network',null,0,0)
		Op_1_1_3 = new tunMen('Consulting & Development','index.php?pg=consulting',null,0,0)		

	Op_1_2 = new tunMen('Web Consulting & Support',null,null,3,0)

		Op_1_2_0 = new tunMen('Overview','index.php?pg=webconsulting',null,0,0)
		Op_1_2_1 = new tunMen('Services','index.php?pg=webservices',null,0,0)
		Op_1_2_2 = new tunMen('Samples','index.php?pg=websamples',null,0,0)
		

	Op_1_3 = new tunMen('Security',null,null,3,0)
		Op_1_3_0 = new tunMen('GamaLock','index.php?pg=gamanew',null,0)
		Op_1_3_1 = new tunMen('Locks','index.php?pg=locks&p=2',null,0)
		Op_1_3_2 = new tunMen('SIRENA',null,null,4,0)	
				Op_1_3_2_0 = new tunMen('Overview','index.php?pg=sirena',null,0)
				Op_1_3_2_1 = new tunMen('ATM','index.php?pg=sirena_atm',null,0)
				Op_1_3_2_2 = new tunMen('Asset Control','index.php?pg=sirena_asset',null,0)
				Op_1_3_2_3 = new tunMen('Courrier','index.php?pg=sirena_dropbox',null,0)


	Op_1_4 = new tunMen('SOHO Support',null,null,2,0)
		Op_1_4_0 = new tunMen('Overview','index.php?pg=soho',null,0,0)
		Op_1_4_1 = new tunMen('Services','index.php?pg=servicessoho',null,0,0)
	
/*		Op_3_0_2 = new tunMen('Parts & Maintenance',null,null,3,0)
			Op_3_0_2_0 = new tunMen('NCR Diebold Other','#',null,0)
			Op_3_0_2_1 = new tunMen('Outsourcing','#',null,0)
			Op_3_0_2_2 = new tunMen('Maintenance',null,null,2,0)
				Op_3_0_2_2_0 = new tunMen('Preventive','#',null,0)
				Op_3_0_2_2_0 = new tunMen('Corrective','#',null,0)				*/

Op_2 = new tunMen('Financial & General Services',null,null,3,150)
	Op_2_0 = new tunMen('Accounting','index.php?pg=accounting',null,0,100)
//	Op_1_1 = new tunMen('Financial',null,null,0,100)
	Op_2_1 = new tunMen('General Services','index.php?pg=gservices',null,0,100)	
//	Op_1_3 = new tunMen('Labor Recruiting',null,null,0,100)
	Op_2_2 = new tunMen('Taxes Preparation','index.php?pg=taxes',null,0,100)

// 10/12/10 Op_2 = new tunMen('Financial & General Services',null,null,3,150)
// 10/12/10 	Op_2_0 = new tunMen('Accounting','index.php?pg=accounting',null,0,100)
//	Op_1_1 = new tunMen('Financial',null,null,0,100)
// 10/12/10 	Op_2_1 = new tunMen('General Services','index.php?pg=gservices',null,0,100)	
//	Op_1_3 = new tunMen('Labor Recruiting',null,null,0,100)
// 10/12/10 	Op_2_2 = new tunMen('Taxes Preparation','index.php?pg=taxes',null,0,100)




var tunIex=navigator.appName=="Microsoft Internet Explorer"?true:false;
if(tunIex && navigator.userAgent.indexOf('Opera')>=0){tunIex = false}
var manita = tunIex ? 'hand' : 'pointer'
var subOps = new Array()
function construye(){
cajaMenu = document.createElement('div')
cajaMenu.style.width = anMenu + "px"
document.getElementById('me').appendChild(cajaMenu)
for(m=0; m < totalMen; m++){
	opchon = eval('Op_'+m)
	ultimo = false
	try{
	eval('Op_' + (m+1))
	}
	catch(error){
	ultimo = true
	}
	boton = document.createElement('div')
	boton.style.position = 'relative'
	boton.className = 'botones'
	boton.style.paddingLeft= 0
	carp = document.createElement('img')
	carp.style.marginRight = 5 + 'px'	
	carp.style.verticalAlign = 'middle'
	carp2 = document.createElement('img')
	carp2.style.verticalAlign = 'middle'


	enla = document.createElement('a')
	if(opchon.subOp > 0){
		carp2.style.cursor = manita
		carp2.src = direc + mas
		boton.secAc = opchon.secAc
		}
	else{
		carp2.style.cursor = 'default'
		enla.className = 'enls'
		if(ultimo){carp2.src = direc + puntosu}
		else{carp2.src = direc + puntos}
		}
		if(m == 0){
		carp.src = direc + icHome
		carp2.src = direc + puntosh
		}
	else{
		carp.src = direc + carpece
		}
	boton.appendChild(carp2)
	boton.appendChild(carp)
	enla.className = 'enls'
	enla.style.cursor = manita
	boton.appendChild(enla)
	enla.appendChild(document.createTextNode(opchon.tex))
	if(tunIex){
		enla.onmouseover = function(){this.className = 'botonesHover'}
		enla.onmouseout = function(){this.className = 'enls'}
		}
	if(opchon.enl != null && opchon.subOp == 0){
			enla.href = opchon.enl
			}
		if(opchon.dest != null && opchon.subOp == 0){
			enla.target = opchon.dest;
			}
	boton.id = 'op_' + m
	
	cajaMenu.appendChild(boton)
	if(opchon.subOp > 0 ){
		carp2.onclick= function(){
		abre(this.parentNode,this,this.nextSibling)
		}
		subOps[subOps.length] = boton.id.replace(/o/,"O")
		enla.onclick = function(){
			abre(this.parentNode,this.parentNode.firstChild,this.previousSibling)
			}
		}
	}
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()
}
var fondo = true
function construyeSub(){
for(y=0; y<subOps.length;y++){
opchon = eval(subOps[y])
capa = document.createElement('div')
capa.className = 'subMe'
capa.style.position = 'relative'
capa.style.display = 'none'
if(!fondo){capa.style.backgroundImage = 'none'}
document.getElementById(subOps[y].toLowerCase()).appendChild(capa)
	for(s=0;s < opchon.subOp; s++){
		sopchon = eval(subOps[y] + "_" + s)
		ultimo = false
		try{
			eval(subOps[y] + "_" + (s+1))
			}
		catch(error){
			ultimo = true
			}
			if(ultimo && sopchon.subOp > 0){
			fondo = false
			}
		opc = document.createElement('div')
		opc.className = 'botones'
		opc.id = subOps[y].toLowerCase() + "_" + s
		if(tunIex){
		//	opc.onmouseover = function(){this.className = 'botonesHover'}
		//	opc.onmouseout = function(){this.className = 'botones'}
			}
		enla = document.createElement('a')
		enla.className = 'enls'
		enla.style.cursor = manita
		if(sopchon.enl != null && sopchon.subOp == 0){
			enla.href = sopchon.enl
			if(sopchon.dest != null && sopchon.subOp == 0){
				enla.target = sopchon.dest
				}
			}
		
		enla.appendChild(document.createTextNode(sopchon.tex))
		capa.appendChild(opc)
		carp = document.createElement('img')
		carp.src = direc + carpece
		carp.style.verticalAlign = 'middle'
		carp.style.marginRight = 1 + 'px'
		carp2 = document.createElement('img')
		carp2.style.verticalAlign = 'middle'
		if(sopchon.subOp > 0){
			opc.secAc = sopchon.secAc
			carp2.style.cursor = manita
			carp2.src = direc + mas
			/*carp2.src = mas			*/
				enla.onclick = function(){
				abre(this.parentNode,this.parentNode.firstChild,this.previousSibling)
				}
			carp2.onclick= function(){
			abre(this.parentNode,this,this.nextSibling)
			}
			if(tunIex){
			enla.onmouseover = function(){this.className = 'botonesHover'}
			enla.onmouseout = function(){this.className = 'enls'}
			}
			}
		else{
			carp2.style.cursor = 'default'
			carp.src = direc + doc
			if(ultimo){carp2.src = direc + puntosu; 
			//alert(sopchon.subOp)
			if(sopchon.subOp > 0){alert('hola');capa.style.backgroundImage = 'none'}
			//direc + puntosv
			}
			else{carp2.src = direc + puntos}
				}
		opc.appendChild(carp2)
		opc.appendChild(carp)
		opc.appendChild(enla)
		
		}
	}
Seccion()
}
function abre(cual,im,car){
//alert(cual.secAc)
abierta = cual.lastChild.style.display != 'none'? true:false;
if(abierta){
	cual.lastChild.style.display = 'none'
	im.src = direc + mas
	if(cual.secAc){
		car.src = direc + carpecesel
		
		}
	else{car.src = direc + carpece}
	}
else{
	cual.lastChild.style.display = 'block'
	im.src = direc + menos
	if(cual.secAc){car.src = direc + carpeabsel}
	else{car.src = direc + carpeab}
	}
}
var seccion = null
function Seccion(){
if (seccion != null){
	if(seccion.length == 4){
		document.getElementById(seccion.toLowerCase()).firstChild.nextSibling.src = direc + carpeabsel
		//alert(document.getElementById(seccion.toLowerCase()).lastChild.tagName)
		document.getElementById(seccion.toLowerCase()).lastChild.className = 'secac2'
		document.getElementById(seccion.toLowerCase()).lastChild.onmouseover = function(){
			this.className = 'enls'
			}
		document.getElementById(seccion.toLowerCase()).lastChild.onmouseout = function(){
			this.className = 'secac2'
			}
		}
	else{
		document.getElementById(seccion.toLowerCase()).firstChild.nextSibling.src = direc + docsel
		document.getElementById(seccion.toLowerCase()).firstChild.nextSibling.nextSibling.className = 'secac'
		document.getElementById(seccion.toLowerCase()).parentNode.parentNode.lastChild.previousSibling.className = 'secac2' 
		//
			document.getElementById(seccion.toLowerCase()).parentNode.parentNode.lastChild.previousSibling.onmouseout = function(){
			this.className = 'secac2'
			}
			if(!tunIex){
			document.getElementById(seccion.toLowerCase()).parentNode.parentNode.lastChild.previousSibling.onmouseover = function(){
			this.className = 'enls'
			}
		}
		document.getElementById(seccion.toLowerCase()).parentNode.parentNode.secAc = true
		//alert(document.getElementById(seccion.toLowerCase()).parentNode.parentNode.innerHTML)
		seccion = seccion.substring(0,seccion.length - 2)
		seccionb = document.getElementById(seccion.toLowerCase())
		abre(seccionb,seccionb.firstChild,seccionb.firstChild.nextSibling)
		if(seccion.length > 4){
		lar = seccion.length
			for(x = lar; x > 4; x-=2){
				seccion = seccion.substring(0,seccion.length - 2)
				seccionb = document.getElementById(seccion.toLowerCase())
				abre(seccionb,seccionb.firstChild,seccionb.firstChild.nextSibling)
				}
			}
		}
	}
}
onload = construye
