﻿var iReadStep=0, iDelay=20;
var sLoDID=',', sDate='';

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 getimages(Id, FileName){
	var number = new Number(Id);
	var hexId = Hexa(number);	
	return '/Files/Subject/'.concat(hexId.substring(0,2)).concat('/').concat(hexId.substring(2,4)).concat('/').concat(hexId.substring(4,6)).concat('/').concat(hexId.substring(6,8)).concat('/').concat(FileName);			
}

function RSSLink(sId){
	var strLink = '';
	var strRSS = 'RSS <img class="img-rss" src="/Images/rss.gif" alt="" />'
	if(PAGE_SITE == 0)
		strLink = '<a class="link-rss" href="/RSS/GL/';
	else if(PAGE_SITE == 1)
		strLink = '<a class="link-rss" href="/RSS/HN/';
	else if(PAGE_SITE == 2)
		strLink = '<a class="link-rss" href="/RSS/SG/';	
	switch (parseInt(sId)){
		case 18: 	strLink = strLink.concat('Xa-hoi.rss">').concat(strRSS).concat('</a>'); break;
		case 2: 	strLink = strLink.concat('The-gioi.rss">').concat(strRSS).concat('</a>'); break;
		case 3: 	strLink = strLink.concat('Kinh-doanh.rss">').concat(strRSS).concat('</a>'); break;
		case 51:	strLink = strLink.concat('Van-hoa.rss">').concat(strRSS).concat('</a>'); break;
		case 9:		strLink = strLink.concat('The-thao.rss">').concat(strRSS).concat('</a>'); break;
		case 47:	strLink = strLink.concat('Phap-luat.rss">').concat(strRSS).concat('</a>'); break;
		case 110:	strLink = strLink.concat('Doi-song.rss">').concat(strRSS).concat('</a>'); break;
		case 83:	strLink = strLink.concat('Khoa-hoc.rss">').concat(strRSS).concat('</a>'); break;
		case 89:	strLink = strLink.concat('Vi-tinh.rss">').concat(strRSS).concat('</a>'); break;
		case 38:	strLink = strLink.concat('Oto-Xe-may.rss">').concat(strRSS).concat('</a>'); break;
		case 109:	strLink = strLink.concat('Ban-doc-viet.rss">').concat(strRSS).concat('</a>'); break;
		case 127:	strLink = strLink.concat('Ban-doc-viet-Tam-su.rss">').concat(strRSS).concat('</a>'); break;		
		case 105:	strLink = strLink.concat('Cuoi.rss">').concat(strRSS).concat('</a>'); break;
		default: 	strLink = ''; break;
	}	
	return strLink;
}

function showtopstories(){
	var sTimeTS;
	var arItem = new Array();	
	var sLink = ''
	if(DOMESTIC_IP==0)
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/sd_ts.xml');
	else
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/so_ts.xml');
	var iMaxTS = 4;
	AjaxRequest.get({
		'url':sLink,
		'onSuccess':function(req){
			if (req.responseXML.getElementsByTagName('F').length>0){
				with(req.responseXML.getElementsByTagName('F').item(0))
					sTimeTS = getNodeValue(getElementsByTagName('T'));		
			}
			var iCount=0;
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){
					if (iCount<iMaxTS){
						var sTemp = getNodeValue(getElementsByTagName('I'));
						if (sTemp!='' && displayid(sTemp)){
							arItem[iCount] = new Array(20);
							arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
							arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
							arItem[iCount][2] = getNodeValue(getElementsByTagName('T'));
							arItem[iCount][3] = getNodeValue(getElementsByTagName('L'));
							arItem[iCount][4] = getNodeValue(getElementsByTagName('TI'));
							arItem[iCount][5] = getNodeValue(getElementsByTagName('TW'));
							arItem[iCount][6] = getNodeValue(getElementsByTagName('TH'));
							arItem[iCount][7] = getNodeValue(getElementsByTagName('SI'));
							arItem[iCount][8] = getNodeValue(getElementsByTagName('SW'));
							arItem[iCount][9] = getNodeValue(getElementsByTagName('SH'));
							arItem[iCount][10] = getNodeValue(getElementsByTagName('LI'));
							arItem[iCount][11] = getNodeValue(getElementsByTagName('LW'));
							arItem[iCount][12] = getNodeValue(getElementsByTagName('LH'));
							arItem[iCount][13] = getNodeValue(getElementsByTagName('HV'));
							arItem[iCount][14] = getNodeValue(getElementsByTagName('HI'));
							arItem[iCount][15] = getNodeValue(getElementsByTagName('HS'));
							arItem[iCount][16] = getNodeValue(getElementsByTagName('OI'));
							arItem[iCount][17] = getNodeValue(getElementsByTagName('OW'));
							arItem[iCount][18] = getNodeValue(getElementsByTagName('OH'));
							arItem[iCount][19] = getNodeValue(getElementsByTagName('F'));
							iCount++;
						}
					}
				}
			}			
			gmobj('top4').innerHTML=gettopstoriesitem(sTimeTS,arItem);
			iReadStep=2;
		},
		'onError':function(req){
			gmobj('top4').innerHTML=req.statusText; iReadStep=2;
		}
	})
}

function gettopstoriesitem(sTimeTS,arItem){	
	var i;
	var sHTML='';	
	dFormat(sTimeTS);			
	sHTML=sHTML.concat('<div class="hotnews-top fl">');
	sHTML=sHTML.concat('	<div class="fl"><img src="/Images/Background/hotnews-topleft.gif" alt="" class="alt" /></div>');
	sHTML=sHTML.concat('	<div class="hotnews-topright fl">&nbsp;</div>');
	sHTML=sHTML.concat('</div>');
	sHTML=sHTML.concat('<div class="hotnews-content fl">');
	sHTML=sHTML.concat('	<div class="hotnews-detail fl">');
	sHTML=sHTML.concat('<p>');
	if(arItem[0][4]!='')
		sHTML=sHTML.concat(BuildLink(arItem[0][19], arItem[0][1], '')).concat('<img class="img-topnews fl" src="').concat(getimages(arItem[0][0], arItem[0][4])).concat('" alt="" /></a>');		
	sHTML = sHTML.concat(BuildLink(arItem[0][19], arItem[0][1], 'link-topnews')).concat(arItem[0][2]).concat('</a>');
	sHTML=sHTML.concat(showMediaIcon(arItem[0][1], arItem[0][13], arItem[0][14], 3)).concat('</p>');
	sHTML=sHTML.concat('<p>').concat(arItem[0][3].replace(/class=Lead/ig,'class=Lead1')).concat('</p>');
	sHTML=sHTML.concat('	</div>');
	sHTML=sHTML.concat('</div>');
	sHTML=sHTML.concat('<div class="hotnews-bottom fl">');
	sHTML=sHTML.concat('	<div class="hbl he4 fl">&nbsp;</div>');
	sHTML=sHTML.concat('	<div class="hotnews-bottomright fl">&nbsp;</div>');
	sHTML=sHTML.concat('</div>');
	sHTML=sHTML.concat('<div class="t3 fl">');
	for (i=1;i<=arItem.length-1;i++){
		sHTML=sHTML.concat('	<div class="t3-content fl">');
		if(arItem[i][4]!=''){
			sHTML=sHTML.concat('<p>').concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-top3" src="').concat(getimages(arItem[i][0], arItem[i][4])).concat('.thumb150x0.ns.jpg" alt="" /></a></p>');
			sHTML=sHTML.concat('<p>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-title')).concat(arItem[i][2]).concat('</a>');
			sHTML=sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 3)).concat('</p>');
		}
		else{
			sHTML=sHTML.concat('<p>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-title')).concat(arItem[i][2]).concat('</a></p>');
			sHTML=sHTML.concat('<p>').concat(arItem[i][3].replace(/class=Lead/ig,'class=Lead1'));
			sHTML=sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 3)).concat('</p>');
		}
		sHTML=sHTML.concat('	</div>');
	}
	sHTML=sHTML.concat('</div>');	
	return sHTML;
}

function writeTopDate(){	
	if(gmobj("topnewsdate")&&sDate!='') gmobj("topnewsdate").innerHTML = sDate;		
	else setTimeout(function(){writeTopDate();},iDelay);
}

function showtoplistitem(){
	var sIdTD, sNameTN, sPathTN;
	var arItem = new Array();	
	var sLink = '';
	if(DOMESTIC_IP==0)
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/sd_tn.xml');
	else
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/so_tn.xml');
	var iMaxTN = 10;
	AjaxRequest.get({
		'url':sLink,
		'onSuccess':function(req){
			if (req.responseXML.getElementsByTagName('F').length>0){
				with(req.responseXML.getElementsByTagName('F').item(0)){
					sIdTN = getNodeValue(getElementsByTagName('I'));
					sNameTN = toUpper(getNodeValue(getElementsByTagName('N')));
					sPathTN = getNodeValue(getElementsByTagName('P'));
				}
			}
			var iCount=0;
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){
					if (iCount<iMaxTN){
						var sTemp = getNodeValue(getElementsByTagName('I'));
						if (sTemp!=''){
							arItem[iCount] = new Array(20);
							arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
							arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
							arItem[iCount][2] = getNodeValue(getElementsByTagName('T'));
							arItem[iCount][3] = getNodeValue(getElementsByTagName('L'));
							arItem[iCount][4] = getNodeValue(getElementsByTagName('TI'));
							arItem[iCount][5] = getNodeValue(getElementsByTagName('TW'));
							arItem[iCount][6] = getNodeValue(getElementsByTagName('TH'));
							arItem[iCount][7] = getNodeValue(getElementsByTagName('SI'));
							arItem[iCount][8] = getNodeValue(getElementsByTagName('SW'));
							arItem[iCount][9] = getNodeValue(getElementsByTagName('SH'));
							arItem[iCount][10] = getNodeValue(getElementsByTagName('LI'));
							arItem[iCount][11] = getNodeValue(getElementsByTagName('LW'));
							arItem[iCount][12] = getNodeValue(getElementsByTagName('LH'));
							arItem[iCount][13] = getNodeValue(getElementsByTagName('HV'));
							arItem[iCount][14] = getNodeValue(getElementsByTagName('HI'));
							arItem[iCount][15] = getNodeValue(getElementsByTagName('HS'));
							arItem[iCount][16] = getNodeValue(getElementsByTagName('OI'));
							arItem[iCount][17] = getNodeValue(getElementsByTagName('OW'));
							arItem[iCount][18] = getNodeValue(getElementsByTagName('OH'));
							arItem[iCount][19] = getNodeValue(getElementsByTagName('F'));
							iCount++;
						}
					}
				}
			}
			gmobj('toplist').innerHTML=gettoplistitem(sNameTN,sPathTN,arItem);			
		},
		'onError':function(req){gmobj('toplist').innerHTML=req.statusText;}
	})
}

function gettoplistitem(sNameTN,sPathTN,arItem){		
	var sHTML='';	
	sHTML=sHTML.concat('<ul>');
	for (var i=0;i<=arItem.length-1;i++){
		sHTML=sHTML.concat('<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-toplist')).concat(arItem[i][2]).concat('</a>');
		if(arItem[i][13]>0)
			sHTML=sHTML.concat('&nbsp;<img src="/Images/video2.gif" alt="" />');
		if(arItem[i][14]>0)
			sHTML=sHTML.concat('&nbsp;<img src="/Images/photo2.gif" alt="" />');
		sHTML=sHTML.concat('</li>');
	}
	sHTML=sHTML.concat('</ul>');	
	return sHTML;	
}

