// JavaScript Document

var aTopJobsPool;
var iDisplayTime = 10000;
var iCountPerBlock = 5;
var iCurrPos = 0;

function JobDisplay(sThisReponse){
	var sThisDiv = 'ThisJobs';
	
	if (Trim(sThisReponse) != 0){
		aTopJobsPool = sThisReponse.split(';');
		iTopJobsPool = aTopJobsPool.length;
		
		RotateJobs(sThisDiv);
		setInterval('RotateJobs("'+sThisDiv+'");', iDisplayTime);
	}else{
		var oDiv = document.getElementById(sThisDiv);
		oDiv.innerHTML = 'No Latest Job Openings at this time.';
	}
}

function RotateJobs(sThisDiv){
	var oDiv = document.getElementById(sThisDiv);
	var aTopJobs;
	var y = 1;
	
	if (iCurrPos > 0){
		if (iCurrPos >= aTopJobsPool.length){
			iCurrPos = 0;
		}
	}
	
	var sHTML = '<table border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed; width:560px; font-size:0.9em;">' +
					'<tr style="font-size:0.9em;">' +
						'<th style="text-align:left; width:260px;">Job Title</th>' +
						'<th style="text-align:left; width:130px;">Work Site</th>' +
						'<th style="text-align:left; width:170px;">Company</th>' +
					'</tr>';
	
	for (x=iCurrPos; x<aTopJobsPool.length && y<=iCountPerBlock; x++){
		aTopJobs = aTopJobsPool[x].split('|');
		sHTML += '<tr>' +
						'<td style="vertical-align:top; border-top:solid 1px gray;"><a href="javascript:void(0);" style="text-decoration:none;" onclick="NewWindow(\'http://system.deltavir.com.ph/popup.php?go=job&id='+aTopJobs[0]+'&e=1\', 660, 300, 1);">'+aTopJobs[1]+'</a></td>' +
						'<td style="vertical-align:top; border-top:solid 1px gray;">'+aTopJobs[3]+'</td>' +
						'<td style="vertical-align:top; border-top:solid 1px gray;">'+aTopJobs[2]+'</td>' +
					'</tr>';
		y++;
	}
	
	sHTML += '<tr><td colspan="3" style="height:5px;"></td></tr>' +
				'<tr><td colspan="3" style="text-align:right;"><a href="http://system.deltavir.com.ph/jobs.php" style="text-decoration:none;" target="_blank">Click here for more jobs.</a></td></tr></table>';
	oDiv.innerHTML = sHTML;
	iCurrPos += iCountPerBlock;
}

function IntDisplay(sThisReponse){
	var aTopIntPool = sThisReponse.split(';');
	var oDiv = document.getElementById("ThisInterview");
	
	if (Trim(sThisReponse) != 0){
		var sHTML = '<table border="0" cellpadding="2" cellspacing="0" style="table-layout:fixed; width:560px; font-size:0.9em;">' +
						'<tr style="font-size:0.9em;">' +
							'<th style="text-align:left; width:260px;">Employer</th>' +
							'<th style="text-align:left; width:130px;">Venue</th>' +
							'<th style="text-align:left; width:170px;">Date</th>' +
						'</tr>';
		
		for (x=0; x<aTopIntPool.length; x++){
			aTopInt = aTopIntPool[x].split('|');
			sHTML += '<tr>' +
							'<td style="vertical-align:top; border-top:solid 1px gray;">'+aTopInt[0]+'</td>' +
							'<td style="vertical-align:top; border-top:solid 1px gray;">'+aTopInt[1]+'</td>' +
							'<td style="vertical-align:top; border-top:solid 1px gray;">'+aTopInt[2]+'</td>' +
						'</tr>';
		}
		
		sHTML += '</table>';
	}else{
		sHTML = 'No Interview Schedules at this time.';
	}
	
	oDiv.innerHTML = sHTML;
}
