// JavaScript Document
/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!
function checkBrowser(){
        this.ver=navigator.appVersion
        this.dom=document.getElementById?1:0
        this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
        this.ie4=(document.all && !this.dom)?1:0;
        this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
        this.ns4=(document.layers && !this.dom)?1:0;
        this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
        return this
}
bw=new checkBrowser()
//With nested layers for netscape, this function hides the layer if it's visible and visa versa
function showHide(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
        else obj.visibility='visible'
}
//Shows the div
function show(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        obj.visibility='visible'
}
//Hides the div
function hide(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        obj.visibility='hidden'
}

function OpenWin(URL,Name,W,H) {
 open(URL,Name,"width="+W+",height="+H+",resizable=no,dependent=no,scrollbars=no");
}

function OpenScrollWin(URL,Name,W,H) {
 open(URL,Name,"width="+W+",height="+H+",resizable=no,dependent=no,scrollbars=yes");
}

//Blocks the div
function yes(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        obj.display='block'
}
//Hides the div
function no(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        obj.display='none'
}
function HideSearchHint() {
no('hidesearchhinton');yes('showsearchhinton');no('searchhint');
}

function HideAllComplex() {
no('hidecomplex');yes('showcomplex');no('complex');
}

function HideAllFollow() {
no('hidefollow');yes('showfollow');no('follow');
}

//JumpMenu
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function setVisibility(id,block) {
  id=(typeof id=='string'?document.getElementById(id):id);
  if(!id) return;
  if(id.style) id.style.display=block;
  else id.setAttribute('style','display:'+block);
}

function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Bitte STRG+D (Netscape) oder STRG+T (Opera) druecken");
  }
}

// Start parameters.js


function showDetail(a,v){
	obj = document.getElementById(a);
	objPf = document.getElementById(a+'Pfeil');
	if(obj.style.display == "none" && v != 2){
		obj.style.display = "inline";
		objPf.className = "detailZu";
	}
	else{
		if(obj.style.display != "none" && v != 1){
			obj.style.display = "none";
			objPf.className = "detailAuf";
		}
	}
}

function showDetail1(a,v){
	obj = document.getElementById(a);
	objPf = document.getElementById(a+'Pfeil');
	if(obj.style.display == "none" && v != 2){
		obj.style.display = "inline";
		objPf.className = "categoryZu";
	}
	else{
		if(obj.style.display != "none" && v != 1){
			obj.style.display = "none";
			objPf.className = "categoryAuf";
		}
	}
}

function showDetail3(a,v){
	obj = document.getElementById(a);
	objPf = document.getElementById(a+'Pfeil');
	if(obj.style.display == "none" && v != 2){
		obj.style.display = "inline";
		objPf.className = "cityZu";
	}
	else{
		if(obj.style.display != "none" && v != 1){
			obj.style.display = "none";
			objPf.className = "cityAuf";
		}
	}
}


function removeDistrFilter(url) {
	newUrl = url;
	newUrl = getUrlWithRemovedParameter(newUrl, "districtfilter");
	location.href = newUrl;
}


function selectAllEntr(url, para) {
	newUrl = url;
	newUrl = getUrlWithRemovedParameter(newUrl, para);
	location.href = newUrl;
}

function removeZvo_ok(url, origCi) {
	newUrl = url;
	newUrl = getUrlWithRemovedParameter(newUrl, "zvo_ok");
	newUrl = getUrlWithRemovedParameter(newUrl, "ci");
	newUrl = newUrl + "&ci=" + escape(origCi);
	newUrl = newUrl + "&zvo_ok=5";
	location.href = newUrl;        
}


function selectDistr(url, distr) {
	newUrl = url;
	// fuer Ereignislogging
	newUrl = getUrlWithRemovedParameter(newUrl, "context");
	newUrl = getUrlWithRemovedParameter(newUrl, "page");
	newUrl = getUrlWithRemovedParameter(newUrl, "action");
	newUrl = newUrl + "&context=11";
	newUrl = newUrl + "&page=78";
	newUrl = newUrl + "&action=65";
	newUrl = getUrlWithRemovedParameter(newUrl, "districtfilter");
	newUrl = newUrl + "&districtfilter=" + escape(distr);
	location.href = newUrl;
}


function selectCat(url, cat) {
	newUrl = url;
	// fuer Ereignislogging
	newUrl = getUrlWithRemovedParameter(newUrl, "context");
	newUrl = getUrlWithRemovedParameter(newUrl, "page");
	newUrl = getUrlWithRemovedParameter(newUrl, "action");
	newUrl = newUrl + "&context=11";
	newUrl = newUrl + "&page=78";
	newUrl = newUrl + "&action=65";
	newUrl = getUrlWithRemovedParameter(newUrl, "catkeyfilter");
	newUrl = newUrl + "&catkeyfilter=" + escape(cat);
	location.href = newUrl;
}