function showhomefolderitem(sFolder){
	iReadStep = 2
	if (iReadStep<2){	
		setTimeout(function(){showhomefolderitem(sFolder);},iDelay); return;
	}
	var sId, sName, sPath;
	var arItem = new Array();	
	var sLink = '';
	if(DOMESTIC_IP==0)
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/sd_').concat(sFolder).concat('.xml');
	else
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/so_').concat(sFolder).concat('.xml');
	var sHTML;
	var iMaxItem;
	switch (parseInt(sFolder)){
		case 15: case 16: case 25: 
			iMaxItem = 1; break;
		case 110: case 400: 
			iMaxItem = 4; break;
		case 2: case 3: case 9: case 18: case 38: case 47: case 51: case 83: case 89: case 127: 
			iMaxItem = 5; break;
		case 1001: 
			iMaxItem = 7;break;		
		case 105:
			iMaxItem = 2; break;		
		default: 
			iMaxItem = 3;
	}
	AjaxRequest.get({
		'url':sLink,
		'onSuccess':function(req){			
			if (req.responseXML.getElementsByTagName('F').length>0){				
				with(req.responseXML.getElementsByTagName('F').item(0)){
					sId = getNodeValue(getElementsByTagName('I'));
					sName = toUpper(getNodeValue(getElementsByTagName('N')));
					sPath = getNodeValue(getElementsByTagName('P'));					
				}
			}
			var iCount=0;
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){
					if (iCount<iMaxItem){
						var sTemp = getNodeValue(getElementsByTagName('I'));
						if (sTemp!='' && displayid(sTemp)){
							arItem[iCount] = new Array(20);
						arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
						arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
						arItem[iCount][2] = getNodeValue(getElementsByTagName('T'));
						arItem[iCount][3] = getNodeValue(getElementsByTagName('L'));
						arItem[iCount][4] = getNodeValue(getElementsByTagName('TI'));
						arItem[iCount][5] = getNodeValue(getElementsByTagName('TW'));
						arItem[iCount][6] = getNodeValue(getElementsByTagName('TH'));
						arItem[iCount][7] = getNodeValue(getElementsByTagName('SI'));
						arItem[iCount][8] = getNodeValue(getElementsByTagName('SW'));
						arItem[iCount][9] = getNodeValue(getElementsByTagName('SH'));
						arItem[iCount][10] = getNodeValue(getElementsByTagName('LI'));
						arItem[iCount][11] = getNodeValue(getElementsByTagName('LW'));
						arItem[iCount][12] = getNodeValue(getElementsByTagName('LH'));
						arItem[iCount][13] = getNodeValue(getElementsByTagName('HV'));
						arItem[iCount][14] = getNodeValue(getElementsByTagName('HI'));
						arItem[iCount][15] = getNodeValue(getElementsByTagName('HS'));		
						arItem[iCount][16] = getNodeValue(getElementsByTagName('OI'));
						arItem[iCount][17] = getNodeValue(getElementsByTagName('OW'));
						arItem[iCount][18] = getNodeValue(getElementsByTagName('OH'));
						arItem[iCount][19] = getNodeValue(getElementsByTagName('F'));
						iCount++;
					}
				}
				}
			}
			switch (parseInt(sFolder)){	    						
				case 400: sHTML = getphotofolder(sId,sName,sPath,arItem);break;
				default: sHTML = gethomefolderitem(sId,sName,sPath,arItem); break;
			}			
			gmobj('tdHomeFolder'+sFolder).innerHTML=sHTML;			
			switch (parseInt(sFolder)){
				case 110: showsubfolder(151); break;				
				default: break;
			}			
		},
		'onError':function(req){gmobj('tdHomeFolder'.concat(sFolder)).innerHTML=req.statusText;}
	})
}

function gethomefolderitem(sId,sName,sPath,arItem){
	var sHTML = '';
	var i=0;	
	if(sId==105){
		while(i<arItem.length){
			sHTML = sHTML.concat('<p>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-title')).concat(arItem[i][2]).concat('</a></p> ');
			sHTML = sHTML.concat('<p>').concat(arItem[i][3].replace(/class=Lead/ig,'class=Lead1')).concat('</p>');			
			i++;
		}
	}	
	else if(sId==109){
		while(i<arItem.length){
			if(i==0){
				sHTML = sHTML.concat('	<div class="folder-topnews2 fl">');
				if(arItem[i][7] != '')
					sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-subject fl" src="').concat(getimages(arItem[i][0], arItem[i][7])).concat('" alt="" /></a>');					
				sHTML = sHTML.concat('<p>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-title')).concat(arItem[i][2]).concat('</a>');
				sHTML = sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 0)).concat('</p>');
				sHTML = sHTML.concat('<p>').concat(arItem[i][3].replace(/class=Lead/ig,'class=Lead1')).concat('</p>');
				sHTML = sHTML.concat('	</div>');
			}
			else{
				if(i==1){
					sHTML = sHTML.concat('	<div class="folder-othernews2 fl" style="padding-top:5px;">');
					sHTML = sHTML.concat('		<ul>');
					sHTML = sHTML.concat('			<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				}
				else if(i!=arItem.length-1){
					sHTML = sHTML.concat('			<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');					
				}
				else{
					sHTML = sHTML.concat('			<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					sHTML = sHTML.concat('		</ul>');
					sHTML = sHTML.concat('	</div>');
				}
			}
			i++;
		}
	}
	else{			
		sHTML = sHTML.concat('	<div class="folder-topnews fl">');	
		if(arItem[i][7] != '')
			sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-subject fl" src="').concat(getimages(arItem[i][0], arItem[i][7])).concat('" alt="" /></a>');					
		sHTML = sHTML.concat('<p>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-title')).concat(arItem[i][2]).concat('</a>');
		sHTML = sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 0)).concat('</p>');
		sHTML = sHTML.concat('<p>').concat(arItem[i][3].replace(/class=Lead/ig,'class=Lead1')).concat('</p>');
		sHTML = sHTML.concat('	</div>');		
		sHTML = sHTML.concat(getothernews(sId,sName,sPath,arItem));		
	}
	if(sId!=110)
		sHTML = sHTML.concat('	<div class="rss fr">').concat(RSSLink(sId)).concat('</div>');
	else{
		sHTML = sHTML.concat('	<div class="rss fr">');
		sHTML = sHTML.concat('<div class="fl"><img src="/Images/Menu/black-triangle.gif" alt="" />&nbsp;').concat('<a class="link-othernews3" href="/GL/Suc-khoe/Tu-van/">T&#432; v&#7845;n s&#7913;c kh&#7887;e</a>');
		sHTML = sHTML.concat('&nbsp;&nbsp;&nbsp;<img src="/Images/Menu/black-triangle.gif" alt="" />&nbsp;').concat('<a class="link-othernews3" href="/GL/Doi-song/Tu-van-nuoi-day-tre/">T&#432; v&#7845;n nu&#244;i d&#7841;y tr&#7867;</a></div>');
		sHTML = sHTML.concat(RSSLink(sId)).concat('</div>');
	}
	sHTML = sHTML.concat('</div>');	
	return sHTML;
}

function getothernews(sId,sName,sPath,arItem){
	var sHTML = '';
	var i=1;
	switch (parseInt(sId)){
		case 2: case 3: case 9: case 18: case 38: case 47: 
			while(i<arItem.length){
				if(i==1){
					sHTML = sHTML.concat('	<div class="folder-othernews fl">');					
					if(arItem[i][7] != '' || arItem[i][10] != ''){
						sHTML = sHTML.concat('<div class="other-folder fl">');
						if(arItem[i][10] != '')
							sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-other fl" src="').concat(getimages(arItem[i][0], arItem[i][10])).concat('" alt="" /></a>');
						else
							sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-other fl" src="').concat(getimages(arItem[i][0], arItem[i][7])).concat('" alt="" /></a>');
						sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a>');
						sHTML = sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 0));
						sHTML = sHTML.concat('</div>');
						sHTML = sHTML.concat('<div class="fl">');
						sHTML = sHTML.concat('	<ul>');
					}	
					else{
						sHTML = sHTML.concat('		<div class="fl">');
						sHTML = sHTML.concat('			<ul>');
						sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					}
				}
				else if(i!=arItem.length-1){
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				}
				else{
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					sHTML = sHTML.concat('			</ul>');
					sHTML = sHTML.concat('		</div>');
					sHTML = sHTML.concat('	</div>');
				}
				i++;
			}
			break;				
		case 110:
			while(i<arItem.length){
				if(i==1) {
					sHTML = sHTML.concat('	<div class="folder-othernews fl">');
					sHTML = sHTML.concat('		<div class="fl">');
					sHTML = sHTML.concat('			<ul>');
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				}
				else if(i!=arItem.length-1)
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				else{
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					sHTML = sHTML.concat('			</ul>');
					sHTML = sHTML.concat('		</div>')
					sHTML = sHTML.concat('		<div class="other-folder2 fl" id="HomeFolder151"></div>');
					sHTML = sHTML.concat('	</div>');
				}
				i++;
			}
			break;		
		default:
			while(i<arItem.length){
				if(i==1){
					sHTML = sHTML.concat('	<div class="folder-othernews fl">');
					sHTML = sHTML.concat('		<ul>');
					sHTML = sHTML.concat('			<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				}
				else if(i!=arItem.length-1)
					sHTML = sHTML.concat('			<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				else{
					sHTML = sHTML.concat('			<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					sHTML = sHTML.concat('		</ul>');
					sHTML = sHTML.concat('	</div>');
				}
				i++;
			}
			break;
	}
	return	sHTML;
}

function getphotofolder(sId,sName,sPath,arItem){
	var sHTML = '';	
	var i=0;	
	while (i<arItem.length){
		if(i==0){
			sHTML = sHTML.concat('<div class="box-middle1 folder-photo fl">');
			sHTML = sHTML.concat('		<p><a href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></p>');
			sHTML = sHTML.concat('		<p><a href="').concat(arItem[i][1]).concat('"><img src="').concat(getimages(arItem[i][0], arItem[i][16])).concat('"/></a></p>');
			sHTML = sHTML.concat('</div>');
		}		
		else{
			if(i==1){	
				sHTML = sHTML.concat('<div class="box-middle1 list-item fl">');				
				sHTML = sHTML.concat('		<ul>');
				sHTML = sHTML.concat('			<li><a class="link-othernews3" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></li>');
			}			
			else if(i!=arItem.length-1)
				sHTML = sHTML.concat('			<li><a class="link-othernews3" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></li>');
			else{
				sHTML = sHTML.concat('			<li><a class="link-othernews3" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat('</a></li>');
				sHTML = sHTML.concat('		</ul>');
				sHTML = sHTML.concat('	</div>')				
			}
		}
		i++;
	}		
	return sHTML;
}

function showsubfolder(sFolder){		
	var sId, sName, sPath;
	var arItem = new Array();	
	var sLink = '';
	if(DOMESTIC_IP==0)
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/sd_').concat(sFolder).concat('.xml');
	else
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/so_').concat(sFolder).concat('.xml');
	var sHTML;
	var iMaxItem;
	switch (parseInt(sFolder)){
		case 10: case 14: iMaxItem = 2; break;		
		case 121: iMaxItem = 4; break;			
		default: iMaxItem = 1; break;
	}			
	AjaxRequest.get({
		'url':sLink,
		'onSuccess':function(req){			
			if (req.responseXML.getElementsByTagName('F').length>0){				
				with(req.responseXML.getElementsByTagName('F').item(0)){
				sId = getNodeValue(getElementsByTagName('I'));
				sName = toUpper(getNodeValue(getElementsByTagName('N')));
				sPath = getNodeValue(getElementsByTagName('P'));					
				}
			}
			var iCount=0;
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){
					if (iCount<iMaxItem){
						var sTemp = getNodeValue(getElementsByTagName('I'));
						if (sTemp!='' && displayid(sTemp)){
							arItem[iCount] = new Array(20);
							arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
							arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
							arItem[iCount][2] = getNodeValue(getElementsByTagName('T'));
							arItem[iCount][3] = getNodeValue(getElementsByTagName('L'));
							arItem[iCount][4] = getNodeValue(getElementsByTagName('TI'));
							arItem[iCount][5] = getNodeValue(getElementsByTagName('TW'));
							arItem[iCount][6] = getNodeValue(getElementsByTagName('TH'));
							arItem[iCount][7] = getNodeValue(getElementsByTagName('SI'));
							arItem[iCount][8] = getNodeValue(getElementsByTagName('SW'));
							arItem[iCount][9] = getNodeValue(getElementsByTagName('SH'));
							arItem[iCount][10] = getNodeValue(getElementsByTagName('LI'));
							arItem[iCount][11] = getNodeValue(getElementsByTagName('LW'));
							arItem[iCount][12] = getNodeValue(getElementsByTagName('LH'));
							arItem[iCount][13] = getNodeValue(getElementsByTagName('HV'));
							arItem[iCount][14] = getNodeValue(getElementsByTagName('HI'));
							arItem[iCount][15] = getNodeValue(getElementsByTagName('HS'));
							arItem[iCount][16] = getNodeValue(getElementsByTagName('OI'));
							arItem[iCount][17] = getNodeValue(getElementsByTagName('OW'));
							arItem[iCount][18] = getNodeValue(getElementsByTagName('OH'));
							arItem[iCount][19] = getNodeValue(getElementsByTagName('F'));
							iCount++;
						}
					}
				}
			}	
			sHTML = getsubfolder(sId, sName, sPath, arItem, sFolder);
			gmobj('HomeFolder'.concat(sFolder)).innerHTML=sHTML;			
		},
		'onError':function(req){gmobj('HomeFolder'.concat(sFolder)).innerHTML=req.statusText;}
	})
}

