$(document).ready(
            function()
            {
                renderBoxes();
                
                //$("form").bind("click keydown", function() { 
                //    $(this).expose({maskId:"mask",api:true}).load();
                //});
                
                //setTimeout("blink()", 3000);
                
                //replaceToAjax();
                
                $('#VoteLinks').find('a').addClass('noVote').click(function(){
                    var voteEl = this;
                    if ($(this).hasClass('noVote') || $(this).hasClass('doneVote')) {
                            return false;
                    } else {
                            $(voteEl).find('img').css('border-color','#FF6600');
                            setTimeout(function() {
                                    if ($('#VoteLinks').find('.noVote').length > 0) {
                                            $('#VoteLinks').find('.noVote:first').removeClass('noVote').find('img').fadeTo('slow', 1);
                                    } else {
                                            $('#VoteForm').find('.submit').attr('disabled','');
                                            $('#VoteForm').slideDown();
                                    }
                                    $(voteEl).addClass('doneVote').find('img').css('border-color', '#74C200');
                            },10000);
                            }
                    }).find('img').fadeTo(0, 0.3);
                    $('#VoteLinks').find('a:first').removeClass('noVote').find('img').fadeTo('slow', 1);
                    $('#VoteForm').submit(function() {
                            $('#VoteForm').find('.submit').attr('disabled','disabled');
                            $.getJSON("/vote-for-server-help-to-grow&format=json&callback=?",
                                    {'l2acc': $('#l2_acc').val(),'l2char': $('#l2_char').val(), 'l2server': $('#l2_server').val()},
                            function(data){
                              if ( data ){
                                            if ( data.response ) {
                                                    if ( data.hide ) {
                                                            $('#VoteForm').html('<div class="Status">'+data.response+'</div>');
                                                    } else {
                                                            $('#VoteForm').find('.Status').html( data.response );
                                                            $('#VoteForm').find('.submit').attr('disabled','');
                                                    }
                                            }
                                      }
                            }
                            );
                            return false;
                    });
            }
        );
        
        function renderBoxes()
        {
            $(".box").hide();
            setTimeout("fadeInClanky()",500);
        }
        
        function replaceToAjax()
        {
            $("#page a").click(function(){
                $.ajax({
                    url: $(this).attr("href"),
                    data: "ajax=true",
                    cache: false,
                    success: function(html){
                        $("#page").html(html);
                        renderBoxes();
                        replaceToAjax();
                    }
                });
                return false;
            });
        }
        
        function blink()
        {
            $("#left img").fadeTo("slow", 0.5);
            $("#left img").fadeTo("slow", 1);
            setTimeout("blink()", 1000);
        }
        
        function fadeInHead()
        {
            $("#head").fadeIn("slow");
            $("#middle").fadeIn("slow");
        }
        function fadeInTop()
        {
            $("#top_menu").fadeIn("fast");
            $("#top_panel").fadeIn("slow");
        }
        function fadeInPage()
        {
            $("#left").slideDown("slow");
            $("#page").slideDown("slow");
        }
        function fadeInClanky()
        {
            $(".box").slideDown("slow");
        }