function SetNewRating(url,elem, posi) {
		url += "&elem="+elem;
		url += "&posi="+posi;
		url += "&form_name=search_setRating";		
		var width = 630;
		var height = 840;
		if (document.forms[0].la) {
			if (document.forms[0].la.value == "en") height = height + 13;
		}
		var windowPars = "width="+width+",height="+height+",resizable=yes,scrollbars=no,dependent=yes";
		if (screen.height < 1024){
			windowPars = "width="+width+",height="+height+",resizable=yes,scrollbars=yes,dependent=yes";
		}
		var wind = window.open(url,"RatingSearch",windowPars);
		wind.opener = self;
}



function setze(index) {
		window.location.href = "#anker"+index;
}


  
  /** Anzeige ALLER Treffer aus der Trefferliste */ 
  /** Setzt die URL fuer die Stadtplanansicht aus der Trefferliste zusammen und verlinkt dorthin */
  function makeAllStadtplanUrl(url, noChoose, noMap, noMapOne, maxNumber) {
 	  var checkboxes = document.getElementsByName("check10");
    var checkboxesSerial = document.getElementsByName("check11");
    var paramSelectedItems = "";
    var flagNotAllowed = false;
    var numberSelItems = 0;
    // wurden Folgeeintraege ausgewaehlt
		for(n = 0; n < checkboxesSerial.length; n++) {
     	if (checkboxesSerial.length == 1) {
            paramSelectedItems += document.getElementsByName("check11")[0].value + ",";	
            numberSelItems++;
      } else {
            numberSelItems++;
            paramSelectedItems += document.getElementsByName("check11")[n].value + ",";
      }
    }

	// wurden Haupteintraege ausgewaehlt	
    for(i = 0; i < checkboxes.length; i++) {
      if (checkboxes.length == 1) {
            paramSelectedItems += "0,";
            numberSelItems++;
      } else {
            paramSelectedItems += i + ",";
            numberSelItems++;
   	  }
    }

    if (paramSelectedItems == '') {
      if (flagNotAllowed) {
				alert(noMap);
      } else {
				alert(noChoose);
      }
    } else {
      if (flagNotAllowed) {
        alert(noMapOne);
      }   

      paramSelectedItems = paramSelectedItems.substring(0, paramSelectedItems.length - 1);      
      url += "&selHits=" + paramSelectedItems;
      window.open(url, 'DasOertliche', 'height=600,width=1000,scrollbars=yes,resizable=yes');
    }
  }  
  
   
  /** Setzt die URL fuer die Stadtplanansicht aus der Trefferliste zusammen und verlinkt dorthin */
  function makeDetailStadtplan(url) {
    window.open(url, 'DasOertlicheDetail', 'height=600,width=1000,scrollbars=yes,resizable=yes');
  }  


  
  
  /** Setzt die URL fuer die Stadtplanansicht aus der Trefferliste zusammen und verlinkt dorthin */
  function stadtplanUrl(url, select) {
    var paramSelectedItems = "&selHits=" + select;
    url += paramSelectedItems;   
		window.open(url, 'DasOertliche', 'height=650,width=850,scrollbars=yes');
  }  


  /** Setzt die URL fuer die Vornamensuche aus X-FnDetected */
  function fnUrl(url, select, formname) {
	pos = url.indexOf("&fn=");
	if (pos != -1){
		url = url.replace(/&fn/, "&fnold");
	}
    var paramSelectedItems = "&fn=" + select;
    url += paramSelectedItems;    
	pos = url.indexOf("&kw=");
	if (pos != -1){
		url = url.replace(/&kw/, "&kwold");
	}

	pos = formname.indexOf("_ext");
	if (pos == -1){
		formname+= "_ext";
		url = url.replace(/form_name/, "frm_n");
		url= url + "&form_name=" + formname;
	}

    location.href = url;
  }  


	// setzt die Werte im Formular und submitted es
	function getvalues(noChoose) {
	// lesen radioButton
    var radioboxes = document.getElementsByName("radb");
    var checkboxes = document.getElementsByName("check1");
	var check = 0;
	var erg = "";
	if (radioboxes.length == 1){
		if( document.search_nat.radb.checked ==  true ) {
			erg = "catkey=" + document.search_nat.radb.value;
			check++;
		}
	}
	else {
		for( i=0; i< radioboxes.length; i++ ) {
			if( document.search_nat.radb[i].checked ==  true ) {
				erg = "catkey=" + document.search_nat.radb[i].value;
				check++;
			}
		}
	}

	var terg = "";
	var fname = "";
	if (checkboxes.length == 1){
		if( document.search_nat.check1.checked ==  true ) {
			fname = "ciField0";
			check++;
			erg = "";
			for (var z = 0; z < document.search_nat.length; ++z) {
				if ( (document.search_nat.elements[z].name == fname)  ) {
					erg = document.search_nat.elements[z].value;
				}
			}
		}
	}
	else {
		for( i=0; i< checkboxes.length; i++ ) {
			if( document.search_nat.check1[i].checked ==  true ) {
				check++;
			}
		}
	}
	if( check  == 0 ) {
		alert(noChoose);
	} 
	else if (checkboxes.length > 1){   
		for( i=0; i< document.search_nat.check1.length; i++ ) {
			if( document.search_nat.check1[i].checked ==  true ) {
				fname = "ciField" + (i);
				terg = "";
				for (var z = 0; z < document.search_nat.length; ++z) {
					if ( (document.search_nat.elements[z].name == fname)  ) {
						terg = document.search_nat.elements[z].value;
					}
				}
				if( terg != "" ) {  
					if (erg == ""){
						erg = terg;
					}
					else {
						erg = erg + " | " + terg;
					}
				}
			}
		} 
	}
return erg;
}


  /** Setzt die URL fuer die Vornamensuche aus X-FnDetected */
  /** ausserdem bei alternativen Suchergebnisen sh_suche_altern_01.jsp */
  function newSearch(urlPara, search, cat, catkey, ci) {
	url = urlPara;
 	pos = search.indexOf("catkey=");
	if (pos != -1){
		catkey = search.substring(7);
		 	pos = catkey.indexOf("catkw=");
			if (pos != -1){
				catkw = catkey.substring(pos+6);
				catkw = escape(catkw);
				catkey = catkey.substring(0,pos) + "catkw=" + catkw;
			}
	}

	if (search == "" && catkey == ""){
		return;
	}
 	pos = url.indexOf("&kw=");
	if (pos != -1){
		url = getUrlWithRemovedParameter(url, "kw")
	}
 	pos = url.indexOf("&ci=");
	if (pos != -1){
		url = getUrlWithRemovedParameter(url, "ci")
	}

	if (catkey != ""){
		pos = url.indexOf("form_name=");
		if (pos != -1){
			url = url.replace(/form_name/, "frmold");
		}
		pos = url.indexOf("&catkey=");
		if (pos != -1){
			url = url.replace(/&catkey/, "&catold");
		}
		url = url + "&form_name=search_cat" + "&catkey=" + catkey;
		if (cat != "") {
			url = url + "&catkw=" + escape(cat);
		}
		
	}
	else {
		url = url + "&kw=" + escape(search);
	}
	url = url + "&ci=" + escape(ci);
    location.href = url;
  }  