function getsubfolder(sId, sName, sPath, arItem, sFolder){
	var sHTML = '';
	var i=0;
	switch(parseInt(sFolder)){
		case 5: case 151:
			if(arItem[i][10] != '')
				sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-other fl" src="').concat(getimages(arItem[i][0], arItem[i][10])).concat('" alt="" /></a>');
			else if(arItem[i][7] != '')
				sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-other fl" src="').concat(getimages(arItem[i][0], arItem[i][7])).concat('" alt="" /></a>');
			if(parseInt(sFolder)==5){
				sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a>');
				sHTML = sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 1));
			}
			else
				sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[0][2]).concat('</a>');	
			break;
		case 121:
			while(i<arItem.length){
				if(i==0) {
					sHTML = sHTML.concat('	<div class="folder-othernews fl">');					
					if(arItem[i][7] != '' || arItem[i][10] != ''){
						sHTML = sHTML.concat('<div class="other-folder fl">');
						if(arItem[i][10] != '')
							sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-other fl" src="').concat(getimages(arItem[i][0], arItem[i][10])).concat('" alt="" /></a>');
						else
							sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img class="img-other fl" src="').concat(getimages(arItem[i][0], arItem[i][7])).concat('" alt="" /></a>');
						sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a>');
						sHTML = sHTML.concat(showMediaIcon(arItem[i][1], arItem[i][13], arItem[i][14], 0));
						sHTML = sHTML.concat('</div>');
						sHTML = sHTML.concat('<div class="fl">');
						sHTML = sHTML.concat('	<ul>');
					}	
					else{
						sHTML = sHTML.concat('		<div class="fl">');
						sHTML = sHTML.concat('			<ul>');
						sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					}
				}
				else if(i!=arItem.length-1)
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				else{
					sHTML = sHTML.concat('				<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
					sHTML = sHTML.concat('			</ul>');
					sHTML = sHTML.concat('		</div>');
					sHTML = sHTML.concat('	</div>');
				}
				i++;
			}
			break;
		case 10: case 14:
			sHTML = sHTML.concat('<ul>');
			while (i<arItem.length){
				sHTML = sHTML.concat('	<li>').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-othernews')).concat(arItem[i][2]).concat('</a></li>');
				i++;
			}
			sHTML = sHTML.concat('</ul>');
			break;
		default: break;
	}
	return sHTML;
}

function changeChannel(objObject){showIPTV(objObject.value);}

function showIPTV(ExLocalID){	
	var sDate = '';
	var channel = '';
	var arItem = new Array();	
	var sLink = '/ListFile/iTV/' + ExLocalID + '.xml';
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){			
			sDate = getNodeValue(req.responseXML.getElementsByTagName('Date'));										    	
			if(req.responseXML.getElementsByTagName('Items').length>0){				
				for(var i=0; i<req.responseXML.getElementsByTagName('Items').length; i++) {
					if(req.responseXML.getElementsByTagName('Items')[i].getAttribute("ID")==ExLocalID){
						channel = req.responseXML.getElementsByTagName('Items')[i].getAttribute("NAME");
						var iCount=0;
						for(var j=0; j<req.responseXML.getElementsByTagName('Items')[i].getElementsByTagName('Item').length; j++) {
							arItem[iCount] = new Array(2);
							arItem[iCount][0] = getNodeValue(req.responseXML.getElementsByTagName('Items')[i].getElementsByTagName('Item')[j].getElementsByTagName('TVTime'));
							arItem[iCount][1] = getNodeValue(req.responseXML.getElementsByTagName('Items')[i].getElementsByTagName('Item')[j].getElementsByTagName('Desc'));								
							iCount++;
						}
						break;
					}
				}
			}
			gmobj("iptv-channel").innerHTML=getIPTV(ExLocalID,sDate, channel, arItem);
			gmobj("iptv-channel").scrollTop=0;
		}
		,'onError':function(req){gmobj("iptv-channel").innerHTML=req.statusText;}
	})
}

function getIPTV(ExLocalID,sDate, channel, arItem){	
	var sHTML = '';
	sHTML = sHTML.concat('<table border=0 cellpadding=0 cellspacing=3 width=100%>');
	sHTML = sHTML.concat('<tr height=20><td colspan=2 class="Time" style="padding-left:3;font-size:11px"><b>').concat(channel).concat(' (').concat(sDate).concat(')</b></td></tr>');
	sHTML = sHTML.concat('<tr height=1><td colspan=2 bgcolor="#666666"></td></tr>');
	if(arItem.length > 0){
		for(var i=0; i<arItem.length; i++){
			sHTML = sHTML.concat('<tr>');
			sHTML = sHTML.concat('<td style="padding-left:3; padding-right:5;" valign=top width=15 align=center class="Image" style="font: 11px arial;"><b>').concat(arItem[i][0]).concat('</b></td>');
			sHTML = sHTML.concat('<td valign=top class="Image" width="100%"><font color="#06175D"  style="font:11px arial;">').concat(arItem[i][1]).concat('</font></td>');
			sHTML = sHTML.concat('</tr>');
		}
	}
	else{
		sHTML = sHTML.concat('<tr>');
		sHTML = sHTML.concat('<td colspan=2 style="padding-left:3; padding-right:5;" valign=top align=left class="Image" style="font-size:11px"><font color="#06175D">Ch&#432;a c&#243; l&#7883;ch</font></td>');
		sHTML = sHTML.concat('</tr>');	
	}
	sHTML = sHTML.concat('</table>');	
	return sHTML;
}

function ShowTopicJS(vFolderID, vItemCount, vType1, vType2, vCustomTitle, vPageCheck, vObjectID, vShowHeader, vSubjectID){
	var sId, sTitle, iCount=0, iMaxItem=10;
	var arItem = new Array();
	var sLink = '';
	var vHId='';	
	vHId = Hexa(vFolderID);	
	vHId = vHId.substring(vHId.length-6,vHId.length);	
	vHId = vHId.substring(0,2) + "/" + vHId.substring(2,4) + "/" + vHId.substring(4,6) + "/";	
	if(DOMESTIC_IP==0)		
		sLink = sLink + '/ListFile/Topic/' + vHId + 'sd_' + PAGE_SITE + '.xml';		
	else
		sLink = sLink + '/ListFile/Topic/' + vHId + 'so_' + PAGE_SITE + '.xml';				
	
	var sHTML;
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){				
			if (req.responseXML.getElementsByTagName('T').length>0){
				with(req.responseXML.getElementsByTagName('T').item(0)){
					sId = getNodeValue(getElementsByTagName('I'));
					sTitle= getNodeValue(getElementsByTagName('T'));
					sDate = getNodeValue(getElementsByTagName('D'));
				}
			}
			var iCount=0;				
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){					
					if (iCount<iMaxItem && iCount<vItemCount){	
						var sTemp = getNodeValue(getElementsByTagName('P'));
						var sTemps = new Array();
						sTemps = sTemp.split('/');							
						if (sTemps[sTemps.length-1]!='' && displayid(HexToDec(sTemps[sTemps.length-1]))){								
							arItem[iCount] = new Array(3);
							arItem[iCount][0] = getNodeValue(getElementsByTagName('T'));
							arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
							arItem[iCount][2] = getNodeValue(getElementsByTagName('D'));							
							iCount++;							
						}
					}
				}
			}
			gmobj(vObjectID).innerHTML = GetTopicHTML(sId,sTitle,sDate,arItem,vType1,vType2,vCustomTitle,vShowHeader);
		}
		,'onError':function(req){gmobj(vObjectID).innerHTML=req.statusText;}
	})
}

function GetTopicHTML(sId,sTitle,sDate,arItem,vType1,vType2,vCustomTitle,vShowHeader){
	var sHTML = '';
	var iCount=0, i=0;
	var sTdBullet='', sTableTopicTitle='';
	var sTopicTitle='Theo d&#242;ng s&#7921; ki&#7879;n'

	switch(vType2)
	{
		case 0: // ' 0 Default Title
			sTableTopicTitle += '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
			sTableTopicTitle += '<tr><td class="OtherTitle" height="40" valign="middle">'+sTopicTitle+':</td></tr>';
			sTableTopicTitle += '</table>';
			sTdBullet='';
			break;
		case 1: // ' 1 User Defined Title
			sTableTopicTitle += '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
			sTableTopicTitle += '<tr><td class="OtherTitle" height="40" valign="middle">'+vCustomTitle+':</td></tr>';
			sTableTopicTitle += '</table>';
			sTdBullet='';
			break;
		case 2: // ' 2 No Title
			sTrTopicTitle='';
			sTdBullet='';
			break;
		case 3: // ' 3 List Item Only
			sTrTopicTitle='';
			sTdBullet='<td width="7" valign="top" class="Normal">&#9642;</td>'
			break;
	}

	if (vShowHeader==0) sTableTopicTitle='';

	switch(vType1)
	{
		case 1: // ' Topic
			sHTML += sTableTopicTitle;
			sHTML += '<table border="0" cellpadding="2" cellspacing="0" width="96%">';					
			sHTML += '<tr><td><a href="/topic/?id='+sId+'" class="TopicTitle">'+sTitle+'</a><span class="ShowDate">&nbsp;('+dmy(sDate)+')</span></td></tr>';
			sHTML += '</table>';
			break;
		case 2: // ' Subject
			sHTML += sTableTopicTitle;
			sHTML += '<table border="0" cellpadding="2" cellspacing="0" width="96%">';
			while (i<arItem.length)
			{
				sHTML += '<tr>'+sTdBullet+'<td><a class="Other" href="'+arItem[i][1]+'">'+arItem[i][0]+'</a><span class="ShowDate">&nbsp;('+dmy(arItem[i][2])+')</span></td></tr>';
				i++;
			}
			sHTML += '</table>';
			break;
		case 3: // ' Topic + Subject
			sHTML += sTableTopicTitle;
			sHTML += '<table border="0" cellpadding="2" cellspacing="0" width="96%">';					
			sHTML += '<tr><td><a href="/topic/?id='+sId+'" class="TopicTitle">'+sTitle+'</a><span class="ShowDate">&nbsp;('+dmy(sDate)+')</span></td></tr>';
			while (i<arItem.length){
				sHTML += '<tr><td><table border="0" width="100%" cellpadding="2" cellspacing="0"><tr>'+sTdBullet+'<td><a class="Other" href="'+arItem[i][1]+'">'+arItem[i][0]+'</a><span class="ShowDate">&nbsp;('+dmy(arItem[i][2])+')</span></td></tr></table></td></tr>';
				i++;
			}
			sHTML += '</table>';
			break;
		case 4: // ' Subject (before)
			sHTML += sTableTopicTitle;
			sHTML += '<table border="0" cellpadding="2" cellspacing="0" width="96%">';
			while (i<arItem.length){
				sHTML += '<tr><td><table border="0" width="100%" cellpadding="2" cellspacing="0"><tr>'+sTdBullet+'<td><a class="Other" href="'+arItem[i][1]+'">'+arItem[i][0]+'</a><span class="ShowDate">&nbsp;('+dmy(arItem[i][2])+')</span></td></tr></table></td></tr>';
				i++;
			}						
			sHTML += '<tr><td><table border="0" width="100%" cellpadding="2" cellspacing="0"><tr><td align="right"><a class="Other" href="/topic/?id='+sId+'">Xem ti&#7871;p</a></td></tr></table></td></tr>';
			sHTML += '</table>';
			break;
		case 5: // ' Topic + Subject (before)
			sHTML += sTableTopicTitle;
			sHTML += '<table border="0" cellpadding="2" cellspacing="0" width="96%">';						
			sHTML += '<tr><td><a href="/topic/?id='+sId+'" class="TopicTitle">'+sTitle+'</a><span class="ShowDate">&nbsp;('+dmy(sDate)+')</span></td></tr>';
			while (i<arItem.length){
				sHTML += '<tr><td><table border="0" width="100%" cellpadding="2" cellspacing="0"><tr>'+sTdBullet+'<td><a class="Other" href="'+arItem[i][1]+'">'+arItem[i][0]+'</a><span class="ShowDate">&nbsp;('+dmy(arItem[i][2])+')</span></td></tr></table></td></tr>';
				i++;
			}						
			sHTML += '<tr><td align="right"><a class="Other" href="/topic/?id='+sId+'">Xem ti&#7871;p</a></td></tr>';
			sHTML += '</table>';
			break;
	}
	return sHTML;
}

