﻿// JScript File
//var JsonCompany = eval ('('+ JsonDataCompany + ')') ;
//var datarefHO = new Array(), datarefHA = new Array(), datarefUPCOM = new Array();
//$.ajax({
//    type: "GET",
//    url: "/DesktopModules/AG.StockChart/StockChartIndex.ashx?index=HO&fileName=ref",
//    async: false,
//    success: function(result) {
//        datarefHO = result.split('|');
//    }
//})
//$.ajax({
//    type: "GET",
//    url: "/DesktopModules/AG.StockChart/StockChartIndex.ashx?index=HA&fileName=ref",
//    async: false,
//    success: function(result) {
//        datarefHA = result.split('|');
//    }
//})
//$.ajax({
//    type: "GET",
//    url: "/DesktopModules/AG.StockChart/StockChartIndex.ashx?index=UPCOM&fileName=ref",
//    async: false,
//    success: function(result) {
//        datarefUPCOM = result.split('|');
//    }
//})

var ListStock_TimeOut;
var iNumberItem;
var arListStock;
var ListStock;

function   runSearch() {
    loadjsCS('includeJs', '/DesktopModules/AG.Company_Search/SymbolCompany.ashx');
    loadjsCS("includeJs", "/DesktopModules/AG.Company_Search/ListStockCare.aspx?type=Load&Data=", function() { });
}

function loadjsCS(Name, url, func) {
    $.ajax({
        url: url,
        async: false,
        cache: true,
        success: function(data) {
            $('#' + Name).append('<script>' + data + '</script>');
        }
    });
};


$(document).ready(function() {
InfomationListSymbol();
    runSearch();
})


var checkSearch = 'SearchSymbol';

function changeSearch(obj) {
    checkSearch = obj.value;
    if (checkSearch == 'SearchSymbol') {
        document.getElementById('NiemYet_Company_txtIndex').style.display = 'none';
        document.getElementById('NiemYet_Company_txtCompany').style.display = '';
    }
    if (checkSearch == 'SearchIndex') {
        document.getElementById('NiemYet_Company_txtCompany').style.display = 'none';
        document.getElementById('NiemYet_Company_txtIndex').style.display = '';
    }
    if (checkSearch == 'SearchFullText') {
        document.location.href = 'http://' + location.host + '/tabid/223/default.aspx';
    }
};

$('#NiemYet_Company_txtCompany').ready(function() {
    
    if ($.cookie('symbol') != null && $.cookie('symbol') != '-1') {
        document.getElementById('NiemYet_Company_txtCompany').value = $.cookie('symbol');
    }
    else
        document.getElementById('NiemYet_Company_txtCompany').value = 'Tìm kiếm...';
    try {

        $('#NiemYet_Company_txtCompany').autocomplete(JsonCompany, {
            minChars: 0,
            width: 310,
            matchContains: false,
            autoFill: false,
            formatItem: function(row, i, max) {
                return row.S + " - [" + row.CN + "]";
            },
            formatMatch: function(row, i, max) {
                return row.S + " - " + row.CN;
            },
            formatResult: function(row) {
                return row.S;
            }
        });
    }
    catch (Error) {
    }
    $('#NiemYet_Company_txtIndex').keypress(function(e) {
        if (e.which == 13) {
            var key;
            if (window.event)
                key = window.event.keyCode; //IE
            else
                key = e.which; //firefox     
            if (key == 13) {
                var value = $('#NiemYet_Company_txtIndex').val();
                if (checkSearch == 'SearchIndex') {
                    location.href = 'http://' + location.host + '/tabid/222/default.aspx?key=' + value;
                }
            }
            return (key != 13);
        }
    });
    $('#NiemYet_Company_txtCompany').keypress(function(e) {
        if (e.which == 13) {
            var key;
            if (window.event)
                key = window.event.keyCode; //IE
            else
                key = e.which; //firefox     
            if (key == 13) {
                var value = $('#NiemYet_Company_txtCompany').val();
                if (checkSearch == 'SearchSymbol') {
                    LinkToPageBySymbol(value);
                }
            }
            return (key != 13);
        }
    });
});