/** Selektiert alle Checkboxen in einer Trefferliste */
function selectAll(sender) {
	var checkboxes = document.getElementsByName("check10");
	var checkboxesSerial = document.getElementsByName("check11");
	if (sender.checked) {
		for(i = 0; i < checkboxes.length; i++) {
			document.getElementsByName("check10")[i].checked = true;
			selectPrintParent(document.getElementsByName("check10")[i]);
		}
		for(i = 0; i < checkboxesSerial.length; i++) {
			document.getElementsByName("check11")[i].checked = true;
		}
	} else {
		for(i = 0; i < checkboxes.length; i++) {
			document.getElementsByName("check10")[i].checked = false;
			unselectPrintParent(document.getElementsByName("check10")[i]);
		}
		for(i = 0; i < checkboxesSerial.length; i++) {
			document.getElementsByName("check11")[i].checked = false;
		}
	}
}

/** entfernt die Selektion komplett -> für popup-druck-funktion */
function unselectAll(sender) {
	var checkboxes = document.getElementsByName("check10");
	var checkboxesSerial = document.getElementsByName("check11");
	for(i = 0; i < checkboxes.length; i++) {
		document.getElementsByName("check10")[i].checked = false;
		unselectPrintParent(document.getElementsByName("check10")[i]);
	}
	
	for(i = 0; i < checkboxesSerial.length; i++) {
		document.getElementsByName("check11")[i].checked = false;
	}
}

function printPopEntry(entry) {
	unselectAll(null);	
	document.getElementsByName('check10')[entry].checked=true;
	selectPrintParent(document.getElementsByName('check10')[entry]);
	window.print();
}
 
/** Setzt noprint bei nicht markiertem Treffer, damit dieser nicht gedruckt wird */
function switchPrintParent(element) {
	var parentClassname = element.parentNode.className;	
 	var pos = parentClassname.indexOf(" noprint");
	if (pos != -1){
		parentClassname = parentClassname.substring(0, pos);
	}
	var classNameSwitch = (element.checked == true) ? parentClassname :  parentClassname + " noprint"; 
	element.parentNode.setAttribute((document.all ? "className" : "class"),classNameSwitch);
}

/** setzt noprint bei unselect */
function unselectPrintParent(element) {
	var parentClassname = element.parentNode.className;	
 	var pos = parentClassname.indexOf(" noprint");
	if (pos != -1){
		parentClassname = parentClassname.substring(0, pos);
	}
	element.parentNode.setAttribute((document.all ? "className" : "class"), parentClassname + " noprint");
}

