function getHTTPObject(theDiv){
    var xmlhttp = false;

    /* Compilation conditionnelle d'IE */
    /*@cc_on
     @if (@_jscript_version >= 5)
     try
     {
     xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch (e)
     {
     try
     {
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
     }
     catch (E)
     {
     xmlhttp = false;
     }
     }
     @else
     xmlhttp = false;
     @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e) {
            xmlhttp = false;
        }
    }
    if (xmlhttp) {
        xmlhttp.onreadystatechange = function(){
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    //document.getElementById("wait").style.visibility = 'hidden';
                    document.getElementById(theDiv).innerHTML = xmlhttp.responseText;
                    return xmlhttp.responseText;
                }
            }
        }
    }
    return xmlhttp;
}

function ajaxSend(url){
    var xmlhttp = sendHTTPObject();
    xmlhttp.open("GET", url, true);
    xmlhttp.send(null);
}

function ajaxGet(url, div){
    var xmlhttp = getHTTPObject(div);
    xmlhttp.open("GET", url, true);
    xmlhttp.send(null);
    xmlhttp = undefined;
}

function ajaxCheck(url){
    var xmlhttp = sendHTTPObject();
    xmlhttp.open("GET", url, false);
    xmlhttp.send(null);
    return xmlhttp.responseText;
}

function allowOnlyNumbers(event) {
    // Compatibilité IE / Firefox
    if(!event&&window.event) {
        event=window.event;
    }
    // IE
    if((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 9 && event.keyCode != 37 && event.keyCode != 39) {
        event.returnValue = false;
        event.cancelBubble = true;
    }
    // DOM
    if((event.which < 48 || event.which > 57) && event.which != 8 && event.which != 0) {
        event.preventDefault();
        event.stopPropagation();
    }
}


window.addEvent('domready', function(){
    // The same as before: adding events
    $('menus').addEvents({
        'mouseenter': function(){
            // Always sets the duration of the tween to 1000 ms and a bouncing transition
            // And then tweens the height of the element
            this.set('tween', {
                duration: 1000,
                transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out'
            }).tween('height', '100px'); // 25 + 3 * 25
        },
        'mouseleave': function(){
            // Resets the tween and changes the element back to its original size
            this.set('tween', {}).tween('height', '16px');
        }
    });
    $('carte').addEvents({
        'mouseenter': function(){
            // Always sets the duration of the tween to 1000 ms and a bouncing transition
            // And then tweens the height of the element
            this.set('tween', {
                duration: 1000,
                transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out'
            }).tween('height', '240px');
        },
        'mouseleave': function(){
            // Resets the tween and changes the element back to its original size
            this.set('tween', {}).tween('height', '16px');
        }
    });
    $('boissons').addEvents({
        'mouseenter': function(){
            // Always sets the duration of the tween to 1000 ms and a bouncing transition
            // And then tweens the height of the element
            this.set('tween', {
                duration: 1000,
                transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out'
            }).tween('height', '100px');
        },
        'mouseleave': function(){
            // Resets the tween and changes the element back to its original size
            this.set('tween', {}).tween('height', '16px');
        }
    });
});

window.addEvent('domready', function() {

    var slideDefault = new Fx.Slide('default');

    var currentDiv = slideDefault;

    var slideMenuMidi = new Fx.Slide('menuMidi');
    slideMenuMidi.toggle();

    $('bt_menuMidi').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideMenuMidi){
            currentDiv.toggle();
            currentDiv = slideMenuMidi;
            currentDiv.toggle();
        }
    });

    var slideMenuSoir = new Fx.Slide('menuSoir');
    slideMenuSoir.toggle();

    $('bt_menuSoir').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideMenuSoir){
            currentDiv.toggle();
            currentDiv = slideMenuSoir;
            currentDiv.toggle();
        }
    });

    var slideMenuEnfants = new Fx.Slide('menuEnfants');
    slideMenuEnfants.toggle();

    $('bt_menuEnfants').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideMenuEnfants){
            currentDiv.toggle();
            currentDiv = slideMenuEnfants;
            currentDiv.toggle();
        }
    });

    var slideCarteBrunch = new Fx.Slide('carteBrunch');
    slideCarteBrunch.toggle();

    $('bt_carteBrunch').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteBrunch){
            currentDiv.toggle();
            currentDiv = slideCarteBrunch;
            currentDiv.toggle();
        }
    });

    $('bt_carteBrunch2').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteBrunch){
            currentDiv.toggle();
            currentDiv = slideCarteBrunch;
            currentDiv.toggle();
        }
    });

    /*
    var slideCarteAfterwork = new Fx.Slide('carteAfterwork');
    slideCarteAfterwork.toggle();

    $('bt_carteAfterwork').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteAfterwork){
            currentDiv.toggle();
            currentDiv = slideCarteAfterwork;
            currentDiv.toggle();
        }
    });
    */

    var slideCarteSalonThe = new Fx.Slide('carteSalonThe');
    slideCarteSalonThe.toggle();

    $('bt_carteSalonThe').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteSalonThe){
            currentDiv.toggle();
            currentDiv = slideCarteSalonThe;
            currentDiv.toggle();
        }
    });

    var slideCarteSalades = new Fx.Slide('carteSalades');
    slideCarteSalades.toggle();

    $('bt_carteSalades').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteSalades){
            currentDiv.toggle();
            currentDiv = slideCarteSalades;
            currentDiv.toggle();
        }
    });

    var slideCarteTartines = new Fx.Slide('carteTartines');
    slideCarteTartines.toggle();

    $('bt_carteTartines').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteTartines){
            currentDiv.toggle();
            currentDiv = slideCarteTartines;
            currentDiv.toggle();
        }
    });

    var slideCarteEntrees = new Fx.Slide('carteEntrees');
    slideCarteEntrees.toggle();

    $('bt_carteEntrees').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteEntrees){
            currentDiv.toggle();
            currentDiv = slideCarteEntrees;
            currentDiv.toggle();
        }
    });

    var slideCartePlats = new Fx.Slide('cartePlats');
    slideCartePlats.toggle();

    $('bt_cartePlats').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCartePlats){
            currentDiv.toggle();
            currentDiv = slideCartePlats;
            currentDiv.toggle();
        }
    });

    var slideCarteDesserts = new Fx.Slide('carteDesserts');
    slideCarteDesserts.toggle();

    $('bt_carteDesserts').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideCarteDesserts){
            currentDiv.toggle();
            currentDiv = slideCarteDesserts;
            currentDiv.toggle();
        }
    });

    var slideBoissonsBoissons = new Fx.Slide('boissonsBoissons');
    slideBoissonsBoissons.toggle();

    $('bt_boissonsBoissons').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideBoissonsBoissons){
            currentDiv.toggle();
            currentDiv = slideBoissonsBoissons;
            currentDiv.toggle();
        }
    });

    var slideBoissonsAperitifs = new Fx.Slide('boissonsAperitifs');
    slideBoissonsAperitifs.toggle();

    $('bt_boissonsAperitifs').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideBoissonsAperitifs){
            currentDiv.toggle();
            currentDiv = slideBoissonsAperitifs;
            currentDiv.toggle();
        }
    });

    var slideBoissonsVins = new Fx.Slide('boissonsVins');
    slideBoissonsVins.toggle();

    $('bt_boissonsVins').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideBoissonsVins){
            currentDiv.toggle();
             currentDiv = slideBoissonsVins;
             currentDiv.toggle();
        }
    });


    /*
    var slideEnvoyer = new Fx.Slide('envoyer');
    slideEnvoyer.toggle();

    $('bt_envoyer').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideEnvoyer){
            currentDiv.toggle();
            currentDiv = slideEnvoyer;
            currentDiv.toggle();
        }
    });
    */

    var slideContact = new Fx.Slide('contact');
    slideContact.toggle();

    $('bt_contact').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideContact){
            currentDiv.toggle();
             currentDiv = slideContact;
             currentDiv.toggle();
        }
    });

    var slideMentions = new Fx.Slide('mentions');
    slideMentions.toggle();

    $('bt_mentions').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideMentions){
            currentDiv.toggle();
            currentDiv = slideMentions;
            currentDiv.toggle();
        }
    });

    var slideAcces = new Fx.Slide('acces');
    slideAcces.toggle();

    $('bt_acces').addEvent('click', function(e){
        e.stop();
        if(currentDiv != slideAcces){
            currentDiv.toggle();
            currentDiv = slideAcces;
            currentDiv.toggle();
        }
    });

});