function LoadDataSymbol() {    
    var value = $('#NiemYet_Company_txtCompany').val();
        if (checkSearch == 'SearchSymbol') {
            value = value.toUpperCase();
            LinkToPageBySymbol(value);
        }
        else if (checkSearch == 'SearchIndex') {
	value = $('#NiemYet_Company_txtIndex').val();
        location.href = 'http://' + location.host + '/tabid/222/default.aspx?key=' + value;
//        alert('click tim kiem');
    }
    return false;
};

function LinkToPageBySymbol(value) {
    for (var i = 0; i < JsonCompany.length; i++) {
        if (JsonCompany[i].S == value) {
            var strPage = $.cookie('page');
            var idTemplate = ''; var template = $.cookie('Template');
            if (JsonCompany[i].Fo == '3') {
                idTemplate = '1';
                $.cookie('Template', 'ChuaNiemYet');
            }
            else if (JsonCompany[i].Fo == '4') {
                idTemplate = '4';
                $.cookie('Template', 'UPCOM');            
            }
            else if (JsonCompany[i].CT == '3') {
                idTemplate = '3';
                $.cookie('Template', 'TraiPhieu');
            }
            else {
                idTemplate = '2';
                $.cookie('Template', 'NiemYet');
            }
            var strUrl = document.location.host;
            if (idTemplate == '1') {
                if (strPage != null && template == $.cookie('Template')) {
                    location.href = 'http://' + strUrl + '/tabid/102/Symbol/' + value + '/Page/' + strPage + '/default.aspx';
                    
                 }
                 else location.href = 'http://' + strUrl + '/tabid/102/Symbol/' + value + '/default.aspx'; 
            };
            if (idTemplate == '2') {
                if (strPage != null && template == $.cookie('Template')) {
                    location = 'http://' + strUrl + '/tabid/101/Symbol/' + value + '/Page/' + strPage + '/default.aspx';
                    return false;
                }
                else location.href = 'http://' + strUrl + '/tabid/101/Symbol/' + value + '/default.aspx'; 
            };
            if (idTemplate == '3') {
                if (strPage != null && template == $.cookie('Template')) {
                    location.href = 'http://' + strUrl + '/tabid/103/Symbol/' + value + '/Page/' + strPage + '/default.aspx'; 
                }
                else location.href = 'http://' + strUrl + '/tabid/103/Symbol/' + value + '/default.aspx';
            };
            if (idTemplate == '4') {
                if (strPage != null && template == $.cookie('Template')) {
                    location.href = 'http://' + strUrl + '/tabid/382/Symbol/' + value + '/Page/' + strPage + '/default.aspx';
                }
                else location.href = 'http://' + strUrl + '/tabid/382/Symbol/' + value + '/default.aspx';
            }
            break;
        }
    }
    return false;    
};


var cookies = '';
function IsSymbolCompany(value) {
    //    alert('kiểm tra mã CK');
    //alert(cookies.indexOf(""));
    var Data = $.cookie('SymbolS');
    if (Data.indexOf(value) != -1) {
        for (var i = 0; i < JsonCompany.length; i++) {
            if (JsonCompany[i].S == value) {
                if (JsonCompany[i].CT == '2' || JsonCompany[i].CT == '5') {
                    return true;
                }
            }
        }
    }
    return false;
};
function addValueSymbol() {
    var value = $('#NiemYet_Company_txtCompany').val().toUpperCase();

    /***hieu viet them( day maCk cho co phieu toi quan tam)****/

    if ($.cookie('SymbolS') != null)
        cookies = $.cookie('SymbolS');
    else
        cookies = "";
    if (cookies != "") {
     // neu ma nay da ton tai thi khong cong vao nua  els thi them vao
        var CheckData = cookies.split(",");
        var checkSum = false;
        var i  = 0;
        for (var i = 0; i < CheckData.length; i++)
         {if (CheckData[i] == value)
                 checkSum = true;       
         }
        if ( checkSum ==  false)
            cookies = cookies + "," + value;    
    }
    else
        cookies = value;
    $.cookie('SymbolS', cookies);
    /**** end ***/
    if (IsSymbolCompany(value) ) {
        AGBB.loadjs("includeJs", "/DesktopModules/AG.Company_Search/ListStockCare.aspx?type=Add&Data=" + cookies, function() { });
        AddMyFavorite(cookies);  
    }
    else {
        $('#NiemYet_Company_txtCompany').val('');
        if ($.browser.msie) event.returnValue = false; else return false;
    }
    //    alert('Nhập cổ phiếu tôi quan tâm');
};

