﻿var sLoDIDNext=',';
var iReadStep=0;
var iDelayNext=200;
var iBoxCountNext=0;
var iMaxHH=5,iMaxTBSNext=5;
var iTSTimerNext=0;


var iDisplayCateNo=0;
var iHHTimer=0;
var iHHCount,iHHCur,iHHFading,iHHPrev=0,iHHNext=0,iHHFastMove=0;
var iFadeDelay=50;

/*

*/

function getNodeValueNext(o){
	try	{
		return o.item(0).firstChild.nodeValue;
	}
	catch(err) {
		return '';
	}
}
function displayidNext(id,add){
	if (typeof(add)=='undefined') add=true;
	if (sLoDIDNext.indexOf(id)<=0){
		if (add) sLoDIDNext=sLoDIDNext.concat(id).concat(',');
		//sLoDIDNext=sLoDIDNext.concat(id).concat(',');
		return true;
	}
	else{
		return false;
	}
}

function showtopboxitem(sFolder,sName,sPath,arItem,index){
	var sHTML='';
	sHTML=sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 style="width:241px;height:233px;">');
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td style="height:233px;" valign="top">');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 style="width:241px;">');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('					    <td style="width:241px;padding-left:2px;" valign="top" align="left">');	
	sHTML=sHTML.concat('                            <img width=5 height=5 src="/images/BulletNewHomes.jpg"> <a class="cssNewsTitle" href="').concat(arItem[index][1]).concat('">').concat(arItem[index][2]).concat(' <span class="cssNewsTitleDate">(').concat(arItem[index][5]).concat(')</span >').concat('</a>');
	sHTML=sHTML.concat('				         </td>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('				</tr>');
	if (arItem[index][5]!=''){
		sHTML=sHTML.concat('			<tr>');		
		sHTML=sHTML.concat('				<td style="width:7px;">');
		sHTML=sHTML.concat('				<td align="center" valign="top">');
		sHTML=sHTML.concat('<a href="').concat(arItem[index][1]).concat('"><img border=0 style="border:solid 1px #A5A5A5;" width=235px height=130 src="').concat(arItem[index][4]).concat('"></a>');
		sHTML=sHTML.concat('				</td>');
		sHTML=sHTML.concat('				<td style="width:7px;">');
		sHTML=sHTML.concat('			</tr>');
	}

	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('					<td style="width:241px;" class="cssNewsHeaderTitleView" ><div style="text-align:justify">');
	sHTML=sHTML.concat('					    ').concat(arItem[index][3]);
	sHTML=sHTML.concat('				    </div></td>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('			</Table>');
	sHTML=sHTML.concat('		</td>');
	sHTML=sHTML.concat('	</tr>');
	//Bat dau co cai nut Pre va Next
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td align="right"  valign=bottom>');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 >');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('					<td height=12 valign="top">');
	if (index==0){
		sHTML=sHTML.concat('					<img heigh="12" src="/Images/NewsImages/Prev2.gif">');
	}
	else{
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Prev.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitem(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index-1).concat(')"');
		sHTML=sHTML.concat('>');
	}
	sHTML=sHTML.concat('</td>');
		sHTML=sHTML.concat('<td>&nbsp;</td>');
	sHTML=sHTML.concat('					<td height=12 valign="top">');
	if (index>=arItem.length-1){
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Next2.gif" heigh="12">');
	}
	else{
		sHTML=sHTML.concat('<img heigh="12" src="/Images/NewsImages/Next.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitem(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index+1).concat(')"');
		sHTML=sHTML.concat('>');
	}
	sHTML=sHTML.concat('</td>');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('			</Table>');
	sHTML=sHTML.concat('		</td>');
	sHTML=sHTML.concat('	</tr>');
	sHTML=sHTML.concat('</Table>');
	gmobj('tdTopBox'+sFolder).innerHTML=sHTML;
}

