jQ(document).ready(function() {
    frontend.init();
});

var frontend = {
    init: function() {
        jQ('#rxconnexion-frontend-advance-search-container #toggle-container a, #rxconnexion-frontend-advance-search-container #search-container a').bind('click', frontend.toggle_advance_search);
        jQ('#forSchedule').bind('click', frontend.toggle_for_schedule);
    },
    toggle_advance_search: function() {

        if(jQ('#rxconnexion-frontend-advance-search-container #search-container').css('display') === 'none') {
            jQ('#rxconnexion-frontend-advance-search-container #toggle-container').hide();
            jQ('#rxconnexion-frontend-advance-search-container #search-container').show();
        } else {
            jQ('#rxconnexion-frontend-advance-search-container #search-container').hide();
            jQ('#rxconnexion-frontend-advance-search-container #toggle-container').show();
        }
    },
    toggle_for_schedule: function() {
        if(jQ(this).prop('checked'))
            jQ('#for-schedule-query-container').show();
        else
            jQ('#for-schedule-query-container').hide();
    }
};