/**
 * Mở links trên localhsot
**/

function share_twitter() {u = location.href;t = document.title;window.open("http://twitter.com/home?status=" + encodeURIComponent(u));}
function share_facebook() {u = location.href;t = document.title;window.open("http://www.facebook.com/share.php?u=" + encodeURIComponent(u) + "&t=" + encodeURIComponent(t));}
function share_google() {u = location.href;t = document.title;window.open("http://www.google.com/bookmarks/mark?op=edit&bkmk=" + encodeURIComponent(u) + "&title=" + t + "&annotation=" + t);}

function share_buzz() {u = location.href;t = document.title;window.open("http://buzz.yahoo.com/buzz?publisherurn=DanTri&targetUrl=" + encodeURIComponent(u));}if (!DanTri_NewsWidgetCollection)
{
    var DanTri_NewsWidgetCollection = Array();
}
function DantriShowWidget(giao_dien,dantri_chuyen_de,loai_box_nhung,so_luong_tin,chieu_rong,chieu_cao,kieu_hien_thi)
{
    var widgetIndex = 0;
    if (DanTri_NewsWidgetCollection.length > 0)
    {
        while (DanTri_NewsWidgetCollection[widgetIndex])
        {
            widgetIndex++;
        }
    }
    DanTri_NewsWidgetCollection[widgetIndex] = new DanTri_NewsWidget(widgetIndex);
    DanTri_NewsWidgetCollection[widgetIndex].UpdateWidget('news', giao_dien, dantri_chuyen_de, loai_box_nhung, so_luong_tin, chieu_rong, chieu_cao, 0, kieu_hien_thi, '', '');
}


function goPage(fileName)
{
	location.href = fileName;
}

function setAsHomePage(i)
{	
	if (document.all) {
		i.style.behavior='url(#default#homepage)';
		i.setHomePage('http://chuyennhahongphuong.com/');
	}	
}

/* JQUERY HIDE/SHOW BOX */
function HideBox(){
    $('#divError').slideUp();
}  

function ShowBox(){
    $('#divError').slideDown();
}

function onlyNumbers(evt) {
	var e = evt
	if(window.event){ // IE
		var charCode = e.keyCode;
	} else if (e.which) { // Safari 4, Firefox 3.0.4
		var charCode = e.which
	}
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	return false;
	return true;
}

//Change values scroll bar DIV
    function focus_search_keyword(e)
    {
        if ( e.value == strEnterKey )
        {
            e.value = '';
            return false;
        }
    }
    function Moveout_text(e)
    {
        if ( e.value == '')
        {
            e.value = strEnterKey;
            return false;
        }
    }
    
    function Enterkey()
    {
        var strKey    = strFindKey;
        if(strKey=='')
        {
            document.adminForm.keyword.value = strEnterKey;
        }
        else
        {
            document.adminForm.keyword.value = strKey;
        }
    }
    
    function Check_search()
    {
        var txtSearch = document.adminForm.keyword.value;
        
        if ( txtSearch == strEnterKey || txtSearch == "")
        {
            alert(strErrorKey);
            document.adminForm.keyword.focus();
            return false;
        }
        return true;
    }
    
    function checkForgot()
    {
        var txtEmail = document.frmForgot.txtEmail.value;
        var txtCode  = document.frmForgot.txtCode.value;
        
        //Empty
        if (txtEmail == "")
        {
            alert(strEmail_empty);
            document.frmForgot.txtEmail.focus();
            return false;
        }
        
        //Contruction Empty
        if (emailCheck(txtEmail) == false)
        {
            alert(strEmail);
            document.frmForgot.txtEmail.focus();
            return false;
        }
        
        //Empty code
        if (txtCode == "")
        {
            alert(strCode);
            document.frmForgot.txtCode.focus();
            return false;
        }                 
        return true;
    }
    
        
    function checkReg()
    {
        var msgbox = "";
        var txtHoten = Trim(document.frmReg.txtHoTen.value);
        var txtEmail = Trim(document.frmReg.txtEmail.value);
        var txtPhone = Trim(document.frmReg.txtPhone.value);
        
        var txtAdd   = Trim(document.frmReg.txtAddress.value);
        var txtUi    = Trim(document.frmReg.txtUser.value);
        var txtPass  = Trim(document.frmReg.txtPass.value);
        var txtRepas = Trim(document.frmReg.txtRepass.value);
        var txtCode  = Trim(document.frmReg.txtCode.value);
        
        //Empty
        if (txtHoten == "")
        {
            msgbox += "+ Bạn chưa nhập Họ và tên!\n";
        }
        
        
        //Empty
        if (txtEmail == "")
        {
            msgbox += "+ Bạn chưa nhập Email!\n";
        }
        
        //Contruction Empty
        if (emailCheck(txtEmail) == false)
        {
            msgbox += "+ Cấu trúc Email không chính xác, xin vui lòng kiểm tra lại!\n";
        }
          
        //Phone
        if (txtPhone == "")
        {
            msgbox += "+ Bạn chưa nhập Số điện thoại!\n";
        }
        
        //MobilePhone
        if (txtMobilePhone == "")
        {
            msgbox += "+ Bạn chưa nhập Số điện thoại di động!\n";
        }
        
        //Địa chỉ
        if (txtAdd == "")
        {
            msgbox += "+ Bạn chưa nhập Địa chỉ!\n";
        }
                
        //Tên đăng nhập
        if (txtUi == "")
        {
            msgbox += "+ Bạn chưa nhập Tên đăng nhập!\n";
        }   
        
        var varUi    = document.frmReg.txtUser.value.length;
        var varPass  = document.frmReg.txtPass.value.length;
        var varRepas = document.frmReg.txtRepass.value.length;
        
        //Tên đăng nhập <6 ký tự
        if (varUi <=5)
        {
            msgbox += "+ [Tên đăng nhập] phải nhập 6 ký tự trở lên!\n";
        }
        if (varPass <=5)
        {
            msgbox += "+ [Mật khẩu] phải nhập 6 ký tự trở lên!\n";
        }
        if (varRepas <=5)
        {
            msgbox += "+ [Xác nhận mật khẩu] phải nhập 6 ký tự trở lên!\n";
        }
                
        if(document.frmReg.txtPass.value != document.frmReg.txtRepass.value)
        {
            msgbox += "+ [Mật khẩu] và [Xác nhận mật khẩu] chua trùng khớp!\n";
        }
        
        //Ma xac minh
        if (txtCode == "")
        {
            msgbox += "+ Bạn chưa nhập Mã bảo vệ!\n";
        }          

        if (msgbox != '')
        {
            alert("Các lỗi sau được tìm thấy:\n\n"+msgbox);
            return false
        }              
        return true;
    }
    
    function checkContact()
    {
        var msgbox = "";
        var txtHoten = Trim(document.frmReg.txtHoTen.value);
		var txtAdd   = Trim(document.frmReg.txtDiaChi.value);
		var txtPhone = Trim(document.frmReg.txtDienThoai.value);
		var txtMobiPhone = Trim(document.frmReg.txtDiDong.value);
        var txtEmail = Trim(document.frmReg.txtEmail.value);
        var txtCode  = Trim(document.frmReg.txtCode.value);
		var txtContent  = Trim(document.frmReg.txtNoiDung.value);

        
        //Empty
        if (txtHoten == "")
        {
            msgbox += "+ Bạn chưa nhập Họ và tên!\n";
        }

        //MobilePhone
        if (txtMobiPhone == "")
        {
            msgbox += "+ Bạn chưa nhập Số điện thoại di động!\n";
        }
        
        //Empty
        if (txtEmail == "")
        {
            msgbox += "+ Bạn chưa nhập Email!\n";
        }
        
        //Contruction Empty
        if (emailCheck(txtEmail) == false)
        {
            msgbox += "+ Cấu trúc Email không chính xác, xin vui lòng kiểm tra lại!\n";
        }
           
          //Empty
        if (txtContent == "")
        {
            msgbox += "+ Bạn chưa nhập Nội dung!\n";
        }     
        //Ma xac minh
        if (txtCode == "")
        {
            msgbox += "+ Bạn chưa nhập Mã bảo vệ!\n";
        }          

        if (msgbox != '')
        {
            alert("Các lỗi sau được tìm thấy:\n\n"+msgbox);
            return false
        }              
        return true;
    }    
        
