function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	
	window.location.href = window.location.href; 
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
/*
function add_to_list(chk_name,hdn_id){

	hdn_object = document.getElementById(hdn_id);
	hdn_object.value = "";
	arr_chk = document.getElementsByName(chk_name);
	p=0;
	for (i=0;i<arr_chk.length;i++){
		if (arr_chk[i].checked){
			if (p==0){
			hdn_object.value = arr_chk[i].value;
			}else{
			hdn_object.value = hdn_object.value+";"+arr_chk[i].value;				
			}
			p++;
		}
	}
	
}
*/
var string='';
var string1='';
var string2='';
var string3='';
var string4='';
function selcectsearch(id)
{

if(id=='gia')
{
var a=document.getElementById("gia").value;
document.getElementById("gias").value=a;
}
if(id=='nhom')
{
var b=document.getElementById("nhom").value;
document.getElementById("nhoms").value=b;
}
if(id=='sortby')
{
var d=document.getElementById("sortby").value;
document.getElementById("sortbys").value=d;
}
if(document.getElementById("gias").value!='')
{
string1="&gia="+document.getElementById("gias").value;
}
if(document.getElementById("xuatxus").value!='')
{
string2="&xuatxu="+document.getElementById("xuatxus").value;
}
if(document.getElementById("nhoms").value!='')
{
string3="&nhom="+document.getElementById("nhoms").value;
}
if(document.getElementById("sortbys").value!='')
{
string4="&sortby="+document.getElementById("sortbys").value;
}

string=string1+""+string2+""+string3+""+string4;
document.getElementById("string").value=string;

}