/** setzt item bei selectall */
function selectPrintParent(element) {
	var parentClassname = element.parentNode.className;	
 	var pos = parentClassname.indexOf(" noprint");
	if (pos != -1){
		parentClassname = parentClassname.substring(0, pos);
	}
	element.parentNode.setAttribute((document.all ? "className" : "class"),parentClassname);
}

function confirmPrint(){
    var checkboxes = document.getElementsByName("check10");
    var itemSel = false;
    for (i = 0; i < checkboxes.length; i++) {
        if (checkboxes[i].checked) {
            itemSel = true;
            break;                
        }
    }
    if (itemSel){ 
        window.print();
    } else {
        Check = confirm('Sie haben keinen Eintrag zum Drucken ausgewählt. Möchten Sie alle Einträge ausdrucken?')
        if (Check) {
            document.getElementById("selectall").checked = "checked";
            selectAll(document.getElementById("selectall"));
            window.print();                
        }
    }
}
  /*********************************************
    Drucken Trefferliste - Funktionen
    checkt, welche Treffer gedruckt werden sollen
    ********************************************/
function checkPrintItems(url, form, recFrom, poiBez, radius, noChoose) {
	  var newUrl=url;

	pos = newUrl.indexOf("&action=");
	if (pos != -1){
		newUrl = getUrlWithRemovedParameter(newUrl, "action") 
	}
	pos = newUrl.indexOf("&context=");
	if (pos != -1){
		newUrl = getUrlWithRemovedParameter(newUrl, "context") 
	}
	pos = newUrl.indexOf("&page=");
	if (pos != -1){
		newUrl = getUrlWithRemovedParameter(newUrl, "page") 
	}

	var items = document.getElementsByName('notepadItemsHitList');
    var id;
    var print = "";
    var checkboxes = document.getElementsByName("check10");
    var checkboxesSerial = document.getElementsByName("check11");
    
	// wurden Haupteintraege ausgewaehlt
    for(i = 0; i < checkboxes.length; i++) {
		if (checkboxes.length == 1){
		/* wenn nur 1 Element auf der Seite, dann KEIN array !!! */
			if (document.getElementsByName("check10")[0].checked == true){
				print += " 0|";
			}
		}
		else {
			if (document.getElementsByName("check10")[i].checked == true){
				if (i < 10){
			        print += " " + i + "|";
				}
				else {
			        print += i + "|";
		        }
    		}
   	  }
    }

	// wurden Folgeeintraege ausgewaehlt
	for(n = 0; n < checkboxesSerial.length; n++) {
		/* wenn nur 1 Element auf der Seite, dann KEIN array !!! */
		if (checkboxesSerial.length == 1){
			if(document.getElementsByName("check11")[0].checked == true) {
			var testCheck = document.getElementsByName("check11")[0].value;
			var suche = testCheck.indexOf("_");
			var teil = testCheck.substring(0, suche);
			var addSpace = "";
			if (teil.length == 1){
				addSpace = " ";
			}
			print += addSpace;
			print += document.getElementsByName("check11")[0].value + "|";    
			// ALT: document.search_nat.check11.value + "|";
		
			}
		}
		else {
			if(document.getElementsByName("check11")[n].checked == true) {
			testCheck = document.getElementsByName("check11")[n].value;
			var suche = testCheck.indexOf("_");
			var teil = testCheck.substring(0, suche);
			var addSpace = "";
			if (teil.length == 1){
				addSpace = " ";
			}
			print += addSpace;
			print += document.getElementsByName("check11")[n].value + "|";
			}
		}
    }
	
	if (print == ""){
		if(!confirm(noChoose)) {
		  return;
		}
		for(i = 0; i < checkboxes.length; i++) {
			document.getElementsByName("check10")[i].checked = true;
		}
		for(i = 0; i < checkboxesSerial.length; i++) {
			document.getElementsByName("check11")[i].checked = true;
		}
        checkPrintItems(url, form, recFrom, poiBez, radius);
        return;
	}

	var boxMain = print.split("|");
	boxMain.sort(); 
	print = boxMain.join("|");
	print = print + "|";
    newUrl = newUrl + "&print=" + print + "&form_nam=" + form  + 
    	"&recFrom=" + recFrom +  "&poiBez=" + poiBez + "&radius=" + radius ; 
    window.open(newUrl, 'DasOertliche', 'width=990, scrollbars=yes, resizable=yes');
  }