function showVideo(VideoId){
	var sLink = '';	
	var sList = '';
	var iMaxItem = 4;	
	sLink = '/ListFile/Video/tv' + PAGE_SITE + '.xml';
	AjaxRequest.get(
		{
		'url':sLink
		,'onSuccess':function(req){			
			sList = sList.concat('<ul>');			
			var iCount=0;			
			if(VideoId == 0) {				
				for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++) {					
					if(req.responseXML.getElementsByTagName('I')[i].getElementsByTagName('I').length > 0) {						
						with(req.responseXML.getElementsByTagName('I').item(i)) {
							if(iCount < iMaxItem) {
								if(i==0)
									showVideoObject(getNodeValue(getElementsByTagName('T')),getNodeValue(getElementsByTagName('P')),getNodeValue(getElementsByTagName('IP')));
								else{
									sList = sList.concat('<li><a href="javascript:showVideo(');
									sList = sList.concat(getNodeValue(getElementsByTagName('I')));
									sList = sList.concat(');" class="link-othernews2">');
									sList = sList.concat(getNodeValue(getElementsByTagName('T')));
									sList = sList.concat('</a></li>');
								}
								iCount++;
							}
							else break;
						}
					}
				}
			}
			else{
				for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
					if(req.responseXML.getElementsByTagName('I')[i].getElementsByTagName('I').length > 0){	
						with(req.responseXML.getElementsByTagName('I').item(i)){
							if(iCount < iMaxItem){
								if(parseInt(getNodeValue(getElementsByTagName('I'))) == VideoId)
									showVideoObject(getNodeValue(getElementsByTagName('T')),getNodeValue(getElementsByTagName('P')),getNodeValue(getElementsByTagName('IP')));
								else{
									sList = sList.concat('<li><a href="javascript:showVideo(');
									sList = sList.concat(getNodeValue(getElementsByTagName('I')));
									sList = sList.concat(');" class="link-othernews2">');
									sList = sList.concat(getNodeValue(getElementsByTagName('T')));
									sList = sList.concat('</a></li>');
								}
								iCount++;
							}	
							else break;
						}
					}
				}
			}
			sList = sList.concat('</ul>');			
			gmobj('MediaList').innerHTML = sList;				
		}
		,'onError':function(req){gmobj("divVideo").innerHTML=req.statusText;}
	})
}

function showVideoObject(title,path,imagepath){
	gmobj('video-title').innerHTML 	= title;					
	var so = new SWFObject('/Library/Common/Player/mediaplayer.swf','MediaPlayer','280','240','8');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	so.addParam('wmode','transparent');
	so.addVariable('width','278');
	so.addVariable('height','238');
	so.addVariable('file','http://media.vnexpress.net/MediaStore/Video/' + path);		
	if(imagepath=='') so.addVariable('image','/Images/video-vne.jpg');
	else so.addVariable('image','http://media.vnexpress.net/MediaStore/' + imagepath);
	so.write('mediaspace');
}

function showMediaIcon(path, ivideo, iphoto, type){
	var strIcon = ''
	if(type==0){
		if(ivideo > 0 || iphoto > 0){
			strIcon=strIcon.concat('&nbsp;<a style="text-decoration:none" href="').concat(path).concat('">');		
			if(ivideo > 0)
				strIcon=strIcon.concat('<img border="0" src="/Images/video.gif" />&nbsp;&nbsp;');
			if(iphoto > 0)
				strIcon=strIcon.concat('<img border="0" src="/Images/photo.gif" />&nbsp;&nbsp;');
			strIcon = strIcon.concat('</a>');
		}
	}
	else if(type==1){
		if(ivideo > 0)
			strIcon=strIcon.concat('&nbsp;&nbsp;<img border="0" src="/Images/video.gif" align="middle" />');
		if(iphoto > 0)
			strIcon=strIcon.concat('&nbsp;&nbsp;<img border="0" src="/Images/photo.gif" align="middle" />');
	}
	else if(type==2){
		if(ivideo > 0)
			strIcon=strIcon.concat('<img border="0" src="/Images/video.gif" />&nbsp;&nbsp;');
		if(iphoto > 0)
			strIcon=strIcon.concat('<img border="0" src="/Images/photo.gif" />&nbsp;&nbsp;');
	}
	else if(type==3){
		if(ivideo > 0)
			strIcon=strIcon.concat('&nbsp;<img border="0" src="/Images/video.gif" />');
		if(iphoto > 0)
			strIcon=strIcon.concat('&nbsp;<img border="0" src="/Images/photo.gif" />');
	}
	return strIcon;
}

function showAdWord(FolderId){
	if(FolderId < 0) FolderId = 0;
	var sLink = '';	
	var arItem = new Array();
	var iMaxItem = 16;
	sLink = '/ListFile/AdWord/' + FolderId + '.xml';	
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){				    	
			if(req.responseXML.getElementsByTagName('I').length>0){				
				var iCount=0;				
				for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
					with(req.responseXML.getElementsByTagName('I').item(i)){
						if(iCount < iMaxItem){
							var sTemp = getNodeValue(getElementsByTagName('I'));
							if (sTemp!=''){
								arItem[iCount] = new Array(2);
								arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
								arItem[iCount][1] = getNodeValue(getElementsByTagName('T'));																				
								iCount++;
							}
						}
					}		    		
				}
			}
			gmobj("AdWord").innerHTML=getAdWord(arItem, FolderId);			
		}
		,'onError':function(req){}
	})
}

function getAdWord(arItem, FolderId){
	var sHTML = '';
	var Link = '/User/Rao-vat/Source/View.Asp?ID=';
	var i=0;
	sHTML = sHTML.concat('<ul>');
	while(i<arItem.length){				
		sHTML = sHTML.concat('<li><a class="link-othernews2" href="').concat(Link).concat(arItem[i][0]).concat('&c=').concat(FolderId).concat('">');
		sHTML = sHTML.concat(arItem[i][1]).concat('</a></li>');		
		i++;		
	}
	sHTML = sHTML.concat('</ul>');	
	return sHTML;
}

function showAdWordItem(FolderId, Items, iType){
	if(FolderId < 0) FolderId = 0;
	var sLink = '';	
	var arItem = new Array();
	var iMaxItem = 50;
	sLink = '/ListFile/AdWord/' + FolderId + '.xml';	
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){						
			if(req.responseXML.getElementsByTagName('I').length>0) {				
				var iCount=0;								
				for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){					
					with(req.responseXML.getElementsByTagName('I').item(i)){
						if(iCount < iMaxItem){
							var sTemp = getNodeValue(getElementsByTagName('I'));
							if (sTemp!=''){
								arItem[iCount] = new Array(6);
								arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
								arItem[iCount][1] = getNodeValue(getElementsByTagName('T'));																				
								arItem[iCount][2] = getNodeValue(getElementsByTagName('P'));																				
								arItem[iCount][3] = getNodeValue(getElementsByTagName('S'));																				
								arItem[iCount][4] = getNodeValue(getElementsByTagName('D'));																				
								arItem[iCount][5] = getNodeValue(getElementsByTagName('PR'));																				
								iCount++;
							}
						}
					}		    		
				}
			}
			gmobj("adw_".concat(FolderId)).innerHTML=getAdWordItem(arItem, FolderId, iType, Items);			
		}
		,'onError':function(req){}
	})
}

function getAdWordItem(arItem, FolderId, iType, Items){
	var sHTML = '';
	var Link = '';
	var i=0;
	var maxTop = 8;
	if(FolderId=='13_15'||FolderId=='12_14') maxTop = 10;
	sHTML = sHTML.concat('<ul>');
	var arItemTemp = new Array();
	var flag = false	
	while(i<arItem.length){
		if(arItem[i][2]==1){
			arItemTemp[i] = new Array(6);
			arItemTemp[i][0] = arItem[i][0];
			arItemTemp[i][1] = arItem[i][1];
			arItemTemp[i][2] = arItem[i][2];
			arItemTemp[i][3] = arItem[i][3];
			arItemTemp[i][4] = arItem[i][4];
			arItemTemp[i][5] = arItem[i][5];
		}
		else break;
		i++;
	}
	i=0;
	if(arItemTemp.length > maxTop) flag = true;
	if(iType==0){
		var len = arItemTemp.length;			
		while(arItemTemp.length > maxTop)
			arItemTemp.splice(Math.round((arItemTemp.length-1)*Math.random()),1);							
		while(i<arItemTemp.length){
			Link = '/User/Rao-vat/Source/View.Asp?ID='.concat(arItemTemp[i][0]).concat('&c=').concat(FolderId)
			sHTML = sHTML.concat('<li><div class="adword-dline"><ul>');
			sHTML = sHTML.concat('<li class="fl" style="width:70%"><a class="AdvLink2" href="').concat(Link).concat('" onClick="return openAdWord(\'').concat(arItemTemp[i][0]).concat('\',\'').concat(arItemTemp[i][2]).concat('\');">');
			sHTML = sHTML.concat(arItemTemp[i][1]).concat('</a></li>');			
			if(iType==0){
				var sDates = arItemTemp[i][4].split(' ');
				sHTML = sHTML.concat('<li class="fl txtr" style="width:10%; line-height:18px"><label class="item-date">').concat(dmy(sDates[0])).concat('</label></li>');
			}
			sHTML = sHTML.concat('<li class="fl txtr" style="width:20%; line-height:18px"><label class="item-date">').concat(arItemTemp[i][5]).concat('</label></li>');
			sHTML = sHTML.concat('</ul></div></li>');
			i++;
		}		
		if(flag==true){
			i = len;
			Items = Items + (i-maxTop);
		}
		while(i<arItem.length && i<Items){			
			Link = '/User/Rao-vat/Source/View.Asp?ID='.concat(arItem[i][0]).concat('&c=').concat(FolderId)
			sHTML = sHTML.concat('<li><div class="adword-dline"><ul>');
			sHTML = sHTML.concat('<li class="fl" style="width:70%"><a class="BoxLink2" href="').concat(Link).concat('" onClick="return openAdWord(\'').concat(arItem[i][0]).concat('\',\'').concat(arItem[i][2]).concat('\');">');
			sHTML = sHTML.concat(arItem[i][1]).concat('</a></li>');			
			if(iType==0){
				var sDates = arItem[i][4].split(' ');
				sHTML = sHTML.concat('<li class="fl txtr" style="width:10%; line-height:18px"><label class="item-date">').concat(dmy(sDates[0])).concat('</label></li>');
			}	
			sHTML = sHTML.concat('<li class="fl txtr" style="width:20%; line-height:18px"><label class="item-date">').concat(arItem[i][5]).concat('</label></li>');
			sHTML = sHTML.concat('</ul></div></li>');								
			i++;		
		}
	}
	else{
		while(i<arItem.length && i<Items){
			if(arItem[i][2]==1){				
				Link = '/User/Rao-vat/Source/View.Asp?ID='.concat(arItem[i][0]).concat('&c=').concat(FolderId)
				sHTML = sHTML.concat('<li style="padding-bottom:5px;"><a class="AdvLink2" href="').concat(Link).concat('" onClick="return openAdWord(\'').concat(arItem[i][0]).concat('\',\'').concat(arItem[i][2]).concat('\');">');
				sHTML = sHTML.concat(arItem[i][1]).concat('</a>');				
				sHTML = sHTML.concat('</li>');						
			}
			else{
				Link = '/User/Rao-vat/Source/View.Asp?ID='.concat(arItem[i][0]).concat('&c=').concat(FolderId)
				sHTML = sHTML.concat('<li style="padding-bottom:5px;"><a class="BoxLink2" href="').concat(Link).concat('" onClick="return openAdWord(\'').concat(arItem[i][0]).concat('\',\'').concat(arItem[i][2]).concat('\');">');
				sHTML = sHTML.concat(arItem[i][1]).concat('</a>');
				if(iType==0){
					var sDates = arItem[i][4].split(' ');
					sHTML = sHTML.concat('<label class="item-date"> - ').concat(dmy(sDates[0])).concat('</label>');
				}	
				sHTML = sHTML.concat('</li>');	
			}	
			i++;		
		}
	}	
	sHTML = sHTML.concat('</ul>');	
	return sHTML;
}

function ShowAdWordTitle(FolderId){
	var strTitle = ''
	switch(parseInt(FolderId)){
		case 1: strTitle = 'D&#7883;ch v&#7909; s&#7917;a ch&#7919;a gia d&#7909;ng'; break;
		case 2: strTitle = 'D&#7883;ch v&#7909; v&#259;n ph&#242;ng'; break;
		case 3: strTitle = 'B&#225;n thi&#7871;t b&#7883; v&#259;n ph&#242;ng v&#224; ph&#7909; ki&#7879;n'; break;
		case 4: strTitle = 'Mua thi&#7871;t b&#7883; v&#259;n ph&#242;ng v&#224; ph&#7909; ki&#7879;n'; break;
		case 5: strTitle = 'B&#225;n &#244;t&#244; xe m&#225;y'; break;
		case 6: strTitle = 'Mua &#244;t&#244; xe m&#225;y'; break;
		case 7: strTitle = 'Nh&#7855;n tin'; break;
		case 8: strTitle = 'B&#225;n &#273;i&#7879;n tho&#7841;i di &#273;&#7897;ng'; break;
		case 9: strTitle = 'Mua &#273;i&#7879;n tho&#7841;i di &#273;&#7897;ng'; break;
		case 10: strTitle = 'T&#236;m &#273;&#7889;i t&#225;c'; break;
		case 11: strTitle = 'Linh tinh'; break;
		case 12: strTitle = 'Cho thu&#234; nh&#224;'; break;
		case 13: strTitle = 'B&#225;n nh&#224;'; break;
		case 14: strTitle = 'C&#7847;n thu&#234; nh&#224;'; break;
		case 15: strTitle = 'C&#7847;n mua nh&#224;'; break;
		case 16: strTitle = 'T&#236;m vi&#7879;c l&#224;m'; break;
		case 17: strTitle = 'C&#7847;n tuy&#7875;n'; break;
		case 18: strTitle = 'Cho thu&#234; xe'; break;
		case 19: strTitle = 'V&#259;n h&#243;a ph&#7849;m'; break;
		case 20: strTitle = 'PM & TK Web'; break;
		case 21: strTitle = 'Tuy&#7875;n sinh'; break;
		default: break;
	}
	document.write(strTitle);
}

