$('#swimlane0step4buffermedium').droppable({
    accept      : "div",
    tolerance   : "pointer",
    hoverClass  : "dragdrop"
});

$('#swimlane0step4buffermedium').on("drop", function(e, ui){
    var id = "";
    idstate = ui.draggable.attr("id");
    [swimlane, id, stepno, steprole, state, original_priority, severity, special, release_no] = idstate.split('###');
    $('#swimlane0step4buffermedium').html('<img src="/images/ajax-loader.gif">').load('/kanban/dropped_on_step_priority', {swimlane_no:'0', step_no:'4', step_role:'buffer', priority:'medium', doc_id:id});
    if (special === 'expedite') {
        $('#swimlane'+swimlane+'step'+stepno+steprole+special).html('<img src="/images/ajax-loader.gif">').load('/kanban/step_'+steprole+'_'+special, {swimlane_no:swimlane, step_no:stepno});
    } else {
        $('#swimlane'+swimlane+'step'+stepno+steprole+original_priority).html('<img src="/images/ajax-loader.gif">').load('/kanban/step_'+steprole+'_'+original_priority, {swimlane_no:swimlane, step_no:stepno});
    }
});

$('#togglestep4buffer').click(function() {
    if (($('#swimlane0step4buffermedium').is(':visible')) || ($('#swimlane0step4bufferall').is(':visible'))) {
        $('#step4bufferentrycriteria').hide();
        $('#swimlane0step4bufferexpedite').hide();
        $('#swimlane0step4bufferall').hide();
        $('#swimlane0step4buffercritical').hide();
        $('#swimlane0step4bufferhigh').hide();
        $('#swimlane0step4buffermedium').hide();
        $('#swimlane0step4bufferlow').hide();
        $('#swimlane0step4bufferpull').hide();
        $('#swimlane0step4bufferwaiting').hide();
        $('#swimlane0step4bufferblocked').hide();
        $('#swimlane0step4bufferdeferred').hide();
        $('#swimlane0step4bufferghosted').hide();
        $('#step4bufferexitcriteria').hide();
        $('#togglestep4buffer').val('Show');
    } else {
        $('#step4bufferentrycriteria').show();
        $('#swimlane0step4bufferexpedite').show();
        $('#swimlane0step4bufferall').show();
        $('#swimlane0step4buffercritical').show();
        $('#swimlane0step4bufferhigh').show();
        $('#swimlane0step4buffermedium').show();
        $('#swimlane0step4bufferlow').show();
        $('#swimlane0step4bufferpull').show();
        $('#swimlane0step4bufferwaiting').show();
        $('#swimlane0step4bufferblocked').show();
        $('#swimlane0step4bufferdeferred').show();
        $('#swimlane0step4bufferghosted').show();
        $('#step4bufferexitcriteria').show();
        $('#togglestep4buffer').val('Hide');
    }
});