// 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 menu_flip(menuID) {

	subs = new Array;

	subs[0] = 'builder';
	subs[1] = 'realtor';

	for (var i = 0; i <= subs.length - 1; i++) {

		if (menuID == subs[i]) {

			if (document.getElementById(menuID + 'sub').style.display == 'block') {
				document.getElementById(menuID + 'sub').style.display = 'none';
			} else {
				document.getElementById(menuID + 'sub').style.display = 'block';
			}

		} else {

			document.getElementById(subs[i] + 'sub').style.display = 'none';

		}

	}

}

function show_medium(medium) {
	document.getElementById('pic_medium').style.backgroundImage = 'url(md/' + medium + ')';
}

/*
function popup_hq(i, popupWidth, popupHeight) {
	window.open('popup_hq.php?i=' + i, 'popup_hq', 'width=' + popupWidth + ', height=' + popupHeight + ', toolbar=0, menubar=0, status=0, resizable=1, scrollbars=0, directories=0, location=0');
}
*/

function open_hq_popup(imgsrc, imgtxt) {

	// Caption setzen
	document.getElementById('caption').firstChild.nodeValue = imgtxt;

	foto = new Image();
	foto.src = imgsrc;

	// Website ausblenden
	document.getElementById('format').style.display = 'none';
	document.getElementById('hq_container').style.width = '600px';
	document.getElementById('hq_popup').style.display = 'block';

	foto.onload = function () {

		document.getElementById('hq_container').style.width = foto.width + 'px';

		// Bild setzen
		document.images['hq_img'].src = foto.src;

	}

}

function close_hq_popup() {

	// Popup ausblenden
	document.getElementById('hq_popup').style.display = 'none';

	// Website einblenden
	document.getElementById('format').style.display = 'block';

	// Transparentes GIF setzen ...
	document.images['hq_img'].src = 'gfx/tpx.gif';

}

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

	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';
	}

	if (anchorname) {
		window.location.href = '#' + anchorname;
	}

}

