$(document).ready(function() {
    
    $('#ptype input').change(function() {
	if($(this).attr('checked')){
	    if($(this).attr('id') == 'types-value-all'){
		$('#ptype input').not($('#types-value-all')).each(function(){
		    $(this).removeAttr('checked');
		});
	    }
	    if($(this).attr('id') != 'types-value-all'){
		$('#types-value-all').removeAttr('checked');
	    }
	
	}
      //console.log($(this).attr('checked') + $(this).attr('id'));
    });
    
    
    
    //districts-nid-all
    $('#districts input').change(function() {
	if($(this).attr('checked')){
	    if($(this).attr('id') == 'districts-nid-all'){
		$('#districts input').not($('#districts-nid-all')).each(function(){
		    $(this).removeAttr('checked');
		});
	    }
	    if($(this).attr('id') != 'districts-nid-all'){
		$('#districts-nid-all').removeAttr('checked');
	    }
	
	}
      //console.log($(this).attr('checked') + $(this).attr('id'));
    });
    

    //tid
    $('#tid input').change(function() {
	if($(this).attr('checked')){
	    if($(this).attr('id') == 'tid-all'){
		$('#tid input').not($('#tid-all')).each(function(){
		    $(this).removeAttr('checked');
		});
	    }
	    if($(this).attr('id') != 'tid-all'){
		$('#tid-all').removeAttr('checked');
	    }
	
	}
      //console.log($(this).attr('checked') + $(this).attr('id'));
    });

});
