var news = new function(){
    var _this = this;
    this.init = function(){
        _this.initNewsButtons();
        _this.initNews();
    };
    
    this.initNewsButtons = function(){
        $('#newsbuttons li').click( _this.onNewsButtonClick );
        $('#news a').attr('target', '_blank');
        $('#news a').click( _this.onNewsClick );
        
    };
    
    this.initNews = function(){
        
    };
    
    this.onNewsButtonClick = function(){
        var topPosition = 0;
        var li = $(this);
        var pos_nr = li.attr('class').replace(/([^0-9]+)/g, '');
        pos_nr = parseInt(pos_nr);
        topPosition = (pos_nr-1) * (-45);
        $('#news li').animate({ top: topPosition + 'px' }, 1000);
    };
    
    this.onNewsClick = function(){
        var news_id = $(this).attr('class').replace(/([^0-9]+)/g, '')
        var news = siteData.newses[news_id];
        if (news.application_id)
        {
            akcesoria.showAppById(news.application_id);
            return false;
        }
        return true;
    };
}

$(news.init);
