﻿var iMaxTS = 5, iMaxTBS = 3;
var iReadStep = 0;
var sLoDID = ',';
var iDelay = 200;
var iDisplayCateNo = 0;
var iTSTimer = 0;
var iTSCount, iTSCur, iTSFading, iTSPrev = 0, iTSNext = 0, iTSFastMove = 0;
var iFadeDelay = 50;
var iBoxCount = 0;
var Story = 'images/slideshow/story.gif';
var video = 'images/slideshow/video.gif';
var Photo = 'images/slideshow/Photo.gif';
var Next = 'images/slideshow/Next.gif';
var Prev = 'images/slideshow/Prev.gif';
var Next2 = 'images/slideshow/Next2.gif';
var Prev2 = 'images/slideshow/Prev2.gif';
function getNodeValue(o) {
    try {
        return o.item(0).firstChild.nodeValue;
    }
    catch (err) {
        return '';
    }
}

function displayid(id, add) {
    if (typeof (add) == 'undefined') add = true;
    if (sLoDID.indexOf(id) <= 0) {
        if (add) sLoDID = sLoDID.concat(id).concat(',');
        return true;
    }
    else {
        return false;
    }
}

function showtopstoryitem(arItemTS) {
    iTSCount = arItemTS.length - 1;

    var sHTML = '';
    sHTML = sHTML.concat('<div style="position:relative;width:240px;height:215px;">');
    sHTML = sHTML.concat('	<div style="left:0px;top:0px;width:240px;height:2px;" class="HomeTopStoryBorder"></div>');
    sHTML = sHTML.concat('	<div style="left:0px;top:215px;width:240px;height:2px;" class="HomeTopStoryBorder"></div>');
    sHTML = sHTML.concat('	<div style="left:0px;top:2px;width:3px;height:215px;" class="HomeTopStoryBorder"></div>');
    sHTML = sHTML.concat('	<div style="left:240px;top:0px;width:3px;height:215px; " class="HomeTopStoryBorder"></div>');
    for (var i = 0; i <= iTSCount; i++) {
        sHTML = sHTML.concat('	<div id="divTopStory').concat(i).concat('" onmousemove="cleartopstorycounter();" style="overflow:hidden;position:absolute;').concat((i == 0 ? 'left:0px' : 'left:-1000px')).concat(';top:0px;width:240px;height:215px;">');
        if (arItemTS[i][10] > 0) {
            sHTML = sHTML.concat('		<a title="').concat(arItemTS[i][2]).concat('" href="').concat('/User/Interview/').concat('"><img border="0" src="').concat(arItemTS[i][1]).concat(arItemTS[i][4]).concat('" alt="').concat(arItemTS[i][2]).concat('" width="240" height="215"></a>');
        }
        else {
            sHTML = sHTML.concat('		<a title="').concat(arItemTS[i][2]).concat('" href="').concat(arItemTS[i][5]).concat('"><img border="0" src="').concat(arItemTS[i][1]).concat(arItemTS[i][4]).concat('" alt="').concat(arItemTS[i][2]).concat('" width="240" height="215"></a>');
        }
        sHTML = sHTML.concat('	</div>'); //bg title
        sHTML = sHTML.concat('	<div id="divTopStoryLayer').concat(i).concat('" onmousemove="cleartopstorycounter();" style="').concat((i == 0 ? 'left:0px' : 'left:-1000px')).concat(';top:170px;width:240px;height:45px;" class="HomeTopStoryColorLayer"></div>');
        sHTML = sHTML.concat('	<div id="divTopStoryTitle').concat(i).concat('" onmousemove="cleartopstorycounter();" style="').concat((i == 0 ? 'left:0px' : 'left:-1000px')).concat(';top:170px;width:240px;height:45px;" class="HomeTopStoryColorLayerContent">');
        if (arItemTS[i][10] > 0) {
            sHTML = sHTML.concat('		<div style="left:3px;top:4px;width:240px;height:15px;" class="HomeTopStoryTitle" onclick="window.location=\'').concat('/User/Interview/').concat('\'">').concat(arItemTS[i][1]).concat('</div>');
        }
        else {//bgtitle
            sHTML = sHTML.concat('		<div style="left:3px;top:4px;width:240px;height:45px;" title="').concat(arItemTS[i][2]).concat('" class="HomeTopStoryTitle" onclick="window.location=\'').concat(arItemTS[i][6]).concat('\'">').concat(arItemTS[i][2]).concat('</div>');
        }
        sHTML = sHTML.concat('		<div style="left:4px;top:5px;width:240px;height:45px;" class="HomeTopStoryTitleShadow">').concat(arItemTS[i][2]).concat('</div>');
        sHTML = sHTML.concat('		<div style="left:4px;top:28px;width:240px;height:20px;" class="HomeTopStoryLead">').concat(arItemTS[i][3]);
        if (arItemTS[i][7] > 0) {
            sHTML = sHTML.concat('<img src="' + video + '" hspace=2>');
        }
        if (arItemTS[i][8] > 0) {
            sHTML = sHTML.concat('<img src="' + Photo + '" hspace=2>');
        }
        if (arItemTS[i][9] > 0) {
            sHTML = sHTML.concat('<img src="' + Story + '" hspace=2>');
        }
        sHTML = sHTML.concat('		</div>');
        sHTML = sHTML.concat('	</div>');
    }
    sHTML = sHTML.concat('<div style="left:220px;top:200px;width:25px;height:17px;" class="HomeTopStoryColorLayerSubImage">'); //btnext-btprev
    sHTML = sHTML.concat('<img id="imgTSPrev" src="' + Prev2 + '" hspace="2" vspace="0" onmouseover="iTSPrev=1;this.src=\'' + Prev + '\'" onmouseout="iTSPrev=0;this.src=\'' + Prev2 + '\'" style="cursor:pointer" onclick="changetopstory(-1,false);">');
    sHTML = sHTML.concat('<img id="imgTSNext" src="' + Next2 + '" hspace="2" vspace="0" onmouseover="iTSNext=1;this.src=\'' + Next + '\'" onmouseout="iTSNext=0;if (!iTSFading) this.src=\'' + Next2 + '\'" style="cursor:pointer" onclick="changetopstory(1,false);">');
    sHTML = sHTML.concat('</div>');
    sHTML = sHTML.concat('</div>');
    gmobj("tdTS").innerHTML = sHTML;
    iTSCur = 0;
    setInterval(function() { topstorycounter(); }, 100)
}

function changetopstory(direction, fade) {
    var iTop, iBot;
    var oTop, oBot, oTopLayer, oBotLayer, oTopTitle, oBotTitle;
    iTop = iTSCur;
    iBot = iTop + direction;
    if (iBot < 0) iBot = iTSCount;
    if (iBot > iTSCount) iBot = 0;
    oTop = 'divTopStory' + iTop;
    oBot = 'divTopStory' + iBot;
    oTopLayer = 'divTopStoryLayer' + iTop;
    oBotLayer = 'divTopStoryLayer' + iBot;
    oTopTitle = 'divTopStoryTitle' + iTop;
    oBotTitle = 'divTopStoryTitle' + iBot;
    if (iTSFading == 1) {
        gmobj('divTopStory' + (iTop + 1)).style.left = '-1000px';
        gmobj('divTopStoryLayer' + (iTop + 1)).style.left = '-1000px';
        gmobj('divTopStoryTitle' + (iTop + 1)).style.left = '-1000px';
        outdirectionimage();
        iTSFading = 0;
    }
    iTSTimer = 0;
    if (!fade) {
        iTSFastMove = 1;
        changeOpac(100, oBot);
        changeOpac(40, oBotLayer);
        changeOpac(100, oBotTitle);
        gmobj(oTop).style.zIndex = 1;
        gmobj(oBot).style.zIndex = 2;
        gmobj(oBot).style.left = '0px';
        gmobj(oTop).style.left = '-1000px';
        gmobj(oBotLayer).style.left = '0px';
        gmobj(oTopLayer).style.left = '-1000px';
        gmobj(oBotTitle).style.left = '0px';
        gmobj(oTopTitle).style.left = '-1000px';
        iTSFading = 0;
        iTSCur = iBot;
    }
    else {
        iTSFastMove = 0;
        changeOpac(100, oBot);
        changeOpac(0, oBotLayer);
        changeOpac(0, oBotTitle);
        gmobj(oTop).style.zIndex = 2;
        gmobj(oBot).style.zIndex = 1;
        gmobj(oBot).style.left = '0px';
        gmobj(oBotLayer).style.left = '0px';
        gmobj(oBotTitle).style.left = '0px';
        iTSFading = 1;
        changingdirectionimage(direction);
        changingtopstory(iTop, iBot, 0, 100);
    }
}

