//$(window).unload( function () { alert("Bye now!"); } );

$(document).ready(function(){

    // Admin - editable fields - jquery.jeditable.js
    // source: http://www.appelsiini.net/projects/jeditable
//    $('.document_caption').editable($(this).siblings('.control.edit').attr('href'), {
//         //type      : 'textarea',
//         cancel    : 'Cancel',
//         submit    : 'OK',
//         indicator : '<img src="public/images/indicator.gif" alt="Working..." />',
//         tooltip   : 'Click to edit display name of this document'
//     });

    $('.control.edit').click(function() {
        $(this).prev(".document_caption").click();
        return false;
    });


    $('.link').hover(
        function(){
            $(this).removeClass('link');
            $(this).addClass('link-hover');
        },
        function(){
            $(this).removeClass('link-hover');
            $(this).addClass('link');
    });

    $('.not_implemented').click(function(){
        alert("This function is not implemented yet.");
        return false;
    });
    $('.remove.confirm').click(function(){
        return confirm('Are you sure you want to delete this item?');
    });

    // Tooltip
    $('a, input, label').tooltip({
        delay: 0,
        track: true,
        showURL: false,
        showBody: "; "
    });

    $('select').linkselect({
        format:function(source, args){
        //return $.trim(args['value']);
        }
    });

    

});