function ShowWeatherBox(vId){
	var sLink = '';
	sLink = '/ListFile/Weather/';
	switch (parseInt(vId)){	    	
		case 1: sLink = sLink.concat('Sonla.xml');break;
		case 2: sLink = sLink.concat('Viettri.xml');break;
		case 3: sLink = sLink.concat('Haiphong.xml');break;
		case 4: sLink = sLink.concat('Hanoi.xml');break;
		case 5: sLink = sLink.concat('Vinh.xml');break;
		case 6: sLink = sLink.concat('Danang.xml');break;
		case 7: sLink = sLink.concat('Nhatrang.xml');break;
		case 8: sLink = sLink.concat('Pleicu.xml');break;		
		case 9: sLink = sLink.concat('HCM.xml');break;	
		default: sLink = sLink.concat('Hanoi.xml');break;
	}
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){
			var vAdImg, vAdImg1, vAdImg2, vAdImg3, vAdImg4, vAdImg5, vWeather;
			vAdImg = req.responseXML.getElementsByTagName('AdImg').item(0).firstChild.nodeValue;
			vAdImg1 = req.responseXML.getElementsByTagName('AdImg1').item(0).firstChild.nodeValue;
			if(req.responseXML.getElementsByTagName('AdImg2').item(0).firstChild != null)
				vAdImg2 = req.responseXML.getElementsByTagName('AdImg2').item(0).firstChild.nodeValue;
			if(req.responseXML.getElementsByTagName('AdImg3').item(0).firstChild != null)
				vAdImg3 = req.responseXML.getElementsByTagName('AdImg3').item(0).firstChild.nodeValue;
			if(req.responseXML.getElementsByTagName('AdImg4').item(0).firstChild != null)
				vAdImg4 = req.responseXML.getElementsByTagName('AdImg4').item(0).firstChild.nodeValue;
			if(req.responseXML.getElementsByTagName('AdImg5').item(0).firstChild != null)
				vAdImg5 = req.responseXML.getElementsByTagName('AdImg5').item(0).firstChild.nodeValue;
			vWeather = req.responseXML.getElementsByTagName('Weather').item(0).firstChild.nodeValue;
			GetWeatherBox(vAdImg, vAdImg1, vAdImg2, vAdImg3, vAdImg4, vAdImg5, vWeather);				
		}
		,'onError':function(req){}
	})
}

function GetWeatherBox(vImg, vImg1, vImg2, vImg3, vImg4, vImg5, vWeather){
	var sHTML = '';
	sHTML = sHTML.concat('<img src="/Images/Weather/').concat(vImg).concat('" class="img-weather" alt="" />&nbsp;');
	sHTML = sHTML.concat('<img src="/Images/Weather/').concat(vImg1).concat('" class="img-weather" alt="" />');
	if(vImg2!=null) sHTML = sHTML.concat('<img src="/Images/Weather/').concat(vImg2).concat('" class="img-weather" alt="" />');
	if(vImg3!=null) sHTML = sHTML.concat('<img src="/Images/Weather/').concat(vImg3).concat('" class="img-weather" alt="" />');
	if(vImg4!=null) sHTML = sHTML.concat('<img src="/Images/Weather/').concat(vImg4).concat('" class="img-weather" alt="" />');
	if(vImg5!=null) sHTML = sHTML.concat('<img src="/Images/Weather/').concat(vImg5).concat('" class="img-weather" alt="" />');
	sHTML = sHTML.concat('<img src="/Images/Weather/c.gif" class="img-weather" alt="" />');	
	gmobj('img-Do').innerHTML = sHTML;
	gmobj('txt-Weather').innerHTML = vWeather;
}

function ShowGoldPrice(){
	var sHTML = '';		
	sHTML = sHTML.concat('<table cellpadding="0" cellspacing="1" border="0" width="100%">');
	sHTML = sHTML.concat('	<tr class="row" bgcolor="#9cafd2">');
	sHTML = sHTML.concat('		<td class="colOne">Lo&#7841;i</td>');
	sHTML = sHTML.concat('		<td class="colTwo">Mua</td>');
	sHTML = sHTML.concat('		<td class="colThree">B&#225;n</td>');
	sHTML = sHTML.concat('	</tr>');
	sHTML = sHTML.concat('	<tr class="row" bgcolor="#9cafd2">');
	sHTML = sHTML.concat('		<td class="colOne">SBJ</td>');
	sHTML = sHTML.concat('		<td class="colTwo">').concat(vGoldSbjBuy).concat('</td>');
	sHTML = sHTML.concat('		<td class="colThree">').concat(vGoldSbjSell).concat('</td>');
	sHTML = sHTML.concat('	</tr>');
	sHTML = sHTML.concat('	<tr class="row" bgcolor="#9cafd2">');
	sHTML = sHTML.concat('		<td class="colOne">SJC</td>');
	sHTML = sHTML.concat('		<td class="colTwo">').concat(vGoldSjcBuy).concat('</td>');
	sHTML = sHTML.concat('		<td class="colThree">').concat(vGoldSjcSell).concat('</td>');
	sHTML = sHTML.concat('	</tr>');
	sHTML = sHTML.concat('</table>');
	gmobj('eGold').innerHTML = sHTML;
}

function ShowForexRate(){
	var sHTML = '';
	sHTML = sHTML.concat('<table cellpadding="0" cellspacing="1" border="0" width="100%">');
	for(var i=0;i<vForexs.length;i++){
		sHTML = sHTML.concat('	<tr class="row" bgcolor="#9cafd2">');
		sHTML = sHTML.concat('		<td class="colFirst">').concat(vForexs[i]).concat('</td>');
		sHTML = sHTML.concat('		<td class="colSecond">').concat(vCosts[i]).concat('</td>');
		sHTML = sHTML.concat('	</tr>');
	}
	sHTML = sHTML.concat('</table>');
	gmobj('eForex').innerHTML = sHTML;
}

function showlistitem(sTemplate,sFolder,sListItems){		
	var sId, sName, sPath;
	var arItem = new Array();	
	var sLink = '';
	if(DOMESTIC_IP==0)
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/sd_').concat(sFolder).concat('.xml');
	else
		sLink = '/ListFile/Subject/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/so_').concat(sFolder).concat('.xml');
		
	var sHTML;
	var iMaxItem;
	iMaxItem = sListItems;		
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){			
			if (req.responseXML.getElementsByTagName('F').length>0){				
				with(req.responseXML.getElementsByTagName('F').item(0)){
				sId = getNodeValue(getElementsByTagName('I'));
				sName = toUpper(getNodeValue(getElementsByTagName('N')));
				sPath = getNodeValue(getElementsByTagName('P'));					
				}
			}
			var iCount=0;
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){
					if (iCount<iMaxItem){
						var sTemp = getNodeValue(getElementsByTagName('I'));
						if (sTemp!='' && displayid(sTemp)){
							arItem[iCount] = new Array(20);
							arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
							arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
							arItem[iCount][2] = getNodeValue(getElementsByTagName('T'));
							arItem[iCount][3] = getNodeValue(getElementsByTagName('L'));
							arItem[iCount][4] = getNodeValue(getElementsByTagName('TI'));
							arItem[iCount][5] = getNodeValue(getElementsByTagName('TW'));
							arItem[iCount][6] = getNodeValue(getElementsByTagName('TH'));
							arItem[iCount][7] = getNodeValue(getElementsByTagName('SI'));
							arItem[iCount][8] = getNodeValue(getElementsByTagName('SW'));
							arItem[iCount][9] = getNodeValue(getElementsByTagName('SH'));
							arItem[iCount][10] = getNodeValue(getElementsByTagName('LI'));
							arItem[iCount][11] = getNodeValue(getElementsByTagName('LW'));
							arItem[iCount][12] = getNodeValue(getElementsByTagName('LH'));
							arItem[iCount][13] = getNodeValue(getElementsByTagName('HV'));
							arItem[iCount][14] = getNodeValue(getElementsByTagName('HI'));
							arItem[iCount][15] = getNodeValue(getElementsByTagName('HS'));	
							arItem[iCount][16] = getNodeValue(getElementsByTagName('OI'));
							arItem[iCount][17] = getNodeValue(getElementsByTagName('OW'));
							arItem[iCount][18] = getNodeValue(getElementsByTagName('OH'));
							arItem[iCount][19] = getNodeValue(getElementsByTagName('F'));
							iCount++;
						}
					}
				}
			}	
			sHTML = getlistitem(sId, sName, sPath, arItem, sTemplate);					
			gmobj('ListItem'.concat(sFolder)).innerHTML=sHTML;			
		}
		,'onError':function(req){gmobj('ListItem'.concat(sFolder)).innerHTML=req.statusText;}
	})
}

function getlistitem(sId, sName, sPath, arItem, sTemplate){	
	var sHTML = '';
	var i=0;
	switch (parseInt(sTemplate)){
		case 1: case 3: case 4: case 5: case 6: case 7:			
			while (i<arItem.length){
				if(i==0){
					sHTML = sHTML.concat('<div class="tt-ct-f1">');
					if(arItem[i][7] != '' && parseInt(sTemplate) == 1)
						sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], 'tn-img')).concat('<img src="').concat(getimages(arItem[i][0],arItem[i][7])).concat('" alt="" /></a>');
					else if(arItem[i][16] != '' && parseInt(sTemplate) == 7)
						sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], 'tn-img')).concat('<img src="').concat(getimages(arItem[i][0],arItem[i][16])).concat('" alt="" /></a>');
					sHTML = sHTML.concat('	<div class="box">')
					sHTML = sHTML.concat('		<div class="tn-tit">').concat(BuildLink(arItem[i][19], arItem[i][1], 'link-listitem1-title')).concat(arItem[i][2]).concat('</a></div>');
					sHTML = sHTML.concat('		<div class="tn-ct">').concat(arItem[i][3].replace(/class=Lead/ig,'class=Lead2')).concat('</div>');					
					sHTML = sHTML.concat('	</div>');
					sHTML = sHTML.concat('</div>');
				}
				else if(i==1){					
					sHTML = sHTML.concat('<div class="tt-ct-f2">');
					sHTML = sHTML.concat('	<ul>');
					sHTML = sHTML.concat('		<li class="tt-li">').concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat(arItem[i][2]).concat('</a></li>');
				}
				else if(i!=arItem.length-1)
					sHTML = sHTML.concat('		<li class="tt-li">').concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat(arItem[i][2]).concat('</a></li>');
				else{
					sHTML = sHTML.concat('		<li class="tt-li">').concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat(arItem[i][2]).concat('</a></li>');
					sHTML = sHTML.concat('	</ul>');
					sHTML = sHTML.concat('</div>');
				}				
				i++;
			}
			break;
		case 2:
			while (i<arItem.length){
				sHTML = sHTML.concat('<div class="dautu">');
				sHTML = sHTML.concat('		<table>');
				sHTML = sHTML.concat('				<tr>');
				sHTML = sHTML.concat('						<td>');
				if(arItem[i][10] != '')
					sHTML = sHTML.concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat('<img src="').concat(getimages(arItem[i][0],arItem[i][10])).concat('" alt=""/></a>');
				sHTML = sHTML.concat('						</td>');
				sHTML = sHTML.concat('						<td><div class="dautu-ct">').concat(BuildLink(arItem[i][19], arItem[i][1], '')).concat(arItem[i][2]).concat('</a></div></td>');				
				sHTML = sHTML.concat('				</tr>');
				sHTML = sHTML.concat('		</table>');
				sHTML = sHTML.concat('</div>');				
				if (i!=arItem.length-1) sHTML = sHTML.concat('<div class="solid1"></div>');
				i++;
			}
			break;
		default: break;
	}
	return sHTML;
}

