function RadioButton(feld,index,maxindex,anzahl) {
	document.form1[feld].value = index;
	for(i=1;i<maxindex;i++) {
		if(index != i){
			document.images[feld+''+i].src = '../../../../fileadmin/Bilder_SPC/Marke_Marge/Markencheck/radiobut.gif';
		} else {
			document.images[feld+''+i].src = '../../../../fileadmin/Bilder_SPC/Marke_Marge/Markencheck/radiobut_checked.gif';
		}
	}
	doGesPunkte(anzahl);
}


function runden(zahl,wert){
	if (typeof(zahl)=="string")
    	if (zahl.indexOf(",")!=-1)
			zahl =  zahl.substring(0,zahl.indexOf(","))+"."+ zahl.substring(zahl.indexOf(",")+1,zahl.length)

			zahl=Math.round(zahl/Math.pow(10,wert))*Math.pow(10,wert);

			zahl=zahl+"";
			if (zahl.indexOf(".")!=-1)
    			if (zahl.length-zahl.indexOf(".")>Math.abs(wert)+1)
    				zahl=zahl.substring(0,zahl.indexOf(".")+Math.abs(wert)+1);

					if (wert<0){
						if (zahl.indexOf(".")==-1) zahl=zahl+".";
						if (zahl.indexOf(".")== 0) zahl="0"+zahl;
    					while (Math.abs(wert)-(zahl.length-zahl.indexOf("."))>-1)
        					zahl=zahl+"0";
   					}
	return zahl;
}


function doGesPunkte(anzahl) {
	var iGesamtPunkte = 0;
	for(i=1;i<=anzahl;i++) {
		iGesamtPunkte = iGesamtPunkte + eval(this.document.form1['r'+i].value);
	}
//	alert("ges: "+iGesamtPunkte);
	this.document.form1['iGespunkte'].value = runden(iGesamtPunkte,-2);
	
	doMittelWert(iGesamtPunkte,anzahl);
}


function doMittelWert(gespunkte,anzahl) {
	var iMittelWert = 0;
	iMittelWert = gespunkte / anzahl;
	this.document.form1['iMittelwert'].value = runden(iMittelWert,-2);
}