function changingtopstory(iTop, iBot, iStep, iCurOpac) {
    var oTop, oBot, oTopLayer, oBotLayer, oTopTitle, oBotTitle;
    oTop = 'divTopStory' + iTop;
    oBot = 'divTopStory' + iBot;
    oTopLayer = 'divTopStoryLayer' + iTop;
    oBotLayer = 'divTopStoryLayer' + iBot;
    oTopTitle = 'divTopStoryTitle' + iTop;
    oBotTitle = 'divTopStoryTitle' + iBot;
    if (iTSFading == 1) {
        if (iStep == 0) {
            if (iCurOpac >= 0) {
                changeOpac(iCurOpac, oTopTitle);
                changeOpac(iCurOpac * 40 / 100, oTopLayer);
                iCurOpac -= 5;
                setTimeout(function() { changingtopstory(iTop, iBot, 0, iCurOpac) }, iFadeDelay);
            }
            else {
                setTimeout(function() { changingtopstory(iTop, iBot, 1, 100) }, 2000);
            }
        }
        else if (iStep == 1) {
            if (iCurOpac >= 0) {
                changeOpac(iCurOpac, oTop);
                iCurOpac -= 5;
                setTimeout(function() { changingtopstory(iTop, iBot, 1, iCurOpac) }, iFadeDelay);
            }
            else {
                iTSCur = iBot;
                gmobj(oTop).style.left = '-1000px';
                gmobj(oTopLayer).style.left = '-1000px';
                gmobj(oTopTitle).style.left = '-1000px';
                setTimeout(function() { changingtopstory(iTop, iBot, 2, 0) }, 100);
            }
        }
        else if (iStep == 2) {
            if (iCurOpac <= 100) {
                changeOpac(iCurOpac, oBotTitle);
                changeOpac(iCurOpac * 40 / 100, oBotLayer);
                iCurOpac += 5;
                setTimeout(function() { changingtopstory(iTop, iBot, 2, iCurOpac) }, iFadeDelay);
            }
            else {
                outdirectionimage();
                iTSFading = 0;
                iTSTimer = 0;
            }
        }
    }
    else if (iStep < 2 && iTSFastMove == 0) {
        gmobj(oBot).style.left = '-1000px';
        gmobj(oBotLayer).style.left = '-1000px';
        gmobj(oBotTitle).style.left = '-1000px';
        outdirectionimage();
        iTSFading = 0;
        iTSTimer = 0;
    }
}

function changingdirectionimage(direction) {
    if (direction > 0) gmobj('imgTSNext').src = Next;
    else gmobj('imgTSPrev').src = Prev;
}

function outdirectionimage() {
    if (iTSNext == 0) gmobj('imgTSNext').src = Next2;
    if (iTSPrev == 0) gmobj('imgTSPrev').src = Prev2;
}

function topstorycounter() {
    iTSTimer++;
    if (iTSTimer > 70) {
        iTSTimer = 0;
        changetopstory(1, true);
    }
}

function cleartopstorycounter() {
    changeOpac(100, 'divTopStory' + iTSCur);
    changeOpac(40, 'divTopStoryLayer' + iTSCur);
    changeOpac(100, 'divTopStoryTitle' + iTSCur);
    iTSFading = 0;
    iTSTimer = 0;
}

function changeOpac(opacity, id) {
    gmobj(id).style.opacity = (opacity / 100);
    gmobj(id).style.MozOpacity = (opacity / 100);
    gmobj(id).style.KhtmlOpacity = (opacity / 100);
    gmobj(id).style.filter = "alpha(opacity=" + opacity + ")";
}

function showtopboxitem(sFolder, sName, sPath, arItem, index) {
    var sHTML = '';
    sHTML = sHTML.concat('<div>');
    //<a class="NS_Title" href="#">
    sHTML = sHTML.concat('<div  class="four_text_add"><a title="').concat(arItem[index][2]).concat('"  href="').concat(arItem[index][1]).concat('"><img alt="').concat(arItem[index][2]).concat('" style="margin:1px; border:none;" width="150px" height="110px" src="').concat(arItem[index][1]).concat(arItem[index][5]).concat('"/></a></div>');
    sHTML = sHTML.concat('<div class="NF_text">');
    sHTML = sHTML.concat('<div class="NS_Title"><a title="').concat(arItem[index][2]).concat('"  class="NS_Title" href="').concat(arItem[index][1]).concat('">').concat(arItem[index][2]).concat('</a></div>');
    sHTML = sHTML.concat('<div class="NS_Content">');
    sHTML = sHTML.concat(arItem[index][3]);
    if (arItem[index][7] > 0) {
        sHTML = sHTML.concat('<img src="' + video + '" hspace=2>');
    }
    if (arItem[index][8] > 0) {
        sHTML = sHTML.concat('<img src=" ' + Photo + ' " hspace=2>');
    }
    if (arItem[index][9] > 0) {
        sHTML = sHTML.concat('<img src="' + Story + '" hspace=2>');
    }
    sHTML = sHTML.concat('</div>');
    sHTML = sHTML.concat('</div>');
    //sHTML = sHTML.concat('<div style="background-color:#C8D77D;height:20px;width:100%">');

    sHTML = sHTML.concat('<div class="NS_icon_pre">');
    //Prev
    if (index == 0) {
        sHTML = sHTML.concat('<img src="' + Prev2 + '">');
    }
    else {
        sHTML = sHTML.concat('<img src="' + Prev + '" style="cursor:pointer;" ');
        sHTML = sHTML.concat('onclick="showtopboxitem(' + sFolder + ', \'sName' + sFolder + '\', \'sPath' + sFolder + '\', arItem' + sFolder + ', ' + (index - 1) + ');"/>');
    }
    //Prev
    sHTML = sHTML.concat("</div>");
    sHTML = sHTML.concat('<div class="NS_icon_next">');
    //Next
    if (index >= arItem.length - 1) {
        sHTML = sHTML.concat('<img src="' + Next2 + '"/>');
    }
    else {
        sHTML = sHTML.concat('<img src="' + Next + '" style="cursor:pointer;"');
        sHTML = sHTML.concat(' ');
        sHTML = sHTML.concat('onclick="showtopboxitem(' + sFolder + ', \'sName' + sFolder + '\', \'sPath' + sFolder + '\', arItem' + sFolder + ', ' + (index + 1) + ');"/>');
    }
    //Next
    sHTML = sHTML.concat('</div>');

    sHTML = sHTML.concat('</div>');
    sHTML = sHTML.concat('</div>');

    gmobj("BoxNews" + sFolder).innerHTML = sHTML;
    //document.getElementById('tdTopBox').innerHTML = sHTML;

}

