function GetHRObject()
{
	var HttpReq;

	if (typeof(XMLHttpRequest) != 'undefined')
	{
		HttpReq = new XMLHttpRequest();
	}
	else
	{
		try
		{
			HttpReq = new ActiveXObject('Microsoft.XMLHTTP');
		}
		catch (e)
		{
			HttpReq = null;
		}
	}
	return HttpReq;
}


function ProdListUpdate(Cat, Sort, SortOrder, Page, ShowVisuals)
{
	PlcElem = document.getElementById('Plc');
	PlcElem.innerHTML = '<img src="/images/gui/main/Reload.gif" width="16" height="16" align="top" alt="" /> En cours de chargement ...';

	var HttpReq = GetHRObject();

	if (HttpReq)
		Url = '/request/ProdList.php?ref=' + Cat;
	else
		Url = document.location.pathname + '?';
		
	Filters = document.getElementsByName('Filter');
	for (i=0; i<Filters.length; i++)
	{
		F = Filters[i];

		if (F.type == 'checkbox')
		{
			if (F.checked)
				Url += '&f[' + F.id.substr(6) + ']=' + F.value;
		}
		else
		{
			Url += '&f[' + F.id.substr(6) + ']=' + F.value;
		}
	}

	Brands = document.getElementById('FilterBrand');

	if (Brands)
		Url += '&fb=' + Brands.value;

	Price = document.getElementById('FilterPriceValue');
	Url += '&fp=' + Price.value;

	// SF
	SfObj = document.getElementById('FilterSF');
	if (SfObj)
		Url += '&sf=' + SfObj.value;

	// Tri
	Url += '&sort=' + Sort + '&so=' + SortOrder;

	// Page
	Url += '&p=' + Page;
	
	// conserve les checkboxes dŽjˆ cochŽes
	ProdList = document.getElementsByName('comp');
	for(var	i=0; i<ProdList.length; i++)
	{
		if (ProdList[i].checked == true)
		{
			Url += '&prodlist[]=' + ProdList[i].value;
		}
	}

	if (!HttpReq)
	{
		document.location.href = Url;
		return;
	}

	HttpReq.onreadystatechange = function()
	{
		if (HttpReq.readyState == 4 && HttpReq.status == 200)
		{
			if (HttpReq.responseText)
			{
				ProdSpace = document.getElementById('ProdListArea');
				ProdSpace.innerHTML = HttpReq.responseText;
			}
		}
	}

	HttpReq.open('GET', Url, true);
	HttpReq.setRequestHeader('X-Requested-With', 'XmlHttpRequest');
	HttpReq.send(null);
}
