// CHECKBOX AKTIVIEREN/DEAKTIVIEREN
function check_box(id, group, checkedvalue, checktype) {

	boxID		= group + '_' + id + checktype;
	descID		= group + '_' + id + 'desc';

	fieldID		= group + '_' + id;
	group		= group + '_';
	form_name	= document.getElementById(fieldID).form.name;

	if (checktype == "radio") {

			// WERT DES HIDDEN FIELD SETZEN
			document.forms[form_name][fieldID].checked						= true;

	} else if (checktype == "checkbox") {

		// DEAKTIVIEREN WENN AKTIVIERT
		if (document.forms[form_name][fieldID].checked == true) {

			// WERT DES HIDDEN FIELD SETZEN
			document.forms[form_name][fieldID].checked						= false;

		// AKTIVIEREN WENN DEAKTIVIERT
		} else if (document.forms[form_name][fieldID].checked == false) {

			// WERT DES HIDDEN FIELD SETZEN
			document.forms[form_name][fieldID].checked						= true;

		}

	}

	num_of_fields = document.forms[form_name].length;

	for (i = 0; i < num_of_fields; i++) {

		currentFieldID	= document.forms[form_name][i].id;
		currentBoxID	= currentFieldID + checktype;
		currentDescID	= currentFieldID + 'desc';

		//alert("currentFieldID: " + i + " " + currentFieldID + "\r\n" + "currentBoxID: " + i + " " + currentBoxID + "\r\n" + "currentDescID: " + i + " " + currentDescID + "\r\n");

		if (currentFieldID.search(group) != -1) {

			if (document.forms[form_name][i].getAttribute("type", "false") == checktype) {

				if (document.forms[form_name][currentFieldID].checked == false) {

					// CLASS DER CHECKBOX SETZEN
					document.getElementById(currentBoxID).className		= checktype;

					// CLASS DER BESCHREIBUNG SETZEN
					document.getElementById(currentDescID).className	= 'desc';

				// AKTIVIEREN WENN DEAKTIVIERT
				} else if (document.forms[form_name][currentFieldID].checked == true) {

					// CLASS DER CHECKBOX SETZEN
					document.getElementById(currentBoxID).className		= checkedvalue + checktype;

					// CLASS DER BESCHREIBUNG SETZEN
					document.getElementById(currentDescID).className	= checkedvalue + 'desc';

				}

			}

		}

	}

}

function img_popup(img, popupWidth, popupHeight, imgtext) {
	window.open('img.popup.php?img=' + img + '&imgtext=' + imgtext, 'popup_hq', 'width=' + popupWidth + ', height=' + popupHeight + ', toolbar=0, menubar=0, status=0, resizable=0, scrollbars=0, directories=0, location=0');
}

function center_popup () {

	var browser;

	// IE kapiert outerHeight und innerHeight nicht. Deswegen: nachfragen!
	if (window.outerHeight && window.innerHeight) {
		browser = window.outerHeight - window.innerHeight;
	} else {
		browser = 25;
	}

	// Benötigte Gesamthöhe
	var resize_width;
	var resize_height;
	resize_width = document.hq_image.width;
	resize_height = document.body.offsetHeight + browser;

	// Größe ändern
	self.resizeTo(resize_width, resize_height);

	// ------------------------------------------------------------------------

	var ww;
	var wh;

	// IE kapiert outerWidth und outerHeight nicht. Deswegen: nachfragen!
	if (window.outerWidth && window.outerHeight) {
		ww = window.outerWidth;
		wh = window.outerHeight;
	} else {
		ww = document.body.offsetWidth;
		wh = document.body.offsetHeight;
	}

	var x = (screen.availWidth - ww) / 2;
	var y = (screen.availHeight - wh) / 2;
	self.moveTo(x,y);

	self.focus();

}

// EIN-/AUSBLENDEN
function showhide(id) {

	if (document.getElementById(id).style.display == 'none' || !document.getElementById(id).style.display) {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}

}