function showhomefolderitem(sFolder) {
    //    if (iReadStep<2 || (sFolder==1001 && iBoxCount<19)) {
    //    //if (iReadStep<2) {
    //    setTimeout(function(){showhomefolderitem(sFolder);},iDelay);
    //    return;
    //    }
    var sId, sName, sPath;
    var arItem = new Array();
    var arSub = new Array();
    //var sLink = '/ListFile/'.concat(sFolder).concat('.xml');
    var sLink = '/ListFile/'.concat(sFolder).concat('.xml');
    alert(sLink);
    var sHTML;
    var iMaxItem;
    switch (parseInt(sFolder)) {
        case 15: case 16: iMaxItem = 1; break;
        case 21: iMaxItem = 3; break;
        case 1001: iMaxItem = 7; break;
        default: iMaxItem = 3;
    }
    AjaxRequest.get(
		{
		    'url': sLink
	    , 'onSuccess': function(req) {
	        if (req.responseXML.getElementsByTagName('Folder').length > 0) {
	            with (req.responseXML.getElementsByTagName('Folder').item(0)) {
	                sId = getNodeValue(getElementsByTagName('fID'));
	                sName = toUpper(getNodeValue(getElementsByTagName('fName')));
	                sPath = getNodeValue(getElementsByTagName('fPath'));
	            }
	        }
	        var iCount = 0;
	        for (var i = 0; i < req.responseXML.getElementsByTagName('Item').length; i++) {
	            with (req.responseXML.getElementsByTagName('Item').item(i)) {
	                if (iCount < iMaxItem) {
	                    var sTemp = getNodeValue(getElementsByTagName('sID'));
	                    if (sTemp != '' && displayid(sTemp)) {
	                        arItem[iCount] = new Array(10);
	                        arItem[iCount][0] = getNodeValue(getElementsByTagName('sID'));
	                        arItem[iCount][1] = getNodeValue(getElementsByTagName('sPath'));
	                        arItem[iCount][2] = getNodeValue(getElementsByTagName('sTitle'));
	                        arItem[iCount][3] = getNodeValue(getElementsByTagName('sLead'));
	                        arItem[iCount][4] = getNodeValue(getElementsByTagName('sImageTopStory'));
	                        //if (arItem[iCount][4]=='') arItem[iCount][4] = getNodeValue(getElementsByTagName('sImageTopStory'));
	                        arItem[iCount][5] = getNodeValue(getElementsByTagName('sImageHome'));
	                        if (arItem[iCount][5] == '') {
	                            arItem[iCount][5] = getNodeValue(getElementsByTagName('sTopImage'));
	                        }
	                        else {
	                            if (iCount > 0) {
	                                arItem[iCount][5] = arItem[iCount][5].concat('.thumb95x67.ns.jpg');
	                            }
	                        }
	                        arItem[iCount][6] = getNodeValue(getElementsByTagName('sImageFolder'));
	                        if (arItem[iCount][6] == '') arItem[iCount][6] = getNodeValue(getElementsByTagName('sTopImage'));
	                        arItem[iCount][7] = getNodeValue(getElementsByTagName('sHasVideo'));
	                        arItem[iCount][8] = getNodeValue(getElementsByTagName('sHasPhoto'));
	                        arItem[iCount][9] = getNodeValue(getElementsByTagName('sHasStory'));
	                        arSub[iCount] = new Array(5);
	                        for (var j = 0; j < getElementsByTagName('Comment').length; j++) {
	                            with (getElementsByTagName('Comment').item(j)) {
	                                arSub[iCount][j] = new Array(5);
	                                arSub[iCount][j][0] = getNodeValue(getElementsByTagName('sID'));
	                                arSub[iCount][j][1] = getNodeValue(getElementsByTagName('sPath'));
	                                arSub[iCount][j][2] = getNodeValue(getElementsByTagName('sTitle'));
	                            }
	                        }
	                        iCount++;
	                    }
	                }
	            }
	        }
	        switch (parseInt(sFolder)) {
	            case 15: case 16: sHTML = getentertainmenthomefolder(sId, sName, sPath, arItem); break;
	            case 18: case 28: sHTML = getposterhomefolder(sId, sName, sPath, arItem); break;
	            case 21: sHTML = getforumhomefolder(sId, sName, sPath, arItem, arSub); break;
	            case 1001: sHTML = gethotnewshomefolder(sId, sName, sPath, arItem); break;
	            default: sHTML = getnormalhomefolder(sId, sName, sPath, arItem);
	        }
	        gmobj('tdHomeFolder' + sFolder).innerHTML = sHTML;
	        iBoxCount++;
	        iTSTimer = 0;
	    }
	    , 'onError': function(req) {
	        gmobj('tdHomeFolder'.concat(sFolder)).innerHTML = req.statusText;
	        iBoxCount++;
	        iTSTimer = 0;
	    }
		}
	)
}

function getposterhomefolder(sId, sName, sPath, arItem) {
    var sHTML = '';
    var i = 0;
    var stopAdv = false;
    if (VirtualFolder == '/news/test') stopAdv = true; //If stopAdv=true Then Adv Else Normal
    if (!stopAdv) {
        sHTML = sHTML.concat('<div class="TopPoster">');
        sHTML = sHTML.concat('<div class="TopHinhAnh" onclick="location.href=\'/News/Poster/\';" style="cursor:pointer;"></div>');
        sHTML = sHTML.concat('<div class="TopBG"></div>');
        sHTML = sHTML.concat('</div>');
        sHTML = sHTML.concat('<div class="PosterMain">');
        sHTML = sHTML.concat('  <div class="PosterLeft">');
        sHTML = sHTML.concat('      <a title="').concat(arItem[1][2]).concat('" href="').concat(arItem[0][1]).concat('"><img alt="').concat(arItem[1][2]).concat('" class="ImgLeft" border=0 height="120" width="215" src="').concat(arItem[0][1]).concat(arItem[0][5]).concat('"></a>');
        sHTML = sHTML.concat('      <div class="IconPhoto"></div><div class="PosterTitle"><a title="').concat(arItem[1][2]).concat('" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></div>');
        sHTML = sHTML.concat('      <div class="PosterLead">').concat(arItem[0][3]).concat('</div>');
        sHTML = sHTML.concat('  </div>');
        sHTML = sHTML.concat('  <div class="PosterRight">');
        sHTML = sHTML.concat('      <a class="Aimg" title="').concat(arItem[1][2]).concat('" href="').concat(arItem[1][1]).concat('"><img alt="').concat(arItem[1][2]).concat('" class="ImgRight" border=0 height="67" width="95" src="').concat(arItem[1][1]).concat(arItem[1][5]).concat('"></a>');
        sHTML = sHTML.concat('      <div class="PosterTitle"><a title="').concat(arItem[1][2]).concat('" href="').concat(arItem[1][1]).concat('">').concat(arItem[1][2]).concat('</a></div>');
        sHTML = sHTML.concat('      <a class="Aimg" title="').concat(arItem[2][2]).concat('" href="').concat(arItem[2][1]).concat('"><img alt="').concat(arItem[2][2]).concat('" class="ImgRight" border=0 height="67" width="95" src="').concat(arItem[2][1]).concat(arItem[2][5]).concat('"></a>');
        sHTML = sHTML.concat('      <div class="PosterTitle"><a title="').concat(arItem[2][2]).concat('" href="').concat(arItem[2][1]).concat('">').concat(arItem[2][2]).concat('</a></div>');
        sHTML = sHTML.concat('  </div>');
        sHTML = sHTML.concat('</div>');
    }
    else {
        sHTML += '<div class="SeasonAD">';
        sHTML += '	<p class="pTop_SeasonAD"><a href="/News/Poster/" title="H&#236;nh &#7843;nh">H&#236;nh &#7843;nh</a></p>	';
        sHTML += '	<div class="SAD_content">';
        sHTML += '		<div class="SAD_left">';
        sHTML += '			<a href="' + arItem[0][1] + '" title="' + arItem[0][2] + '" class="aImgMain">';
        sHTML += '				<img alt="' + arItem[0][2] + '" src="' + arItem[0][1] + arItem[0][5] + '" />';
        sHTML += '			</a>';
        sHTML += '			<p class="pMainT">';
        sHTML += '				<a href="' + arItem[0][1] + '" title="' + arItem[0][2] + '">' + arItem[0][2] + '</a>';
        sHTML += '			</p>';
        sHTML += '			<p class="pMainL">';
        sHTML += arItem[0][3];
        sHTML += '			</p>';
        sHTML += '		</div>';
        sHTML += '		<div class="SAD_right">';
        sHTML += '			<a href="' + arItem[1][1] + '" title="' + arItem[1][2] + '" class="aImgSub">';
        sHTML += '				<img alt="' + arItem[1][2] + '" src="' + arItem[1][1] + arItem[1][5] + '" />';
        sHTML += '			</a>';
        sHTML += '			<p class="psubLead">';
        sHTML += '				<a href="' + arItem[1][1] + '" title="' + arItem[1][2] + '">' + arItem[1][2] + '</a>';
        sHTML += '			</p>';
        sHTML += '			<a href="' + arItem[2][1] + '" title="' + arItem[2][2] + '" class="aImgSub">';
        sHTML += '				<img alt="' + arItem[2][2] + '" src="' + arItem[2][1] + arItem[2][5] + '" />';
        sHTML += '			</a>';
        sHTML += '			<p class="psubLead">';
        sHTML += '				<a href="' + arItem[2][1] + '" title="' + arItem[2][2] + '">' + arItem[2][2] + '</a>';
        sHTML += '			</p>';
        sHTML += '		</div>';
        sHTML += '	</div>';
        sHTML += '</div>';
    }
    return sHTML;
}

