$(document).ready(function(){
    $(".collapsebtn").click(function(){
        var itra = $(this).data('itra');
        $('.main_div_'+itra+'').fadeToggle( "slow", "linear" );
        if($('#icon',this).hasClass('glyphicon glyphicon-minus icon')){
            $('#icon',this).removeClass('glyphicon glyphicon-minus icon');
            $('#icon',this).addClass('glyphicon glyphicon-plus icon');
        }else{
            $('#icon',this).removeClass('glyphicon glyphicon-plus icon');
            $('#icon',this).addClass('glyphicon glyphicon-minus icon');
        }
    });

    $(".collapsegovernment").click(function(){
        $('.governmentDiv').fadeToggle( "slow", "linear" );
        if($('#icon',this).hasClass('glyphicon glyphicon-minus icon')){
            $('#icon',this).removeClass('glyphicon glyphicon-minus icon');
            $('#icon',this).addClass('glyphicon glyphicon-plus icon');
        }else{
            $('#icon',this).removeClass('glyphicon glyphicon-plus icon');
            $('#icon',this).addClass('glyphicon glyphicon-minus icon');
        }
    });
    
    $(".collapsegovernmentbtn").click(function(){
        var itra = $(this).data('itra');
        $('.container_div_'+itra+'').fadeToggle( "slow", "linear" );
        if($('#icon',this).hasClass('glyphicon glyphicon-minus icon')){
            $('#icon',this).removeClass('glyphicon glyphicon-minus icon');
            $('#icon',this).addClass('glyphicon glyphicon-plus icon');
        }else{
            $('#icon',this).removeClass('glyphicon glyphicon-plus icon');
            $('#icon',this).addClass('glyphicon glyphicon-minus icon');
        }
    });
    
    $('#governmentid').select2().change(function(){
        var selval = $(this).val();
        if(selval != '-1' && selval != '-2'){
            $('.areadiv').show();
        }else{
            $('.areadiv').hide();
        }

    });
});