function showhotitem(sFolder,sListItems){
	var sId, sName, sPath;
	var arItem = new Array();
	sLink = '';
	if(DOMESTIC_IP==0)
		sLink = '/ListFile/HotNews/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/sd_').concat(sFolder).concat('.xml');
	else
		sLink = '/ListFile/HotNews/'.concat(Right(Hexa(PAGE_SITE),2)).concat('/so_').concat(sFolder).concat('.xml');
	
	var sHTML;
	var iMaxItem;
	iMaxItem = sListItems;		
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){			
			if (req.responseXML.getElementsByTagName('F').length>0){				
				with(req.responseXML.getElementsByTagName('F').item(0)){
				sId = getNodeValue(getElementsByTagName('I'));
				sName = toUpper(getNodeValue(getElementsByTagName('N')));
				sPath = getNodeValue(getElementsByTagName('P'));					
				}
			}
			var iCount=0;
			for (var i=0;i<req.responseXML.getElementsByTagName('I').length;i++){
				with(req.responseXML.getElementsByTagName('I').item(i)){
					if (iCount<iMaxItem){
						var sTemp = getNodeValue(getElementsByTagName('I'));
						if (sTemp!='' && displayid(sTemp)){
							arItem[iCount] = new Array(20);
							arItem[iCount][0] = getNodeValue(getElementsByTagName('I'));
							arItem[iCount][1] = getNodeValue(getElementsByTagName('P')) + '/';
							arItem[iCount][2] = getNodeValue(getElementsByTagName('T'));
							arItem[iCount][3] = getNodeValue(getElementsByTagName('L'));
							arItem[iCount][4] = getNodeValue(getElementsByTagName('TI'));
							arItem[iCount][5] = getNodeValue(getElementsByTagName('TW'));
							arItem[iCount][6] = getNodeValue(getElementsByTagName('TH'));
							arItem[iCount][7] = getNodeValue(getElementsByTagName('SI'));
							arItem[iCount][8] = getNodeValue(getElementsByTagName('SW'));
							arItem[iCount][9] = getNodeValue(getElementsByTagName('SH'));
							arItem[iCount][10] = getNodeValue(getElementsByTagName('LI'));
							arItem[iCount][11] = getNodeValue(getElementsByTagName('LW'));
							arItem[iCount][12] = getNodeValue(getElementsByTagName('LH'));
							arItem[iCount][13] = getNodeValue(getElementsByTagName('HV'));
							arItem[iCount][14] = getNodeValue(getElementsByTagName('HI'));
							arItem[iCount][15] = getNodeValue(getElementsByTagName('HS'));
							arItem[iCount][16] = getNodeValue(getElementsByTagName('OI'));
							arItem[iCount][17] = getNodeValue(getElementsByTagName('OW'));
							arItem[iCount][18] = getNodeValue(getElementsByTagName('OH'));
							arItem[iCount][19] = getNodeValue(getElementsByTagName('F'));
							iCount++;
						}
					}
				}
			}	    	
			sHTML = gethotitem(sId, sName, sPath, arItem);
			gmobj('HotItem'+sFolder).innerHTML=sHTML;						
		}
		,'onError':function(req){gmobj('HotItem'.concat(sFolder)).innerHTML=req.statusText;}
	})
}

function gethotitem(sId, sName, sPath, arItem){
	var sHTML = '';		
	sHTML = getlistitem(sId, sName, sPath, arItem, 5);
	return sHTML;
}

var orderby;
var ordertype;
orderby = -1;
ordertype = -1;
function showInterestRate(i,type,bankids){
	var sLink = '';
	var arItem = new Array();
	var tabId = i;
	sLink = '/ListFile/Ebank/Rate_Bank_Type_' + i + '.xml';
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){				
			var iCount=0;			
			for (var i=0;i<req.responseXML.getElementsByTagName('Bank').length;i++){				
				with(req.responseXML.getElementsByTagName('Bank').item(i)){	    								
					arItem[iCount] = new Array(13);
					arItem[iCount][0] = getNodeValue(getElementsByTagName('BankID'));
					arItem[iCount][1] = getNodeValue(getElementsByTagName('BankName'));
					arItem[iCount][2] = getNodeValue(getElementsByTagName('Month0'));
					arItem[iCount][3] = getNodeValue(getElementsByTagName('Month1'));
					arItem[iCount][4] = getNodeValue(getElementsByTagName('Month2'));
					arItem[iCount][5] = getNodeValue(getElementsByTagName('Month3'));
					arItem[iCount][6] = getNodeValue(getElementsByTagName('Month6'));
					arItem[iCount][7] = getNodeValue(getElementsByTagName('Month9'));
					arItem[iCount][8] = getNodeValue(getElementsByTagName('Month12'));
					arItem[iCount][9] = getNodeValue(getElementsByTagName('Month18'));
					arItem[iCount][10] = getNodeValue(getElementsByTagName('Month24'));
					arItem[iCount][11] = getNodeValue(getElementsByTagName('Month36'));
					arItem[iCount][12] = arrBankPos.contains(arItem[iCount][1]);					
					iCount++;					
				}
			}
			if(orderby != -1) arItem.sort(ArrSort);
			else arItem.sort(orderByPos);
			
			sHTML = getInterestRate(arItem, type, bankids, tabId);
			if(type==0) gmobj('dInterestRate').innerHTML=sHTML;
			else{
				gmobj('dCompareResult').innerHTML=sHTML;
				gmobj('dCompareResult').style.display='';
			}
	  }
		,'onError':function(req){
			if(type==0) gmobj('dInterestRate').innerHTML=statusText;						
			else gmobj('dCompareResult').innerHTML=statusText;
		}
	})
}

function ArrSort(a,b){
	a = a[orderby];
	b = b[orderby];
	if(a=='-'){a=0;}
	if(b=='-'){b=0;}
	if(ordertype==0)
		return parseFloat(a)==parseFloat(b) ? 0 : (parseFloat(a) > parseFloat(b) ? -1 : 1);		
	else
		return parseFloat(a)==parseFloat(b) ? 0 : (parseFloat(a) < parseFloat(b) ? -1 : 1);
}

function OrderByMonth(i,j){
	if(orderby != i){
		orderby = i; ordertype = 0;		
	}
	else{		
		if(ordertype!=0) ordertype = 0;
		else ordertype = 1;
	}
	showInterestRate(j,0,gmobj('cbobank').value);
}

function getInterestRate(arItem, type, bankids, tabid){
	var sHTML = '';
	var i=0;
	if(type==0)
		sHTML = sHTML.concat('<table cellpadding="0px" cellspacing="0px" border="0px" width="798px">');
	else
		sHTML = sHTML.concat('<table cellpadding="0px" cellspacing="0px" border="0px" width="733px">');
	sHTML = sHTML.concat('	<tr class="LSHeader">');
	sHTML = sHTML.concat('		<td class="LSHeaderH">');
	sHTML = sHTML.concat('			<table cellpadding="0px" cellspacing="0px" border="0px" width="100%">');
	sHTML = sHTML.concat('				<tr class="trUp" valign="top"><td align="right">KỲ HẠN<br /><span>(tháng) (*)</span></td></tr>');
	sHTML = sHTML.concat('				<tr class="trDown" valign="top"><td align="left">NGÂN HÀNG</td></tr>');
	sHTML = sHTML.concat('			</table>');
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(2,' + tabid + ')">0');
	if(orderby==2)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');	
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(3,' + tabid + ')">1');	
	if(orderby==3)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');	
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(4,' + tabid + ')">2');
	if(orderby==4)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(5,' + tabid + ')">3');
	if(orderby==5)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(6,' + tabid + ')">6');
	if(orderby==6)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(7,' + tabid + ')">9');
	if(orderby==7)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(8,' + tabid + ')">12');
	if(orderby==8)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(9,' + tabid + ')">18');
	if(orderby==9)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(10,' + tabid + ')">24');
	if(orderby==10)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('		<td class="header" style="cursor:pointer;" onClick="OrderByMonth(11,' + tabid + ')">36');
	if(orderby==11)
		sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('</td>');
	sHTML = sHTML.concat('	</tr>');
	if(type==0 && bankids!= '-1'){		
		for(i=0; i<arItem.length; i++){				
			if(arItem[i][0]==parseInt(bankids)){					
				sHTML = sHTML.concat('<tr class="LSBank LSodd">');				
				sHTML = sHTML.concat('	<td class="LSBankH">').concat(arItem[i][1]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO first">').concat(arItem[i][2]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][3]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][4]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][5]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][6]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][7]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][8]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][9]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][10]).concat('</td>');
				sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][11]).concat('</td>');
				sHTML = sHTML.concat('</tr>');
				break;
			}
		}
	}
	else if(type!=0){		
		var ids = bankids.split(",");
		var j = 0;
		var	k = 0;
		for(i=0; i<ids.length; i++){
			for(j=0; j<arItem.length; j++){				
				if(arItem[j][0]==ids[i]){					
					if((k % 2) > 0) sHTML = sHTML.concat('<tr class="LSBank LSodd">');
					else sHTML = sHTML.concat('<tr class="LSBank LSevent">');
					sHTML = sHTML.concat('	<td class="LSBankH">').concat(arItem[j][1]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU first">').concat(arItem[j][2]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][3]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][4]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][5]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][6]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][7]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][8]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][9]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][10]).concat('</td>');
					sHTML = sHTML.concat('	<td class="LSBankU">').concat(arItem[j][11]).concat('</td>');
					sHTML = sHTML.concat('</tr>');
					k++;
					break;
				}
			}
		}
	}
	else{
		while (i<arItem.length){
			if((i % 2) > 0) sHTML = sHTML.concat('<tr class="LSBank LSodd">');
			else sHTML = sHTML.concat('<tr class="LSBank LSevent">');
			sHTML = sHTML.concat('	<td class="LSBankH">').concat(arItem[i][1]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO first">').concat(arItem[i][2]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][3]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][4]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][5]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][6]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][7]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][8]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][9]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][10]).concat('</td>');
			sHTML = sHTML.concat('	<td class="LSBankO">').concat(arItem[i][11]).concat('</td>');
			sHTML = sHTML.concat('</tr>');
			i++;
		}
	}
	sHTML = sHTML.concat('</table>');
	return sHTML;
}

function ShowInvoice(phonenumber){
	var sLink = '';
	var arItem = new Array();
	sLink = '/ListFile/Ebank/Rate_Bank_Type_' + i + '.xml';
	AjaxRequest.get({
		'url':sLink
		,'onSuccess':function(req){				
			var iCount=0;			
			for (var i=0;i<req.responseXML.getElementsByTagName('Bank').length;i++){				
				with(req.responseXML.getElementsByTagName('Bank').item(i)){	    								
					arItem[iCount] = new Array(12);
					arItem[iCount][0] = getNodeValue(getElementsByTagName('BankID'));
					arItem[iCount][1] = getNodeValue(getElementsByTagName('BankName'));
					arItem[iCount][2] = getNodeValue(getElementsByTagName('Month0'));
					arItem[iCount][3] = getNodeValue(getElementsByTagName('Month1'));
					arItem[iCount][4] = getNodeValue(getElementsByTagName('Month2'));
					arItem[iCount][5] = getNodeValue(getElementsByTagName('Month3'));
					arItem[iCount][6] = getNodeValue(getElementsByTagName('Month6'));
					arItem[iCount][7] = getNodeValue(getElementsByTagName('Month9'));
					arItem[iCount][8] = getNodeValue(getElementsByTagName('Month12'));
					arItem[iCount][9] = getNodeValue(getElementsByTagName('Month18'));
					arItem[iCount][10] = getNodeValue(getElementsByTagName('Month24'));
					arItem[iCount][11] = getNodeValue(getElementsByTagName('Month36'));					
					iCount++;					
				}
			}			
			sHTML = getInterestRate(arItem, type, bankids);
			if(type==0) gmobj('dInterestRate').innerHTML=sHTML;
			else{
				gmobj('dCompareResult').innerHTML=sHTML;
				gmobj('dCompareResult').style.display='';
			}
		}
		,'onError':function(req){
			if(type==0) gmobj('dInterestRate').innerHTML=statusText;						
			else gmobj('dCompareResult').innerHTML=statusText;				
		}
	})
}

function FormatCurrency(num, currencyCode, isReplace, justFormat){
	if (num == null) return "";
	var num = num.toString().replace(/\$|\,/g, '');
	if (isNaN(num)) num = "0";
	var sign = (num == (num = Math.abs(num)));
	num = Math.floor(num * 100 + 0.50000000001);
	cents = num % 100;
	num = Math.floor(num / 100).toString();
	if (cents < 10) cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) {
		switch (Trim(currencyCode.toLowerCase())) {
			case 'en-us':
				num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3)); break;
			case 'vi-vn':
				num = num.substring(0, num.length - (4 * i + 3)) + '.' + num.substring(num.length - (4 * i + 3)); break;
		}
	}
	var res = '0';
	switch (Trim(currencyCode.toLowerCase())){
		case 'en-us':
			if (justFormat != null && justFormat == true){
				if (isReplace == false) res = (((sign) ? '' : '-') + num + '.' + cents);
				else res = (((sign) ? '' : '-') + num);
			}
			else{
				if (isReplace == false) res = (((sign) ? '' : '-') + '$' + num + '.' + cents);
				else res = (((sign) ? '' : '-') + '$' + num);
			}
			break;	
		case 'vi-vn':
			if (justFormat != null && justFormat == true){
				if (isReplace == false) res = (((sign) ? '' : '-') + num + ',' + cents);
				else res = (((sign) ? '' : '-') + num);
			}
			else{
				if (isReplace == false) res = (((sign) ? '' : '-') + num + ',' + cents + '<u>d</u>');
				else res = (((sign) ? '' : '-') + num + '<u>d</u>');
			}
			break;
	}
	return res;
}

