function side(indice) {
    if($("#m"+indice).css("height")=="0px") {
        side2big(indice);
    } else {
        side2small(indice);
    }
}

function side2big(indice) {
    $('#m'+indice++%5).animate({height: "150px"}, 1000);
    $('#m'+indice++%5).animate({height: "0px"}, 1000);
    $('#m'+indice++%5).animate({height: "0px"}, 1000);
    $('#m'+indice++%5).animate({height: "0px"}, 1000);
    $('#m'+indice++%5).animate({height: "0px"}, 1000);
}

function side2small(indice) {
    $('#m'+(indice)).animate({height: "0px"}, 1000);
}

$(document).ready(function(){
    $('a[rel*=facebox]').facebox();
    var galleries = $('.ad-gallery').adGallery({
        slideshow: {
            enable: true,
            autostart: true,
            speed: 6000,
            start_label: 'Start',
            stop_label: 'Stop',
            stop_on_scroll: true,
            countdown_prefix: '(',
            countdown_sufix: ')'
        }
    });
    $('#switch-effect').change(
      function() {
        galleries[0].settings.effect = $(this).val();
        return false;
      }
    );
    $('#toggle-slideshow').click(
      function() {
        galleries[0].slideshow.toggle();
        return false;
      }
    );
});
