var hidden_res = -300;
var shown_res = 190;

function change_reservation(start, end) {
    dojo.animateProperty({
        node: dojo.byId('reserve'),
        properties: {
            top: { start: start,  end: end, unit: "px" }}}).play();
}

function is_shown_reservation() {
    return dojo.byId('reserve').style.top == shown_res +'px';
}

function hide_reservation(e) {
    if (is_shown_reservation()) {
        change_reservation(shown_res, hidden_res);
    }
}

function show_reservation(e) {
    if (!is_shown_reservation()) {
        change_reservation(hidden_res, shown_res);
    } else {
        hide_reservation();
    }
}


dojo.addOnLoad(function() {
    dojo.connect(dojo.byId('reserve_button'), 'onclick', show_reservation);
    dojo.connect(dojo.byId('reserve_close'), 'onclick', hide_reservation);
});