function gethotnewshomefolder(sId, sName, sPath, arItem) {
    var sHTML = '';
    var iCount = 0, i = 0;
    sHTML = sHTML.concat('<Table border=0 cellspacing=3 cellpadding=0 width="98%" align="center">');
    while (i < arItem.length) {
        if (i == 0) {
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td colspan="3" width="100%">');
            sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('				<tr>');
            if (arItem[i][6] != '') {
                sHTML = sHTML.concat('		<td style="padding-right:4px;" width="10" valign="top">');
                sHTML = sHTML.concat('			<Table border=0 cellspacing=1 cellpadding=2 bgcolor="#c1c1c1">');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td bgcolor="#FFFFFF"><a href="').concat(arItem[i][1]).concat('"><img border=0 width=95 height=80 src="').concat(arItem[i][1]).concat(arItem[i][6]).concat('"></a></td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('			</Table>');
                sHTML = sHTML.concat('		</td>');
            }
            sHTML = sHTML.concat('		<td valign="top" width="100%">');
            sHTML = sHTML.concat('			<Table border=0 cellspacing=2 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td style="padding-top:2px;padding-bottom:2px;"><a class="HomeHotNews Bold Red" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
            sHTML = sHTML.concat('				</tr>');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td class="HomeNormal Black">').concat(arItem[i][3]).concat('</td>');
            sHTML = sHTML.concat('				</tr>');
            if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
                sHTML = sHTML.concat('<tr>');
                sHTML = sHTML.concat('	<td>');
                sHTML = sHTML.concat('		<Table border=0 cellspacing=1 cellpadding=0 align="right">');
                sHTML = sHTML.concat('			<tr>');
                if (arItem[i][7] > 0) {
                    sHTML = sHTML.concat('				<td style="padding-left:2;padding-right:2;"><img src="' + video + '"></td>');
                }
                if (arItem[i][8] > 0) {
                    sHTML = sHTML.concat('				<td style="padding-left:2;padding-right:2;"><img src="' + Photo + '"></td>');
                }
                if (arItem[i][9] > 0) {
                    sHTML = sHTML.concat('				<td style="padding-left:2;padding-right:2;"><img src="' + Story + '"></td>');
                }
                sHTML = sHTML.concat('			</tr>');
                sHTML = sHTML.concat('		</Table>');
                sHTML = sHTML.concat('	</td>');
                sHTML = sHTML.concat('</tr>');
            }
            sHTML = sHTML.concat('			</Table>');
            sHTML = sHTML.concat('		</td>');
            sHTML = sHTML.concat('	</tr>');
            sHTML = sHTML.concat('	</Table>');
        }
        else {
            sHTML = sHTML.concat('	<tr><td colspan="3" height="1" background="/Images/HotNews/HotlineSep.gif"></td></tr>');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td width="1" style="padding-right:3px;"><img src="/Images/HotNews/Dot.gif"></td>');
            sHTML = sHTML.concat('		<td width="100%"><a class="Small Black" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
            if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
                sHTML = sHTML.concat('	<td>');
                sHTML = sHTML.concat('		<Table border=0 cellspacing=1 cellpadding=0 align="right">');
                sHTML = sHTML.concat('			<tr>');
                if (arItem[i][7] > 0) {
                    sHTML = sHTML.concat('				<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
                }
                if (arItem[i][8] > 0) {
                    sHTML = sHTML.concat('				<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
                }
                if (arItem[i][9] > 0) {
                    sHTML = sHTML.concat('				<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
                }
                sHTML = sHTML.concat('			</tr>');
                sHTML = sHTML.concat('		</Table>');
                sHTML = sHTML.concat('	</td>');
            }
            else {
                sHTML = sHTML.concat('<td></td>');
            }
            sHTML = sHTML.concat('	</tr>');
        }
        i++;
    }
    sHTML = sHTML.concat('</Table>');
    return sHTML;
}

function getforumhomefolder(sId, sName, sPath, arItem, arSub) {
    var sHTML = '';
    var iCount = 0, i = 0, j = 0;
    while (i < arItem.length) {
        if (i == 0) {
            sHTML = sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
        }
        sHTML = sHTML.concat('	<tr>');
        sHTML = sHTML.concat('		<td align=center>');
        sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 width="95%">');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td rowspan="3" valign="top" style="padding-top:4;padding-left:3;padding-right:6;"><img src="/Images/Forum/Dot.gif"></td>');
        sHTML = sHTML.concat('					<td><a class="HomeNormal Bold Grey2" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
        sHTML = sHTML.concat('				</tr>');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td class="HomeNormal Black" style="padding-top:3;padding-bottom:3;">').concat(arItem[i][3]).concat('</td>');
        sHTML = sHTML.concat('				</tr>');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td>');
        sHTML = sHTML.concat('						<Table border=0 cellspacing=2 cellpadding=0 width="100%">');
        for (j = 0; j < 4; j++) {
            if (!(typeof (arSub[i][j]) == 'undefined')) {
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td valign="top" style="padding-top:3;padding-right:3;"><img src="/Images/Forum/Doc.gif"></td>');
                sHTML = sHTML.concat('								<td><a class="HomeNormal Black" href="').concat(arSub[i][j][1]).concat('">').concat(arSub[i][j][2]).concat('</a></td>');
                sHTML = sHTML.concat('							</tr>');
            }
        }
        sHTML = sHTML.concat('						</Table>');
        sHTML = sHTML.concat('					</td>');
        sHTML = sHTML.concat('				</tr>');
        sHTML = sHTML.concat('			</Table>');

        sHTML = sHTML.concat('		</td>');
        sHTML = sHTML.concat('	</tr>');

        if (i < arItem.length - 1) {
            sHTML = sHTML.concat('	<tr><td height=5></td></tr>');
            sHTML = sHTML.concat('	<tr><td height=1 bgcolor="white"></td></tr>');
        }
        sHTML = sHTML.concat('	<tr><td height=5></td></tr>');
        i++;
    }
    sHTML = sHTML.concat('</Table>');
    return sHTML;
}

function getentertainmenthomefolder(sId, sName, sPath, arItem) {
    var sHTML = '';
    var iCount = 0, i = 0;
    while (i < arItem.length) {
        if (i == 0) {
            sHTML = sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('	<tr>');
            if (arItem[i][6] != '' && sId == 16) {
                sHTML = sHTML.concat('		<td style="padding-left:5px;padding-top:5;" width="10" valign="top">');
                sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=2 bgcolor="#c1c1c1">');
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td bgcolor="#FFFFFF"><a href="').concat(arItem[i][1]).concat('"><img border=0 width=95 height=80 src="').concat(arItem[i][1]).concat(arItem[i][6]).concat('"></a></td>');
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('					<td background="/Images/LeftBox/ShadowRight.gif" valign="top"><img src="/Images/LeftBox/ShadowTopRight.gif"></td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td colspan=2>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=0 cellpadding=0>');
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td width=1><img src="/Images/LeftBox/ShadowBottomLeft.gif"></td>');
                sHTML = sHTML.concat('								<td width="100%" background="/Images/LeftBox/ShadowBottom.gif"></td>');
                sHTML = sHTML.concat('								<td width=1><img src="/Images/LeftBox/ShadowBottomRight.gif"></td>');
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('			</Table>');
                sHTML = sHTML.concat('		</td>');
            }
            if (arItem[i][6] != '') {
                sHTML = sHTML.concat('		<td valign="top" style="padding-left:5px;padding-top:10px;">');
            }
            else {
                sHTML = sHTML.concat('		<td style="padding-left:5px;padding-top:5px;padding-bottom:5px;">');
            }
            sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td style="padding-bottom:3px;"><a class="HomeFolder Green2" href="').concat(sPath).concat('">').concat(sName).concat('</a></td>');
            sHTML = sHTML.concat('				</tr>');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td height="1" background="/Images/LeftBox/DotSepWhite.gif"></td>');
            sHTML = sHTML.concat('				</tr>');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td style="padding-top:3px;padding-bottom:3px;"><a class="HomeNormal Bold White" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
            sHTML = sHTML.concat('				</tr>');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td class="Small White">').concat(arItem[i][3]).concat('</td>');
            sHTML = sHTML.concat('				</tr>');
            if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td valign="top" style="padding-right:2;">');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=0 align="right">');
                sHTML = sHTML.concat('							<tr>');
                if (arItem[i][7] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
                }
                if (arItem[i][8] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
                }
                if (arItem[i][9] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
                }
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('				</tr>');
            }
            sHTML = sHTML.concat('			</Table>');
            sHTML = sHTML.concat('		</td>');
            if (arItem[i][6] != '' && sId != 16) {
                sHTML = sHTML.concat('		<td style="padding-right:5px;padding-top:5;" width="10" valign="top">');
                sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=2 bgcolor="#c1c1c1">');
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td bgcolor="#FFFFFF"><a href="').concat(arItem[i][1]).concat('"><img border=0 width=95 height=80 src="').concat(arItem[i][1]).concat(arItem[i][6]).concat('"></a></td>');
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('					<td background="/Images/LeftBox/ShadowRight.gif" valign="top"><img src="/Images/LeftBox/ShadowTopRight.gif"></td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td colspan=2>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=0 cellpadding=0>');
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td width=1><img src="/Images/LeftBox/ShadowBottomLeft.gif"></td>');
                sHTML = sHTML.concat('								<td width="100%" background="/Images/LeftBox/ShadowBottom.gif"></td>');
                sHTML = sHTML.concat('								<td width=1><img src="/Images/LeftBox/ShadowBottomRight.gif"></td>');
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('			</Table>');
                sHTML = sHTML.concat('		</td>');
            }
            sHTML = sHTML.concat('	</tr>');
            sHTML = sHTML.concat('</Table>');
        }
        i++;
    }
    return sHTML;
}

function getnormalhomefolder(sId, sName, sPath, arItem) {
    var sHTML = '';
    var iCount = 0, i = 0;
    while (i < arItem.length) {
        if (i == 0) {
            sHTML = sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('	<tr style="background-image:url(/Images/NewsBox/Background.jpg);background-position: right 11px; background-repeat: repeat-x;">');
            if (arItem[i][6] != '') {
                sHTML = sHTML.concat('		<td valign="top" style="padding-top:4px;">');
                sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=2 bgcolor="#c1c1c1">');
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td bgcolor="#FFFFFF"><a href="').concat(arItem[i][1]).concat('"><img border=0 width=95 height=80 src="').concat(arItem[i][1]).concat(arItem[i][6]).concat('"></a></td>');
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('					<td background="/Images/NewsBox/ShadowRight.gif" valign="top"><img src="/Images/NewsBox/ShadowTopRight.gif"></td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td colspan=2>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=0 cellpadding=0>');
                sHTML = sHTML.concat('							<tr>');
                sHTML = sHTML.concat('								<td width=1><img src="/Images/NewsBox/ShadowBottomLeft.gif"></td>');
                sHTML = sHTML.concat('								<td width="100%" background="/Images/NewsBox/ShadowBottom.gif"></td>');
                sHTML = sHTML.concat('								<td width=1><img src="/Images/NewsBox/ShadowBottomRight.gif"></td>');
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td colspan=2><img src="/Images/White.gif" height="3" width="9"></td>');
                sHTML = sHTML.concat('				</tr>');
                sHTML = sHTML.concat('			</Table>');
                sHTML = sHTML.concat('		</td>');
            }
            if (arItem[i][6] != '') {
                sHTML = sHTML.concat('		<td valign="top" height="105px" width="100%">');
            }
            else {
                sHTML = sHTML.concat('		<td valign="top" height="105px" width="100%" style="padding-left:3px;">');
            }
            sHTML = sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td valign="top" height="88px">');
            sHTML = sHTML.concat('						<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            // sHTML = sHTML.concat('							<tr>');
            // sHTML = sHTML.concat('								<td>');
            // sHTML = sHTML.concat('									<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
            // sHTML = sHTML.concat('										<tr>');
            // sHTML = sHTML.concat('											<td width="100%" style="background-image:url(/Images/NewsBox/HeaderDot.gif);background-position: 2px 9px; background-repeat: repeat-x;"></td>');
            // sHTML = sHTML.concat('											<td style="padding-left:1px;" nowrap><a class="HomeFolder DarkBlue" href="').concat(sPath).concat('">').concat(sName).concat('</a></td>');
            // sHTML = sHTML.concat('										</tr>');
            // sHTML = sHTML.concat('									</Table>');
            // sHTML = sHTML.concat('								</td>');
            // sHTML = sHTML.concat('							</tr>');
            sHTML = sHTML.concat('							<tr>');
            sHTML = sHTML.concat('								<td nowrap align="right"><a class="HomeFolder DarkBlue" href="').concat(sPath).concat('">').concat(sName).concat('</a></td>');
            sHTML = sHTML.concat('							</tr>');
            sHTML = sHTML.concat('							<tr>');
            sHTML = sHTML.concat('								<td style="padding:3;"><a class="HomeNormal Bold DarkGrey" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
            sHTML = sHTML.concat('							</tr>');
            sHTML = sHTML.concat('							<tr>');
            sHTML = sHTML.concat('								<td style="padding-left:3;padding-right:3;" class="Small Black">').concat(arItem[i][3]).concat('</td>');
            sHTML = sHTML.concat('							</tr>');
            sHTML = sHTML.concat('						</Table>');
            sHTML = sHTML.concat('					</td>');
            sHTML = sHTML.concat('				</tr>');
            if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td valign="top" style="padding-right:2;">');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=0 align="right">');
                sHTML = sHTML.concat('							<tr>');
                if (arItem[i][7] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
                }
                if (arItem[i][8] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
                }
                if (arItem[i][9] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
                }
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('				</tr>');
            }
            sHTML = sHTML.concat('			</Table>');
            sHTML = sHTML.concat('		</td>');
            sHTML = sHTML.concat('	</tr>');
            sHTML = sHTML.concat('</Table>');
        }
        else {
            sHTML = sHTML.concat('<Table border=0 cellspacing=2 cellpadding=0 width="100%">');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td width=10><img src="/Images/Footer/Bullet.gif"></td>');
            sHTML = sHTML.concat('		<td width="100%" style="padding-left:3;"><a class="HomeNormal Grey" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</td>');
            if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
                sHTML = sHTML.concat('		<td width=10>');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=0 align="right">');
                sHTML = sHTML.concat('							<tr>');
                if (arItem[i][7] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
                }
                if (arItem[i][8] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
                }
                if (arItem[i][9] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
                }
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('		</td>');
            }
            sHTML = sHTML.concat('	</tr>');
            sHTML = sHTML.concat('</Table>');
        }
        i++;
    }
    return sHTML;
}