function showtopboxitemnew(sFolder,sName,sPath,arItem,index){
	var sHTML='';
	sHTML=sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 style="width:241px;height:258px;">');
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td style="height:258px;" valign="top">');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 style="width:241px;">');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('				    <td style="width:4px;">');
	sHTML=sHTML.concat('					    <td colspan="3" style="width:241px;padding-left:2px;" valign="top" align="left">');
	sHTML = sHTML.concat('                            <img width=5 height=5 src="/images/BulletNewHomes.jpg"> <a class="cssNewsTitle" href="').concat(arItem[index][1]).concat('">').concat(arItem[index][2]).concat(' <span class="cssNewsTitleDate">(').concat(arItem[index][5]).concat(')</span >').concat('</a>');
	sHTML=sHTML.concat('				         </td>');
	sHTML=sHTML.concat('				    <td style="width:4px;">');
	sHTML=sHTML.concat('				</tr>');
	if (arItem[index][5]!=''){
		sHTML=sHTML.concat('			<tr>');		
		sHTML=sHTML.concat('				<td style="width:4px;">');
		sHTML=sHTML.concat('				<td " align="center" valign="top">');
		sHTML=sHTML.concat('				    <table align="Left" CellSpacing="3" cellpadding="0"  style="width:80px;">');
		sHTML=sHTML.concat('				        <tr>');
		sHTML=sHTML.concat('				            <td valign="top">');
		sHTML=sHTML.concat('				                <table CellSpacing="2" cellpadding="2" style="width:100%;">');
		sHTML=sHTML.concat('				                    <tr>');
		sHTML=sHTML.concat('				                        <td valign="top">');
		sHTML=sHTML.concat('<a href="').concat(arItem[index][1]).concat('"><img border=0 style="border:solid 1px #A5A5A5;" width="80" height="75" src="').concat(arItem[index][4]).concat('"></a>');
		sHTML=sHTML.concat('				                        </td>');
		sHTML=sHTML.concat('				                    </tr>');
		sHTML=sHTML.concat('				                </table>');
		sHTML=sHTML.concat('		                    </td>');
		sHTML=sHTML.concat('				        </tr>');
		sHTML=sHTML.concat('                    </table>');
		sHTML=sHTML.concat('                    <div align="justify">');
	    sHTML=sHTML.concat('					    ').concat(arItem[index][3]);
	    sHTML=sHTML.concat('				    </div>');
	    sHTML=sHTML.concat('				</td>');
		sHTML=sHTML.concat('				<td style="width:4px;">');
		sHTML=sHTML.concat('			</tr>');
	}
	
 var intCheck = 0
    for(i = 0 ; i < arItem.length ;i++)
    {
        if(i!=index)
        {	        
            if(intCheck == 4)
            {
                break;
            }
            sHTML=sHTML.concat('				<tr>');
            sHTML=sHTML.concat('				    <td style="width:4px;">');
            sHTML=sHTML.concat('					<td colspan="3" style="width:227px;" class="cssNewsHeaderTitleView" ><div style="text-align:justify">');
            sHTML = sHTML.concat('                        <img width=5 height=5 src="/images/BulletNewHomes.jpg"> <a class="cssNewsTitle" href="').concat(arItem[i][1]).concat('">').concat(arItem[i][2]).concat(' <span class="cssNewsTitleDate">(').concat(arItem[index][5]).concat(')</span >').concat('</a>');
            sHTML=sHTML.concat('				    </div></td>');	
            sHTML=sHTML.concat('				   <td style="width:4px;">');
            sHTML=sHTML.concat('				</tr>');
            intCheck ++;
        }
    }

	sHTML=sHTML.concat('			</Table>');
	sHTML=sHTML.concat('		</td>');
	sHTML=sHTML.concat('	</tr>');
	//Bat dau co cai nut Pre va Next
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td align="right"  valign="bottom" style="height:12px;">');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0  >');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('					<td height=12 valign="bottom" >');
	if (index==0){
		sHTML=sHTML.concat('					<img src="/Images/NewsImages/Prev2.gif">');
	}
	else{
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Prev.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitemnew(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index-1).concat(')"');
		sHTML=sHTML.concat('>');
	}
	sHTML=sHTML.concat('</td>');	
	sHTML=sHTML.concat('<td>&nbsp;</td>');
	sHTML=sHTML.concat('					<td height=12 valign="bottom">');
	if (index>=arItem.length-1){
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Next2.gif">');
	}
	else{
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Next.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitemnew(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index+1).concat(')"');
		sHTML=sHTML.concat('>');
	}
	sHTML=sHTML.concat('</td>');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('			</Table>');
	sHTML=sHTML.concat('		</td>');
	sHTML=sHTML.concat('	</tr>');
	sHTML=sHTML.concat('</Table>');
	gmobj('tdTopBox'+sFolder).innerHTML=sHTML;
}