/*********************************************
Drucken Trefferliste - Funktionen
return String mit Treffer, die gedruckt werden sollen
********************************************/
function returnPrintItems(noChoose) {

var id;
var print = "";
var checkboxes = document.getElementsByName("check10");
var checkboxesSerial = document.getElementsByName("check11");

// wurden Haupteintraege ausgewaehlt
for(i = 0; i < checkboxes.length; i++) {
	if (checkboxes.length == 1){
	/* wenn nur 1 Element auf der Seite, dann KEIN array !!! */
		if (document.getElementsByName("check10")[0].checked == true){
			print += " 0|";
		}
	}
	else {
		if (document.getElementsByName("check10")[i].checked == true){
			if (i < 10){
		        print += " " + i + "|";
			}
			else {
		        print += i + "|";
	        }
		}
	  }
}

// wurden Folgeeintraege ausgewaehlt
for(n = 0; n < checkboxesSerial.length; n++) {
	/* wenn nur 1 Element auf der Seite, dann KEIN array !!! */
	if (checkboxesSerial.length == 1){
		if(document.getElementsByName("check11")[0].checked == true) {
			var testCheck = document.getElementsByName("check11")[0].value;
			var suche = testCheck.indexOf("_");
			var teil = testCheck.substring(0, suche);
			var addSpace = "";
			if (teil.length == 1){
				addSpace = " ";
			}
			print += addSpace;
			print += document.getElementsByName("check11")[0].value + "|";    
		}
	}
	else {
		if(document.getElementsByName("check11")[n].checked == true) {
			testCheck = document.getElementsByName("check11")[n].value;
			var suche = testCheck.indexOf("_");
			var teil = testCheck.substring(0, suche);
			var addSpace = "";
			if (teil.length == 1){
				addSpace = " ";
			}
			print += addSpace;
			print += document.getElementsByName("check11")[n].value + "|";
		}
	}
}

if (print == ""){
	if(!confirm(noChoose)) {
	  return 1;
	}
	
	for(i = 0; i < checkboxes.length; i++) {
		document.getElementsByName("check10")[i].checked = true;
		selectPrintParent(document.getElementsByName("check10")[i]);
	}
	for(i = 0; i < checkboxesSerial.length; i++) {
		document.getElementsByName("check11")[i].checked = true;
		selectPrintParent(document.getElementsByName("check11")[i]);

	}
    return 0;
}

return 0;
}


function addCookie(url, cookie, vari) {
	var newUrl=url;
	var kws = "";
	posV = cookie.indexOf(vari);
	if (posV != -1){
		cookie = cookie.substring(0,posV);
	}
	else {
		location.href = newUrl;
		return; 
	}
	
	cookieArr = cookie.split("|");
	st = cookieArr[0];
	hn = cookieArr[1];
	pc = cookieArr[2];
	ci = cookieArr[3];
	if (url != "") {
		if (st != "") {
			newUrl = newUrl + "&st=" + cookieArr[0];
		}
		if (hn != "") {
			newUrl = newUrl + "&hn=" + cookieArr[1];
		}
		if (pc != "") {
			newUrl = newUrl + "&pc=" + cookieArr[2];
		}
		if (ci != "") {
			newUrl = newUrl + "&ci=" + cookieArr[3];
		}
	}
	
	if (document.forms[0]){
		if (document.forms[0].kw) {
			kws=document.forms[0].kw.value;
			if (kws != "") {
				newUrl = newUrl + "&kw=" + kws
				}
			}	
	}

	location.href = newUrl;
}


// Ueberpruefung, ob Ort geaendert wurde
function checkCity(oldCi, buab, kgs, buc) {
/*	
	var anf = "START Checkcity\n";
	anf+= "oldCi:" + oldCi +  " newCi:" + document.forms[0].ci.value + "  buab:" + buab + " kgs:" + kgs + " buc:" + buc + "\n";
	for (var i = 0; i < document.forms[0].elements.length; i++) {
		anf+= (i+1) + ":" + document.forms[0].elements[i].name + "=" +
		document.forms[0].elements[i].value + "\n";
	}	
*/	
	var newCi = document.forms[0].ci.value;
	
	// keine Ortsliste, falls Ort aus Karte gewaehlt
//	if (document.forms[0].cio) {
//		if (document.forms[0].cio.value == document.forms[0].ci.value) {
//			document.forms[0].zvo_ok.value=1;
//		}
//	}

	
	// keine Ortsliste, falls Ort beibehalten wurde und kgs/buab vorhanden

	if (buab != "" || kgs != "") {
		if (newCi == oldCi ){
			document.forms[0].zvo_ok.value="1";
		}else {
			// funktioniert so nicht beim FireFox, beim IE i.O.
			// document.forms[0].kgs.value="";
			// document.forms[0].buab.value="";
			// document.forms[0].buc.value="";
			// document.forms[0].zbuab.value="";
			// document.forms[0].zvo_ok.value="0";
			// so funktionierts auch beim FireFox
			for (var i = 0; i < document.forms[0].elements.length; i++) {
				if (document.forms[0].elements[i].name == "kgs" ){
					document.forms[0].elements[i].value = "";	
				}
				if (document.forms[0].elements[i].name == "buab" ){
					document.forms[0].elements[i].value = "";	
				}
				if (document.forms[0].elements[i].name == "zbuab" ){
					document.forms[0].elements[i].value = "";	
				}

				if (document.forms[0].elements[i].name == "buc" ){
					document.forms[0].elements[i].value = "";	
				}

				if (document.forms[0].elements[i].name == "zvo_ok" ){
					document.forms[0].elements[i].value = "0";	
				}

			}
		}
	} else if (newCi == "Alle Orte der Region") document.forms[0].buc.value=buc;
}


