$(document).ready(function()
{
        /* ------ || @box links || -------- */

    var activeLinks = $('ul.links').find('a');
    activeLinks.attr("target", "_blank");        
        
      /* -------- || @global || ------- */  

	var nb_error = $('.error').size();
    var nb_ok = $('.ok').size();

    delMessage = function() {
        if( nb_error != 0 ) {
            $('.error').fadeOut('slow');
        } else if(nb_ok != 0 ) {
            $('.ok').fadeOut('fast');
        }
    }
    setTimeout(delMessage, 2500);

	    /* -------- || @LOGIN || ------------   */

    var loginBox = $('#login');
    //var closeBoxAction = function() { }

    loginBox.dialog({
        bgiframe: true,
        autoOpen: false,
        width: 250,
        minHeight: 100,
        maxWidth: 400,
        modal: true,
        resizable: false,
        draggable: false
        //close: function( event, ui) { closeBoxAction(); }
    });

    $('.login').click(function(){
        loginBox.dialog('open');
    });

        /*  ------- || @ARCHIVES || ---------	*/

    var fileFirstLvl = $('ul.lvl_1');
    var fileSecondLvl = $('ul.lvl_2');

    var expandLvl1 = $('li.folder').children('a');
    var expandLvl2 = $('li.folder_lvl1').children('a');

    expandLvl1.toggle(function() {

        $(this).next(fileFirstLvl).hide('fast');
        $(this).children('img').attr({src: '_media/images/design/archives/arrow_right.png'});
        return false;
    }, function() {
        $(this).next(fileFirstLvl).show('fast');
        $(this).children('img').attr({src: '_media/images/design/archives/arrow_down.png'});
        return false;
    });

    expandLvl2.toggle(function() {
        $(this).next(fileSecondLvl).hide('fast');
        $(this).children('img').attr({src: '_media/images/design/archives/arrow_right.png'});
        return false;
    }, function() {
        $(this).next(fileSecondLvl).show('fast');
        $(this).children('img').attr({src: '_media/images/design/archives/arrow_down.png'});
        return false;
    });

}); // ready end

