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

$('#swimlane0step2buffermedium').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('###');
    $('#swimlane0step2buffermedium').html('<img src="/images/ajax-loader.gif">').load('/kanban/dropped_on_step_priority', {swimlane_no:'0', step_no:'2', 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});
    }
});

$('#togglestep2buffer').click(function() {
    if (($('#swimlane0step2buffermedium').is(':visible')) || ($('#swimlane0step2bufferall').is(':visible'))) {
        $('#step2bufferentrycriteria').hide();
        $('#swimlane0step2bufferexpedite').hide();
        $('#swimlane0step2bufferall').hide();
        $('#swimlane0step2buffercritical').hide();
        $('#swimlane0step2bufferhigh').hide();
        $('#swimlane0step2buffermedium').hide();
        $('#swimlane0step2bufferlow').hide();
        $('#swimlane0step2bufferpull').hide();
        $('#swimlane0step2bufferwaiting').hide();
        $('#swimlane0step2bufferblocked').hide();
        $('#swimlane0step2bufferdeferred').hide();
        $('#swimlane0step2bufferghosted').hide();
        $('#step2bufferexitcriteria').hide();
        $('#togglestep2buffer').val('Show');
    } else {
        $('#step2bufferentrycriteria').show();
        $('#swimlane0step2bufferexpedite').show();
        $('#swimlane0step2bufferall').show();
        $('#swimlane0step2buffercritical').show();
        $('#swimlane0step2bufferhigh').show();
        $('#swimlane0step2buffermedium').show();
        $('#swimlane0step2bufferlow').show();
        $('#swimlane0step2bufferpull').show();
        $('#swimlane0step2bufferwaiting').show();
        $('#swimlane0step2bufferblocked').show();
        $('#swimlane0step2bufferdeferred').show();
        $('#swimlane0step2bufferghosted').show();
        $('#step2bufferexitcriteria').show();
        $('#togglestep2buffer').val('Hide');
    }
});