$(document).ready(function () {

    //Buttony:
    $('#newAccountButton').click(function () { $.prettyPhoto.open('http://www.uo-cl.com/register/?iframe=true&width=100%&height=100%', 'Rejestracja'); });
    $('#teamSpeakButton').click(function () { document.location.href = '/pl/team_speak.html'; });
    $('#autoMapButton').click(function () { document.location.href = '/pl/uo_auto_map.html'; });

    //TopLists:
    $('#topList_Left').click(function () { window.open('http://uo.toplista.pl/?we=uores'); });
    $('#topList_Right').click(function () { window.open('http://ultima.top-100.pl/?we=uores'); });

    //Menu:
    $('#leftMenu li a.red').each(function () {
        $(this).parent().addClass('highlighted');
    });
    $('#rightMenu li a.red').each(function () {
        $(this).parent().addClass('highlighted');
    });

    $('#leftMenu a').focus(function () { $(this).blur(); });
    $('#rightMenu a').focus(function () { $(this).blur(); });

    //InLine Images Zoom
    $("a[rel^='lightbox']").prettyPhoto();

    //Animation
    if ($('#topAnimation')) {
        swfobject.embedSWF("img/animation.swf", "topAnimation", "869", "356", "9.0.0", "expressInstall.swf", {}, { wmode: 'transparent' }, {});
    }

    //Status:
    $.post("/status.html", { mode: "ajax" },
        function (_data) {
	    var data = _data;
            $('#statusDescription').fadeOut('fast', function () {
                if ( data['is_status']) {
                    $('#statusDescription').html(data['code']);
                    switch (data['status']) {
                        case 'UP':
                            $('#statusLogo_UP').fadeIn('fast');
                            break;
                        case 'RESTART':
                            $('#statusLogo_RESTART').fadeIn('fast');
                            break;
                        case 'DOWN':
                            $('#statusLogo_DOWN').fadeIn('fast');
                            break;
                    }
                    $('#statusDescription').fadeIn('fast');
                }
                else {
                    $('#statusDescription').html('Brak danych..');
                    $('#statusDescription').fadeIn('fast');
                }
            });
        });


}); 
