var adk = {

    status: {
        
        init: function() {
            
            $('body').append($('<div />').attr({'id':'bg'}).append($('<img />').attr('src','/status/bg.jpg').load(function(){
                $('#bg').append(this);
                $(this).data('width',$(this).width());
                $(this).data('height',$(this).height());
                adk.status.recenter();
            })));
            $('body').append($('<div />').attr({'id':'wrap'}).css({'display':'none'}).append($('<div />').attr({'id':'tweets'}).text('Loading Updates...')));
            $('#wrap').append($('<div />').attr({'id':'links'}));
            $('#links').append($('<a />').attr({'id':'surfstation','href':'http://surfstation.com','title':'Surfstation','target':'_blank'}));
            $('#links').append($('<a />').attr({'id':'stolen','href':'http://stolen.la','title':'Stolen','target':'_blank'}));
            //$('#links').append($('<a />').attr({'id':'dropsite','href':'http://dropsite.com','title':'Dropsite','target':'_blank'}));
            //$('#links').append($('<a />').attr({'id':'stolenshirts','href':'http://stolenshirts.com','title':'Stolen Shirts','target':'_blank'}));
            
            this.recenter();
            
            getTwitters('tweets', { 
                id: 'jcinis', 
                count: 5, 
                enableLinks: true, 
                ignoreReplies: true, 
                clearContents: true,
                template: '%text% <a class="datetime" href="http://twitter.com/%user_screen_name%/statuses/%id%/">%time%</a>'
            });
            
            $('#wrap').show('fast');
            
            this.analytics();
        },
        
        analytics: function() {
            
            // google
            _uacct = "UA-442803-3";
            urchinTracker();
            
            // reinvigorate
            re_("2m07m-7nrp9p8x19");
            
        },
        
        recenter: function() {
            $('#wrap').css({'margin-top': Math.floor(($(window).height() / 2)) - 350 });
            $('#bg').css({ 'width':$(window).width()+'px', 'height':$(window).height()+'px'})
            if($('#bg img').length) {
                
                var img = $('#bg img');
                
                if($(window).width() * $(img).data('height') / $(img).data('width') > $(window).height()) {
                    $(img).css('width', $(window).width()+'px');
                    $(img).css('height', Math.round($(window).width() * $(img).data('height') / $(img).data('width'))+'px');
                    $(img).css('left','0px');
                    $(img).css('top', ($(window).height() - parseInt($(img).css('height'))) / 2 + 'px');
                } else {
                    $(img).css('height', $(window).height()+'px');
                    $(img).css('width', Math.round($(window).height() * $(img).data('width') / $(img).data('height'))+'px');
                    $(img).css('top','0px');
                    $(img).css('left', ($(window).width() - parseInt($(img).css('width'))) / 2 + 'px');                    
                }
            }
        }
    }
}

