// Portfolio
function getItems(e,current)
{
	id =e;
	global=document.getElementById(globalclient);
	global.className="itemoff";
	current.className="itemon";
	$("#"+id).css({'background-color' : '#000', 'color' : '#fff'});
	$("#"+globalclient).css({'background-color' : '#fff', 'color' : '#000'});
	globalclient=current.id;
	var url = 'portfolioDetails.php';
 	var cleanCache = Math.round(Math.random()* 100);
	var pars   = 'id=' + id  +"&type=client" + "&rand="+ cleanCache;
	xmlHttp.open('get', url+'?'+pars,true);
	xmlHttp.onreadystatechange = showResponse;
	xmlHttp.send(null);
}

function showResponse () {
		if(xmlHttp.readyState == 1){
			document.getElementById("wnn").innerHTML="";
			document.getElementById('loading_trans').style.display = 'block';
		}
		if(xmlHttp.readyState == 4){

			Doc=xmlHttp.responseText;
			result=Doc.split("-Y-");
			document.getElementById('loading_trans').style.display = 'none';
			if(Doc!="error"){
				getItem(result[1],null);
				globalitem="item_1";
				document.getElementById("wnn").innerHTML= result[0];
				document.getElementById("wnn").scrollLeft="0px";
				if(result[2]>16)
				{
					document.getElementById("leftscroll").style.display="block";
					document.getElementById("rightscroll").style.display="block";
				}
				else
				{
					document.getElementById("leftscroll").style.display="none";
					document.getElementById("rightscroll").style.display="none";
				}
				//dw_scrollObj.resetSpeed('wnn');
				//dw_scrollObj.loadLayer('wnn','lyra','t1');
			}
			else
			{
				fadein('morejobs',500)
			}
		}	
}

function getItem(e,current)
{
	id =e;
	if(current!=null){
		global=document.getElementById(globalitem);
		global.className="itemoff";
		current.className="itemon";
		globalitem=current.id;
	}
	var url = 'portfolioDetails.php';
 	var cleanCache = Math.round(Math.random()* 100);
	var pars   = 'id=' + id +"&type=item" +"&rand="+ cleanCache;
	xmlHttp.open('get', url+'?'+pars,true);
	xmlHttp.onreadystatechange = showItem;
	xmlHttp.send(null);	
}

function showItem () {
		if(xmlHttp.readyState == 1){
			document.getElementById('loading_trans').style.display = 'block';
		}
		if(xmlHttp.readyState == 4){

			Doc=xmlHttp.responseText;
			resultat=Doc.split("-Y-");
			document.getElementById('loading_trans').style.display = 'none';
			if(Doc!="error"){
				document.getElementById("portfolio").innerHTML= resultat[0];
					document.getElementById("info").innerHTML= resultat[1];
					document.getElementById("info").parentNode.style.background="#000";
			}
			else
			{
				fadein('morejobs',500)
			}
		}	
}



function getItemsbycat(e,current,cat)
{
	id =e;	
	global=document.getElementById(globalclient);
	global.className="itemoff";
	current.className="itemon";
	globalclient=current.id;
	var url = 'portfolioDetails.php';
 	var cleanCache = Math.round(Math.random()* 100);
	if(cat=="Web & Interactive")
		cat="WebInteractive";
	var pars   = 'id=' + id  +"&type=client&cat="+ cat + "&rand="+ cleanCache;
	xmlHttp.open('get',url+'?'+pars,true);
	xmlHttp.onreadystatechange = showResponse;
	xmlHttp.send(null);
}

function getItemsbysearch(e,current,query)
{
	id =e;
	global=document.getElementById(globalclient);
	global.className="itemoff";
	current.className="itemon";
	globalclient=current.id;
	var url = 'portfolioDetails.php';
 	var cleanCache = Math.round(Math.random()* 100);
	var pars   = 'id=' + id  +"&type=client&query="+ query + "&rand="+ cleanCache;
	xmlHttp.open('get', url+'?'+pars,true);
	xmlHttp.onreadystatechange = showResponse;
	xmlHttp.send(null);
}
