//This JavaScript shows the previous set of clients in corresponding category
var XMLHttpRequestObject_2=false;
var clientFirstIdString=null;

function movePrevious()
{
	var clients=document.getElementById("clients");
//	var rowsArr=clients.rows;
	var rowsArr=clients.getElementsByTagName("div");
	
	var divArray=new Array();
	var optiondivArray=new Array();
	var k=-1;
	for(var i=0;i<rowsArr.length;i++)
	{
		if(rowsArr[i].id=="divrows")
		{	k++;
			divArray[k]=rowsArr[i];
			//alert("if i="+i);
		}
		else
		{
			//optiondivArray[i]=rowsArr[i];
		}
	}
	//alert(divArray.length);
	var rowCount=divArray.length;
//	alert("rowCount="+rowCount);
//	var lastDiv=divArray[rowCount-1];
	var FirstDiv=divArray[0];
//	alert("firstdiv id="+FirstDiv.id);
//	var cellCount=lastDiv.getElementsByTagName("div");
	var cellCount=FirstDiv.getElementsByTagName("div");
//	alert("cellcount="+cellCount.length);
	
//	var lastCell=cellCount[cellCount.length-1];
	var firstCell=cellCount[0];
	//alert(lastCell);
//	var lastId=lastCell.id;
	var firstId=firstCell.id;
	//alert("FirstId="+firstId);
	
	
	/*var rowCount=rowsArr.length;
	
	var cellsArr=rowsArr[0].cells;
	var cellCount=cellsArr.length;
	
	var firstCell=cellsArr[0];
	
	var firstId=firstCell.id;
*/
	if(window.XMLHttpRequest)
	{
		XMLHttpRequestObject_2=new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		XMLHttpRequestObject_2=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(XMLHttpRequestObject_2)
	{
		XMLHttpRequestObject_2.open("GET","queryPortfolioNavigation.php?firstId="+firstId);
		XMLHttpRequestObject_2.onreadystatechange=function()
		{
			if(XMLHttpRequestObject_2.readyState==4 && XMLHttpRequestObject_2.status==200)
			{
				var ajaxResponseText=XMLHttpRequestObject_2.responseText;
				var clientListDiv=document.getElementById("portfolioListDiv");
				clientListDiv.innerHTML=ajaxResponseText;
				//alert(ajaxResponseText);
				portfolioFirstIdString=readFirstId();
				var targetPreviousDiv=document.getElementById("previousDiv");
				targetPreviousDiv.style.visibility="visible";
				hideUnhidePreviousPortfolioNavigation(portfolioFirstIdString);
			}						
		}
		XMLHttpRequestObject_2.send(null);
	}
}
function readFirstId()
{
	var targetHidden=document.getElementById("firstIds");
	var firstIdList=targetHidden.value;
	return firstIdList;
}