function addType(url) {
	var newUrl=url;
	// fuer Ereignislogging
	newUrl = getUrlWithRemovedParameter(newUrl, "context");
	newUrl = getUrlWithRemovedParameter(newUrl, "page");
	newUrl = getUrlWithRemovedParameter(newUrl, "action");
	newUrl = newUrl + "&context=11";
	newUrl = newUrl + "&page=78";
	newUrl = newUrl + "&action=64";
	var adressType = "";
	if (document.forms[0]){
		if (document.forms[0].adressType) {
			adressType=document.forms[0].adressType.value;
			pos = newUrl.indexOf("&atfilter=");
			if (pos != -1){
				newUrl = newUrl.replace(/&atfilter/, "&rad");
			}			
			if (adressType != "") {
				newUrl = newUrl + "&atfilter=" + adressType
			}
		}
	}
	location.href = newUrl;
}


function logSort(url) {
	var newUrl=url;
	// fuer Ereignislogging
	newUrl = getUrlWithRemovedParameter(newUrl, "action");
	newUrl = newUrl + "&action=67";
	location.href = newUrl;
}

function addDistrict(url) {
	var newUrl=url;
	// fuer Ereignislogging
	newUrl = getUrlWithRemovedParameter(newUrl, "context");
	newUrl = getUrlWithRemovedParameter(newUrl, "page");
	newUrl = getUrlWithRemovedParameter(newUrl, "action");
	newUrl = newUrl + "&context=11";
	newUrl = newUrl + "&page=78";
	newUrl = newUrl + "&action=65";
	var district = "";
	if (document.forms[0]){
		if (document.forms[0].district) {
			district=document.forms[0].district.value;
			pos = newUrl.indexOf("&districtfilter=");
			if (pos != -1){
				newUrl = newUrl.replace(/&districtfilter/, "&rad");
  			}					
			if (district != "") {
				newUrl = newUrl + "&districtfilter=" + escape(district)
			}
		}
	}
	location.href = newUrl;
}

/** testet einen String auf Ziffern - liefert true, falls nur Ziffern enthalten */
function validateInteger(strValue) {
  var objRegExp  = /(^-?\d\d*$)/;
  return objRegExp.test(strValue);
}


// Link in Ortsliste
function submitOrtsUrl(url,kgs,ort,buab,zbuab,bi,plzSearch,searchPlz) {
	var newUrl = url;
	newUrl = getUrlWithRemovedParameter(newUrl, "zvo_ok");
	var newUrl = newUrl + "&zvo_ok=1";
	if (kgs != "") {
		newUrl = getUrlWithRemovedParameter(newUrl, "kgs");
		newUrl = newUrl + "&kgs=" + kgs
	}
	if (ort != "") {
		newUrl = getUrlWithRemovedParameter(newUrl, "ci");
		newUrl = newUrl + "&ci=" + escape(ort)
	}
	if (buab != "") {
		newUrl = getUrlWithRemovedParameter(newUrl, "buab");
		newUrl = newUrl + "&buab=" + escape(buab)
	}
	if (zbuab != "") {
		newUrl = getUrlWithRemovedParameter(newUrl, "zbuab");
		newUrl = newUrl + "&zbuab=" + escape(zbuab)
	}
	if (bi != "") {
		newUrl = getUrlWithRemovedParameter(newUrl, "bi");
		newUrl = newUrl + "&bi=" + bi
	}
	if (plzSearch == 'true') {
		newUrl = getUrlWithRemovedParameter(newUrl, "pcs");
		newUrl = getUrlWithRemovedParameter(newUrl, "spc");
	    newUrl = newUrl + "&pcs=1&spc=" + searchPlz;	    
	}

//alert(newUrl);
 	window.location.href = newUrl;
}


function HideSearchHint() {
no('hidesearchhinton');yes('showsearchhinton');no('searchhint');
}
function ShowSearchHint() {
no('showsearchhinton');yes('hidesearchhinton');yes('searchhint');
}


function HideSearchCity() {
no('hidesearchcityon');yes('showsearchcityon');no('searchcity');
}
function ShowSearchCity() {
no('showsearchcityon');yes('hidesearchcityon');yes('searchcity');
}


function HideSearchword() {
no('hidesearchwordon');yes('showsearchwordon');no('searchsearchword');
}
function ShowSearchword() {
no('showsearchwordon');yes('hidesearchwordon');yes('searchsearchword');
}


