
function ContraeTodo(){
	var i;
	for(i=1; i<=document.getElementById('cantitems').value;i++){
				document.getElementById('sub'+i).className='SubMenu';
		  		document.getElementById('bot'+i).className='botonmenu'; 
	}
}
function SeleccionMenu(nro,despliega,vinculo,nivel){

if (despliega){
		if (nivel<1) ContraeTodo();
	if (vinculo && document.getElementById('sub'+nro).className=='SubMenu'){
		
		document.getElementById('modulo').value=vinculo;
		document.getElementById('modulonumero').value=nro;
		document.getElementById('desplegar').value=1;
		Cargar(vinculo);
	}
		if(document.getElementById('sub'+nro).className=='SubMenuV') {
			
				document.getElementById('sub'+nro).className='SubMenu';
		  		document.getElementById('bot'+nro).className='botonmenu'; 
		  		
			}
		
		 else 
			{ 
		 		document.getElementById('sub'+nro).className='SubMenuV';
		  		document.getElementById('bot'+nro).className='aPresionado'; 
		
		  	}
		  }
	else {
		if (nivel<1) ContraeTodo();
		document.getElementById('modulo').value=vinculo;
		document.getElementById('modulonumero').value=nro;
		document.getElementById('desplegar').value=0;
		Cargar(vinculo);
		
	}
  }
  function NuevoAjax(){
var xmlhttp=false;
try{
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
	try{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}catch(E){
		xmlhttp = false;
	}
}

if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
	xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function Cargar(url){
var contenido, preloader;
contenido = document.getElementById('contenido');
//preloader = document.getElementById('preloader');
ajax=NuevoAjax();
ajax.open("GET","ver.php?url=" + url,true);
ajax.onreadystatechange=function(){
	if(ajax.readyState==1){
		contenido.innerHTML = "Cargando...";
//		preloader.style.background = "url('loading.gif') no-repeat";
	}else if(ajax.readyState==4){
		if(ajax.status==200){
			contenido.innerHTML = ajax.responseText;
//			preloader.innerHTML = "Cargado.";
//			preloader.style.background = "url('loaded.gif') no-repeat";
		}else if(ajax.status==404){
			contenido.innerHTML = "<h2>La página no existe</h2>";
		}else{
			contenido.innerHTML = "<h2>Error:</h2>".ajax.status;
		}
	}
}
ajax.send(null);
}
function CargarD(url){
var contenido, preloader;
contenido = document.getElementById('contenido');
//preloader = document.getElementById('preloader');
ajax=NuevoAjax();
ajax.open("GET",url,true);
ajax.onreadystatechange=function(){
	if(ajax.readyState==1){
		contenido.innerHTML = "Cargando...";
//		preloader.style.background = "url('loading.gif') no-repeat";
	}else if(ajax.readyState==4){
		if(ajax.status==200){
			contenido.innerHTML = ajax.responseText;
//			preloader.innerHTML = "Cargado.";
//			preloader.style.background = "url('loaded.gif') no-repeat";
		}else if(ajax.status==404){
			contenido.innerHTML = "<h2>La página no existe</h2>";
		}else{
			contenido.innerHTML = "<h2>Error:</h2>".ajax.status;
		}
	}
}
ajax.send(null);
}
