<!--


var NumRegionen;
var Regionen = new Array();

function FillRegionenArray() {
	for ($n = 0; $n < NumRegionen; $n++) {
		Regionen.push(document.suchform.region.options[$n+3].value);
	}
}

function SwitchState(KarteID) {
	var ChkStr = 'document.suchform.Checkbox_' + KarteID + '.checked';
	var checked = eval(ChkStr);
	if (checked) {
		eval('document.suchform.Checkbox_' + KarteID + '.checked = false');
		MM_showHideLayers(KarteID, '', 'hide');
	}
	else {
		eval('document.suchform.Checkbox_' + KarteID + '.checked = true');
		MM_showHideLayers(KarteID, '', 'show');
	}
	CheckMehrfach();
}

function SwitchStateCheckbox(KarteID) {
	var ChkStr = 'document.suchform.Checkbox_' + KarteID + '.checked';
	var checked = eval(ChkStr);
	if (checked) {
		MM_showHideLayers(KarteID, '', 'show');
	}
	else {
		MM_showHideLayers(KarteID, '', 'hide');
	}
	CheckMehrfach();
}

function SwitchAlle() {
	if (document.suchform.alleRegionen.checked) {
		SelectAlle();
		document.suchform.region.selectedIndex = 2;
	}
	else {
		DeselectAlle();
		document.suchform.region.selectedIndex = 0;
	}
}

function SwitchStateRollOver(KarteID) {
	var ChkStr = 'document.suchform.Checkbox_' + KarteID + '.checked';
	var checked = eval(ChkStr);
	if (!checked) {
		MM_showHideLayers(KarteID, '', 'show');
	}
}

function SwitchStateRollOut(KarteID) {
	var ChkStr = 'document.suchform.Checkbox_' + KarteID + '.checked';
	var checked = eval(ChkStr);
	if (!checked) {
		MM_showHideLayers(KarteID, '', 'hide');
	}
}

function CheckAlle() {
	CheckMehrfach();
}

function CheckMehrfach() {
	var $Num = 0;
	var $LastIdx = "";
	for ($n = 0; $n < Regionen.length; $n++) {
		var ChkStr = 'document.suchform.Checkbox_' + Regionen[$n] + '.checked';
		var checked = eval(ChkStr);
		if (checked) {
			$LastIdx = $n;
			$Num++;
		}
	}
	if ($Num == 0) {
		document.suchform.region.selectedIndex = 0;
	}
	if ($Num == 1) {
		document.suchform.region.selectedIndex = $LastIdx + 3;
	}
	if ($Num > 1) {
		document.suchform.region.selectedIndex = 1;
	}
	if ($Num == NumRegionen) {
		document.suchform.region.selectedIndex = 2;
		document.suchform.alleRegionen.checked = true;
	}
	else {
		document.suchform.alleRegionen.checked = false;
	}
}

function selectRegionSingle(RegionID) {
	if (document.suchform.region.selectedIndex == "0") {
		DeselectAlle();
	}
	if (document.suchform.region.selectedIndex == "2") {
		SelectAlle();
	}
	if (document.suchform.region.selectedIndex > 2) {
		DeselectAlle();
		eval('document.suchform.Checkbox_' + RegionID + '.checked = true');
		MM_showHideLayers(RegionID, '', 'show');
	}
}

function DeselectAlle() {
	for ($n = 0; $n < Regionen.length; $n++) {
		var ChkStr = 'document.suchform.Checkbox_' + Regionen[$n] + '.checked';
		var checked = eval(ChkStr);
		if (checked) {
			eval('document.suchform.Checkbox_' + Regionen[$n] + '.checked = false');
			MM_showHideLayers(Regionen[$n], '', 'hide');
		}
	}
}

function SelectAlle() {
	for ($n = 0; $n < Regionen.length; $n++) {
		var ChkStr = 'document.suchform.Checkbox_' + Regionen[$n] + '.checked';
		var checked = eval(ChkStr);
		if (!checked) {
			eval('document.suchform.Checkbox_' + Regionen[$n] + '.checked = true');
			MM_showHideLayers(Regionen[$n], '', 'show');
		}
	}
}

function SwitchKanton(kanton, bereich, sprache) {
	document.suchform.action = "/html/" + sprache + "/" + bereich + "/" + "immobilien_kanton_" + kanton + ".php";
	DeselectAlle();
	document.suchform.submit();
}

function SubmitSuchform(msgTyp, msgBezirk) {
	var NoTyp = true;
	j=document.suchform.art.length;
	for (i=0; i<j; i++){
		if(document.suchform.art[i].checked) NoTyp = false;
	}
	if (NoTyp) {
		alert(msgTyp);
	}
	else {
		if (msgBezirk != '') {
			if (document.suchform.region.selectedIndex > 0) {
				document.suchform.submit();
			}
			else {
				alert(msgBezirk);
			}
		}
		else {
			document.suchform.submit();
		}
	}
}

function GoHome(action) {
	if (action) {
		document.suchform.action = action;	
	}
	else {
		document.suchform.action = "/index.php";
	}
	document.suchform.submit();
}

function SucheAnpassen(url) {
	document.suchform.action = url;
	document.suchform.submit();
}

function GoToPage(page) {
	document.suchform.page.value = page;
	document.suchform.submit();
}

function OrderResult(field, dir) {
	document.suchform.page.value = 0;
	document.suchform.order.value = field;
	document.suchform.sortorder.value = dir;
	document.suchform.submit();
}

function GoToDetail(url) {
	document.Detail.action = url;
	document.Detail.submit();
}

function GoToSuchabo(url) {
	document.suchform.action = url;
	document.suchform.submit();
}

function GoToList(url) {
	document.suchform.action = url;
	document.suchform.submit();
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function HideKontaktformular() {
	MM_showHideLayers('kontaktformular','','hide');
}

//-->
