$(document).ready(function()
{
    /* subject and level select divs are hidden on document.ready */
    $("#mojo").hide();
    $("#jojo").hide();
    
    $("#search_list_subject").click(function()
    {
        /* toggle hide() and show() to appear like a drop down list */        
        if($("#mojo").is(":hidden"))
        {
            $("#mojo").focus();
            $("#mojo").slideDown("fast");
        }
        else
        {
            $("#mojo").focus();
            $("#mojo").hide();
        }
    });
    
    $("#search_list_level").click(function()
    {
        /* toggle hide() and show() to appear like a drop down list */        
        if($("#jojo").is(":hidden"))
        {
            $("#jojo").focus();
            $("#jojo").slideDown("fast");
        }
        else
        {
            $("#jojo").focus();
            $("#jojo").hide();
        }
    });
    
    $("#subject_All").click(function()
    {
	    //$(this).parent().siblings().find(':checkbox').attr('disabled', this.checked);
    });
    
    $("#level_All").click(function()
    {
	    //$(this).parent().siblings().find(':checkbox').attr('disabled', this.checked);
    });
});

$(document).click(function(e)
{
    e = e || window.event;
    //var element = e.target || e.srcElement;
    
    if((e.target.id != "mojo") && (e.target.id.substring(0,8) != "subject_"))
    {
        $("#mojo").hide();
    }
    
    if((e.target.id != "jojo") && (e.target.id.substring(0,6) != "level_"))
    {
        $("#jojo").hide();
    }
    /*
    if(e.target.id == "subject_All")
    {
        if($("input[type='checkbox']:not([disabled='disabled'])"))
        {
            $("input[type='checkbox']:not([name='subject_All'])").attr('disabled', true);
        }
        else
        {
            $("input[type='checkbox']:not([name='subject_All'])").attr('disabled', false);
        }
    }
    */
});

