/*
    ==================================================================================
    dsFrontEnd Plugin JS for view: show
    ==================================================================================
*/

function ConfirmDelete( del_href, del_text ) {
    
    var dialog_width = 300;
    var dialog_v_shift = 100;
    
    var win_h = $(window).height();
    var doc_h = $(document).height();
    var doc_w = $(document).width();
    
    var dialog_left = ( doc_w / 2 ) - ( dialog_width / 2 );
    var dialog_top = $(document).scrollTop() + ( win_h / 2 ) - dialog_v_shift;
    
    // Draw the Confirmation (still hidden)
    $('body').append('<div id="dsfe-dark-alpha" style="display: none;"><div id="dsfe-confirm-delete"><p>' + del_text + '</p><a id="dsfe-cancel-delete" class="button" href="#">Abbrechen</a><a id="dsfe-confirm-delete" class="button main" href="' + del_href + '">Löschen</a></div></div>');
    
    // Set the size of the alpha-mask
    $('#dsfe-dark-alpha').css( { 
        'height': doc_h,
        'width': "100%"
    });
    
    // Set position of the dialog-box
    
    
    $('div#dsfe-confirm-delete').css( { 
        'top': dialog_top,
        'left': dialog_left,
        'width': dialog_width + "px"
    });
    
    // Enable the cancel button
    $('#dsfe-cancel-delete').click( function() {
        $('div#dsfe-confirm-delete').fadeOut("fast");
        $('#dsfe-dark-alpha').fadeOut("fast");
        $('#dsfe-dark-alpha').remove();
        return false;
    });
    
    // Display the dialog
    $('#dsfe-dark-alpha').fadeIn("fast");
    
}
