///**** in answer base filter system is static, function name left only for consistency **////
function PopulateNext(id)
{
	var i;
	var list;
	var option;
	
	list = document.getElementById("selectPlatform");
	for(i=0;i<arrPlatforms.length;i++)
	{
		var item = arrPlatforms[i];
		option = document.createElement("OPTION");
		option.value = item.split("#")[0];
		option.text = item.split("#")[1];
		list.options[list.options.length] = option;
	}
	var arr = getQSvalues("selectPlatform");
	if(arr.length != 0)
	{
		for(i=0; i < arr.length;i++)
			for(var k=0; k<list.options.length;k++)
				if(list.options[k].value == arr[i])
					list.options[k].selected = true;
	}
	else
		list.options[0].selected = true;
	
	list = document.getElementById("selectHost");
	for(i=0;i<arrHosts.length;i++)
	{
		var item = arrHosts[i];
		option = document.createElement("OPTION");
		option.value = item.split("#")[0];
		option.text = item.split("#")[1];
		list.options[list.options.length] = option;
	}
	var arr = getQSvalues("selectHost");
	if(arr.length != 0)
	{
		for(i=0; i < arr.length;i++)
			for(var k=0; k<list.options.length;k++)
				if(list.options[k].value == arr[i])
					list.options[k].selected = true;
	}
	else
		list.options[0].selected = true;
	
	list = document.getElementById("selectProd");
	for(i=0;i<arrProducts.length;i++)
	{
		var item = arrProducts[i];
		option = document.createElement("OPTION");
		option.value = item.split("#")[0];
		option.text = item.split("#")[1];
		list.options[list.options.length] = option;
	}
	var arr = getQSvalues("selectProd");
	if(arr.length != 0)
	{
		for(i=0; i < arr.length;i++)
			for(var k=0; k<list.options.length;k++)
				if(list.options[k].value == arr[i])
					list.options[k].selected = true;
	}
	else
		list.options[0].selected = true;
	
	list = document.getElementById("selectInterest");
	for(i=0;i<arrInterests.length;i++)
	{
		var item = arrInterests[i];
		option = document.createElement("OPTION");
		option.value = item.split("#")[0];
		option.text = item.split("#")[1];
		list.options[list.options.length] = option;
	}
	var arr = getQSvalues("selectInterest");
	if(arr.length != 0)
	{
		for(i=0; i < arr.length;i++)
			for(var k=0; k<list.options.length;k++)
				if(list.options[k].value == arr[i])
					list.options[k].selected = true;
	}
	else
		list.options[0].selected = true;
		
	var freeText = getQSvalues("textFreeSearch");
	if(freeText.length != 0)
		document.getElementById("textFreeSearch").value = unescape(freeText[0]);
		
	/*
	if(getQSvalues("hidSubmit").length != 0)
		window.location.href = "#ItemsCount";	
	*/	
	
	var btn = document.getElementById("butSubmit");
	if(btn != null)
		btn.focus();
}

function ValidateFilterForm()
{
	if(document.getElementById("selectPlatform").value == "" && document.getElementById("selectHost").value == ""  && document.getElementById("selectProduct").value == "" && document.getElementById("selectInterest").value == "")
	{
		alert("You must choose at least one filter value");
		return false;
	}
	
	if(document.getElementById("textFreeSearch").value.length == 1)
	{
		alert("Free text must be at least 2 charachters");
		return false;
	}
	
	document.getElementById('hidSubmit').value = 'true'
	return true;
}

function ShowContent(id)
{
	var tr = document.getElementById("trContent" + id);

	if(tr.style.display == 'none')
		tr.style.display = '';
	else
		tr.style.display = 'none';	
}

function RenderLabels()
{
	var qs = new Querystring();
	
	var prodId = qs.get("selectProd");
	var platId = qs.get("selectPlatform");
	var hostId = qs.get("selectHost");	
	var intrsId = qs.get("selectInterest");	
		
	for(var i=0; i < arrProducts.length; i++)
	{
		if(arrProducts[i].split("#")[0] == prodId)
			document.getElementById("tdProd").innerText = arrProducts[i].split("#")[1];		
	}
	
	for(var i=0; i < arrPlatforms.length; i++)
	{
		if(arrPlatforms[i].split("#")[0] == platId)
			document.getElementById("tdPlatform").innerText = arrPlatforms[i].split("#")[1];		
	}
	
	for(var i=0; i < arrHosts.length; i++)
	{
		if(arrHosts[i].split("#")[0] == hostId)
			document.getElementById("tdHost").innerText = arrHosts[i].split("#")[1];		
	}
	
	for(var i=0; i < arrInterests.length; i++)
	{
		if(arrInterests[i].split("#")[0] == intrsId)
			document.getElementById("tdInterest").innerText = arrInterests[i].split("#")[1];		
	}
	
	
}

function focusButton()
{
	var btn = document.getElementById("butSubmit");
	if(btn != null)
		btn.focus();
}