﻿var furl = "/AjaxHandler.ashx"; //the url for processing ajax request

$(function() {
    $.ajax({
        type: "POST",
        url: furl,
        data: {
            type: "GetDialogNewsHtml"
        },
        dataType: "text",
        success: function(data) {
            $("#news_content").html(data);
            $('#news_content .news_list').prepend(getNewsItem());

            $('#news_content .news_item .learn_more a').click(function() {
                _gaq.push(['_trackEvent', 'Browsers', 'Learn More', 'News', 0]);
            });

            $('#news_content .view_all_news a').click(function() {
                _gaq.push(['_trackEvent', 'Browsers', 'View All News', 'Button', 0]);
            });

        },
        error: function(xhr, err, e) {
            //do nothing
        }
    });
});

function getNewsItem() {
    var item = $('#newsItem').html();
    if (item == '' || item == null)
        return "";

    var html = '<div class="news_item first_news_item">';
    html += item;
    html += '</div>';

    return html;
}
