
function creasubcapa(op){



 
cadena= new String();
cadena="";

for(i=0;i<nitem[op];i++){

 objeto=eval("subitem"+op);
 valor=4*(i);
 subac=eval("subaccion"+op);

 cadena=cadena+" <div id='Sub"+i+"' style='position:relative; left:10px; top:"+valor+"px; width:140px; height:0px; visibility: visible; z-index:"+(34+i)+"'><font face='arial' style='font-size:10px'><a href='"+subac[i]+"' style='text-decoration:none'>"+objeto[i]+"</a></font></div>";



}

Submenu.innerHTML=cadena;

}


function nuevoretraer(nombreCapa,altura,num){ 


valor2=document.getElementById("Capa"+num).style.top; 
numero2=parseInt(valor2); 
numero2-=altura; 
document.getElementById("Capa"+num).style.top=numero2; 


valor=document.getElementById(nombreCapa).style.top; 
numero=parseInt(valor); 
numero-=altura; 
document.getElementById(nombreCapa).style.top=numero; 

}


function nuevomover(nombreCapa,altura,num){ 



valor2=document.getElementById("Capa"+num).style.top; 
numero2=parseInt(valor2); 
numero2+=altura; 
document.getElementById("Capa"+num).style.top=numero2; 

valor=document.getElementById(nombreCapa).style.top; 
numero=parseInt(valor); 
numero+=altura; 
document.getElementById(nombreCapa).style.top=numero; 

} 








function desmarcar(op){

 nombreCapa=eval("Capa"+op);


 nombreCapa.innerHTML="<table width='151' height='21' border='0' cellspacing='0' cellpadding='0' style='font-size:10px;'><tr><td width='10'></td><td><font face='Arial'><a href='javascript:click("+op+")' style='text-decoration:none'>"+opcion[op]+"</a></font></td></tr></table>";

 marcado=0;

}


function marcar(op){

nombreCapa=eval("Capa"+op);
nombreCapa.innerHTML="<table width='151' height='21' border='0' cellspacing='0' cellpadding='0' 	 style='font-size:10px;'><tr><td width='10'></td><td><font face='Arial'><a 	href='javascript:click("+op+")' style='color:red; 	text-decoration:none'>"+opcion[op]+"</a></font></td></tr></table></div>";
marcado=op;

}


function click(op){


nombreCapa=eval("Capa"+op);

if(!marcado)
{

	marcado=op;
	
	

    marcar(op);
 	creasubcapa(op);




	h=0;
	
	objeto=eval("subitem"+op);
        

	for(q=0;q<nitem[op];q++){

		if((objeto[q].length)>22)
			
			h+=30

		else
			h+=21;

		
	}


	for(i=op+1;i<=14;i++){

		
		
			nuevomover("conten"+i,h,i);




	}



	if(nitem[op]>0){

    	valor=(-578)+(22*op);
    	document.getElementById("Submenu").style.top=valor;

	}else{


		document.getElementById("Submenu").style.top=-5000;

	}






}else if(marcado==op)
{


	
h=0;
	
	objeto=eval("subitem"+op);
        

	for(q=0;q<nitem[op];q++){

		if((objeto[q].length)>22)
			
			h+=30;

		else
			h+=21;

		
	}


	for(i=op+1;i<=14;i++){

		
		//nuevoretraer("Capa"+i,h);
		nuevoretraer("conten"+i,h,i);




	}

	


    valor=-2000;
    document.getElementById("Submenu").style.top=valor;



	 desmarcar(op);



		


}else if(marcado!=op)
{


	creasubcapa(op);


	if(nitem[op]>0){

   	 	valor=(-578)+(22*op);
    	document.getElementById("Submenu").style.top=valor;

	}else{


		document.getElementById("Submenu").style.top=-2000;


	}

	nombreCapa=eval("Capa"+op);

	nombreCapa.innerHTML="<table width='151' height='21' border='0' cellspacing='0' cellpadding='0' 	 style='font-size:10px;'><tr><td width='10'></td><td><font face='Arial'><a 	href='javascript:click("+op+")' style='color:red; 	text-decoration:none'>"+opcion[op]+"</a></font></td></tr></table></div>";


objeto=eval("subitem"+marcado);
	


	

	



h=0;
	
	objeto=eval("subitem"+marcado);
        

	for(q=0;q<nitem[marcado];q++){

		if((objeto[q].length)>22)
			
			h+=30;

		else
			h+=21;

		
	}


	for(i=marcado+1;i<=14;i++){

		
		//nuevoretraer("Capa"+i,h);
		nuevoretraer("conten"+i,h,i);



	}













	objeto=eval("subitem"+op);
        
h=0;
	for(q=0;q<nitem[op];q++){

		if((objeto[q].length)>22)
			
			h+=30;

		else
			h+=21;

		
	}


	for(i=op+1;i<=14;i++){

		
		
		nuevomover("conten"+i,h,i);



	}







	
	desmarcar(marcado);
	marcado=op;

  


}





	if(!nitem[op]){

		
				enviarpag(op);
				
		
		
		
	
	}


}




function menu(){



for(i=1;i<15;i++){




document.write("<div id='conten"+i+"' style='position:relative; left:0px; top:"+(12+(i-1))+"px; width:151px; height:10px;  z-index:'"+(i)+"'>"+"<img src='fondomenu.jpg' width='151' height='21'>"+"</div>");

}


for(i=1;i<15;i++){


	document.write("<div id='Capa"+i+"' style='position:relative;  left:0px; top:"+((-295)+(12+(i-1)))+"px; width:151px; height:11px; z-index:'"+(i+200)+"'> <table width='151' height='21' border='0' cellspacing='0' cellpadding='0' style='font-size:10px;'><tr><td width='10'></td><td><font face='Arial'><a href='javascript:click("+i+")' style='text-decoration:none'>"+opcion[i]+"</a></font></td></tr></table></div>");




}




}




function enviarpag(op){

	location.href=accion[op];

}