function displaylistcategory(face, loc) {
    var sHTML = '';
    var arSplit = ''.concat(loc).split(',');
    for (var i = 0; i < arSplit.length; i++) {
        if (parseInt(arSplit[i]) > 0) {
            iDisplayCateNo++;
            sHTML = '';
            sHTML = sHTML.concat('<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td style="padding-top:5px;" id="tdCate').concat(iDisplayCateNo).concat('">');
            sHTML = sHTML.concat('		</td>');
            sHTML = sHTML.concat('	</tr>');
            sHTML = sHTML.concat('</Table>');
            document.write(sHTML);
            displaycategory(face, parseInt(arSplit[i]), 'tdCate'.concat(iDisplayCateNo));
        }
    }
}

function displaycategory(face, id, objreturn) {
    var sId, sName, sPath;
    var arItem = new Array();
    var sLink = '/ListFile/'.concat(id).concat('.xml');
    var sHTML;
    var iMaxItem = 0;
    switch (face) {
        case 2: iMaxItem = 2; break;
        default: iMaxItem = 1; break;
    }
    AjaxRequest.get(
		{
		    'url': sLink
	    , 'onSuccess': function(req) {
	        if (req.responseXML.getElementsByTagName('Folder').length > 0) {
	            with (req.responseXML.getElementsByTagName('Folder').item(0)) {
	                sId = getNodeValue(getElementsByTagName('fID'));
	                sName = toUpper(getNodeValue(getElementsByTagName('fName')));
	                sPath = getNodeValue(getElementsByTagName('fPath'));
	            }

	        }
	        var iCount = 0;
	        for (var i = 0; i < req.responseXML.getElementsByTagName('Item').length; i++) {
	            with (req.responseXML.getElementsByTagName('Item').item(i)) {
	                if (iCount < iMaxItem) {
	                    var sTemp = getNodeValue(getElementsByTagName('sID'));
	                    if (sId == 38) {
	                        if (sTemp != '') {
	                            arItem[iCount] = new Array(10);
	                            arItem[iCount][0] = getNodeValue(getElementsByTagName('sID'));
	                            arItem[iCount][1] = getNodeValue(getElementsByTagName('sPath'));
	                            arItem[iCount][2] = getNodeValue(getElementsByTagName('sTitle'));
	                            arItem[iCount][3] = getNodeValue(getElementsByTagName('sLead'));
	                            arItem[iCount][4] = getNodeValue(getElementsByTagName('sImageTopStory'));
	                            arItem[iCount][5] = getNodeValue(getElementsByTagName('sImageHome'));
	                            arItem[iCount][6] = getNodeValue(getElementsByTagName('sImageFolder'));
	                            arItem[iCount][7] = parseInt(getNodeValue(getElementsByTagName('sHasVideo')));
	                            arItem[iCount][8] = parseInt(getNodeValue(getElementsByTagName('sHasPhoto')));
	                            arItem[iCount][9] = parseInt(getNodeValue(getElementsByTagName('sHasStory')));
	                            iCount++;
	                        }
	                    }
	                    else {
	                        if (sTemp != '' && displayid(sTemp)) {
	                            arItem[iCount] = new Array(10);
	                            arItem[iCount][0] = getNodeValue(getElementsByTagName('sID'));
	                            arItem[iCount][1] = getNodeValue(getElementsByTagName('sPath'));
	                            arItem[iCount][2] = getNodeValue(getElementsByTagName('sTitle'));
	                            arItem[iCount][3] = getNodeValue(getElementsByTagName('sLead'));
	                            arItem[iCount][4] = getNodeValue(getElementsByTagName('sImageTopStory'));
	                            arItem[iCount][5] = getNodeValue(getElementsByTagName('sImageHome'));
	                            arItem[iCount][6] = getNodeValue(getElementsByTagName('sImageFolder'));
	                            arItem[iCount][7] = parseInt(getNodeValue(getElementsByTagName('sHasVideo')));
	                            arItem[iCount][8] = parseInt(getNodeValue(getElementsByTagName('sHasPhoto')));
	                            arItem[iCount][9] = parseInt(getNodeValue(getElementsByTagName('sHasStory')));
	                            iCount++;
	                        }
	                    }
	                }
	            }
	        }

	        switch (face) {
	            case 1: gmobj(objreturn).innerHTML = getlefttopboxcategory(sId, sName, sPath, arItem); break;
	            case 2: gmobj(objreturn).innerHTML = getleftbottomboxcategory(sId, sName, sPath, arItem); break;
	            case 3: gmobj(objreturn).innerHTML = getcentercategory(sId, sName, sPath, arItem); break;
	        }
	    }
	    , 'onError': function(req) { gmobj('tdHomeFolder'.concat(sFolder)).innerHTML = req.statusText; }
		}
	)
}

