window.onload = function() {
	
	// ACORDEÓN PARA EL MENÚ
	var menuStretch = document.getElementsByClassName('menuStretch');
	var menuStretcher = document.getElementsByClassName('menuStretcher');
	var menuAccordion = new fx.Accordion(menuStretch, menuStretcher, {opacity: true, duration: 200});
	
	menuAccordion.showThisHideOpen = function(toShow){
    	this.elements.each(function(el, j){
        if (el == toShow) this.clearAndToggle(toShow, j);
    	}.bind(this));
	}
	
	// ACORDEÓN PARA LOS INTERIORES: PESTAÑAS DE IDIOMAS EN EL FORMULARIO
	var intStretch = document.getElementsByClassName('intStretch');
	var intStretcher = document.getElementsByClassName('intStretcher');
	var intAccordion = new fx.Accordion(intStretch, intStretcher, {opacity: true, duration: 100});
	
	intAccordion.showThisHideOpen = function(toShow){
    	this.elements.each(function(el, j){
        if (el == toShow) this.clearAndToggle(toShow, j);
    	}.bind(this));
	}
	for(i=0; i<=menuOpen.length; i++){
		intAccordion.showThisHideOpen(intStretcher[i]);
	}
}


/* Función para modificar el icono de las pestañas (abierta/cerrada) */

function menuToggle(index){
	var idx = index - 1;
	menuOpen[idx] = !menuOpen[idx];
	
	if(document.getElementById){
		obj=document.getElementById("opcionMenu" + (idx + 1));
		
		if(menuOpen[idx]) obj.style.backgroundImage = 'url(img/menos.gif)';
		else obj.style.backgroundImage = 'url(img/mas.gif)';
	}
}

function intToggle(index){
	var idx = index - 1;
	intOpen[idx] = !intOpen[idx];
	
	if(document.getElementById){
		obj=document.getElementById("opcionInt" + (idx + 1));
		
		if(intOpen[idx]) obj.style.backgroundImage = 'url(img/arrow_left.gif)';
		else obj.style.backgroundImage = 'url(img/arrow_down.gif)';
	}

}