function setCookie(cName, cValue, days){
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + days);
	document.cookie = cName + "=" + escape(cValue) + ((days == null) ? "" : "; expires = " + exdate.toGMTString());
}
function getCookie(cName){
	if (document.cookie.length>0){
		cStart = document.cookie.indexOf(cName + "=");
		if (cStart != -1){
			cStart = cStart + cName.length + 1;
			cEnd = document.cookie.indexOf(";", cStart);
			if (cEnd == -1)
				cEnd = document.cookie.length;
			
			return unescape(document.cookie.substring(cStart, cEnd));
		}
	}
return '';
}

function hideElements(id){
	var imgStatus;
	for (i=1; i<100; i++){
		var rowid = id+'P'+i;
		if (document.getElementById(rowid)){
			var row = document.getElementById(rowid);
			
			if (row.style.display != 'none'){
				row.style.display = 'none';
				imgStatus = 'down';
				setCookie('cat'+id, id, 365);
			}
			else{
				row.style.display = '';
				imgStatus = 'up';
				setCookie('cat'+id, id, -366);
			}
		}
	}
	img = document.getElementById('sh'+id);
	if (imgStatus == 'down')
		img.src = "styles/"+ss+"/images/bouton/hs_cat.gif";
	if (imgStatus == 'up')
	img.src = "styles/"+styleName+"/images/bouton/sh_cat.gif";
}
function autoHideRows(catid, id){
	var cat = getCookie('cat'+catid);
	if (cat != ''){
		if (document.getElementById(id)){
			var row = document.getElementById(id);
			row.style.display = 'none';
		}
	}
}
function hideAll(id){
	var cat = getCookie('cat'+id);
	if (cat != '')
		hideElements(id);
}