//BEGIN
function changeScrollBar(objId, direct)
{
	var curScrollPos = getObjectById(objId).scrollTop
	getObjectById(objId).scrollTop = curScrollPos + 20*(direct);
	return;
}

function getObjectById(id) 
{
	var obj = null;
	if( document.getElementById )
		obj = document.getElementById( id );
	else if( document.all )
		obj = document.all[id];
	else
		obj = document.layer[id];
	return obj;
}


/**
* Thực hiện submit để thực thi những function khác nhau
**/
function submitbutton(pressbutton) {
	submitform(pressbutton);
}

/**
* Submit form adminForm
**/
function submitform(pressbutton){
	if (pressbutton) {
		document.frmCat.cmd.value=pressbutton;
	}
	document.frmCat.submit();
}

function addToFavorite()
{
	var pageTitle = document.title;
	var pageUrl = location.href;
	window.external.addFavorite(pageUrl, pageTitle);
}

function show_popup_info(duongdan,pid,c_rong,c_cao)
{
	window.open( duongdan + pid,"my_new_window","location: yes, status=no, menubar=yes ,scrollbars=yes, resizable=yes, copyhistory=yes, width="+ c_rong +", height="+c_cao);
	return false;
}

function submitSearch(){
    document.searchForm.cmd.click();
}

function emailCheck (emailStr) {
	
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		return false
	}
	
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) {
    	return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
		  	if (IPArray[i]>255) {
		  		return false
		  	}
		}
	   return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		return false
	}

	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {
   	return false
	}

	if (len<2) {
	   return false
	}
	
	return true;
}


function go(form) 
{
	var URL = form.selectmenu.value;
	if ( URL != "")
	{
		window.open(URL, '_blank');
		return false;
	}
	else
		return false;
}

function AdFindObjectID(idName)
{
	return document.getElementById(idName);
}
function AdFindObjectName(strName)
{
	return document.getElementsByName(strName);
}

