// JavaScript Document

//var xmlHttp

function LoadPortfolio(which,pftype)
{ 

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
	  alert ("Your browser does not support AJAX!");
	  return;
	 }

	
	if (document.getElementById("whichvalue")) {
		var whichvalue = parseFloat(document.getElementById("whichvalue").value);
	} else {
		var whichvalue = 0;
	}

	if (which == "next") {
		whichvalue = whichvalue + 1;
	} else if (which == "prev") {
		whichvalue = whichvalue - 1;
	}

	if (whichvalue<0) {
		whichvalue = 0;
	}
	
	var maxvalue_pf = parseFloat(document.getElementById("maxvalue_pf").value)-1;
	if (whichvalue>=maxvalue_pf) {
		whichvalue = maxvalue_pf;
	}

	var url="ajax/loadportfolio.php";
	url=url+"?whichvalue="+whichvalue;
	if (pftype) {
		url=url+"&pftype="+pftype;
	}
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange = function() {
		
		if ((xmlHttp.readyState==1) || (xmlHttp.readyState==2) || (xmlHttp.readyState==3)) {
			
			document.getElementById("portfoliobox").style.display = "block";
			document.getElementById("portfoliobox").innerHTML="<img src='include/ajax-loader.gif' />";
			
		} else if (xmlHttp.readyState==4) {
			
			document.getElementById("portfoliobox").innerHTML=xmlHttp.responseText;
			document.getElementById("whichvalue").value=whichvalue;
			
		}
	
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}
