function handleMoreNews(text_first_news) {
    $('#ShowMoreNews').click(function(){
        $('.OneNewsBox').removeClass('Hidden');
        $('#FirstNews').html(text_first_news);
        $(this).hide();
        return false;
    });
}

function handleLiveSearch() {
    $("#search").keypress(function() {
        var typing_text = this.value;
        if (typing_text.length >= 2) {
            jQuery('#jquery-live-search-example input[name="text"]').liveSearch({url: '/search_ajax' + '?text='});
        }
    });
}
function handleFoundElement() {
    $(".found_element").click(function() {
        $('#search').attr('value', (this.innerHTML));
        $('#search_ajax').hide();
        $('.jSLSearchBoxFormOptionInput').val(0);
        $('#form_program_search').submit();
    });
}

function updateDownloads(program_id, path) {    
    $("#loading").show();
    $.ajax({
      url: "/program/update_uploads/" + program_id + "/" ,
      dataType: 'json'
      })    
      .success(function(data){
        if (data['already_updated']) {
            $("#loading").hide();
            document.location = "/programs/" + path; 
        }
      })
      .error(function() {
      });
}

function showNews(news_id, data, button_id) {
    $("#"+news_id).html( data );
    $("#"+button_id).hide();    
}