function eraseSymbol(value) {
    if (value != null && value!= '') {
        AGBB.loadjs("includeJs", "/DesktopModules/AG.Company_Search/ListStockCare.aspx?type=Remove&Data=" + value, function() { });

    }
};

setInterval("InfomationListSymbol()",300000);
function InfomationListSymbol() {
    var ListC = "";
    if ($.cookie('SymbolS') != null && $.cookie('SymbolS') != "")
        ListC = $.cookie('SymbolS');
    else
        ListC = "";    
    $('#TilteListStockCare').hide();
    clearTimeout(ListStock_TimeOut);
        var Url = "/DesktopModules/AG.Company_Search/Backend/GetInfoListStockCare.ashx?Symbol=" + ListC + "&&Floor=";
        if (ListC != '') {
            $('#TilteListStockCare').ready(function() {
                GetData(Url);
              // alert("url    :" + Url);
            })
        }
        else {
            $('#ListStockCare').html('Thông tin về mã CK sẽ hiển thị khi bạn Click dấu "+" mã CK trong hộp tìm kiếm.');
            $('#ListStockCare').show();
            $('#ListStockCare1').hide();
            $('#ListStockCare2').hide();
            $('#TilteListStockCare').hide();
            clearTimeout(ListStock_TimeOut);
        }
   
};
var color;
function GetData(Url) {
    var tabid = AGBB.request("tabid","");
    $.ajax({
        type: "GET",
        url: Url,
        dataType: "json",
        success: function(result) {
            if (tabid == "129") {
                var htmlOut = '<table width="260px" border="0" cellpading="0" cellspacing="0"  style="border-top:solid 1px #4A4A4A;border-right:solid 1px #4A4A4A;">';
                htmlOut += '<tr><td width="60px" height="27px" class="txtSymbolFavoriteHeaded">Mã</td><td width="70px" height="27px"class="txtSymbolFavoriteHeaded">Giá khớp</td>';
                htmlOut += '<td width="110px" height="27px" class="txtSymbolFavoriteHeaded">Tổng KL khớp</td>';
                htmlOut += '<td width="90px" height="27px" class="txtSymbolFavoriteHeaded">Thay đổi</td><td class="txtSymbolFavoriteHeaded" width="50px" height="27px">&nbsp;</td></tr>';
                for (var i = 0; i < result.StockData.length; i++) {
                    var temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                    color = temp.substr(0, temp.indexOf(';'));
                    temp = temp.substr(temp.indexOf(';') + 1, 1);
                    htmlOut += '<tr><td height="20px" class="txtSymbolFavoriteC" style="color:' + color + '"><a class="aStockSymbol" style="color:' + color + '" href="http://' + location.host + '/tabid/101/default.aspx#' + result.StockData[i].Symbol + ',NiemYet_Default">';
                    htmlOut += result.StockData[i].Symbol;
                    htmlOut += '</a>' + temp;
                    htmlOut += '</td>';
                    temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                    color = temp.substr(0, temp.indexOf(';'));
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                    htmlOut += result.StockData[i].FinishPrice;
                    htmlOut += '</td>';
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                    htmlOut += formatNumber_input_decimal_format(result.StockData[i].TotalShare, 0);
                    htmlOut += '</td>';
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                    htmlOut += formatNumber_input_decimal_format(result.StockData[i].Diff, 1);
                    htmlOut += '</td>';
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteC">';
                    htmlOut += "<a title='Xóa cổ phiếu' href=\"javascript:void(0)\" onclick=\"eraseSymbol('" + result.StockData[i].Symbol + "');\" style=\"color:#FFFFFF\">-</a>";
                    htmlOut += '</td></tr>';
                }
                htmlOut += '</table>';
                $('#ListStockCare').html(htmlOut);
                $('#ListStockCare').show();
                $('#ListStockCare1').hide();
                $('#ListStockCare2').hide();
                $('#TilteListStockCare').hide();
            }
            else if (tabid == "67" || tabid == "") {
                var htmlOut = '<div style="width:250px;"><div style="width:120px;text-align:left;font-weight:bold;padding-left:10px;" class="txtSymbolFavoriteL" >Mã CK</div><div class="txtSymbolFavoriteL"style="width:60px; font-weight:bold">Giá khớp</div><div class="txtSymbolFavoriteL" style="width:60px;font-weight:bold">Thay đổi</div></div>';
                htmlOut += '<div class="clear"></div>';
                for (var i = 0; i < result.StockData.length; i++) {
                    var temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                    color = temp.substr(0, temp.indexOf(';'));
                    htmlOut += '<div style="width:250px;border-top:solid 1px #4A4A4A;margin-top:5px;pading-top:5px;">';
                    htmlOut += '<div style="width:120px;text-align:left;font-weight:bold;padding-left:10px;" class="txtSymbolFavoriteL"><a class="aStockSymbol" style="color:' + color + ';" href="http://' + location.host + '/tabid/101/default.aspx#' + result.StockData[i].Symbol + ',NiemYet_Default">' + result.StockData[i].Symbol + '</a></div>';
                    htmlOut += '<div class="txtSymbolFavoriteL" style="width:60px;color:' + color + ';">' + result.StockData[i].FinishPrice + '</div>';
                    htmlOut += '<div class="txtSymbolFavoriteL" style="width:60px;color:' + color + ';">' + formatNumber_input_decimal_format(result.StockData[i].DiffRate, 2) + '%' + '</div>';
                    htmlOut += '</div>';
                    htmlOut += '<div class="clear"></div>';
                    htmlOut += '<div style="width:250px;" id="newSymbolFavorite_' + result.StockData[i].Symbol + '"></div>';
                    htmlOut += '<div class="clear"></div>';
                    AddMyFavorite(result.StockData[i].Symbol);
                }
                $('#ListStockCare').html(htmlOut);
                $('#ListStockCare').show();
                $('#ListStockCare1').hide();
                $('#ListStockCare2').hide();
                $('#TilteListStockCare').hide();
            }
            else {
                var iCurrentItem = 0;
                var htmlOut = '<table width="295px" border="0" cellpading="0" cellspacing="0" style="border-top:solid 1px #4A4A4A;border-right:solid 1px #4A4A4A;">';
                htmlOut += '<tr><td width="60" height="27px" class="txtSymbolFavoriteHeaded">Mã</td><td width="70px" height="27px"class="txtSymbolFavoriteHeaded">Giá khớp</td>';
                htmlOut += '<td width="110px" height="27px" class="txtSymbolFavoriteHeaded">Tổng KL khớp</td>';
                htmlOut += '<td width="90px" height="27px" class="txtSymbolFavoriteHeaded">Thay đổi</td><td class="txtSymbolFavoriteHeaded" width="50px" height="27px">&nbsp;</td></tr>';
                for (var i = 0; i < result.StockData.length && i <= 5; i++) {
                    iCurrentItem = i;
                    if (iCurrentItem == 5) break;
                    var temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                    color = temp.substr(0, temp.indexOf(';'));
                    temp = temp.substr(temp.indexOf(';') + 1, 1);
                    htmlOut += '<tr><td height="20px" class="txtSymbolFavoriteC" style="color:' + color + '"><a class="aStockSymbol" style="color:' + color + '"  href="http://' + location.host + '/tabid/101/default.aspx#' + result.StockData[i].Symbol + ',NiemYet_Default">';
                    htmlOut += result.StockData[i].Symbol;
                    htmlOut += '</a>' + temp;
                    htmlOut += '</td>';
                    temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                    color = temp.substr(0, temp.indexOf(';'));
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                    htmlOut += result.StockData[i].FinishPrice;
                    htmlOut += '</td>';
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                    htmlOut += formatNumber_input_decimal_format(result.StockData[i].TotalShare, 0);
                    htmlOut += '</td>';
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                    htmlOut += formatNumber_input_decimal_format(result.StockData[i].Diff, 1);
                    htmlOut += '</td>';
                    htmlOut += '<td height="20px" class="txtSymbolFavoriteC">';
                    htmlOut += "<a title='Xóa cổ phiếu' href=\"javascript:void(0)\" onclick=\"eraseSymbol('" + result.StockData[i].Symbol + "');\" style=\"color:#FFFFFF\">-</a>";
                    htmlOut += '</td></tr>';
                    $('#ListStockCare2').hide();
                }
                htmlOut += '</table>';
                if (iCurrentItem == 5) {
                    var htmlOut1 = '<table width="295px" border="0" cellpading="0" cellspacing="0" style="border-top:solid 1px #4A4A4A;border-right:solid 1px #4A4A4A;">';
                    htmlOut1 += '<tr><td width="60" height="27px" class="txtSymbolFavoriteHeaded">Mã</td><td width="70px" height="27px"class="txtSymbolFavoriteHeaded">Giá khớp</td>';
                    htmlOut1 += '<td width="110px" height="27px" class="txtSymbolFavoriteHeaded">Tổng KL khớp</td>';
                    htmlOut1 += '<td width="90px" height="27px" class="txtSymbolFavoriteHeaded">Thay đổi</td><td class="txtSymbolFavoriteHeaded" width="50px" height="27px">&nbsp;</td></tr>';
                    for (var i = 5; i < result.StockData.length; i++) {
                        var temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                        color = temp.substr(0, temp.indexOf(';'));
                        temp = temp.substr(temp.indexOf(';') + 1, 1);
                        htmlOut1 += '<tr><td height="20px" class="txtSymbolFavoriteC" style="color:' + color + '"><a class="aStockSymbol" style="color:' + color + '"  href="http://' + location.host + '/tabid/101/default.aspx#' + result.StockData[i].Symbol + ',NiemYet_Default">';
                        htmlOut1 += result.StockData[i].Symbol;
                        htmlOut1 += '</a>' + temp;
                        htmlOut1 += '</td>';
                        temp = ChangeImage(result.StockData[i].Symbol, result.StockData[i].FinishPrice);
                        color = temp.substr(0, temp.indexOf(';'));
                        htmlOut1 += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                        htmlOut1 += result.StockData[i].FinishPrice;
                        htmlOut1 += '</td>';
                        htmlOut1 += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                        htmlOut1 += formatNumber_input_decimal_format(result.StockData[i].TotalShare, 0);
                        htmlOut1 += '</td>';
                        htmlOut1 += '<td height="20px" class="txtSymbolFavoriteR" style="color:' + color + '">';
                        htmlOut1 += formatNumber_input_decimal_format(result.StockData[i].Diff, 1);
                        htmlOut1 += '</td>';
                        htmlOut1 += '<td height="20px" class="txtSymbolFavoriteC">';
                        htmlOut1 += "<a title='Xóa cổ phiếu' href=\"javascript:void(0)\" onclick=\"eraseSymbol('" + result.StockData[i].Symbol + "');\" style=\"color:#FFFFFF\">-</a>";
                        htmlOut1 += '</td></tr>';

                    }
                    htmlOut1 += '</table>';
                    $('#ListStockCare2').html(htmlOut1);
                    $('#ListStockCare2').show();
                }
                $('#ListStockCare').hide();
                $('#ListStockCare1').html(htmlOut);
                $('#ListStockCare1').show();
                $('#TilteListStockCare').show();
            }
        },
        error: function displayError(request, errorType, errorThrown) {
            try {
                if (errorType == 'timeout') {
                }
                if (errorType == 'error') {
                }
            }
            catch (err) {
            }
        }
    });
    //ListStock_TimeOut = setTimeout("GetData('" + Url + "')", 20000);
};