function getlefttopboxcategory(sId, sName, sPath, arItem) {
    var sHTML = '';
    var iCount = 0, i = 0;
    while (i < arItem.length) {
        sHTML = sHTML.concat('<Table border=0 cellpadding=0 cellspacing=0 width="100%" style="background: url(/images/sd/SD01.png) no-repeat; background-position:0 11">');
        sHTML = sHTML.concat('	<tr>');
        sHTML = sHTML.concat('		<td>');
        sHTML = sHTML.concat('			<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td nowrap><a class="HomeFolder DarkBlue" href="').concat(sPath).concat('">').concat(sName).concat('</a></td>');
        sHTML = sHTML.concat('					<td style="background-image: url(/Images/NewsBox/HeaderDot.gif); background-position: 2px 9px; background-repeat: repeat-x;" width="100%"></td>');
        sHTML = sHTML.concat('				</tr>');
        sHTML = sHTML.concat('			</Table>');
        sHTML = sHTML.concat('		</td>');
        sHTML = sHTML.concat('	</tr>');
        sHTML = sHTML.concat('	<tr>');
        sHTML = sHTML.concat('		<td>');
        sHTML = sHTML.concat('			<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td style="padding-top:4;padding-bottom:2;">');
        if (IsStarTeenFolder()) {
            sHTML = sHTML.concat(ShowPhoto(arItem[i][1], arItem[i][5], 215, 120, 1, '#606060', 0, '', 0).replace(/align=left/, "align=center"));
            sHTML = sHTML.concat('					</td>');
            sHTML = sHTML.concat('				</tr>	');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td style="padding:0 4 2 4;" bgcolor="#e0e0e0">');
            sHTML = sHTML.concat('				<a class="HomeNormal Bold Black" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a>');
        }
        else {
            sHTML = sHTML.concat('						<a class="HomeNormal Bold Black" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a>');
        }
        sHTML = sHTML.concat('					</td>');
        sHTML = sHTML.concat('				</tr>	');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td>');
        sHTML = sHTML.concat('						<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
        sHTML = sHTML.concat('							<tr>');
        if (arItem[i][6] != '' && (!IsStarTeenFolder)) {
            sHTML = sHTML.concat('								<td valign="top" style="padding-right:3;">');
            sHTML = sHTML.concat('									<Table border=0 cellspacing=2 cellpadding=0 bgcolor="#FFFFFF">');
            sHTML = sHTML.concat('										<tr><td><a href="').concat(arItem[i][1]).concat('"><img border=0 width=65 height=55 src="').concat(arItem[i][1]).concat(arItem[i][6]).concat('"></a></td></tr>');
            sHTML = sHTML.concat('									</Table>');
            sHTML = sHTML.concat('								</td>');
        }
        sHTML = sHTML.concat('								<td valign="top">');
        sHTML = sHTML.concat('									<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
        sHTML = sHTML.concat('										<tr><td class="HomeNormal Black" ' + (IsStarTeenFolder() ? ' style="padding:0 4 0 4" bgcolor="#e0e0e0" ' : '') + '>').concat(arItem[i][3]).concat('</td></tr>');
        if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td valign="top" style="padding-right:2;">');
            sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=0 align="right">');
            sHTML = sHTML.concat('							<tr>');
            if (arItem[i][7] > 0) {
                sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
            }
            if (arItem[i][8] > 0) {
                sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
            }
            if (arItem[i][9] > 0) {
                sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
            }
            sHTML = sHTML.concat('							</tr>');
            sHTML = sHTML.concat('						</Table>');
            sHTML = sHTML.concat('					</td>');
            sHTML = sHTML.concat('				</tr>');
        }
        sHTML = sHTML.concat('									</table>');
        sHTML = sHTML.concat('								</td>');
        sHTML = sHTML.concat('							</tr>');
        sHTML = sHTML.concat('						</Table>');
        sHTML = sHTML.concat('					</td>');
        sHTML = sHTML.concat('				</tr>	');
        sHTML = sHTML.concat('			</Table>');
        sHTML = sHTML.concat('		</td>');
        sHTML = sHTML.concat('	</tr>');
        sHTML = sHTML.concat('</Table>');
        i++;
    }
    return sHTML;
}

function getleftbottomboxcategory(sId, sName, sPath, arItem) {
    var sHTML = '';
    var iCount = 0, i = 0;
    while (i < arItem.length) {
        if (i == 0) {
            sHTML = sHTML.concat('<Table border=0 cellpadding=0 cellspacing=0 width="100%" style="background: url(/images/sd/SD05.gif) no-repeat; background-position:0 12">');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td>');
            sHTML = sHTML.concat('			<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
            sHTML = sHTML.concat('				<tr>');
            sHTML = sHTML.concat('					<td nowrap><a class="HomeFolder LightGreen" href="').concat(sPath).concat('">').concat(sName).concat('</a></td>');
            sHTML = sHTML.concat('					<td style="background-image: url(/Images/LeftBox/DotSepWhite.gif); background-position: 2px 9px; background-repeat: repeat-x;" width="100%"></td>');
            sHTML = sHTML.concat('				</tr>');
            sHTML = sHTML.concat('			</Table>');
            sHTML = sHTML.concat('		</td>');
            sHTML = sHTML.concat('	</tr>')
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td>');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td style="padding-top:4;">');
            if (IsStarTeenFolder()) {
                sHTML = sHTML.concat(ShowPhoto(arItem[i][1], arItem[i][5], 215, 120, 1, '#606060', 0, '', 0).replace(/align=left/, "align=center"));
                sHTML = sHTML.concat('					</td>');
                sHTML = sHTML.concat('				</tr>	');
                sHTML = sHTML.concat('				<tr>');
                sHTML = sHTML.concat('					<td style="padding:0 4 2 4;">');
                sHTML = sHTML.concat('		<p class="NoMargin"><a class="HomeNormal Bold White" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></p>');
                i = arItem.length - 1
            }
            else {
                if (arItem[i][6] != '') {
                    sHTML = sHTML.concat('		').concat(ShowPhoto(arItem[i][1], arItem[i][6].concat('.thumb65x55.ns.jpg'), 65, 55, 1, "#d7d7d8", 1, "#ffffff", 'padding-top:3px;padding-right:4px;'));
                }
                sHTML = sHTML.concat('		<p class="NoMargin" style="padding-top:3px;"><a class="HomeNormal Bold White" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></p>');
            }

            //sHTML = sHTML.concat('		<p class="NoMargin"><a class="HomeNormal Bold White" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></p>');
            sHTML = sHTML.concat('		<p class="NoMargin Small White" style="padding-top:3px;">').concat(arItem[i][3]).concat('</p>');
            if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
                sHTML = sHTML.concat('				<p class="NoMargin" align="right">');
                sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=0 align="right">');
                sHTML = sHTML.concat('							<tr>');
                if (arItem[i][7] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
                }
                if (arItem[i][8] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
                }
                if (arItem[i][9] > 0) {
                    sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
                }
                sHTML = sHTML.concat('							</tr>');
                sHTML = sHTML.concat('						</Table>');
                sHTML = sHTML.concat('				</p>');
            }
            sHTML = sHTML.concat('		</td>');
            sHTML = sHTML.concat('	</tr>');
            sHTML = sHTML.concat('</Table>');
        }
        else {
            sHTML = sHTML.concat('<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('		<td width="100%" valign="top" class="HomeNormal LightBlue" style="padding-top:2px;"><font size="2">&#9642;</font>&nbsp;<a class="HomeNormal LBlue2 Bold" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
            sHTML = sHTML.concat('	<tr>');
            sHTML = sHTML.concat('</Table>');
        }
        i++;
    }
    return sHTML;
}

function getcentercategory(sId, sName, sPath, arItem) {
    //if (sId==38){
    //	alert(arItem);
    //}
    var sHTML = '';
    var iCount = 0, i = 0;
    while (i < arItem.length) {
        sHTML = sHTML.concat('<Table border=0 cellpadding=0 cellspacing=0 width="100%" style="background: url(/images/sd/SD04.gif) no-repeat; background-position:0 11">');
        sHTML = sHTML.concat('	<tr>');
        sHTML = sHTML.concat('		<td>');
        sHTML = sHTML.concat('			<Table border=0 cellpadding=0 cellspacing=0 width="100%">');
        sHTML = sHTML.concat('				<tr>');
        sHTML = sHTML.concat('					<td nowrap><a class="HomeFolder DBlue4" href="').concat(sPath).concat('">').concat(sName).concat('</a></td>');
        sHTML = sHTML.concat('					<td style="background-image: url(/Images/NewsBox/HeaderDot.gif); background-position: 2px 9px; background-repeat: repeat-x;" width="100%"></td>');
        sHTML = sHTML.concat('				</tr>');
        sHTML = sHTML.concat('			</Table>');
        sHTML = sHTML.concat('		</td>');
        sHTML = sHTML.concat('	</tr>');
        sHTML = sHTML.concat('	<tr>');
        sHTML = sHTML.concat('		<td style="padding-top:4;">');
        if (arItem[i][6] != '') {
            sHTML = sHTML.concat('		').concat(ShowPhoto(arItem[i][1], arItem[i][6], 65, 55, 1, "#d7d7d8", 1, "#ffffff", 'padding-top:3px;padding-right:4px;'));
        }
        sHTML = sHTML.concat('		<p class="NoMargin" style="margin-top:2px"><a class="HomeNormal Bold Black" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></p>');
        sHTML = sHTML.concat('		<p class="NoMargin Small" style="margin-top:4px">').concat(arItem[i][3]).concat('</p>');
        if ((arItem[i][7] + arItem[i][8] + arItem[i][9]) > 0) {
            sHTML = sHTML.concat('				<p class="NoMargin" align="right">');
            sHTML = sHTML.concat('						<Table border=0 cellspacing=1 cellpadding=0 align="right">');
            sHTML = sHTML.concat('							<tr>');
            if (arItem[i][7] > 0) {
                sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Video.gif"></td>');
            }
            if (arItem[i][8] > 0) {
                sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Photo.gif"></td>');
            }
            if (arItem[i][9] > 0) {
                sHTML = sHTML.concat('								<td style="padding-left:2;padding-right:2;"><img src="/Images/Story.gif"></td>');
            }
            sHTML = sHTML.concat('							</tr>');
            sHTML = sHTML.concat('						</Table>');
            sHTML = sHTML.concat('				</p>');
        }
        if (sId == 26 || sId == 27 || sId == 38) {
            sHTML = sHTML.concat('				<p class="NoMargin">');
            sHTML = sHTML.concat('					<Table border=0 cellspacing=1 cellpadding=0>');
            sHTML = sHTML.concat('						<tr>');
            sHTML = sHTML.concat('							<td style="padding-right:2;"><a href="/service/Contribution/?f=').concat(sId).concat('" hidefocus><img src="/images/pen2.gif" border=0></a></td>');
            sHTML = sHTML.concat('							<td><a href="/service/Contribution/?f=').concat(sId).concat('" class="Contribution" hidefocus>');
            if (sId == 26) sHTML = sHTML.concat('B&#7841;n c&#243; th&#7875; t&#226;m s&#7921; t&#7841;i &#273;&#226;y');
            if (sId == 27) sHTML = sHTML.concat('Vi&#7871;t cho ng&#432;&#7901;i y&#234;u d&#7845;u');
            if (sId == 38) sHTML = sHTML.concat('&#272;&#7863;t c&#226;u h&#7887;i t&#7841;i &#273;&#226;y');
            sHTML = sHTML.concat('</a></td>');
            sHTML = sHTML.concat('						</tr>');
            sHTML = sHTML.concat('					</Table>');
            sHTML = sHTML.concat('				</p>');
        }
        sHTML = sHTML.concat('		</td>');
        sHTML = sHTML.concat('	</tr>');
        sHTML = sHTML.concat('</Table>');
        i++;
    }
    return sHTML;
}


function ShowPhoto(vPath, vFile, vWidth, vHeight, vOutBorderWidth, vOutBorderColor, vInBorderWidth, vInBorderColor, vPaddingRight) {
    if (typeof (vInBorderWidth) == 'undefined') {
        return '<table align=left cellspacing=0 cellpadding=' + vOutBorderWidth + ' bgcolor="' + vOutBorderColor + '" width="' + vWidth + vOutBorderWidth + '"><tr><td class="LoadBox">' + GetPhoto(vPath, vFile, vWidth, vHeight) + '</td></tr></table>';
    }
    else if (typeof (vPaddingRight) == 'undefined') {
        return '<table align=left cellspacing="' + vOutBorderWidth + '" cellpadding="' + vInBorderWidth + '" border="0" bgcolor="' + vOutBorderColor + '"><tr><td bgcolor="' + vInBorderColor + '">' + GetPhoto(vPath, vFile, vWidth, vHeight) + '</td></tr></table>';
    }
    else {
        return '<table align=left cellspacing="0" cellpadding="0" border="0"><tr><td style="' + vPaddingRight + '"><table align=left cellspacing="' + vOutBorderWidth + '" cellpadding="' + vInBorderWidth + '" border="0" bgcolor="' + vOutBorderColor + '"><tr><td bgcolor="' + vInBorderColor + '">' + GetPhoto(vPath, vFile, vWidth, vHeight) + '</td></tr></table></td></tr></table>';
    }
}

function GetPhoto(vPath, vFile, vWidth, vHeight) {
    return '<a href="' + vPath + '" hidefocus><img src="' + vPath + vFile + '" border=0 width="' + vWidth + '" height="' + vHeight + '"></a>';
}

function AddBreak(vHeight) {
    return '<table border=0 cellpadding=0 cellspacing=0><tr><td height=' + vHeight + '></td></tr></table>'
}

function DisplayFolderSub(id) {
    displaylistcategory(3, id);
}

function IsStarTeenFolder() {
    if (RelatedFolder == 28 || RelatedFolder == 31 || RelatedFolder == 32 || RelatedFolder == 33 || RelatedFolder == 34) return true; else return false;
}

//------------------------------- NewsPanel --------------------------------
function NewsPanelHeader() {
    var HTML = '';
    HTML += '<table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" id="table_BT">';
    HTML += '<tr>';
    HTML += '	<td><img width="3" height="3" alt="" src="/images/BG/RB/LT.gif"/></td>';
    HTML += '	<td width="100%" height="3" background="/images/BG/RB/T.gif" alt=""/>';
    HTML += '	<td><img width="3" height="3" alt="" src="/images/BG/RB/RT.gif"/></td>';
    HTML += '</tr>';
    return HTML;
}

function NewsPanelHR() {
    var HTML = '';
    HTML += '<tr>';
    HTML += '	<td width="3" height="4" background="/images/bg/BGBRL.gif"/>';
    HTML += '	<td height="4" background="/images/bg/RB/BGM.gif"/>';
    HTML += '	<td width="3" height="4" background="/images/bg/BGBRR.gif"/>';
    HTML += '</tr>';
    return HTML;
}

function NewsPanelFooter() {
    var HTML = '';
    HTML += '<tr>';
    HTML += '	<td><img width="3" height="3" alt="" src="/images/BG/RB/LB.gif"/></td>';
    HTML += '	<td width="100%" height="3" background="/images/BG/RB/B.gif" alt=""/>';
    HTML += '	<td><img width="3" height="3" alt="" src="/images/BG/RB/RB.gif"/></td>';
    HTML += '</tr>';
    HTML += '</table>';
    return HTML;
}

function NewsPanelItem(vPath, vTitle, vShortLead, vImage, vImageWidth, vImageHeight) {
    var HTML = '';
    HTML += '<tr>';
    HTML += '	<td style="border-left: 1px solid rgb(167, 168, 175); border-right: 1px solid rgb(167, 168, 175); padding: 4px 8px; background: rgb(238, 241, 245) none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" colspan="3">';
    HTML += '		<table width="100%" cellspacing="0" cellpadding="0" border="0">';
    HTML += '		<tr>';
    if (vImage != '') {
        HTML += '			<td class="Right Top">';
        HTML += '				<table cellspacing="1" cellpadding="1" border="0" bgcolor="#d4d4d4" align="left"><tr><td bgcolor="#ffffff"><a hidefocus="" href="' + vPath + '"><img width="' + vImageWidth + '" height="' + vImageHeight + '" border="0" src="' + vPath + vImage + '.thumb' + vImageWidth + 'x' + vImageHeight + '.ns.jpg"/></a></td></tr></table>';
        HTML += '			</td>';
        HTML += '			<td width="8"/>';
    }
    HTML += '			<td valign="top">';
    HTML += '				<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">';
    HTML += '				<tr><td colspan="4"><a class="HomeNormal Bold DRed" href="' + vPath + '">' + vTitle + '</a></td></tr>';
    HTML += '				<tr><td class="Small Justify" colspan="4">' + vShortLead + '</td></tr>';
    HTML += '				</table>';
    HTML += '			</td>';
    HTML += '		</tr>';
    HTML += '		</table>';
    HTML += '	</td>';
    HTML += '</tr>';

    return HTML;
}

function NewsPanelHTML(id, arItem) {
    var HTML = '';
    var i = 0;

    HTML += NewsPanelHeader();
    while (i < arItem.length) {
        if (i > 0) HTML += NewsPanelHR();
        switch (id) {
            case 18:
                HTML += NewsPanelItem(arItem[i][1], arItem[i][2], arItem[i][3], arItem[i][5], 95, 67); break;
            default:
                HTML += NewsPanelItem(arItem[i][1], arItem[i][2], arItem[i][3], arItem[i][6], 65, 55); break;
        }
        i++;
    }
    HTML += NewsPanelFooter();
    return HTML;
}

function ShowNewsPanel(id, max) {
    var iMaxItem = max;
    var arItem = new Array();

    AjaxRequest.get
	(
		{
		    'url': '/ListFile/NewsPanel(' + id + ').xml'
	    , 'onSuccess': function(req) {
	        if (req.responseXML.getElementsByTagName('Folder').length > 0) {
	            with (req.responseXML.getElementsByTagName('Folder').item(0)) {
	                sId = getNodeValue(getElementsByTagName('fID'));
	            }
	        }
	        var iCount = 0;
	        for (var i = 0; i < req.responseXML.getElementsByTagName('Item').length; i++) {
	            with (req.responseXML.getElementsByTagName('Item').item(i)) {
	                if (iCount < iMaxItem) {
	                    var sTemp = getNodeValue(getElementsByTagName('sID'));
	                    if (sTemp != '' && displayid(sTemp)) {
	                        arItem[iCount] = new Array(10);
	                        arItem[iCount][0] = getNodeValue(getElementsByTagName('sID'));
	                        arItem[iCount][1] = getNodeValue(getElementsByTagName('sPath'));
	                        arItem[iCount][2] = getNodeValue(getElementsByTagName('sTitle'));
	                        arItem[iCount][3] = getNodeValue(getElementsByTagName('sShortLead'));
	                        arItem[iCount][4] = getNodeValue(getElementsByTagName('sImageTopStory'));
	                        arItem[iCount][5] = getNodeValue(getElementsByTagName('sImageHome'));
	                        arItem[iCount][6] = getNodeValue(getElementsByTagName('sImageFolder'));
	                        arItem[iCount][7] = getNodeValue(getElementsByTagName('sHasVideo'));
	                        arItem[iCount][8] = getNodeValue(getElementsByTagName('sHasPhoto'));
	                        arItem[iCount][9] = getNodeValue(getElementsByTagName('sHasStory'));
	                        iCount++;
	                    }
	                }
	            }
	        }

	        gmobj('tdNewsPanel').innerHTML = (NewsPanelHTML(id, arItem));
	    }
		}

	)
}
//------------------------------- /NewsPanel --------------------------------
function writeAdv(url, link, width, height, className, title, target) {
    if (!url) return;
    width = width ? "width='" + width + "'" : "";
    height = height ? "height='" + height + "'" : "";
    link = link ? "href='" + link + "'" : "";
    title = title ? "title='" + title + "'" : "";
    target = target ? "target='" + target + "'" : "";
    className = className ? "class='" + className + "'" : "";
    if (url.match(/.swf$/ig)) {
        document.write("<embed src='" + url + "' quality='best' wmode='transparent' " + width + " " + height + " align='middle'  allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
        //            document.write("\
        //        <a "+ link +">\
        //           <embed src='" + url + "' quality='best' wmode='transparent' " + width + " " + height + " align='middle'  allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
        //        </a>\
        //        ");
    }
    else {
        document.write("\
        <a " + className + "  " + link + " " + title + " " + target + ">\
            <img src='" + url + "' " + width + " " + height + " style='border:none'/>\
        </a>\
        ");
    }
}
