function Supermarket_Search_ManageAdditionalCharacts(str, id, label, currentRid) {
	if (str == 'none') {
		document.getElementById('whereToSearch').value = 26647;
	} else {
		document.getElementById('whereToSearch').value = currentRid;
	}
	document.getElementById("supermarketSearchFormSubmitButton").value = label;
	for(var i = 0; i <= id; i++) {
		if (document.getElementById('additionalCharacts' + i)) {
			document.getElementById('additionalCharacts' + i).style.display = str;
		}
		if(document.getElementById('filter_' + i)) {
			document.getElementById('filter_' + i).disabled = (str == 'none');
		}
		if(document.getElementById('filter_min_' + i)) {
			document.getElementById('filter_min_' + i).disabled = (str == 'none');
		}
		if(document.getElementById('filter_max_' + i)) {
			document.getElementById('filter_max_' + i).disabled = (str == 'none');
		}
	}
}
function checkArticulsForm() {
	var d = document;
	var f = document.getElementById("supermarketArticulsForm");
	var found = 0;
	for(var i = 0; i < f.elements.length; i++) {
		var e = f.elements[i];
		var e_ = f.elements[i + 1];
		if(e.name == 'articul') {
			if(e.value != '' && parseInt(e_.value) > 0) {
				found = 1;
			} else {
				if(e.value != '' || (e_.value != '' && e_.value != '0')) {
					alert('Неверные данные!');
					found = 0;
					break;
//					e.value = '';
//					e_.value = '';
				}
			}
		}
	}
	if(found == 1) {return true;} else {return false;}
}
function processParam(id) {
	a = document.getElementById("param" + id);
	if(a.className != "buttonPressed") {
		Cookie(id + ":1", 'params', true, 'add');
		a.className = "buttonPressed";
	} else {
		Cookie(id + ":0", 'params', true, 'replace');
		a.className = "buttonNotPressed";
	}
}
function turnOnOffSearchDiv() {
	var div = document.getElementById('searchFormDiv');
	var btn = document.getElementById('searchFormTurnOnOffButton');
	if (div && btn) {
		if (div.getAttribute('status') == 'on') {
			div.setAttribute('status', 'off');
			div.style.display = 'none';
			btn.value = btn.getAttribute('showLabel');
		} else {
			div.setAttribute('status', 'on');
			div.style.display = '';
			btn.value = btn.getAttribute('hideLabel');
		}
	}
}
function Supermarket_Search_SetAvailability(obj) {
	if(obj.checked) {
		setCookie('availability', 1);
	} else {
		setCookie('availability', 0);
	}
	var l = document.location + '';
	if(l.match(/set_cookie/)) {
		l = document.location;
	} else {
		if(l.match(/\?/)) {
			l += '&set_cookie=1';
		} else {
			l += '/?set_cookie=1';
		}
	}
	if(document.location == l) {
		location.reload();
	} else {
		document.location = l;
	}
}