function DanTri_NewsWidget(widgetIndex)
{
    this.newshost = '';
    this.imagehost = '';
    this.host = '';
    this.base_folder = '/www/';
    this.script_object = null;
    this.widget_index = widgetIndex;
    this.query_string = '';
    this.ga_utm = '';
    this.update_elementid = '';
    this.symbol = '';
    this.widget = 'news';
    this.template = 'red';  /* template mac dinh */
    this.category = 31;     /* chuyen muc duoc chon */
    this.news_type = 0;     /* loai box nhung */
    this.display_count = 5; /* so luong ban ghi duoc hien thi ra */
    this.width = 250;       /* chieu rong cua box nhung */
    this.height = 320;      /* chieu cao cua box nhung */
    this.border = true;     /* cho phep hien border cua box nhung */
    this.display_type = 1;  /* 0:Title only; 1:Title+Description; 2:Title+Image+Description */
    this.UpdateWidget = function(widget, layout, category, type, count, width, height, border, display, symbol, updateto)
    {
        this.widget = widget;
        this.template = layout; /* Thuc hien chuyen giao dien cho moi box nhung */
        this.category = parseInt(category);
        this.news_type = parseInt(type);
        this.display_count = parseInt(count);
        this.width = parseInt(width);
        this.height = parseInt(height);
        this.border = (border == 1);
        this.display_type = parseInt(display);
        this.symbol = symbol;
        this.update_elementid = updateto;
        
        this.InitTemplate();
        this.RequestWidget();
    }
    
    this.InitTemplate = function()
    {
        var layout = '';
        var init_template = this.template;
        if(this.news_type ==2)
        {
            layout += '<table cellpadding="0" cellspacing="0" style="width:310px"><tr><td>';
            layout += '     <div class="DanTri_Widget_ListContainer" style="padding-left:2px">';
            layout += '    	    <div class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
            layout += '</td></tr></table>';
        }
        else if(init_template == 10 && this.news_type == 3)
        {
            layout += '     <div class="DanTri_Widget_ListContainer" align="center">';
            layout += '    	    <div style="width:300px;text-align:left;" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 15 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:310px;text-align:left" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 16 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:' + this.width + 'px;text-align:left" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }   
        else if(init_template == 17 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:' + this.width + 'px;text-align:left" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 18 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:' + this.width + 'px;text-align:left;float:left;padding-left:4px" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 19 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:' + this.width + 'px;text-align:left;float:left;padding-left:4px" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 20 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:' + this.width + 'px;text-align:left;float:left;padding-left:4px;" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 21 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:' + this.width + 'px;text-align:left;float:left;padding-left:4px" class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 22 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 23 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 24 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 25 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 26 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 27 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 28 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 29 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 30 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 31 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 32 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 33 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 34 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 34 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 35 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(init_template == 36 && this.news_type == 3)
        {
            layout += '     <div>';
            layout += '    	    <div style="width:300px;text-align:left;padding-left:5px;" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
        }
        else if(this.display_count == 3 && this.news_type == 3)
        {
            if(init_template == 8)
            {
                layout += '<table cellpadding="0" cellspacing="0" width="308px"><tr><td>';
                layout += '     <div class="DanTri_Widget_ListContainer" style="">';
                layout += '    	    <div class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
                layout += '         </div>';
                layout += '     </div>';
                layout += '</td></tr></table>';
            }
            else if(init_template == 1 || init_template == 2)
            {   
                layout += '<div style="padding-left:2px">';
                layout += '<table cellpadding="0" cellspacing="0" width="150" style="background-image:url(' + this.base_folder + 'images/dantri_template/giaitri_bg_top1.jpg);background-repeat:no-repeat;background-position:top"><tr><td style="height:5px; font-size:1px"></td></tr></table><table cellpadding="0" cellspacing="0" width="150" style="background-image:url(' + this.base_folder + 'images/dantri_template/giaitri_bg_main1.jpg); background-repeat:repeat-y;"><tr><td style="padding-left:3px">';
                layout += '     <div class="DanTri_Widget_ListContainer">';
                layout += '    	    <div class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
                layout += '         </div>';
                layout += '     </div>';
                layout += '</td></tr></table><table cellpadding="0" cellspacing="0" width="150" style="background-image:url(' + this.base_folder + 'images/dantri_template/giaitri_bg_bot1.jpg); background-repeat:no-repeat; background-position:bottom"><tr><td style="height:5px; font-size:1px"></td></tr></table>';
                layout += '</div>';
            }
            else
            {   
                layout += '<div style="padding-left:2px">';
                layout += '<table cellpadding="0" cellspacing="0" width="308" style="background-image:url(' + this.base_folder + 'images/dantri_template/main_temp_bg_top.jpg);background-repeat:no-repeat;background-position:top"><tr><td style="height:5px; font-size:1px"></td></tr></table><table cellpadding="0" cellspacing="0" width="308" style="background-image:url(' + this.base_folder + 'images/dantri_template/main_temp_bg2.jpg); background-repeat:repeat-y;"><tr><td style="padding-left:3px">';
                layout += '     <div class="DanTri_Widget_ListContainer">';
                layout += '    	    <div class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
                layout += '         </div>';
                layout += '     </div>';
                layout += '</td></tr></table><table cellpadding="0" cellspacing="0" width="308" style="background-image:url(' + this.base_folder + 'images/dantri_template/main_temp_bg_bot1.jpg); background-repeat:no-repeat; background-position:bottom"><tr><td style="height:5px; font-size:1px"></td></tr></table>';
                layout += '</div>';
            }                        
        }
        else if(init_template == 9 && this.news_type == 3)
        {
            
            layout += '<div style="padding-left:2px;overflow:hidden;" class="widget-neo-tieudiem">';
            layout += '<h3>' + this.symbol + '</h3>';
            layout += '<table cellpadding="0" cellspacing="0" style="width:308px; background-image:url(' + this.base_folder + 'images/dantri_template/main_temp_bg_top.jpg);background-repeat:no-repeat;background-position:top"><tr><td style="height:5px; font-size:1px"></td></tr></table><table cellpadding="0" cellspacing="0" width="308" style="background-image:url(' + this.base_folder + 'images/dantri_template/main_temp_bg2.jpg); background-repeat:repeat-y;"><tr><td style="padding-left:3px">';
            layout += '     <div class="DanTri_Widget_ListContainer" align="center">';
            layout += '    	    <div class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '" style="text-align:left;margin-left:10px; margin-bottom:8px;">';
            layout += '         </div>';
            layout += '     </div>';
            layout += '</td></tr></table><table cellpadding="0" cellspacing="0" style="width:308px; background-image:url(' + this.base_folder + 'images/dantri_template/main_temp_bg_bot1.jpg); background-repeat:no-repeat; background-position:bottom"><tr><td style="height:5px; font-size:1px"></td></tr></table>';
            layout += '</div>';
        }
        else
        {
            layout += '<table style="border:solid 1px #CCCCCC; width: ' + this.width + 'px; height: ' + this.height + 'px;" cellpadding="0" cellspacing="0">';
            layout += '    <tr><td>';
            layout += '    <div class="dantri-neo-tdcontent-widget">';
            layout += '     <div class="DanTri_Widget_ListContainer" style="height: ' + (this.height - 10) + 'px;">';
            layout += '    	    <div class="DanTri_Widget_NewsList" id="DanTri_Widget_NewsList' + this.widget_index + '">';
            layout += '         </div>';
            layout += '     </div>';
            layout += '     </div>';
            layout += '    </td></tr>';
            layout += '</table>';
        }
        
        if (this.update_elementid && this.update_elementid != '')
        {
            var updateElement = document.getElementById(this.update_elementid);
            
            if (updateElement)
            {
                updateElement.innerHTML = layout;
            }
        }
        else
        {
            document.write(layout);
        }
    }
   
    this.OnLoaded = function(data, widget)
    {
        var json = eval(data);
        
        var items,liveScoreItems;
        items = json.NewsItems;
        liveScoreItems = json.LiveScoreItems;
        var newsList = '';
        var liveScoreList = '';
        if(items != null && items.length > 0)
        {
            for (var i = 0; i < items.length; i++)
            {
                if(this.display_count == 3 && this.template==1 && this.news_type == 3)
                {
                    if(i==0)
                    {
						var thumb = items[i].Image.replace("_50.","_130.");
                        newsList += '<div class="temp_div1"><table cellpadding="0" cellspacing="0" width="100%" style="background-image:url(' + this.base_folder + 'images/dantri_template/tem13_bg1.jpg); background-repeat:repeat-x; background-position:bottom"><tr><td>';
                        newsList += '<div class="temp_div2"></div>';
                        
                        newsList += '<div class="temp_div3 p_t_8" align="center">';
                        newsList += '   <div style="width:134px">';
                        newsList += '	    <a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                        newsList += '		    <img style="border:solid 1px #ccc;padding:1px" align="left" alt="' + items[i].Title + '" src="' + thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].NormalImage + '\');"' + ' />';
                        newsList += '	    </a>';
                        newsList += '   </div>';
                        newsList += '</div>';
                        newsList += '<div class="temp_div3" style="padding-bottom:7px">';
                        newsList += '<div class="temp_div5">';
                        newsList += '   <a class="temp1_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '</div>';
                        newsList += '</div>';
                    }
                    else
                    {
                        newsList += '<div class="temp_div3">';
                        newsList += '    <div class="temp_div4 p_t_3">';
                        newsList += '       <img alt="" src="' + this.base_folder + 'images/dantri_template/chamvuong_1.gif" style="border:0px;padding-bottom:2px" />&nbsp;<a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '    </div>';
                        newsList += '</div>';
                    }
                    if(i==2) 
                    {    
                        newsList +='</td></tr><tr><td class="h_10"></td></tr></table></div>';
                    }
                    
                }
                else if(this.display_count == 3 && this.template==2 && this.news_type == 3)
                {
                    if(i==0)
                    {
						var thumb = items[i].Image.replace("_50.","_130.");
                        newsList += '<div class="temp_div1"><table cellpadding="0" cellspacing="0" width="100%" style="background-image:url(' + this.base_folder + 'images/dantri_template/tem13_bg1.jpg); background-repeat:repeat-x; background-position:bottom"><tr><td>';
                        newsList += '<div class="temp2_div2"></div>';
                        
                        newsList += '<div class="temp_div3 p_t_8" align="center">';
                        newsList += '   <div style="width:135px">';
                        newsList += '	    <a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                        newsList += '		    <img style="border:solid 1px #ccc;padding:1px" align="left" alt="' + items[i].Title + '" src="' + thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].NormalImage + '\');"' + ' />';
                        newsList += '	    </a>';
                        newsList += '   </div>';
                        newsList += '</div>';
                        newsList += '<div class="temp_div3" style="padding-bottom:7px">';
                        newsList += '<div class="temp_div5">';
                        newsList += '   <a class="temp1_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '</div>';
                        newsList += '</div>';
                    }
                    else
                    {
                        newsList += '<div class="temp_div3">';
                        newsList += '    <div class="temp_div4 p_t_3">';
                        newsList += '       <img alt="" src="' + this.base_folder + 'images/dantri_template/chamvuong_1.gif" style="border:0px;padding-bottom:2px" />&nbsp;<a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '    </div>';
                        newsList += '</div>';
                    }
                    if(i==2) newsList +='</td></tr><tr><td class="h_10"></td></tr></table></div>';
                }
                else if(this.display_count == 3 && this.template==3 && this.news_type == 3)
                {
                    if(i==0)
                    {
						var thumb = items[i].Image.replace("_50.","_279.");
                        newsList += '<div class="temp3_div1"><table cellpadding="0" cellspacing="0" width="100%" style="background-image:url(' + this.base_folder + 'images/dantri_template/tem13_bg1.jpg); background-repeat:repeat-x; background-position:bottom"><tr><td>';
                        newsList += '<div class="temp3_div2"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp3/temp3_header.jpg" style="border:0px" /></div>';
                        
                        newsList += '<div class="temp3_div2 p_t_8" align="center">';
                        newsList += '   <div style="width:280px">';
                        newsList += '	    <a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                        newsList += '		    <img style="border:0px" align="left" alt="' + items[i].Title + '" src="' + thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');"' + ' />';
                        newsList += '	    </a>';
                        newsList += '   </div>';
                        newsList += '</div>';
                        newsList += '<div class="temp3_div2" style="padding-bottom:7px">';
                        newsList += '<div class="temp3_div4">';
                        newsList += '   <a class="temp1_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '</div>';
                        newsList += '</div>';
                    }
                    else
                    {
                        newsList += '<div class="temp3_div2">';
                        newsList += '    <div class="temp3_div3 p_t_3">';
                        newsList += '       <img alt="" src="' + this.base_folder + 'images/dantri_template/chamvuong_1.gif" style="border:0px;padding-bottom:2px" />&nbsp;<a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '    </div>';
                        newsList += '</div>';
                    }
                    if(i==2) newsList +='</td></tr><tr><td class="h_10"></td></tr></table></div>';
                }
                else if(this.display_count == 3 && this.template==4 && this.news_type == 3)
                {
                    if(i==0)
                    {
                        newsList += '<div class="temp4_div1"><div class="temp4_div2"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp4/temp4_header.jpg" style="border:0px;padding:0px" /></div><div class="temp4_div2"><div style="border-left:solid 4px #fff; float:left; width:247px;height:146px; background-image:url(' + this.base_folder + 'images/dantri_template/temp4/temp4_body_bg3.jpg); background-repeat:repeat-x"><div class="dantri-temp4-des" style="float:left; width:242px"><ul>';
                        newsList += '        <li><a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Description + '</a></li>';
                        newsList += '    </ul>';
                        newsList += '</div>';
                        newsList += '<div class="dantri-cat-morenews" style="padding-top:6px;float:left; width:242px"><ul>';
                    }
                    else
                    {
                        newsList += '   <li><a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></li>';
                    }
                    if(i==2)
                    {
                        var endList = '</ul></div></div><div class="temp4_div4"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp4/temp4_body_2.jpg" style="border:0px;padding:0px" /></div></div><div class="temp4_div2"><div class="temp4_div5"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp4/temp4_fot_1.jpg" style="border:0px;padding:0px" /></div><div class="temp4_div6"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp4/temp4_fot_2.jpg" style="border:0px;padding:0px" /></div></div></div>';
                        newsList = newsList + endList;
                    }
                }
                else if(this.display_count == 3 && this.template==5 && this.news_type == 3)
                {
                    newsList += '<tr><td style="padding-left:30px;padding-top:3px;padding-right:6px"><img alt="" src="' + this.base_folder + 'images/dantri_template/chamvuong_3.gif" style="border:0px" />&nbsp;&nbsp;<a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></td></tr>';
                    if(i==2)
                    {
                        var startList = '<div class="temp5_div1"><div class="temp5_div2"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp5/temp5_header.jpg" style="border:0px" /></div><div class="temp5_div2"><table cellpadding="0" cellspacing="0" style="width:100%; padding-top:10px;background-image:url(' + this.base_folder + 'images/dantri_template/temp5/temp5_body_bg1.jpg); background-position:bottom; background-repeat:repeat-x">';
                        var endList = '<tr><td style="height:15px; font-size:1px"></td></tr></table></div></div>';
                        newsList = startList + newsList + endList;
                    }
                }
                else if(this.display_count == 3 && this.template==6 && this.news_type == 3)
                {
                    if(i==0)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList += '<div class="temp6_div1"><div class="temp6_div2" sytle="border:solid 1px red"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp6/chuyen_cua_toi.jpg" style="border:0px" /></div><div class="temp6_div2"><div style="padding-left:8px;float:left;width:290px"><div style="width:280px; border:solid 1px #ccc; float:left;margin:8px 0px 8px 0px"><div style="padding:2px;float:left; width:276px">';
                            newsList += '<div style="width:265px;height:107px; overflow:hidden;padding-top:8px; padding-left:9px;float:left; margin-left:1px; background-color:#EAEAEA">';
                            newsList += '<a class="temp_hot_title_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                            newsList += '<br />' + items[i].Description;
                            newsList += '</div></div></div></div><div class="temp6_div2"><table cellpadding="0" cellspacing="0" style="width:100%; background-image:url(' + this.base_folder + 'images/dantri_template/temp6/temp6_body_bg1.jpg); background-position:bottom; background-repeat:repeat-x">';
                        }
                        else
                        {
							var thumb = items[i].Image.replace("_50.","_115.");	
                            newsList += '<div class="temp6_div1"><div class="temp6_div2"><img alt="" src="' + this.base_folder + 'images/dantri_template/temp6/chuyen_cua_toi.jpg" style="border:0px" /></div><div class="temp6_div2"><div style="padding-left:8px;float:left;width:290px"><div style="width:280px; border:solid 1px #ccc; float:left;margin:8px 0px 8px 0px"><div style="padding:2px;float:left; width:276px"><div style="width:115px;float:left;">';
                            newsList += '	    <a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                            newsList += '<img style="width:115px;border:0px" align="left" alt="' + items[i].Title + '" src="' + thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].MediumImage + '\');"' + ' />';
                            newsList += '	    </a>';
                            newsList += '</div><div style="width:150px;height:107px; overflow:hidden;padding-top:8px; padding-left:9px;float:left; margin-left:1px; background-color:#EAEAEA">';
                            newsList += '<a class="temp_hot_title_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                            newsList += '<br />' + items[i].Description;
                            newsList += '</div></div></div></div><div class="temp6_div2"><table cellpadding="0" cellspacing="0" style="width:100%; background-image:url(' + this.base_folder + 'images/dantri_template/temp6/temp6_body_bg1.jpg); background-position:bottom; background-repeat:repeat-x">';
                        }
                    }
                    else
                    {
                        newsList += '<tr><td class="p_l_8 p_t_8" valign="top"><img alt="" src="'+ this.base_folder + 'images/dantri_template/chamvuong_1.gif" style="border:0px" /></td><td valign="top" class="p_l_8 p_t_3"><a class="temp1_small_link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></td></tr>';
                    }
                    if(i==2)
                    {
                        var endList = '<tr><td class="h_10"></td></tr></table></div></div><div class="temp6_div2"><img alt="" src="'+ this.base_folder + 'images/dantri_template/temp6/temp6_fotter_2.jpg" style="border:0px" /></div></div>';
                        newsList = newsList + endList;
                    }
                }
                else if(this.display_count == 3 && this.template==7 && this.news_type == 3) // Load box nhung video-clip
                {
                    if(i==0)
                    {
                        newsList += '<div style="overflow:hidden;width: 298px; height: 160px; border: solid 1px #CCCCCC; background-image: url(' + this.base_folder + '/images/dantri_template/videoclip/video-clip-bg1.jpg);background-position:top;background-repeat:repeat-x"><div style="margin: 5px 0px 0px 8px; overflow: hidden; font-size: 17px; font-weight: bold;text-transform: uppercase; color: #003866; font-family: Arial"><a href="http://dantri.com.vn/c26s221/videoclip/trang-1.htm" class="neo-video-title">VIDEO CLIP</a></div><div style="margin: 20px 10px 0px 10px; overflow: hidden"><div style="background-image: url('+ this.base_folder +'/images/dantri_template/videoclip/Untitled-1_r3_c4.jpg); float: left; width: 73px;height: 83px"></div><div style="float: left; margin-left: 5px;width:200px"><div style="overflow: hidden;float:left;width:200px"><div style="float: left;width:26px"><a href="' + this.newshost + items[i].Link + this.ga_utm + '"><img src="'+ this.base_folder +'/images/dantri_template/videoclip/Untitled-1_r3_c6.jpg" border="0" /></a></div><div style="float: left; margin-left: 5px;width:169px">';
                        newsList += '<a class="dantri-video-clip-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '</div></div>';
                    }
                    else
                    {
                        newsList += '<div style="overflow: hidden; padding-left: 10px; margin-top: 5px;float:left;width:200px"><div style="float: left;padding-top:3px;"><a href="' + this.newshost + items[i].Link + this.ga_utm + '"><img src="' + this.base_folder + '/images/dantri_template/videoclip/Untitled-1_r5_c7.jpg" border="0" /></a></div><div style="float: left; margin-left: 5px;width:190px"><a class="dantri-video-clip-title" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></div></div>';
                    }
                    if(i==2)
                    {
                        var endList = '</div></div></div>';
                        newsList = newsList + endList;
                    }
                }
                else if(this.display_count == 3 && this.template==8 && this.news_type == 3) // Load box nhung Hau truong san co
                {
                    if(i==0)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList += '<div class="neo-htsc"><h3><a href="http://dantri.com.vn/c26s657/hautruong/trang-1.htm" class="neo-htsc-title">Hậu trường sân cỏ</a></h3><div class="neo-htsccontent"><div class="neo-htsc-top"><div class="neo-htsc-bt">';
                            newsList += '<div class="htsc-title"><a class="" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></div><ul>';
                        }
                        else
                        {
							var thumb = items[i].Image.replace("_50.","_279.");							
                            newsList += '<div class="neo-htsc"><h3><a href="http://dantri.com.vn/c26s657/hautruong/trang-1.htm" class="neo-htsc-title">Hậu trường sân cỏ</a></h3><div class="neo-htsccontent"><div class="neo-htsc-top"><div class="neo-htsc-bt">';
                            newsList += '<div style="padding-left:5px;float:left;"><a class="" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '"><img style="border:0px" align="left" alt="' + items[i].Title + '" src="' + thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');"' + ' /></a></div>';
                            newsList += '<div class="htsc-title" style="float:left;width:270px"><a class="" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></div><ul style="float:left">';
                        }
                    }
                    else
                    {
                        newsList += '<li style="width:270px;"><a class="" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></li>';
                    }
                    if(i==2)
                    {
                        var endList = '</ul><div style="float:left;width:280px;">&nbsp;</div></div></div></div></div>';
                        newsList = newsList + endList;
                    }
                }
                else if(this.template==9 && this.news_type == 3) /* Load box tin tieu diem */
                {
                    if((i%2) == 0) /* Truong hop so le thi cho mau ne cua dong tin la trang */
                    {
                        newsList += '<table style="width:280px;" cellpadding="0" cellspacing="0"><tr><td class="dantri-neo-tdctodd dantriclearfix">'
                    }
                    else /* Truong hop so chan thi cho phep doi mau cua dong tin thay the */
                    {
                        newsList += '<table style="width:280px;" cellpadding="0" cellspacing="0"><tr><td style="background-color:#f2f8ff" class="dantri-neo-tdcteven dantriclearfix">'
                    }
                    if(this.display_type == 2) /* Cho phep hien thi ca tieu de va anh */
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        }
                        else
                        {
                            newsList +=    '<div class="dantri-neo-tdct-img">';
                            newsList +=    '	<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                            newsList +=    '		<img align="left" alt="' + items[i].Title + '" src="' + this.imagehost + items[i].Image + '"' + 'onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"' + ' />';
                            newsList +=    '	</a>';
                            newsList +=    '</div>';
                            newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        }
                    }
                    else /* Cho hien thi tieu de va mo ta */
                    {
                        newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '<br />' + items[i].Description;
                    }
                    newsList += '</table></tr></td>';
                }
                else if(this.display_count == 3 && this.template==10 && this.news_type == 3) // Load box nhung thong cao bao chi
                {
                    if(i==0)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList +='<div class="thongcaobc"><h3>Thông cáo báo chí</h3><div class="tcbc-content"><h4><a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></h4><div class="tcbc-info dantriclearfix"><div class="tcbc-text-noimage">' + items[i].Description + '</div></div></div><div style="float:left;width:200px;height:5px"></div></div>'
                        }
                        else
                        {
                            newsList +='<div class="thongcaobc"><h3>Thông cáo báo chí</h3><div class="tcbc-content"><h4><a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></h4><div class="tcbc-info dantriclearfix"><div class="tcbc-img"><a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '"><img align="left" alt="' + items[i].Title + '" src="' + this.imagehost + items[i].MediumImage + '"' + 'onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"' + ' /></a></div><div class="tcbc-text">' + items[i].Description + '</div></div></div><div style="float:left;width:200px;height:5px"></div></div>'
                        }
                    }
                    
                }
                else if(this.display_count == 3 && this.template==11 && this.news_type == 3) // Load box nhung teendep
                {
                    if(i==0)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList +='<div class="boxwrap"><div class="box-teendep"><h3>&nbsp;</h3><div class="box-td-content">';
                        }
                        else
                        {							
							var thumb = items[i].Image.replace("_50.","_279.");							
                            newsList +='<div class="boxwrap"><div class="box-teendep"><h3>&nbsp;</h3><div class="box-td-content"><a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '"><img alt="' + items[i].Title + '" src="' +  thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage  + '\');"' + ' width="274" /></a>';
                        }
                        newsList += '<h4 style="float:left; padding-top:5px;"><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></h4><ul>';
                    }
                    else
                    {
                        newsList += '<li><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></li>';
                    }
                    if(i==2)
                    {
                        newsList = newsList + '</ul></div></div></div>';
                    }
                }
                                
                else if(this.display_count == 3 && this.template==12 && this.news_type == 3) // Load box nhung chuyen cua nguoi tre
                {
                    if(i==0)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            //newsList +='<div class="boxwrap"><div class="box-teendep"><h3>&nbsp;</h3><div class="box-td-content">';
                            newsList +='<div class="boxwrap"><div class="box-nguoitre"><h3>&nbsp;</h3><div class="box-nt-content"><ul><li class="nt-first"><div class="nt-ftop clearfix"><div class="nt-fright-noimage">'
                            newsList += '<h4><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></h4>';
                            newsList += '<p>' + items[i].Description + '</p></div></div></li>';
                        }
                        else
                        {
							var thumb = items[i].Image.replace("_50.","_115.");
                            newsList +='<div class="boxwrap"><div class="box-nguoitre"><h3>&nbsp;</h3><div class="box-nt-content"><ul><li class="nt-first"><div class="nt-ftop clearfix">'
                            newsList +='<div class="nt-fleft"><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '"><img alt="' + items[i].Title + '" src="' + thumb + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].MediumImage + '\');"' + ' style="border:0px" /></a></div><div class="nt-fright">';
                            newsList += '<h4><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></h4>';
                            newsList += '<p>' + items[i].Description + '</p></div></div></li>';
                        }
                    }
                    else
                    {
                        newsList += '<li><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></li>';
                    }
                    if(i==2)
                    {
                        newsList = newsList + '</ul></div></div></div>';
                    }
                }
                
                else if(this.display_count == 3 && this.template==13 && this.news_type == 3) // Load box nhung: bac si tu van
                {
                    if(i==0)
                    {
                        newsList += '<div class="boxsk"><h3><span>Bác sĩ tư vấn</span></h3><div class="boxsk-bottom"><div class="cont-box clearfix"><p class="ct"><span><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Description + '</a></span></p><ul>';
                    }
                    else
                    {
                        newsList += '<li><a title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a></li>';
                    }
                    if(i==2)
                    {
                        newsList = newsList + '</ul><a href="javascript:void(0)" class="send"></a></div></div></div>';
                    }
                }
                else if (this.template == 14 && this.news_type == 3) // Load box nhung tin multimedia
                {
                    newsList = '<div class="box-mul" style="clear:left"><div class="box-mul-bt"><h3>Tin multimedia </h3><div class="box-cont"><ul><li class="clearfix"><div class="photo"><img width="128px" src="' + items[i].MediumImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></div><div class="news-txt"><h4><a href="' + items[i].Link + '">' + items[i].Title + '</a></h4></div></li></ul></div></div></div>';
                }
                else if (this.template == 15 && this.news_type == 3) // Load box Goc Anh
                {
                    if(i==0)
                    {
                        newsList = '<div class="box"><div class="box-top"><div class="box-bt"><h3>góc ảnh</h3><div class="top-img"><img width="284px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/><h4><a href="' + items[i].Link + '">' + items[i].Title + '</a></h4></div><ul>';
                    }
                    else
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i==2)
                    {
                        newsList += '</ul></div></div></div>';
                    }
                }
                else if(this.display_count == 3 && this.template==16 && this.news_type == 3) // Gương mặt seagame
                {
                    if(i==0) 
                    {
                        newsList += '<table width="300" border="1" cellspacing="0" cellpadding="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><a href="/c26s677/guong-mat-seagame-25/trang-1.htm"><img src="/App_Themes/Default/Images/guongmat.jpg" width="298"/></a></td></tr><tr><td><table width="100%" border="0" cellspacing="3" cellpadding="0"><tr><td align="center"><a href="' + items[i].Link + '"><img width="277px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></a></td></tr><tr><td style="padding:3px 7px"><h4><a class="temp_hot_title_link" href="' + items[i].Link + '">' + items[i].Title + '</a></h4></td></tr>';
                    }
                    else if(i==1)
                    {
                        newsList += '<tr><td style="padding-left:7px;padding-right:7px"><img style="border: 0px none ; padding-bottom: 2px;" src="/www/images/dantri_template/cham.jpg" alt=""/>&nbsp;<a class="temp1_small_link" href="' + items[i].Link + '">' + items[i].Title + '</a></td></tr>';
                    }
                    else if(i==2)
                    {
                        newsList += '<tr><td style="padding-left:7px;padding-right:7px"><img style="border: 0px none ; padding-bottom: 2px;" src="/www/images/dantri_template/cham.jpg" alt=""/>&nbsp;<a class="temp1_small_link" href="' + items[i].Link + '">' + items[i].Title + '</a></td></tr></table></td></tr></table></td></tr></table>';
                    }
                }
                else if(this.display_count == 3 && this.template==17 && this.news_type == 3) // chuyện bên lề seagame
                {
                    if(i==0) 
                    {
                        newsList += '<table width="300" border="1" cellspacing="0" cellpadding="0"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><a href="/c26s678/chuyen-ben-le-segames-25/trang-1.htm"><img src="/App_Themes/Default/Images/chuyenbenle.jpg" width="298"/></a></td></tr><tr><td><table width="100%" border="0" cellspacing="3" cellpadding="0"><tr><td align="center"><a href="' + items[i].Link + '"><img width="277px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></a></td></tr><tr><td style="padding:3px 7px"><h4><a class="temp_hot_title_link" href="' + items[i].Link + '">' + items[i].Title + '</a></h4></td></tr>';
                    }
                    else if(i==1)
                    {
                        newsList += '<tr><td style="padding-left:7px;padding-right:7px"><img style="border: 0px none ; padding-bottom: 2px;" src="/www/images/dantri_template/cham.jpg" alt=""/>&nbsp;<a class="temp1_small_link" href="' + items[i].Link + '">' + items[i].Title + '</a></td></tr>';
                    }
                    else if(i==2)
                    {
                        newsList += '<tr><td style="padding-left:7px;padding-right:7px"><img style="border: 0px none ; padding-bottom: 2px;" src="/www/images/dantri_template/cham.jpg" alt=""/>&nbsp;<a class="temp1_small_link" href="' + items[i].Link + '">' + items[i].Title + '</a></td></tr></table></td></tr></table></td></tr></table>';
                    }
                }
                else if(this.display_count == 3 && this.template==18 && this.news_type == 3) // ảnh xuân
                {
                    if(i==0) 
                    {
                        newsList += '<div class="md-mid anhxuan"><h3>Ảnh xuân</h3><div class="anhxuan-cont"><div class="photo-anhxuan"><a href="' + items[i].Link + '"><img width="272px" height="188px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></a><p><a href="' + items[i].Link + '">' + items[i].Title + '</a></p></div><ul class="nor">';
                    }
                    else if(i==1)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i==2)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li></ul></div></div>';
                    }
                }
                else if(this.display_count == 3 && this.template==19 && this.news_type == 3) // Xem gi
                {
                    if(i==0) 
                    {
                        newsList += '<div class="md-mid film"><h3>Xem gì</h3><div class="film-cont"><a href="' + items[i].Link + '"><img width="260px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></a><p><a href="' + items[i].Link + '">' + items[i].Title + '</a></p></div></div>';
                    }
                }
                else if(this.display_count == 3 && this.template==20 && this.news_type == 3) // Chơi đâu
                {
                    if(i==0) 
                    {
                        newsList += '<div class="md-mid play"><h3>Chơi đâu</h3><div class="play-cont"><div class="photo-play"><a href="' + items[i].Link + '"><img width="281px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></a><p><a href="' + items[i].Link + '">' + items[i].Title + '</a></p><ul class="nor">';
                    }
                    else if(i==1)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i==2)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li></ul></div></div></div>';
                    }
                }     
                else if(this.display_count == 3 && this.template==21 && this.news_type == 3) // dep ngay tet
                {
                    if(i==0) 
                    {
                        newsList += '<div class="md-mid beauty"><h3>Đẹp ngày tết</h3><div class="beauty-cont"><a href="' + items[i].Link + '"><img width="281px" src="' + items[i].LargeImage + '" onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"/></a><p><a href="' + items[i].Link + '">' + items[i].Title + '</a></p><ul class="nor">';
                    }
                    else if(i==1)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i==2)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li></ul></div></div></div>';
                    }
                }
                else if(this.template==22 && this.news_type == 3) // tuvantuyensinh
                {
                    if(i==0) 
                    {
                        newsList += '<div class="tuvantuyensinh"><h3><a href="javascript:void(0)">Tư vấn tuyển sinh</a></h3>';
                        newsList += '<div class="divimage"><a href="'+items[i].Link+'"><img alt="' + items[i].Title + '" src="' + items[i].Image.replace("_50.","_279.") + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');" /></a></div>';
                        newsList += '<h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4>';
                        newsList += '<ul>';
                    }
                    else if(i>0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }   
                else if(this.template==23 && this.news_type == 3) // dethidapan
                {
                    if(i==0) 
                    {
                        newsList += '<div class="giaidapdethi"><h3><a href="/c704s706/dethidapan.htm">Đề thi - đáp án</a></h3>';
                        newsList += '<ul>';
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i>0 && i != (items.length - 1))
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i == (items.length - 1))
                    {
                        newsList += '<li class="last"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }
                else if(this.template==24 && this.news_type == 3) // tienich
                {
                    if(i==0) 
                    {
                        newsList += '<div class="tienich"><h3><a href="javascript:void(0)">Tiện ích</a></h3>';
                        newsList += '<ul>';
                        newsList += '<li class="odd"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i%2!=0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i%2==0)
                    {
                        newsList += '<li class="odd"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }    
                else if(this.template==25 && this.news_type == 3) // chitieutuyensinh
                {
                    if(i==0) 
                    {
                        newsList += '<div class="chitieutuyensinh"><h3><a href="/c704s708/chitieu.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3>';
                        newsList += '<h4><a href="' + items[0].Link + '">' + items[0].Title + '</a></h4>';
                        newsList += '<p>' + items[0].Description + '</p>';
                        newsList += '<ul>';                        
                    }
                    else
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }      
                else if(this.template==26 && this.news_type == 3) // guongmatkhoanhkhac
                {
                    if(i==0) 
                    {
                        newsList += '<div class="guongmatkhoanhkhac"><h3><a href="/c704s709/guongmat.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="33px"/></a></h3>';
                        newsList += '<div class="divimage"><a href="'+items[i].Link+'"><img alt="' + items[i].Title + '" src="' + items[i].Image.replace("_50.","_279.") + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');" /></a></div>';
                        newsList += '<h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4></div>';                        
                    }                    
                }    
                else if(this.template==27 && this.news_type == 3) // kinhnghiemtuyensinh
                {
                    if(i==0) 
                    {
                        newsList += '<div class="kinhnghiemtuyensinh"><h3><a href="/c704s705/kinhnghiem.htm">Kinh nghiệm</a></h3>';
                        newsList += '<ul>';
                        newsList += '<li class="odd"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i%2!=0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i%2==0)
                    {
                        newsList += '<li class="odd"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }    
                else if(this.template==28 && this.news_type == 3) // chutruongquydinh
                {
                    if(i==0) 
                    {
                        newsList += '<div class="chutruongquydinh"><h3><a href="/c704s707/luu-y-mua-thi.htm">Lưu ý mùa thi</a></h3>';
                        newsList += '<ul>';
                        newsList += '<li class="odd"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i%2!=0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    else if(i%2==0)
                    {
                        newsList += '<li class="odd"><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }   
                else if(this.template==29 && this.news_type == 3) // sacmauworldcup
                {
                    if(i==0) 
                    {
                        newsList += '<div class="worldcup"><h3 class="sacmau"><a href="/c26s712/sacmauworldcup.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3>';
                        newsList += '<div class="divimage"><a href="'+items[i].Link+'"><img alt="' + items[i].Title + '" src="' + items[i].Image.replace("_50.","_279.") + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');" /></a></div>';
                        newsList += '<h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4>';
                        newsList += '<ul>';
                    }
                    else if(i>0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }    
                else if(this.template==30 && this.news_type == 3) // gocnhinnguoinoitieng
                {
                    if(i==0) 
                    {
                        newsList += '<div class="worldcup"><h3 class="gocnhin"><a href="/c26s713/gocnhinnguoinoitieng.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3>';
                        newsList += '<div class="divimage"><a href="'+items[i].Link+'"><img alt="' + items[i].Title + '" src="' + items[i].Image.replace("_50.","_279.") + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');" /></a></div>';
                        newsList += '<h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4>';
                        newsList += '<ul>';
                    }
                    else if(i>0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                } 
                else if(this.template==31 && this.news_type == 3) // chandung
                {
                    if(i==0) 
                    {
                        newsList += '<div class="worldcup"><h3 class="chandung"><a href="/c26s714/chandungngoisao.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3>';
                        newsList += '<div class="divimage"><a href="'+items[i].Link+'"><img alt="' + items[i].Title + '" src="' + items[i].Image.replace("_50.","_279.") + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');" /></a></div>';
                        newsList += '<h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4>';
                        newsList += '<ul>';
                    }
                    else if(i>0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }  
                else if(this.template==32 && this.news_type == 3) // chuyenbenle
                {
                    if(i==0) 
                    {
                        newsList += '<div class="worldcup"><h3 class="chuyenbenle"><a href="/c26s715/chuyenbenle.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3>';
                        newsList += '<div class="divimage"><a href="'+items[i].Link+'"><img alt="' + items[i].Title + '" src="' + items[i].Image.replace("_50.","_279.") + '"' + 'onerror="LoadError(this,\'' + this.imagehost + items[i].LargeImage + '\');" /></a></div>';
                        newsList += '<h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4>';
                        newsList += '<ul>';
                    }
                    else if(i>0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div>';
                    }
                }  
                else if(this.template==33 && this.news_type == 3) // lichthidau
                {
                    newsList += '<div class="worldcupcaption"><h3 class="lichthidau"><a href="#"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3></div>';                                        
                }
                else if(this.template==34 && this.news_type == 3) // bandocviet
                {
                    newsList += '<div class="worldcupcaption"><h3 class="bandocviet"><a href="#"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3></div>';                                        
                }
                else if(this.template==35 && this.news_type == 3) // bangxephang
                {
                    newsList += '<div class="worldcupcaption"><h3 class="bangxephang"><a href="#"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3></div>';                                        
                }
                else if(this.template==36 && this.news_type == 3) // worldcupvideo
                {
                    if(i==0) 
                    {
                        newsList += '<div class="worldcupvideo"><h3><a href="/c26s221/videoclip.htm"><img src="/App_Themes/Default/Images/blank.gif" width="298px" height="30px"/></a></h3>';
                        newsList += '<div class="divimage"><img src="/www/images/video.gif" width="83px" height="105px"></div>';
                        newsList += '<div class="divcontent"><h4><a href="'+items[i].Link+'">'+items[i].Title+'</a></h4>';
                        newsList += '<ul>';
                    }
                    else if(i>0)
                    {
                        newsList += '<li><a href="' + items[i].Link + '">' + items[i].Title + '</a></li>';
                    }
                    if(i == (items.length - 1))
                    {
                        newsList += '</ul></div></div>';
                    }
                }
                if(this.news_type ==2) /* live score */
                {
                    if((i%2) == 0) /* Truong hop so le thi cho mau ne cua dong tin la trang */
                    {
                        newsList += '<div class="content"><div class="score-col1"><div class="pt5">' + items[i].Title + '</div></div><div class="score-col2"><div class="pt5">' + items[i].Description + '</div></div><div class="score-col3"><div class="score1"><div class="pt5">' + items[i].Link + '</div></div><div class="score1"><div class="pt5">' + items[i].Image + '</div></div><div class="score2"><div class="pt5">' + items[i].ErrorImage + '</div></div></div></div>'
                    }
                    else /* Truong hop so chan thi cho phep doi mau cua dong tin thay the */
                    {
                        newsList += '<div class="content-alternate"><div class="score-col1"><div class="pt5">' + items[i].Title + '</div></div><div class="score-col2"><div class="pt5">' + items[i].Description + '</div></div><div class="score-col3"><div class="score1"><div class="pt5">' + items[i].Link + '</div></div><div class="score1"><div class="pt5">' + items[i].Image + '</div></div><div class="score2"><div class="pt5">' + items[i].ErrorImage + '</div></div></div></div>';
                    }
                    if(i == (items.length - 1))
                    {
                        /* Load ra livescore */
                        var ScoreStartDiv = '<div class="neo-score"><div class="neo-score-top"><div class="neo-score-bt"><div class="score-tabs"><a href="javascript:void(0)" onclick="DT_ShowLiveCore(\'v_bt_tiso\')" id="v_bt_tiso" class="score-rate-active"><span>Tỷ lệ cá cược</span></a> <a href="javascript:void(0)" onclick="DT_ShowLiveCore(\'v_bt_licore\')" id="v_bt_licore" class="score-live"><span>Live score</span></a></div><div id="dt_tiso_container"><div class="score-content" id="score-header"><div id="inner"><div id="time"><div style="padding-top: 14px">ngày<br />giờ</div></div><div id="match"><div style="padding-top: 18px">trận đấu</div></div><div id="rate"><div id="euro"><div style="padding-top: 7px">tỷ lệ châu âu</div></div><div id="under"><div class="col1"><div style="padding-top: 7px">chủ</div></div><div class="col1"><div style="padding-top: 7px">hòa</div></div><div class="col3"><div style="padding-top: 7px">khách</div></div></div></div></div></div><div class="score-content" id="space"><div class="score-col1 h10p"></div><div class="score-col2 h10p"></div><div class="score-col3 h10p"><div class="score1 h10p">&nbsp;</div><div class="score1 h10p">&nbsp;</div><div class="score2 h10p">&nbsp;</div></div></div>';
                        var ScoreEndDiv = '<div class="score-content" style="text-align: right"><div class="score-content" id="divlnk_xemchitiet" style="display:"><a target="_blank" href="/Ratedetail.aspx" class="xemchitiet">Xem chi tiết</a></div></div></div></div></div>';
                        var liveScoreLive = '</div><div id="dt_livecore_container" style="display:none"><div id="box_livescore" style="padding-top:10px;"><div id="lsheader"><div id="day" class="r-border-1cc"><div class="pt15">Ngày</div></div><div id="time" class="r-border-1cc"><div class="pt15">Tỷ số</div></div><div id="match"><div class="pt15">trận đấu</div></div></div><div id="lsspace" style="width: 288px"><div id="col1" class="r-border-1cc"><span>&nbsp;</span></div><div id="col2" class="r-border-1cc"><span>&nbsp;</span></div><div id="col3"><span>&nbsp;</span></div></div>';
                        if(liveScoreItems != null && liveScoreItems.length > 0)
                        {
                            for (var j = 0; j < liveScoreItems.length; j++)
                            {
                                if((j%2) == 0) /* Truong hop so le thi cho mau ne cua dong tin la trang */
                                {
                                    liveScoreList += '<div class="content"><div class="col1 r-border-1cc"><span>' + liveScoreItems[j].Time + '</span></div><div class="col2 r-border-1cc"><span><a href="#">' + liveScoreItems[j].Result + '</a></span></div><div class="col3"><span>' + liveScoreItems[j].Match + '</span></div></div>';
                                }
                                else /* Truong hop so chan thi cho phep doi mau cua dong tin thay the */
                                {
                                    liveScoreList += '<div class="content-alt"><div class="col1 r-border-1cc"><span>' + liveScoreItems[j].Time + '</span></div><div class="col2 r-border-1cc"><span><a href="#">' + liveScoreItems[j].Result + '</a></span></div><div class="col3"><span>' + liveScoreItems[j].Match + '</span></div></div>';
                                }
                                if(j == liveScoreItems.length - 1)
                                {
                                    if(liveScoreItems.length >=8)
                                        liveScoreList = liveScoreLive + '<div style="width:290px;overflow:hidden;float:left;overflow-y:auto; height:320px;overflow-x:hidden">' + liveScoreList + '</div></div></div>';
                                    else
                                        liveScoreList = liveScoreLive + liveScoreList + '</div></div>';
                                }
                            }
                            newsList = ScoreStartDiv + newsList + liveScoreList + ScoreEndDiv;
                        }
                        else
                        {
                            newsList = ScoreStartDiv + newsList + liveScoreLive + '</div></div>' + ScoreEndDiv;
                        }
                    }
                }
                if(this.news_type ==1 || this.news_type ==0)
                {
                    if((i%2) == 0) /* Truong hop so le thi cho mau ne cua dong tin la trang */
                    {
                        newsList += '<table style="width: ' + (this.width - 5) + 'px;" cellpadding="0" cellspacing="0"><tr><td class="dantri-neo-tdctodd dantriclearfix">'
                    }
                    else /* Truong hop so chan thi cho phep doi mau cua dong tin thay the */
                    {
                        newsList += '<table style="width: ' + (this.width - 5) + 'px;" cellpadding="0" cellspacing="0"><tr><td style="background-color:#f2f8ff" class="dantri-neo-tdcteven dantriclearfix">'
                    }
                    if(this.display_type == 2)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        }
                        else
                        {
                            newsList +=    '<div class="dantri-neo-tdct-img">';
                            newsList +=    '	<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                            newsList +=    '		<img align="left" alt="' + items[i].Title + '" src="' + this.imagehost + items[i].Image + '"' + 'onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"' + ' />';
                            newsList +=    '	</a>';
                            newsList +=    '</div>';
                            newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        }
                    }
                    else if (this.display_type == 3)
                    {
                        if(items[i].ImageNotAvaiable == "0")
                        {
                            newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                            newsList += '<br />' + items[i].Description;
                        }
                        else
                        {
                            newsList +=    '<div class="dantri-neo-tdct-img">';
                            newsList +=    '	<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">';
                            newsList +=    '		<img align="left" alt="' + items[i].Title + '" src="' + this.imagehost + items[i].Image + '"' + 'onerror="LoadError(this,\'' + items[i].ErrorImage + '\');"' + ' />';
                            newsList +=    '	</a>';
                            newsList +=    '</div>';
                            newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                            newsList += '<br />' + items[i].Description;
                        }
                    }
                    else if(this.display_type == 1)
                    {
                        newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                        newsList += '<br />' + items[i].Description;
                    }
                    else if(this.display_type == 0)
                    {
                        newsList += '<a class="dantriwidget-link" title="' + items[i].Title + '" href="' + this.newshost + items[i].Link + this.ga_utm + '">' + items[i].Title + '</a>';
                    }
                    newsList += '</table></tr></td>';
                }
            }
            document.getElementById('DanTri_Widget_NewsList' + this.widget_index).innerHTML = newsList;
        }
    }
    
    this.RequestWidget = function()
    {
        var query = '?widget=' + this.widget;
        query += '&CallBack=DanTri_NewsWidgetCollection[' + this.widget_index + '].OnLoaded';
        query += '&top=' + this.display_count;
        query += '&desc=' + (this.display_type == 1 || this.display_type == 2 || this.display_type == 3 ? '1' : '0');
        if (this.widget == 'news')
        {
            query += '&catid=' + this.category;
            query += '&type=' + this.news_type;
            query += '&image=' + (this.display_type == 2 || this.display_type == 3 ? '1' : '0');
        }
        else
        {
            query += '&symbol=' + this.symbol;
        }
        this.CreateScriptObject(this.host + '/widgets.ashx' + query);
        //this.CreateScriptObject('http://dantri.com.vn/widgets.ashx' + query);
    }
    
    this.CreateCssLink = function(href)
    {
        var css = document.createElement('link');
        css.type = 'text/css';
        css.rel = 'stylesheet';
        css.href = href;
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(css);
    }
    
    this.CreateScriptObject = function(src)
    {
        if (this.script_object != null)
	    {
		    this.script_object.parentNode.removeChild(this.script_object) ;
	        this.script_object = null ;
	    }
    	
	    this.script_object = document.createElement('script');

        this.script_object.setAttribute('type','text/javascript');
        this.script_object.setAttribute('src', src);
        
        var head = document.getElementsByTagName('head')[0];
        head.appendChild(this.script_object);
    }
    
    this.GetQueryString = function()
    {
        var src = this.GetLastChildElement(document.lastChild).getAttribute('src');
        
        if (src.indexOf('?') >= 0)
        {
            return src.replace(/.*\?/, '');
        }
        else
        {
            return ''; 
        }
    }
    
    this.GetLastChildElement = function(lastElement)
    {
        return (lastElement.lastChild && lastElement.lastChild.nodeName != '#text') ? this.GetLastChildElement(lastElement.lastChild) : lastElement;
    }
   // this.CreateCssLink(this.base_folder + 'css/widget.css');
}
