function switchcheck(opt) {
	chkid=opt.attributes["for"].value;
	newclass=(document.getElementById(chkid).checked)?"label_active":"label_inactive";
	opt.className=newclass;
	countproducts();
}

function countproducts() {
	anzahl=0;
	check=0;
	inputs=document.getElementsByTagName("input");
	for(inp=0;inp<inputs.length;inp++) {
		if(inputs[inp].attributes &&
		   inputs[inp].attributes["type"].value=="checkbox" &&
		   inputs[inp].attributes["name"].value=="kategorie[]" &&
		   inputs[inp].checked) {
			anzahl+=Math.abs(inputs[inp].attributes["alt"].value);
			if(Math.abs(inputs[inp].attributes["alt"].value)>0) check++;
			subs=inputs[inp].attributes["title"].value;
			if(subs!="") {
				subarr=subs.split("|");
				for(var subid in subarr) {
					subel=document.getElementById("box"+subarr[subid]);
					if(!subel.checked) {
						anzahl+=Math.abs(subel.attributes["alt"].value);
						check++;
					}
				}
			}
		}
	}
	errfield=document.getElementById("categoryerror");
	if(check<2) {
		errfield.innerHTML="Bitte wählen Sie weitere Kategorien aus.";
		errfield.className="err-strong";
		return false;
	} else if(anzahl<30) {
		errfield.innerHTML="Bitte wählen Sie weitere Kategorien aus.";
		errfield.className="err-med";
		return false;
	}
	errfield.innerHTML="Diese Anzahl der Kategorien reicht für ein sicheres Captcha.";
	errfield.className="err-no";
	return true;
}