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;

function getNodeValue(o){
	try	{
		return o.item(0).firstChild.nodeValue;
	}
	catch(err) {
		return '';
	}
	// if (o.item(0)){
		// if (o.item(0).firstChild){
			// return o.item(0).firstChild.nodeValue;
		// }
		// else{
			// return '';
		// }
	// }
	// else{
		// return '';
	// }
}

function displayid(id,add){
	if (typeof(add)=='undefined') add=true;
	if (sLoDID.indexOf(id)<=0){
		if (add) sLoDID=sLoDID.concat(id).concat(',');
		//sLoDID=sLoDID.concat(id).concat(',');
		return true;
	}
	else{
		return false;
	}
}

function showtopstoryitem(sNameTS,sPathTS,arItemTS){
	iTSCount = arItemTS.length-1;
	var sHTML='';
	sHTML=sHTML.concat('<div style="position:relative;width:360px;height:265px;">');
	sHTML=sHTML.concat('	<div style="left:0px;top:0px;width:360px;height:3px;" class="HomeTopStoryBorder"></div>');
	sHTML=sHTML.concat('	<div style="left:0px;top:262px;width:360px;height:3px;" class="HomeTopStoryBorder"></div>');
	sHTML=sHTML.concat('	<div style="left:0px;top:3px;width:3px;height:259px;" class="HomeTopStoryBorder"></div>');
	sHTML=sHTML.concat('	<div style="left:357;top:3px;width:3px;height:259px;" 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(iif(i==0,'left:0px','left:-1000px')).concat(';top:0px;width:360px;height:265px;">');
		if(arItemTS[i][10]>0){
			sHTML=sHTML.concat('		<a href="').concat('/User/Interview/').concat('"><img border="0" src="').concat(arItemTS[i][1]).concat(arItemTS[i][4]).concat('" width="360" height="265"></a>');	
		}
		else{
			sHTML=sHTML.concat('		<a href="').concat(arItemTS[i][1]).concat('"><img border="0" src="').concat(arItemTS[i][1]).concat(arItemTS[i][4]).concat('" width="360" height="265"></a>');
		}
		sHTML=sHTML.concat('	</div>');
		sHTML=sHTML.concat('	<div id="divTopStoryLayer').concat(i).concat('" onmousemove="cleartopstorycounter();" style="').concat(iif(i==0,'left:0px','left:-1000px')).concat(';top:200px;width:360px;height:65px;" class="HomeTopStoryColorLayer"></div>');
		sHTML=sHTML.concat('	<div id="divTopStoryTitle').concat(i).concat('" onmousemove="cleartopstorycounter();" style="').concat(iif(i==0,'left:0px','left:-1000px')).concat(';top:200px;width:360px;height:65px;" class="HomeTopStoryColorLayerContent">');
		if(arItemTS[i][10]>0){
			sHTML=sHTML.concat('		<div style="left:7px;top:4px;width:355px;height:18px;" class="HomeTopStoryTitle" onclick="window.location=\'').concat('/User/Interview/').concat('\'">').concat(arItemTS[i][2]).concat('</div>');	
		}
		else{
			sHTML=sHTML.concat('		<div style="left:7px;top:4px;width:355px;height:18px;" class="HomeTopStoryTitle" onclick="window.location=\'').concat(arItemTS[i][1]).concat('\'">').concat(arItemTS[i][2]).concat('</div>');
		}
		sHTML=sHTML.concat('		<div style="left:8px;top:5px;width:355px;height:18px;" class="HomeTopStoryTitleShadow">').concat(arItemTS[i][2]).concat('</div>');
		sHTML=sHTML.concat('		<div style="left:8px;top:28px;width:340px;height:18px;" class="HomeTopStoryLead">').concat(arItemTS[i][3]);
		if (arItemTS[i][7]>0){
			sHTML = sHTML.concat('<img src="/Images/Video.gif" hspace=2>');
		}
		if (arItemTS[i][8]>0){
			sHTML = sHTML.concat('<img src="/Images/Photo.gif" hspace=2>');
		}
		if (arItemTS[i][9]>0){
			sHTML = sHTML.concat('<img src="/Images/Story.gif" hspace=2>');
		}
		sHTML = sHTML.concat('		</div>');
		sHTML=sHTML.concat('	</div>');
	}
	sHTML=sHTML.concat('<div style="left:332px;top:244px;width:40px;height:32px;" class="HomeTopStoryColorLayerSubImage">');
	sHTML=sHTML.concat('<img id="imgTSPrev" src="/Images/TopStory/Prev2.gif" hspace="2" vspace="0" onmouseover="iTSPrev=1;this.src=\'/Images/TopStory/Prev.gif\'" onmouseout="iTSPrev=0;this.src=\'/Images/TopStory/Prev2.gif\'" style="cursor:pointer" onclick="changetopstory(-1,false);">');
	sHTML=sHTML.concat('<img id="imgTSNext" src="/Images/TopStory/Next2.gif" hspace="2" vspace="0" onmouseover="iTSNext=1;this.src=\'/Images/TopStory/Next.gif\'" onmouseout="iTSNext=0;if (!iTSFading) this.src=\'/Images/TopStory/Next2.gif\'" 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="/Images/TopStory/Next.gif"
	else gmobj('imgTSPrev').src="/Images/TopStory/Prev.gif"
}

function outdirectionimage(){
	if (iTSNext==0) gmobj('imgTSNext').src="/Images/TopStory/Next2.gif"
	if (iTSPrev==0) gmobj('imgTSPrev').src="/Images/TopStory/Prev2.gif"
}

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('<Table border=0 cellspacing=0 cellpadding=0 width="100%" height="100%">');
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td height="100%" valign="top">');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('					<td background="/Images/TopBox/TopBackground.gif" height=4></td>');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('					<td align="center" style="padding-top:0;">');
	sHTML=sHTML.concat('						<Table align="center" border=0 cellspacing=1 cellpadding=0 width="92%">');
	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><a href="').concat(sPath).concat('"><img border="0" src="/Images/TopBox/').concat(sFolder).concat('.gif"></a></td>');
	sHTML=sHTML.concat('											<td width="100%" style="background-image:url(/Images/TopBox/HeaderDot.gif);background-position: 2px 9px; background-repeat: repeat-x;"></td>');
	sHTML=sHTML.concat('										</tr>');
	sHTML=sHTML.concat('									</Table>');
	sHTML=sHTML.concat('								</td>');
	sHTML=sHTML.concat('							</tr>');
	if (arItem[index][5]!=''){
		sHTML=sHTML.concat('							<tr>');
		sHTML=sHTML.concat('								<td align=center>');
		//sHTML=sHTML.concat('									<Table border=0 cellspacing=0 cellpadding=1 bgcolor="#626262">');
		//sHTML=sHTML.concat('										<tr><td><a href="').concat(arItem[index][1]).concat('"><img border=0 width=150 height=110 src="').concat(arItem[index][1]).concat(arItem[index][5]).concat('"></a></td></tr>');
		//sHTML=sHTML.concat('									</Table>');
		sHTML=sHTML.concat('<a href="').concat(arItem[index][1]).concat('"><img border=0 width=150 height=110 src="').concat(arItem[index][1]).concat(arItem[index][5]).concat('"></a>');
		sHTML=sHTML.concat('								</td>');
		sHTML=sHTML.concat('							</tr>');
	}
	sHTML=sHTML.concat('							<tr>');
	sHTML=sHTML.concat('								<td style="padding-left:3px;padding-right:3px;"><a class="HomeNormal Bold Black" href="').concat(arItem[index][1]).concat('">').concat(arItem[index][2]).concat('</a></td>');
	sHTML=sHTML.concat('							</tr>');
	sHTML=sHTML.concat('							<tr>');
	sHTML=sHTML.concat('								<td class="Small" style="padding-left:3px;padding-right:3px;">');
	sHTML=sHTML.concat('									').concat(arItem[index][3]);
	if (arItem[index][7]>0){
		sHTML = sHTML.concat('<img src="/Images/Video.gif" hspace=2>');
	}
	if (arItem[index][8]>0){
		sHTML = sHTML.concat('<img src="/Images/Photo.gif" hspace=2>');
	}
	if (arItem[index][9]>0){
		sHTML = sHTML.concat('<img src="/Images/Story.gif" hspace=2>');
	}
	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('	<tr>');
	sHTML=sHTML.concat('		<td style="padding-bottom:4;" align="right">');

	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 height="20px" width="100%" bgcolor="#c8d77d">');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('					<td>');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 align=right>');
	sHTML=sHTML.concat('				<tr>');
	if (index==0){
		sHTML=sHTML.concat('					<td style="padding-left:5;padding-right:5;"><img src="/Images/TopBox/Prev2.gif"></td>');
	}
	else{
		sHTML=sHTML.concat('					<td style="padding-left:5;padding-right:5;">');
		sHTML=sHTML.concat('<img src="/Images/TopBox/Prev.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitem(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index-1).concat(')"');
		sHTML=sHTML.concat('></td>');
	}
	if (index>=arItem.length-1){
		sHTML=sHTML.concat('					<td style="padding-left:5;padding-right:5;"><img src="/Images/TopBox/Next2.gif"></td>');
	}
	else{
		sHTML=sHTML.concat('					<td style="padding-left:5;padding-right:5;">');
		sHTML=sHTML.concat('<img src="/Images/TopBox/Next.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitem(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index+1).concat(')"');
		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>');
	gmobj('tdTopBox'+sFolder).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 sHTML;
	var iMaxItem;
	switch (parseInt(sFolder)){
		case 15: case 16: iMaxItem = 1; break;
		case 21: iMaxItem = 2;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 iCount=0, i=0;
	sHTML = sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 width="100%" height="100%">');
	sHTML = sHTML.concat('<tr>');
	if (arItem.length>0){
		sHTML = sHTML.concat('	<td bgcolor="#9e1617" valign="top">');
		sHTML = sHTML.concat('		<Table border=0 cellspacing=0 cellpadding=5 width="100%">');
		sHTML = sHTML.concat('			<tr>');
		sHTML = sHTML.concat('				<td>');
		sHTML = sHTML.concat('					<Table border=0 cellspacing=3 cellpadding=0 bgcolor="#FFFFFF">');
		sHTML = sHTML.concat('						<tr>');
		sHTML = sHTML.concat('							<td><a href="').concat(arItem[i][1]).concat('"><img border=0 height="120" width="170" src="').concat(arItem[i][1]).concat(arItem[i][5]).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>');
		sHTML = sHTML.concat('					<Table border=0 cellspacing=0 cellpadding=0 width="100%">');
		sHTML = sHTML.concat('						<tr>');
		sHTML = sHTML.concat('							<td rowspan=2 valign="top" style="padding-right:5px;"><img src="/Images/Poster/Photo.gif"></td>');
		sHTML = sHTML.concat('							<td><a class="HomeNormal White" href="').concat(arItem[i][1]).concat('"><b>').concat(arItem[i][2]).concat('</b></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>');
		sHTML = sHTML.concat('					</Table>');
		sHTML = sHTML.concat('				</td>');
		sHTML = sHTML.concat('			</tr>');
		sHTML = sHTML.concat('		</Table>');
		sHTML = sHTML.concat('	</td>');
	}
	i=1;
	if (arItem.length>1){
		sHTML = sHTML.concat('	<td width="1" bgcolor="#b13e3f"></td>');
		sHTML = sHTML.concat('	<td bgcolor="#861213" align="center" valign="top" style="padding-left:6px;padding-right:7px;padding-top:5px;">');
		sHTML = sHTML.concat('		<Table border=0 cellspacing=0 cellpadding=0 width="90%">');
		while (i<arItem.length){
			sHTML = sHTML.concat('			<tr>');
			sHTML = sHTML.concat('				<td>');
			sHTML = sHTML.concat('					<Table border=0 cellspacing=3 cellpadding=0 bgcolor="#FFFFFF">');
			sHTML = sHTML.concat('						<tr>');
			sHTML = sHTML.concat('							<td><a href="').concat(arItem[i][1]).concat('"><img border=0 height="67" width="95" src="').concat(arItem[i][1]).concat(arItem[i][5]).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 style="padding-top:3px;padding-bottom:3px;"><a class="Smaller Pink" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></td>');
			sHTML = sHTML.concat('			</tr>');
			i++;
		}
		sHTML = sHTML.concat('		</Table>');
		sHTML = sHTML.concat('	</td>');
	}
	sHTML = sHTML.concat('</tr>');
	sHTML = sHTML.concat('</Table>');
	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="/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('	<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] = getNodeValue(getElementsByTagName('sHasPhoto'));
								arItem[iCount][9] = 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] = getNodeValue(getElementsByTagName('sHasPhoto'));
								arItem[iCount][9] = getNodeValue(getElementsByTagName('sHasStory'));
								iCount++;
							}
						}
					}
	    		}
	    	}
			
			//////////////////////////////////////////////////////
			if(RelatedFolder==28) 
			{
			
				//return;
			}
			//alert(sPath);
			//////////////////////////////////////////////////////
			
	    	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], 170, 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], 170, 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){
	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="/user/Contribution/?f=').concat(sId).concat('" hidefocus><img src="/images/pen2.gif" border=0></a></td>');
			sHTML = sHTML.concat('							<td><a href="/user/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 --------------------------------

/*Write Social JS*/
function writeSociable(vLink, vTitle, vDescription, vId, SubjectID) {
	vTitle = vTitle.replace("'", "");
	vDescription = vDescription.replace("'", "");
	var strOut = "";
	strOut += "<div class=\"sociable\">";
	strOut += "<ul>";
	strOut += "<li class=\"sociablefirst\"><a title=\"Facebook\" onfocus=\"this.blur();\" href=\"http://ngoisao.net/Service/Share/?sjid=" + SubjectID + "&sid=1&myurl=" + Url.encode("http://www.facebook.com/share.php%3fu=" + vLink + "%26t=" + vTitle + "") + "'\" target=\"_blank\" id=\"facebook\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Facebook\" title=\"Facebook\" src=\"/images/facebook.gif\" style=\"width:14px;height:14px;\"  /></a></li>";
	strOut += "<li><a title=\"Google Bookmarks\" onfocus=\"this.blur();\" href=\"http://ngoisao.net/Service/Share/?sjid=" + SubjectID + "&sid=2&myurl=" + Url.encode("http://www.google.com/bookmarks/mark%3fop=edit%26amp;bkmk=" + vLink + "&amp;title=" + vTitle + "&amp;annotation=" + vDescription + "") + "\" target=\"_blank\" id=\"google\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Google Bookmarks\" style=\"width:14px;height:14px;\" title=\"Google Bookmarks\" src=\"/images/google.gif\"/></a></li>";
	strOut += "<li class=\"sociablelast\" class=\"sociablelast\"><a onfocus=\"this.blur();\" title=\"Twitter\" href=\"http://ngoisao.net/Service/Share/?sjid=" + SubjectID + "&sid=3&myurl=" + Url.encode("http://twitter.com/home%3fstatus=" + vTitle + " - " + vLink + "") + "'\" target=\"_blank\" id=\"twitter\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Twitter\" title=\"Twitter\" style=\"width:14px;height:14px;\" src=\"/images/twitter.gif\"/></a></li>";
	strOut += "</ul>";
	strOut += "</div>";

	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Mixx\" href=\"javascript:window.location='http://www.mixx.com/submit?page_url=" + Url.encode(vLink) + "&amp;title=" + Url.encode(vTitle) + "';\" target=\"_blank\" id=\"mixx\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Mixx\" title=\"Mixx\" src=\"/images/mixx.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Reddit\" href=\"javascript:window.location='http://reddit.com/submit?url=" + Url.encode(vLink) + "&amp;title=" + Url.encode(vTitle) + "';\" target=\"_blank\" id=\"reddit\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Reddit\" title=\"Reddit\" src=\"/images/reddit.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"StumbleUpon\" href=\"javascript:window.location='http://www.stumbleupon.com/submit?url=" + Url.encode(vLink) + "&amp;title=" + Url.encode(vTitle) + "';\" target=\"_blank\" id=\"stumbleupon\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"StumbleUpon\" title=\"StumbleUpon\" src=\"/images/stumbleupon.png\"/></a></li>";
	//strOut += "<li class=\"sociablefirst\"><a onfocus=\"this.blur();\" title=\"Digg\" href=\"javascript:window.location='http://digg.com/submit?phase=2&amp;url=" + Url.encode(vLink) + "&amp;title=" + Url.encode(vTitle) + "';\" target=\"_blank\" id=\"digg\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Digg\" title=\"Digg\" src=\"/images/digg.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"del.icio.us\" href=\"javascript:window.location='http://delicious.com/post?url=" + Url.encode(vLink) + "&amp;title=" + Url.encode(vTitle) + "';\" target=\"_blank\" id=\"del.icio.us\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"del.icio.us\" title=\"del.icio.us\" src=\"/images/delicious.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Yahoo! Buzz\" href=\"javascript:window.location='http://buzz.yahoo.com/submit/?submitUrl=" + Url.encode(vLink) + "&amp;submitHeadline=" + Url.encode(vTitle) + "&amp;submitSummary=" + vDescription + "&amp;submitCategory=science&amp;submitAssetType=text';\" target=\"_blank\" id=\"yahoobuzz\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Yahoo! Buzz\" title=\"Yahoo! Buzz\" src=\"/images/yahoobuzz.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"FriendFeed\" href=\"javascript:window.location='http://www.friendfeed.com/share?title=" + Url.encode(vTitle) + "&amp;link=" + Url.encode(vLink) + "';\" target=\"_blank\" id=\"friendfeed\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"FriendFeed\" title=\"FriendFeed\" src=\"/images/friendfeed.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Ping.fm\" href=\"javascript:window.location='http://ping.fm/ref/?link=" + Url.encode(vLink) + "&amp;title=" + Url.encode(vTitle) + "&amp;body=" + vDescription + "';\" target=\"_blank\" id=\"ping.fm\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Ping.fm\" title=\"Ping.fm\" src=\"/images/ping.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Technorati\" href=\"javascript:window.location='http://technorati.com/faves?add=" + Url.encode(vLink) + "';\" target=\"_blank\" id=\"technorati\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Technorati\" title=\"Technorati\" src=\"/images/technorati.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Yahoo! Bookmarks\" href=\"javascript:window.location='http://bookmarks.yahoo.com/toolbar/savebm?u=" + Url.encode(vLink) + "&amp;t=" + Url.encode(vTitle) + "&opener=bm&amp;ei=UTF-8&amp;d=';\" target=\"_blank\" id=\"yahoo! bookmarks\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Yahoo! Bookmarks\" title=\"Yahoo! Bookmarks\" src=\"/images/yahoomyweb.png\"/></a></li>";
	//strOut += "<li><a onfocus=\"this.blur();\" title=\"Netvibes\" href=\"javascript:window.location='http://www.netvibes.com/share?title=" + Url.encode(vTitle) + "&amp;url=" + Url.encode(vLink) + "';\" target=\"_blank\" id=\"netvibes\" rel=\"nofollow\"><img class=\"sociable-hovers\" alt=\"Netvibes\" title=\"Netvibes\" src=\"/images/netvibes.png\"/></a></li>";
	gmobj(vId).innerHTML = strOut;
}

/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/

var Url = {

    // public method for url encoding
    encode: function(string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode: function(string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode: function(string) {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if ((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode: function(utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while (i < utftext.length) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if ((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i + 1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i + 1);
                c3 = utftext.charCodeAt(i + 2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}