function HideAllComplex() {
no('hidecomplex');yes('showcomplex');no('complex');
}

function HideAllFollow() {
no('hidefollow');yes('showfollow');no('follow');
}



// Datenschutzhinweis Email-Versand
function PrivacyEmail(url) {
OpenScrollWin(url,'EmailPrivacy',710,450)
}

//With nested layers for netscape, this function hides the layer if it's visible and visa versa
function showHide(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
        else obj.visibility='visible'
}
//Shows the div
function show(div,nest){
		obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        obj.visibility='visible'
}


//Hides the div
function hide(div,nest){
        obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0;
        obj.visibility='hidden'
}

// mouseOut-Ereignis fuer Ortsauswahlkarte
function mouseOutOrt(ID) {
	document.getElementById('oe_' + ID).className='';
}

// mouseOver-Ereignis fuer Ortsauswahlkarte
function mouseOverOrt(ID) {
        document.getElementById('oe_' + ID).className='hilite';
}

function clickOrt(ID) {
	// onclick-Ereignis fuer Ortsauswahlkarte (Hauptapplikation + Suchassistent)
	var urlObj = "url" + ID;
	url = window.document.ortsliste[urlObj].value;
	window.location.href = url;
}

		
function getUrlWithRemovedParameter(url, parameterToRemove) {
	tmpParam = "&" + parameterToRemove + "=";
	lastPosBeforeParam = url.indexOf(tmpParam);
	fragezeichen = false;
	if (lastPosBeforeParam == -1) {
		tmpParam = "?" + parameterToRemove + "=";
		lastPosBeforeParam = url.indexOf(tmpParam);
		fragezeichen = true;
	}
	if (lastPosBeforeParam > -1) {
		if (fragezeichen) {
		// Fragezeichen drinne lassen
			lastPosBeforeParam += 1;
		}

            
		newUrl = url.substring(0, lastPosBeforeParam);
		firstPosAfterParam = url.indexOf("&", lastPosBeforeParam + 1);

		if (firstPosAfterParam > -1) {
		// falls Ende der URL erreicht
			newUrl += url.substring(firstPosAfterParam, url.length );
		}
	return newUrl;
	} 
return url;
}

function trim(str){
while(str.substring(0,1)==' ')str=str.substring(1);
while(str.substring(str.length-1)==' ')str=str.substring(0,str.length-1);
return str;
}


// Cookies fuer Ort merken
// geaendert mit CR 3022, nur noch 1 Ort wenn checkbox geklickt
// ohne Cookie ist checkbox aktiv
function setRciCookie(cookieDomain) {
      var histor = new Date();
      var ablauf = new Date();
      var inNeunzigTagen = ablauf.getTime() + (90 * 24 * 60 * 60 * 1000);
      ablauf.setTime(inNeunzigTagen);
         
         if( !document.forms[0].rci.checked ) {
              document.forms[0].rci.value="";             
              setCookie("Orte","",cookieDomain, histor );              
         }

      setCookie("Rci", document.forms[0].rci.checked , cookieDomain, ablauf.toGMTString()); 
}

// start ajax.js

function XMLHTTPObject(){
  var xmlhttp;
 	if (window.ActiveXObject){
  	if (_XML_ActiveX){
  		xmlhttp = new ActiveXObject(_XML_ActiveX);
  	} else {
  		var versions = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP", 
						"Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", 
						"Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0"];

			for (var i = 0; i < versions.length ; i++) {
		    try {
		    	xmlhttp = new ActiveXObject(versions[i]);
		    	if (xmlhttp){
		    		var _XML_ActiveX = versions[i];
		    		break;
		 			}
		    }catch(e){};
		  };
		}
	}
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){
  	try {xmlhttp = new XMLHttpRequest();} catch(e) {xmlhttp = false;}
  }
  return xmlhttp;
}

function doEventLogging(targetUrl, eventId, sessionId, rzId, duration, 
						context, page, action, spage, url, countPrivate, countBusiness,
						countPublic, countPerPage, referer) {	
	var eventID = "";
	var getVars = '&eventId=' + eventId + '&sessionId=' + sessionId + '&rzId=' + rzId + 
					'&duration=' + duration + '&context=' + context + '&page=' + page +
					'&action=' + action + '&spage=' + spage + '&url=' + url + 
					'&countPrivate=' + countPrivate + '&countBusiness=' + countBusiness + 
					'&countPublic=' + countPublic + '&countPerPage=' + countPerPage + '&referer=' + referer;	
	http = XMLHTTPObject();	
	
  try {
   	http.open('GET', targetUrl + getVars , false);
	http.send(null);
    eventID = http.responseText.replace(/<html>/, "").replace(/<\/html>/, "");
  } catch(e){}

  return eventID;
  
}