function showTableGoldPrice(){    
	AjaxRequest.get({
		"url": "/Service/San-vang/Data/SbjServices.xml"
		, 'onSuccess': function(req){
				var strOut = "";
				var OPENPRICE;
				var HIGHESTPRICE;
				var LOWESTPRICE;
				var MATCHVOL; 
				var Item = req.responseXML.getElementsByTagName('Ticker').item(0);
				
				OPENPRICE = getNodeValue(Item.getElementsByTagName('OPENPRICE'));
				HIGHESTPRICE = getNodeValue(Item.getElementsByTagName('HIGHESTPRICE'));
				LOWESTPRICE = getNodeValue(Item.getElementsByTagName('LOWESTPRICE'));
				MATCHVOL = parseInt(getNodeValue(Item.getElementsByTagName('MATCHVOL'))) * 2;
				
				strOut = strOut.concat("<ul class='st-ul'>");
				strOut = strOut.concat("<li class='st-li-hd hd-top5-bd fl'>");
				strOut = strOut.concat("<ul class='st-ul'>");                     
				strOut = strOut.concat("<li class='st-li-hd fl'>");
				strOut = strOut.concat("<ul class='st-ul'>");
				strOut = strOut.concat("<li class='hd-sp3 fl'>&nbsp;</li>");
				strOut = strOut.concat("<li class='hd-top1-gp fl'>");
				strOut = strOut.concat("<div style='padding:4px;'>");
	
				strOut = strOut.concat("<table style='border: thin none ;cursor:pointer;' cellspacing='0' cellpadding='0' width='100%' border='0' onclick=\"window.open('http://vnexpress.net/Service/San-vang/');\">");
				strOut = strOut.concat("<tbody>");
				strOut = strOut.concat("<tr height='20'>");
				strOut = strOut.concat("<td class='TopGoldActive' align='center' nowrap='nowrap'>Mã vàng</td>");
				strOut = strOut.concat("<td class='TopGoldActive' align='center' nowrap='nowrap'>Mở cửa</td>");
				strOut = strOut.concat("<td class='TopGoldActive' align='center' nowrap='nowrap'>Thấp nhất</td>");
				strOut = strOut.concat("<td class='TopGoldActive' align='center' nowrap='nowrap'>Cao nhất</td>");
				strOut = strOut.concat("<td class='TopGoldActive' align='center' nowrap='nowrap'>Tổng KLGD</td>");
				strOut = strOut.concat("</tr>");
				strOut = strOut.concat("<tr>");
				strOut = strOut.concat("<td colspan='5' style='padding:2px;'></td>");
				strOut = strOut.concat("</tr>");
				strOut = strOut.concat("<tr>");
				strOut = strOut.concat("<td colspan='5' bgcolor='#c5c5c5' height='1'></td>");
				strOut = strOut.concat("</tr>");   
				strOut = strOut.concat("<tr height='19'>");   
				strOut = strOut.concat("<td class='LbTop' align='center' nowrap='nowrap'><b>SJC</b></td>");
				strOut = strOut.concat("<td class='LbTop' align='center' nowrap='nowrap'>").concat(FormatCurrency(OPENPRICE, 'vi-vn', true, true)).concat("</td>");
				strOut = strOut.concat("<td class='LbTop' align='center' nowrap='nowrap'>").concat(FormatCurrency(LOWESTPRICE, 'vi-vn', true, true)).concat("</td>");  
				strOut = strOut.concat("<td class='LbTop' align='center' nowrap='nowrap'>").concat(FormatCurrency(HIGHESTPRICE, 'vi-vn', true, true)).concat("</td>");
				strOut = strOut.concat("<td class='LbTop' align='center' nowrap='nowrap' style='color:#FF0000;'>").concat(FormatCurrency(MATCHVOL, 'vi-vn', true, true)).concat("</td>");
				strOut = strOut.concat("</tr>");
				strOut = strOut.concat("<tr>");
				strOut = strOut.concat("<td colspan='5' align='right' style='color:#0068ba;font-size:11px;font-style:italic;padding-top:5px;'>(Nguồn:&nbsp;<img alt='Sacombank' src='http://vnexpress.net/Images/logoSb.gif' style='border: 0px none ; vertical-align: middle; width: 80px; height: 9px;'/>)</td>");
				strOut = strOut.concat("</tr>");							  
				strOut = strOut.concat("</tbody>");
				strOut = strOut.concat("</table>");

				strOut = strOut.concat("</div>");
				strOut = strOut.concat("</li>");
				strOut = strOut.concat("<li class='hd-sp3 fl'>&nbsp;</li>");
				strOut = strOut.concat("</ul>");                            
				strOut = strOut.concat("</li>");
				strOut = strOut.concat("</ul>");
				strOut = strOut.concat("</li>");        
				strOut = strOut.concat("</ul>");

				gmobj("tblGoldPrice").innerHTML = strOut;
		},
		'onError': function(req){return "";}
	});
}

function ShowForumComment(id){	
	AjaxRequest.get({		
		"url": "/Extend/Forum/Default.asp?sID=" + id
		, 'onSuccess': function(req){
			gmobj("dForumComment_" + id).innerHTML = req.responseText;						
		}
		, 'onError': function(req){gmobj("dForumComment_" + i).innerHTML = "";}
	});
}

var ViMuaWidget = {
    init: function(vPosition, vFolder) {
        AjaxRequest.get(
        {
            "url": "/ListFile/Vimua/" + vPosition + "_" + vFolder + ".xml"
            , 'onSuccess': function(req) {
				var ItemWidth 	= "";
                var ItemHeight 	= "";
				var ItemSpan 	= "";
                var ItemType 	= "";
                var ItemName 	= "";
                var ItemLink 	= "";
                var ItemImage 	= "";
                var Description = "";
                var VimuaPrice 	= "";
                var MarketPrice = "";
                var strOut 		= "";
                var vStyleBottom = "";
                var k = 0;
				var vcWidth = 0;
				var vdWidth = 25;
                var vWidth = 0;				
                k = req.responseXML.getElementsByTagName('item').length - 1;				
                if (vPosition == "Bottom") {
                    strOut += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
                    strOut += "<tr>";
                }				
                for (var i = 0; i < req.responseXML.getElementsByTagName('item').length && i < 4 && vcWidth < 100; i++) {										
                    with (req.responseXML.getElementsByTagName('item').item(i)) {
						ItemWidth 	= getNodeValue(getElementsByTagName('ItemWidth')); 
                        ItemHeight 	= getNodeValue(getElementsByTagName('ItemHeight'));
						ItemSpan 	= getNodeValue(getElementsByTagName('ItemSpan'));
                        ItemType 	= getNodeValue(getElementsByTagName('ItemType'));
                        ItemName 	= getNodeValue(getElementsByTagName('ItemName'));
                        ItemLink 	= getNodeValue(getElementsByTagName('ItemLink'));
                        ItemImage 	= getNodeValue(getElementsByTagName('ItemImage'));
                        Description = getNodeValue(getElementsByTagName('Description'));
                        VimuaPrice 	= getNodeValue(getElementsByTagName('VimuaPrice'));
                        MarketPrice = getNodeValue(getElementsByTagName('MarketPrice'));						
						if (ItemSpan == "" || ItemSpan == "0") {
                            ItemSpan = "1";
                        }						
                        //alert(vPosition);
                        if (vPosition == "Right") {
                            if (i == k) {
                                vStyleBottom = "";
                            } else {
                                vStyleBottom = "border-bottom:solid 1px #c9d5e5;";
                            }

                            strOut += "<div style=\"overflow:hidden; cursor:pointer; padding-left:4px;" + vStyleBottom + "\" onmousedown=\"window.open('" + ItemLink + "',target='_blank')\">"
                            strOut += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
                            strOut += "     <tr>";
                            if (ItemType == "0") {								
								strOut += "         <td style=\"width:85px;height:58px;\">" + ShowVimuaImage(1, "clsImgProductRight-vimua", ItemImage, ItemName, ItemWidth, ItemHeight) + "</td>";								
								strOut += "         <td style=\"padding-right:4px;\"><div style=\"float:left; height:15px;overflow:hidden;margin-right:1px;\"><label class=\"Desc-vimua\">" + ItemName + "</label></div><br />";
								strOut += "             <span class=\"Desc-vimua\">Giá bán:</span><br />"
								strOut += "             <span class=\"Price-vimua\">" + VimuaPrice + "</span><br />"
								strOut += "             <span class=\"Desc-vimua\">Giá thị trường:</span><br />"
								strOut += "             <span class=\"Price-vimua Price-vimua-market\">" + MarketPrice + "</span><br />"
                            } else {
                                if (Description == "") {                                    
                                    strOut += "     <td colspan=\"2\"><div style=\"width:172px;overflow:hidden;\">" + ShowVimuaImage(1, "clsImgArticleRight-vimua", ItemImage, ItemName, ItemWidth, ItemHeight) + "</div></td>";
                                } else {
									strOut += "     <td style=\"width:85px;height:58px;\">" + ShowVimuaImage(1, "clsImgProductRight-vimua", ItemImage, ItemName, ItemWidth, ItemHeight) + "</td>";
                                    strOut += "     <td><div style=\"float:left; height:15px;overflow:hidden;margin-right:1px;\"><label class=\"Desc-vimua\">" + ItemName + "</label></div>" + Description + "</td>";
                                }
                            }
                            strOut += "     </tr>";
                            strOut += "</table>";
                            strOut += "</div>";

                        } else if (vPosition == "Bottom") {
                            if (i == k) {
                                vStyleRight = "margin:2px 0px;";
                            } else {
                                vStyleRight = "margin:2px 0px; border-right:solid 1px #c9d5e5;";
                            }							
                            vWidth = vdWidth * parseInt(ItemSpan);
                            vcWidth = vcWidth + vWidth;							

                            strOut += "<td width='" + vWidth + "%'>";
                            strOut += "<div style=\"overflow:hidden; cursor:pointer; " + vStyleRight + "\" onmousedown=\"window.open('" + ItemLink + "',target='_blank')\">"
                            strOut += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
                            strOut += "     <tr>";
                            if (ItemType == "0") {                               
                                strOut += "         <td>" + ShowVimuaImage(0, "clsImgProduct-vimua", ItemImage, ItemName, ItemWidth, ItemHeight) + "</td>";                                
                                strOut += "         <td><div style=\"float:left; height:15px;overflow:hidden\"><label class=\"Desc-vimua\">" + ItemName + "</label></div><br />"
                                strOut += "             <span class=\"Desc-vimua\">Giá bán:</span><br />"
                                strOut += "             <span class=\"Price-vimua\">" + VimuaPrice + "</span><br />"
                                strOut += "             <span class=\"Desc-vimua\">Giá thị trường:</span><br />"
                                strOut += "             <span class=\"Price-vimua Price-vimua-market\">" + MarketPrice + "</span><br />"
                                strOut += "         </td>";
                            } else {
                                if (Description == "") {                                    
                                    strOut += "     <td colspan=\"2\"><div style=\"height:86px;overflow:hidden;\">" + ShowVimuaImage(0, "clsImgArticle-vimua", ItemImage, ItemName, ItemWidth, ItemHeight) + "</div></td>";
                                } else {
									strOut += "     <td>" + ShowVimuaImage(0, "clsImgProduct-vimua", ItemImage, ItemName, ItemWidth, ItemHeight) + "</td>";
                                    strOut += "     <td><label class=\"Desc-vimua\">" + Description + "</label></td>";
                                }
                            }
                            strOut += "     </tr>";
                            strOut += "</table>";
                            strOut += "</div>";
                            strOut += "</td>";
                        }
                    }
                }

                if (vPosition == "Bottom") {
                    strOut += "</tr>";
                    strOut += "</table>";
                }

                if (vPosition == "Right") {
                    gmobj("vimua-content-right").innerHTML = strOut;
                } else if (vPosition == "Bottom") {
                    gmobj("vimua-content-bottom").innerHTML = strOut;
                }
            }
            , 'onError': function(req) { return ""; }
        }
        );
    }
};