function ChangeImage(sSymbol,iValue) {
    var dataPrice = getPriceRealTimeIndex(sSymbol);
    var ValueTemp = parseFloat(iValue);
    try{
        if (ValueTemp == parseFloat(dataPrice[1])) {
            if (ValueTemp < parseFloat(dataPrice[3])) {
            return '#FF33FF;▼';
        }
        else if (ValueTemp == parseFloat(dataPrice[3])) {
        return '#FF33FF;■';
        }
        else {
            return '#FF33FF;▲';
        }
    }
    else if (ValueTemp == parseFloat(dataPrice[2])) {
    if (ValueTemp < parseFloat(dataPrice[3])) {
            return '#66CCFF;▼';
        }
        else if (ValueTemp == parseFloat(dataPrice[3])) {
        return '#66CCFF;■';
        }
        else {
            return '#66CCFF;▲';
        }
    }
    else {
        if (ValueTemp < parseFloat(dataPrice[3])) {
            return '#FF3333;▼';
        }
        else if (ValueTemp == parseFloat(dataPrice[3])) {
        return '#F7FF31;■';
        }
        else {
            return '#00FF00;▲';
        }
    }
    }
    catch (err) {
        return '#F7FF31;■';
    }
};

function getPriceRealTimeIndex(value) {
    var result = new Array();
    for (var i = 0; i < datarefHO.length; i++) {
        if (-1 != datarefHO[i].indexOf(value)) {
            result = datarefHO[i].split(';');
            return result;
        }
    }
    for (var i = 0; i < datarefHA.length; i++) {
        if (-1 != datarefHA[i].indexOf(value)) {
            result = datarefHA[i].split(';');
            return result;
        }
    }
    for (var i = 0; i < datarefUPCOM.length; i++) {
        if (-1 != datarefUPCOM[i].indexOf(value)) {
            result = datarefUPCOM[i].split(';');
            return result;
        }
    }
};
function SubString(current_str, position) {
    var cL = current_str.length;

    var tem;
    //neu nho hon
    if (position < cL) {
        tem = current_str.substring(0, position);
        var pos = tem.lastIndexOf(' ');

        var kaka = tem.substring(0, pos);
        return kaka + '...';

    }
    else {
        return current_str;
    }
};
$(document).ready(function() {
    if ($.cookie('SymbolS') != "" && $.cookie('SymbolS') != null)
        AddMyFavorite($.cookie('SymbolS'));
})