function showtopboxitemEmployment(sFolder,sName,sPath,arItem,index){
	var sHTML='';
	sHTML=sHTML.concat('<Table border=0 cellspacing=0 cellpadding=0 style="width:241px;height:204px;">');
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td style="height:211px;" valign="top">');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 style="width:241px;">');
	if (arItem[index][5]!=''){
		sHTML=sHTML.concat('			<tr>');		
		sHTML=sHTML.concat('				<td style="width:7px;">');
		sHTML=sHTML.concat('				<td align="center" valign="top">');
		sHTML=sHTML.concat('<a href="').concat(arItem[index][1]).concat('"><img border=0 width=194 height=110 src="').concat(arItem[index][4]).concat('"></a>');
		sHTML=sHTML.concat('				</td>');
		sHTML=sHTML.concat('				<td style="width:7px;">');
		sHTML=sHTML.concat('			</tr>');
	}
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('					<td style="width:241px;" valign="top" align="left">');	
	sHTML=sHTML.concat('                        <img width=5 height=5 src="/Vinafood1/images/BulletNewHomes.jpg"> <a class="cssNewsTitle" href="').concat(arItem[index][1]).concat('">').concat(arItem[index][2]).concat('</a>');
	sHTML=sHTML.concat('				    </td>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('					<td style="width:241px;" class="cssNewsHeaderTitleView" ><div style="text-align:justify">');
	sHTML=sHTML.concat('					    ').concat(arItem[index][3]);
	sHTML=sHTML.concat('				    </div></td>');
	sHTML=sHTML.concat('				    <td style="width:7px;">');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('			</Table>');
	sHTML=sHTML.concat('		</td>');
	sHTML=sHTML.concat('	</tr>');
	//Bat dau co cai nut Pre va Next
	sHTML=sHTML.concat('	<tr>');
	sHTML=sHTML.concat('		<td style="padding-bottom:1;" align="right"  valign=bottom>');
	sHTML=sHTML.concat('			<Table border=0 cellspacing=0 cellpadding=0 >');
	sHTML=sHTML.concat('				<tr>');
	sHTML=sHTML.concat('					<td height=12 style="padding-left:2;padding-right:2;">');
	if (index==0){
		sHTML=sHTML.concat('					<img src="/Vinafood1/Images/NewsImages/Prev2.gif">');
	}
	else{
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Prev.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitem(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index-1).concat(')"');
		sHTML=sHTML.concat('>');
	}
	sHTML=sHTML.concat('</td>');
	sHTML=sHTML.concat('					<td height=12 style="padding-left:2;padding-right:2;">');
	if (index>=arItem.length-1){
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Next2.gif">');
	}
	else{
		sHTML=sHTML.concat('<img src="/Images/NewsImages/Next.gif" style="cursor:pointer;" ');
		sHTML=sHTML.concat('onclick="showtopboxitem(sId').concat(sFolder).concat(',sName').concat(sFolder).concat(',sPath').concat(sFolder).concat(',arItem').concat(sFolder).concat(',').concat(index+1).concat(')"');
		sHTML=sHTML.concat('>');
	}
	sHTML=sHTML.concat('</td>');
	sHTML=sHTML.concat('				</tr>');
	sHTML=sHTML.concat('			</Table>');
	sHTML=sHTML.concat('		</td>');
	sHTML=sHTML.concat('	</tr>');
	sHTML=sHTML.concat('</Table>');
	gmobj('tdTopBox'+sFolder).innerHTML=sHTML;
}
