﻿function switchMapaVertical() {
    iLeft = ($('menuOculto').getStyle('left').toInt());

    var myMorph = new Fx.Morph('menuOculto', { 'duration': 300});
    this.td_array = $$('.btnMenuOculto a'); 
    
    if (iLeft==0) {                
        myMorph.start({ 'left': -175 });                
        
        this.td_array.each(
            function(td) {
                td.setProperty('class', 'btnMostrarMenu' );
            }
        );
        
    } else {
        myMorph.start({ 'left': 0 });
        
        this.td_array.each(
            function(td) {
                td.setProperty('class', 'btnOcultarMenu' );
            }
        );                
    }
}

function switchMapa() {
    iTop = ($('menuOculto').getStyle('top').toInt());

    var myMorph = new Fx.Morph('menuOculto', { 'duration': 600});
    this.td_array = $$('.btnMenuOculto a'); 
    
    if (iTop==64) {                
        myMorph.start({ 'top': -400 });                
        
        this.td_array.each(
            function(td) {
                td.setProperty('class', 'btnMostrarMenu' );
                td.set('text', 'mostrar menú principal' );
            }
        );
        
    } else {
        myMorph.start({ 'top': 64 });
        
        this.td_array.each(
            function(td) {
                td.setProperty('class', 'btnOcultarMenu' );
                td.set('text', 'ocultar menú principal' );
            }
        );                
    }
}

function mostrarLogin() {
    iTop = ($('zonaUsuario').getStyle('top').toInt());
    
    var myMorph = new Fx.Morph('zonaUsuario', { 'duration': 300});
    
    
    if (iTop==-60) { 
        myMorph.start({ 'top': 0 });
    } else {
        myMorph.start({ 'top': -60 });
    }
}               

function fotosAnteriores() {
    iTop = ($('miniaturas').getStyle('top').toInt());
    
    if (iTop%460==0) {//nos aseguramos de que no está a media transición
        var myMorph = new Fx.Morph('miniaturas', { 'duration': 300});        
        
        if (iTop<0) {
            myMorph.start({ 'top': iTop+460 });
        }
    }
}       

function fotosSiguientes(numFotos) {
    iTop = ($('miniaturas').getStyle('top').toInt());
    
    if (iTop%460==0) {//nos aseguramos de que no está a media transición
        var myMorph = new Fx.Morph('miniaturas', { 'duration': 300});
        
        if (numFotos%10!=0){
            numFotos=numFotos - (numFotos%10);
        }
        var numVistas=numFotos/10;
        
        //alert(numVistas*460 + ". + Máx:" + iTop);
        
        if (iTop>(numVistas*(-460))) {    
            myMorph.start({ 'top': iTop-460 });
        }
    }
}

function situarFotos(fotoSeleccionada) {
    
    iTop = ($('miniaturas').getStyle('top').toInt());
    
    if (iTop%460==0) {//nos aseguramos de que no está a media transición
        var myMorph = new Fx.Morph('miniaturas', { 'duration': 0});
        
        if (fotoSeleccionada%10!=0){
            numVista=((fotoSeleccionada - fotoSeleccionada%10)/10);
        } else {
            numVista=fotoSeleccionada/10;
        }        
 
        myMorph.start({ 'top': numVista*(-460) });
    }
}    