//A();
//function A() {
//    alert(1);
//    $.ajax({
//        url: "/DesktopModules/AG.Company_Search/New.txt",
//        async: false,
//        cache: true,
//        success: function(data) {
//       // var le = $(data).find("It").length;
//        var json = $.xml2json(data);

//        alert(json.Articles.It[1].);
//        }
//    });
//}



function AddMyFavorite(symbol) {
if (symbol.toString().length > 0) {
    var Url = '/DesktopModules/AG.Company_Search/CompanySearch_CoPhieuToiQuanTam_Hander.ashx?SetOfSymbol=' + symbol;
    var content = '';
 
    $.ajax({
        type: "GET",
        url: Url,
        dataType: "xml",
        success: function(result) {
            var totalfor = 10;
            if ($(result).find("It").length < 10) {
                totalfor = $(result).find("It").length;
            }
            if ($(result).find("It").length > 0) {
                // alert($(result).find("It[id=\"0\"]").find("T").text().length);
                content += "<div class=\"AL_CPTQT\"><span  style='color:#fff; font-weight:bold'>Tin cổ phiếu tôi quan tâm</span></div><div class=\"clear\"";
            }
            //alert(result);
            for (i = 1; i <= totalfor; i++) {
                if (i == 1) {
                }
                var date1 = new Date($(result).find("It[id=\"" + i + "\"]").find("D").text());
                //     alert(date1 + $(result).find("It[id=\"" + i + "\"]").find("D").text());
                var month;

                content += "<div class='WCPTQT'><div class='CPTQG_Date'>";
                content += DateUtils.ConvertStringToDayMonthYear(date1) + '&nbsp;|&nbsp;' + DateUtils.ConvertStringToHourMinus(date1);
                content += "</div><div class='CPTQT_Title'><a class='M_N_OTC_TQT' style='color:#fff; font-weight:bold;'  href=\"javascript:AGBB.TinTucCoPhieuToiQuanTamR.goToDetail(\'/tabid/88/default.aspx\',\'";
                content += $(result).find("It[id=\"" + i + "\"]").find("P").text();
                content += "','";
                content += $(result).find("It[id=\"" + i + "\"]").find("Id").text();
                content += "')\">";
                content += "<div class='CPTQG_Source'>";
                content += $(result).find("It[id=\"" + i + "\"]").find("S").text();
                content += "</div>";
                content += $(result).find("It[id=\"" + i + "\"]").find("T").text();
                content += "</a></div></div>";
            }
            content += "<div class='divCPTQT'><a href='/tabid/129/Default.aspx' class='nextCPTQT'>Xem tiếp...</a></div><div class='clear'></div>";
            $("#TinTucCoPhieuToiQuanTamContent").html('');
            $("#TinTucCoPhieuToiQuanTamContent").html(content);
        }
    })
    }
}


