function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
addLoadEvent(function init(){
	for(var i=2; i<=3; i++){
		document.getElementById('contenido'+i).style.display = 'none';
	}
	for(var i=2; i<=8; i++){
		document.getElementById('subcontenido'+i).style.display = 'none';
	}
});

function VerSeccion(id,total){
	for (var i=1; i<=3; i++){
		if(i!=id){
			document.getElementById('contenido'+i).style.display = 'none';
		}else{
			document.getElementById('contenido'+i).style.display = 'block';
		}
	}
}

function VerSubSeccion(id,total){
	for (var i=1; i<=8; i++){
		if(i!=id){
			document.getElementById('subcontenido'+i).style.display = 'none';
		}else{
			document.getElementById('subcontenido'+i).style.display = 'block';
		}
	}
}

var peticion = false; 
if (window.XMLHttpRequest) {
      peticion = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
            peticion = new ActiveXObject("Microsoft.XMLHTTP");
}

function CambiarEstilo(id) {
	var elementosMenu = getElementsByClassName(document, "li", "activo");
	for (k = 0; k< elementosMenu.length; k++) {
	elementosMenu[k].className = "inactivo";
	}
	var identity=document.getElementById(id);
	identity.className="activo";
}

function CambiarEstilo2(id) {
	var elementosMenu = getElementsByClassName(document, "li", "activo2");
	for (k = 0; k< elementosMenu.length; k++) {
	elementosMenu[k].className = "inactivo2";
	}
	var identity=document.getElementById(id);
	identity.className="activo2";
}

function getElementsByClassName(oElm, strTagName, strClassName){
    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
    for(var i=0; i<arrElements.length; i++){
        oElement = arrElements[i];      
        if(oRegExp.test(oElement.className)){
            arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}