function ShowVimuaImage(position, className, source, imageName, ItemWidth, ItemHeight){
  var strReturn = '';
	if(ItemWidth=="") ItemWidth = "100%";
	if(ItemHeight=="") ItemHeight = "100%";
	switch(position){
		case 0:
			if (/\.(swf)$/.test(source)){
				strReturn = strReturn.concat('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 " alt="').concat(imageName).concat('" WIDTH="').concat(ItemWidth).concat('" HEIGHT="').concat(ItemHeight).concat('">');
				strReturn = strReturn.concat('<PARAM NAME="movie" VALUE="').concat(source).concat('">');
				strReturn = strReturn.concat('<PARAM NAME="AllowScriptAccess" VALUE="always">');
				strReturn = strReturn.concat('<PARAM NAME="quality" VALUE="high">');
				strReturn = strReturn.concat('<PARAM NAME="bgcolor" VALUE="#FFFFFF">');
				strReturn = strReturn.concat('<PARAM NAME="wmode" VALUE="transparent">');
				strReturn = strReturn.concat('<EMBED src="').concat(source).concat('" quality="high" bgcolor="#FFFFFF"').concat('" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" WIDTH="').concat(ItemWidth).concat('" HEIGHT="').concat(ItemHeight).concat('" wmode="transparent" AllowScriptAccess="always" alt="').concat(imageName).concat('" >');
				strReturn = strReturn.concat('</OBJECT>');
			}
			else strReturn = "<img src=\"" + source + "\" class=\"" + className + "\" alt=\"" + imageName + "\" />";
		case 1:
			if (/\.(swf)$/.test(source)){
				strReturn = strReturn.concat('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 " alt="').concat(imageName).concat('" WIDTH="').concat(ItemWidth).concat('" HEIGHT="').concat(ItemHeight).concat('">');
				strReturn = strReturn.concat('<PARAM NAME="movie" VALUE="').concat(source).concat('">');
				strReturn = strReturn.concat('<PARAM NAME="AllowScriptAccess" VALUE="always">');
				strReturn = strReturn.concat('<PARAM NAME="quality" VALUE="high">');
				strReturn = strReturn.concat('<PARAM NAME="bgcolor" VALUE="#FFFFFF">');
				strReturn = strReturn.concat('<PARAM NAME="wmode" VALUE="transparent">');
				strReturn = strReturn.concat('<EMBED src="').concat(source).concat('" quality="high" bgcolor="#FFFFFF"').concat('" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" WIDTH="').concat(ItemWidth).concat('" HEIGHT="').concat(ItemHeight).concat('" wmode="transparent" AllowScriptAccess="always" alt="').concat(imageName).concat('" >');
				strReturn = strReturn.concat('</OBJECT>');
			}
			else strReturn = "<img src=\"" + source + "\" class=\"" + className + "\" alt=\"" + imageName + "\" />"; 
	}  
	return strReturn;
}

function BuildLink(folder,path, classname){
	var strReturn = '<a href="';
	if(folder >= 600 && folder <= 612) strReturn = strReturn + path + '" ';
	else strReturn = strReturn + 'http://vnexpress.net' + path + '" target="_blank" ';
	if(classname=='') strReturn = strReturn + '>';
	else strReturn = strReturn + ' class="' + classname + '">';
	return strReturn;
}

function ShowUpDown(i){
	var strReturn = '';
	if(i==0) strReturn = ' <img alt="" src="/Images/Ebank/ATM/row-down.gif" style="vertical-align:middle" />';
	else strReturn = ' <img alt="" src="/Images/Ebank/ATM/row-up.gif" style="vertical-align:middle" />';
	return strReturn;
}

var arrBankPos = ['SHB','TiênPhongBank'];
Array.prototype.contains = function(compareVal){		
	for (var i = 0; i < this.length; i++){		
		if (this[i] === compareVal)
			return i;
	}
	return 9999;
}

function orderByPos(a, b){
	a = a[12];
	b = b[12];
	return a - b;	
}

function showInterestRateNew(i,type,bankids){
	var sLink = '';
	var arItem = new Array();
	var tabId = i;
	sLink = '/ListFile/Ebank/Rate_Bank_Type_' + i + '.xml';
	AjaxRequest.get({
		'url':sLink,
		'onSuccess':function(req){				
			var iCount=0;			
			for (var i=0;i<req.responseXML.getElementsByTagName('Bank').length;i++){				
				with(req.responseXML.getElementsByTagName('Bank').item(i)){	    								
					arItem[iCount] = new Array(13);
					arItem[iCount][0] = getNodeValue(getElementsByTagName('BankID'));
					arItem[iCount][1] = getNodeValue(getElementsByTagName('BankName'));
					arItem[iCount][2] = getNodeValue(getElementsByTagName('Month0'));
					arItem[iCount][3] = getNodeValue(getElementsByTagName('Month1'));
					arItem[iCount][4] = getNodeValue(getElementsByTagName('Month2'));
					arItem[iCount][5] = getNodeValue(getElementsByTagName('Month3'));
					arItem[iCount][6] = getNodeValue(getElementsByTagName('Month6'));
					arItem[iCount][7] = getNodeValue(getElementsByTagName('Month9'));
					arItem[iCount][8] = getNodeValue(getElementsByTagName('Month12'));
					arItem[iCount][9] = getNodeValue(getElementsByTagName('Month18'));
					arItem[iCount][10] = getNodeValue(getElementsByTagName('Month24'));
					arItem[iCount][11] = getNodeValue(getElementsByTagName('Month36'));			
					arItem[iCount][12] = arrBankPos.contains(arItem[iCount][1]);					
					iCount++;					
				}
			}
			if(orderby != -1) arItem.sort(ArrSort);
			else arItem.sort(orderByPos);
			
			sHTML = getInterestRateNew(arItem, type, bankids, tabId);
			if(type==0) gmobj('dInterestRate').innerHTML=sHTML;						
			else{
				gmobj('dCompareResult').innerHTML=sHTML;
				gmobj('dCompareResult').style.display='';
			}
		},
		'onError':function(req){
			if(type==0) gmobj('dInterestRate').innerHTML=statusText;						
			else gmobj('dCompareResult').innerHTML=statusText;
		}
	})
}

function getInterestRateNew(arItem, type, bankids, tabid){
	var sHTML = '';
	var i=0;
	sHTML = sHTML.concat('<table cellpadding="0px" cellspacing="0px" border="0px">');
	sHTML = sHTML.concat('	<thead class="thead-ls">');
	sHTML = sHTML.concat('		<td width="50%"><img src="/Images/eBank/ky-han.gif" alt=""></td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(2,' + tabid + ')">0');
	if(orderby==2) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');	
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(3,' + tabid + ')">1');	
	if(orderby==3) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');	
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(4,' + tabid + ')">2');
	if(orderby==4) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(5,' + tabid + ')">3');
	if(orderby==5) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(6,' + tabid + ')">6');
	if(orderby==6) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(7,' + tabid + ')">9');
	if(orderby==7) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(8,' + tabid + ')">12');
	if(orderby==8) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(9,' + tabid + ')">18');
	if(orderby==9) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(10,' + tabid + ')">24');
	if(orderby==10) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('		<td width="50%" style="cursor:pointer; display: none;" onClick="OrderByMonth(11,' + tabid + ')">36');
	if(orderby==11) sHTML = sHTML.concat(ShowUpDown(ordertype));
	sHTML = sHTML.concat('		</td>');
	sHTML = sHTML.concat('</thead>');
	
	if(type==0 && bankids!= '-1'){		
		for(i=0; i<arItem.length; i++){				
			if(arItem[i][0]==parseInt(bankids)){
				if (i%2==0){
					sHTML = sHTML.concat('<tr class="ls-tr">');				
					sHTML = sHTML.concat('	<td class="ls-left">').concat(arItem[i][1]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;>').concat(arItem[i][2]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][3]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][4]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][5]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][6]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][7]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][8]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][9]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][10]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right1"">').concat(arItem[i][11]).concat('</td>');
					sHTML = sHTML.concat('</tr>');
				}
				else{
					sHTML = sHTML.concat('<tr class="ls-tr">');				
					sHTML = sHTML.concat('	<td class="ls-left">').concat(arItem[i][1]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;>').concat(arItem[i][2]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][3]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][4]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][5]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][6]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][7]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][8]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][9]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][10]).concat('</td>');
					sHTML = sHTML.concat('	<td class="ls-right2"">').concat(arItem[i][11]).concat('</td>');
					sHTML = sHTML.concat('</tr>');
				}
				break;
			}
		}
	}
	else if(type!=0){		
		var ids = bankids.split(",");
		var j = 0;
		var	k = 0;
		for(i=0; i<ids.length; i++){
			for(j=0; j<arItem.length; j++){				
				if(arItem[j][0]==ids[i]){	
					if (k%2==0){
						sHTML = sHTML.concat('<tr class="ls-tr">');
						sHTML = sHTML.concat('	<td class="ls-left">').concat(arItem[j][1]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;>').concat(arItem[j][2]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][3]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][4]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][5]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][6]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][7]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][8]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][9]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[j][10]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right1">').concat(arItem[j][11]).concat('</td>');
						sHTML = sHTML.concat('</tr>');
					}
					else{
						sHTML = sHTML.concat('<tr class="ls-tr">');
						sHTML = sHTML.concat('	<td class="ls-left">').concat(arItem[j][1]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;>').concat(arItem[j][2]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][3]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][4]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][5]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][6]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][7]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][8]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][9]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[j][10]).concat('</td>');
						sHTML = sHTML.concat('	<td class="ls-right2">').concat(arItem[j][11]).concat('</td>');
						sHTML = sHTML.concat('</tr>');
					}
					k++;
					break;
				}
			}
		}
	}
	else{
		while (i<arItem.length){		
			if(i%2==0){
				sHTML = sHTML.concat('<tr class="ls-tr">');
				sHTML = sHTML.concat('	<td class="ls-left">').concat(arItem[i][1]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;>').concat(arItem[i][2]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][3]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][4]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][5]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][6]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][7]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][8]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][9]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1" style="display: none;">').concat(arItem[i][10]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right1">').concat(arItem[i][11]).concat('</td>');
				sHTML = sHTML.concat('</tr>');
			}
			else{
				sHTML = sHTML.concat('<tr class="ls-tr">');
				sHTML = sHTML.concat('	<td class="ls-left">').concat(arItem[i][1]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;>').concat(arItem[i][2]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][3]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][4]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][5]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][6]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][7]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][8]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][9]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2" style="display: none;">').concat(arItem[i][10]).concat('</td>');
				sHTML = sHTML.concat('	<td class="ls-right2">').concat(arItem[i][11]).concat('</td>');
				sHTML = sHTML.concat('</tr>');
			}
			i++;
		}
	}
	sHTML = sHTML.concat('</table>');
	return sHTML;
}

function paging(size){
	var total = $('.box-mid-td > ul > li').length;
	if (total > size){
		var strC = '';
		var pcount = 0, icount = 0, i = 0;
		$('.box-mid-td > ul > li').each(function(){
			if (icount==0&&pcount==0) strC += '<ul id="'+pcount+'">';
			else if(icount==0) strC += '<ul id="'+pcount+'" style="display: none;">';
			strC += '	<li>' + $(this).html() + '</li>';
			if (icount==size-1){
				strC += '</ul>';
				pcount++;
				icount = -1;
			}
			else if(i==total-1) {strC += '</ul>'; pcount++;}
			icount++; i++;
		});
		strC += '<div class="page"></div>';
		$('.box-mid-td').html(strC);
		writepagelink(pcount, 0);
	}	
}

function writepagelink(pcount, index){
	var strP = '';
	strP += '<div class="pageright"></div>';
	strP += '<div class="pagemid">';
	strP += '	<a class="next" href="/GL/Ebank/Tuyen-dung/">Xem tiếp</a><img src="/images/ebank/next.gif">';
	for(var i=0; i<pcount; i++){
		if(i==index) strP += '	<span class="num">'+(i+1)+'</span>';
		else strP += '	<a class="num" onclick="viewpage('+pcount+','+i+')">'+(i+1)+'</a>';
	}
	strP += '	<img src="/images/ebank/pre.gif">';
	strP += '</div>';
	strP += '<div class="pageleft"></div>';
	$('.page').html(strP);
}

function viewpage(pcount, index){
	$('.box-mid-td > ul').hide();
	$('.box-mid-td > #' + index).show();
	writepagelink(pcount, index);
}
