
var elementExpand = "acordion";
var loadFl;
//carga de pagina
function loadPage(){
    $('hidepage').style.visibility = "hidden";
}
//redirigir
function redirigir(URL){ window.location.href = (URL); }
//retorna el elemento a expandir
function expand(ele){ elementExpand = ele; return elementExpand; }
//retorna el flash a cargar en el mod productos
function loadCont(elem){ loadFl = elem; return loadFl; }
//cuando carga la pagina...
window.onDomReady(function(){
  //si esta dentro del index (hay q cargar el menu)
  if(MostrarMenu==true){
	//aparecer el menu lentamente
    var showNav = new Fx.Styles($('Nav'), { duration: 200, wait: false });
    showNav.start({'opacity': '1','margin-left': 0});
	//si el ac se debe abrir cuando hay subseccion abierto
    if (posSecc != -1) {
        var ac1 = new Fx.Accordion($$('.togProd'), $$('.boxSecc'), {
            alwaysHide: true, duration: 200, transition: Fx.Transitions.Circ.easeIn, display: posPro	,onComplete: function(){
				if(loadFl != undefined){
					//cargar el flash de cada producto
        			var url = "modulos/productos/flash.php";
        			new Ajax(url, { method: 'get', data: 'fl=' + loadFl + '', update: $('MainModCont')}).request();
				}
    		}
        });
    }
	//ac 2 (subseccion)
    var ac2 = new Fx.Accordion($$('.togSecc'), $$('.boxSubS'), {
       	alwaysHide: true, duration: 300, transition: Fx.Transitions.Circ.easeIn, display: posSecc, onActive: function(){
           	var fnx = new Fx.Styles($(elementExpand), { unit: '%' });
           	fnx.start({ 'height': '100' });
           	var subseccT = 1;
       	},
       	onBackground: function(){
           	var fxx = new Fx.Styles($(elementExpand), { unit: '%' });
           	fxx.start({ 'height': '100' });
       	}
    });
    //si el ac se debe abrir cuando NO hay subseccion abierto
    if (posSecc == -1) {
        var ac1 = new Fx.Accordion($$('.togProd'), $$('.boxSecc'), {
            alwaysHide: true, duration: 300, transition: Fx.Transitions.Circ.easeIn,display: posPro	,onComplete: function(){
				if(loadFl != undefined){
					//cargar el flash de cada producto
        			var url = "modulos/productos/flash.php";
        			new Ajax(url, { method: 'get', data: 'fl=' + loadFl + '', update: $('MainModCont')}).request();
				}
    		}
        });
    }
	//igualar la seccion 4
	if (posPro == 3 && (posSecc == 2 || posSecc == 3 || posSecc == 4)) {
		var fx5 = new Fx.Styles( $('secciones4'), {unit: '%'} );
		fx5.start({'unit': '%','height': '100'});
	}
  }
});
