/**
 * General query scripts for the Choralis website
 *
 * @author Rob Edwards
 */

$(document).ready(function() {
    //sets the logic for the check boxes
    searchFormCheckBoxes();
});


function searchFormCheckBoxes() {
    //Check the boxes
    $('#type').children('input').attr('checked', 'checked');
    //see if one of them has changed
    $('#type').children('input').change(function() {
        
        //if this one is false
        if(!$(this).attr('checked')) {
            
            //see if the other one is false
            if(!$(this).siblings('input').attr('checked')) {
                $('#submitSearch').attr('disabled', 'disabled');
            } else {
                //if the other is set to true, undisable the search
                $('#submitSearch').attr('disabled', '');
            }
            
        } else {
            
            //if we're setting to true, undisable the search
            $('#submitSearch').attr('disabled', '');
        }
    });
    /*
        TODO Need to add warning messages for nothing checked.
    */
}