<!--

$(document).ready(function()
{
    /**
    *
    */
    $(document.body).fadeIn(1000);

    $('#notification').fadeIn(3*1000);
    $('#notification').fadeOut(30*1000);

    $('a').click(function() {
        if ('true' != $(this).attr('rel'))
        {
            return false;
        }
    });

    /**
    *
    $('body ').keypress(function(event) {
        if (event.keyCode == '83') {
            alert('hello');
        }
    });
    */



    /**
    *
    */
    $.fn.clickMenu.setDefaults({arrowSrc:'http://kenys.net/public/kenys.net/default/img/icon/16/go-next.png'});
    $('menu#system').clickMenu();
    $('menu#systray').clickMenu();



    /**
    * datepicker
    */
    $('#datepicker').datepicker({
        showWeek: true,
        firstDay: 1,
        showAnim: 'slideDown',
        dateFormat: 'D, d. M yy',
        gotoCurrent: true,
        changeMonth: true,
        changeYear: true,
    });



    /**
    * datetime
    *
    $(function()
    {
        //~ value = $('#datepicker').attr('rel') + 60;
        //~ $('#datepicker').attr('value', value);
    });
    */



    /**
    * Load buddylist
    */
    $('#buddies').click(function()
    {
        $('#buddielist').load('member_buddy');
    });



    /**
    * Load weather
    */
    $(function()
    {
        $.get('weather/do/show/icon', function(show)
        {
            $('#weather').css('background-image', 'url(http://kenys.net/public/kenys.net/default/img/icon/24/weather/' + show + ')');
            $('#condition').css('background-image', 'url(http://kenys.net/public/kenys.net/default/img/icon/24/weather/' + show + ')');
        });

        $('#temperature').load('weather/do/show/temp_c');

        $('#temperature').hover(function()
        {
            $('#temperature').load('weather/do/show/temp_c');
            $('#condition').load('weather/do/show/condition');
            $('#wind_condition').load('weather/do/show/wind_condition');
            $('#humidity').load('weather/do/show/humidity');
        });
    });



    /**
    * show search
    */
    $('#search').click(function() {
        $('#query').show().focus();
        return false;
    });
    /**
    * hide search
    */
    $('#query').blur(function() {
        $('#query').hide();
        return false;
    });
    /**
    * autocomplete search
    * todo: aus der db laden
    */
    var availableTags = ["Andrej", "dito", "Paul", "Peter", "Pumuckl", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "java"];
    $('#query').autocomplete({
        source: availableTags,
    });



    /**
    * Windows
    */
    $.fx.speeds._default = 600;
    $(function() {
        $('div.window').dialog({
            autoOpen: false,
            show: 'shake',
            hide: 'explode',
        });

        // fenster markieren
        $('div.window').parent().click(function() {
            $('div.window').removeClass('ui-dialog-content-active');
            $(this).find('div.window').addClass('ui-dialog-content-active');
            return false;
        });

        // folder
        $('a.folder').dblclick(function() {
            id = $(this).attr('href');
//          id = $(this).find('span').text();
            $('#' + id).dialog('open').dialog({
                title: id,
            });
            return false;
        });
    });



    /**
    * Login dialog
    */
    $('#login').dialog({
        autoOpen: true,
        show: 'shake',
        hide: 'explode',
        modal: true,
    });



    /**
    * change online status / authentication
    */
    $(function() {
        $('#member_onlinestatus a').click(function() {
            // prüfen ob dem link gefolgt werden soll
            if ('false' == $(this).attr('rel'))
            {
                // status ändern
                $.get(this.href);
                // status abfragen
                $.get('member/onlinestatus/get/status', function(onlinestatus)
                {
                    // anzeige aktualisieren
                    $('#onlinestatus').css('background-image', 'url(http://kenys.net/public/kenys.net/default/img/icon/24/user-' + onlinestatus + '.png)');
                });
                // status deaktivieren
                $('#member_onlinestatus li').removeClass('active');
                // aktuellen status aktivieren
                $(this).parents('li').addClass('active');

                return false;
            }
        });
    });

});

-->