function doBookLogging(targetUrl, eventId, sectionId) {
	var getVars = '&eventId=' + eventId + '&sectionId=' + sectionId;
	http = XMLHTTPObject();
	try{
    http.open('GET', targetUrl + getVars , true);
	http.send(null);
  } catch(e){}
}

function doSatisfactionLogging(targetUrl, eventId, satisfied) {
	var getVars = '?form_name=logging&log=satisfaction&eventId=' + eventId + '&satisfied=' + satisfied;
	http = XMLHTTPObject();
  try{
  	http.open('GET', targetUrl + getVars , true);
		http.send(null);
  }catch(e){}
}

function doAdPageLogging(targetUrl, eventId, recordId, sectionId, dar, pagePos, layout, kw) {
	var record = recordId;
	if (record.length > 13) {
		record = record.substring(0, 13);
	}
	var getVars = '?form_name=logging&log=adPage&eventId=' + eventId + '&recordId=' + record + '&sectionId=' + sectionId + '&dar='
			 + dar + '&pagePos=' + pagePos + '&layout=' + layout + '&kw=' + kw;			 
	http = XMLHTTPObject();
	try{
    http.open('GET', targetUrl + getVars , true);
	http.send(null);
  } catch(e){}
}

function doSaveMyLocation(targetUrl, getVars, callbackFct) {
	var url = targetUrl + "?" + getVars;
	http = XMLHTTPObject();
	
	http.onreadystatechange = function(){handleStateChange();};
	try {
		http.open('GET', url, false);
		http.send(null);		
	} catch (e){
		alert(e);
	}
	function handleStateChange() {
  	if(http.readyState == 4) {
    	eval(callbackFct);
    }    
  }
}	
	
function getWeatherPerAjax(targetUrl, buc, eventId) {
	var getVars = '&eventId=' + eventId + '&buc=' + buc;
	http = XMLHTTPObject();
	try {
		http.open('GET', targetUrl + getVars , false);
		http.send(null);
	} catch(e){
		return "";
	}  
	return http.responseText;
  
}

function getMoviesPerAjax(targetUrl, buc, ci, pc, cx, cy, eventId) {
	var getVars = '&eventId=' + eventId + '&buc=' + buc  + '&ci=' + ci + '&pc=' + pc + '&cx=' + cx + '&cy=' + cy;
	http = XMLHTTPObject();
	try {
		http.open('GET', targetUrl + getVars , false);
		http.send(null);
	} catch(e){
		return "";
	}
	return http.responseText;
  
}
function getEventsPerAjax(targetUrl, buc, ci, pc, cx, cy, eventId) {
	var getVars = '&eventId=' + eventId + '&buc=' + buc  + '&ci=' + ci + '&pc=' + pc + '&cx=' + cx + '&cy=' + cy;
	http = XMLHTTPObject();
	try {
		http.open('GET', targetUrl + getVars , false);
		http.send(null);
	} catch(e){
		return "";
	}  
	return http.responseText;
  
}

function getJobsPerAjax(targetUrl, buc, ci, pc, cx, cy, eventId) {
	var getVars = '&eventId=' + eventId + '&buc=' + buc  + '&ci=' + ci + '&cx=' + cx + '&cy=' + cy;
	http = XMLHTTPObject();
	try {
		http.open('GET', targetUrl + getVars , false);
		http.send(null);
	} catch(e){
		return "";
	} 
	return http.responseText;
  
}

function getRssPerAjax(targetUrl, buc, eventId) {
	var getVars = '&eventId=' + eventId + '&buc=' + buc;
	http = XMLHTTPObject();
	try {
		http.open('GET', targetUrl + getVars , false);
		http.send(null);
	} catch(e){
		return "";
	} 
	return http.responseText;
  
}
function showB(destination) {
	$v$.sbHandler.select($v$.sbHandler.types.search_transport);
	window.setTimeout(function() {$("#busbahn_zielort").focus();$("#busbahn_zielort").val(destination);$("#busbahn_startort").focus();},500);             
}
function showBusBahn(id, st, pc, ci) {
    //$("#searchbox").html($("#search_BusBahn").val());
    var ziel = st.trim();       
    if (ci != "" || pc != "") {
        if (ziel != "") ziel = ziel + ", ";
        if (pc != "") ziel = ziel + pc + " ";
        ziel = ziel + ci;
    }
    ziel = encodeURIComponent(ziel);
  	$.get('?form_name=sb_loader&c=search_db' , 
			{ zielort: ziel 
			 },
			 function(data) {
				var searchtype = $v$.sbHandler.types.search_transport;
				//alert("global.js searchType.special:" + searchtype.special);
				//alert("global.js searchType.idSuffix:" + searchtype.idSuffix);
				//alert("global.js searchType.fields:" + searchtype.fields);
				// alert("searchtype" + searchtype.idSuffix + " data:" + data);                  
                 $v$.sbHandler.setHTML(searchtype, data, "form_name=search_db");
             });        
}

