if(typeof gFSUGGEST=="undefined"){
    var gFSUGGEST="defined";
    var gFSuggestInstanceCounter=0;
    var gFSuggestInstances=new Array();
    bodySelect=true;
    blockHide=false;
    function FSuggest(a){
        // should suggest be used at all?
        if((typeof(suggestEnabled) == "undefined") || (suggestEnabled != "yes"))
          return;
        if(typeof(mytest) == "undefined")
          mytest="";
        mytest = mytest+gFSuggestInstanceCounter+": "+a.loc+"#";
        gFSuggestInstances[gFSuggestInstanceCounter]=this;
        this.instance=gFSuggestInstanceCounter++;
        this.currentInput="";
        this.timer=null;
        this.clickSel=0;
        this.scrollSel=0;
        this.userInput="";
        this.params=null;
        this.field=null;
        this.selectType=false;
        this.favorites=false;
        this.newJSONRequest=false;
        this.suggestMode=true;
        this.reenableButton;
        this.useTopFavorites=true;
        this.useProfileStops=true;
        this.topMatches = 0;
        this.cookieMatches = 0;
        this.showSuggestionList = false;
        this.useperi = false;
        this.getSuggestFunctionality = function (){
             var value = "";
             if(document.cookie) {
                 this.suggestMode = SLs.getCookieValue(document.cookie,"db4-suggestMode=",";");
                 if(this.suggestMode != "") {
                     if(this.suggestMode == "false") {
                         this.showEnableButton();
                         this.params.useSuggest = false;
                     }

                 }
             }
        };

        this.showEnableButton = function (){
              var field = this.field;
              var parameter = this;
              var instance = this.instance;

              this.reenableButton = document.createElement("input");
                         var decay = 1000 * 60 * 60 * 24 * 365;
                         var now = new Date();
                         var timeout = new Date(now.getTime() + decay);
                         this.reenableButton.className = 'suggestButton';
                         this.reenableButton.title = (typeof t_suggestionson != 'undefined')?t_suggestionson:'Enable Suggestions';

                         this.reenableButton.onclick = function(){
                            this.disabled = true;
                            this.style.display = 'none';
                            parameter.params.useSuggest = true;
                            document.cookie = "db4-suggestMode=" + parameter.params.useSuggest + "; expires=" + timeout.toGMTString() + ";";
                            field.focus();
                            SLs.delete_SLs();
                            for(var j=0;j < gFSuggestInstanceCounter; j++) {
                                 gFSuggestInstances[j].reenableButton.parentNode.removeChild(gFSuggestInstances[j].reenableButton);
                                 gFSuggestInstances[j].field.style.width = (parseInt(gFSuggestInstances[j].field.clientWidth) + 10) + 'px';
                                 gFSuggestInstances[j].params.useSuggest = true;
                                 SLs.inputField = field;
                            }
                            if(!SLs.container){
                                if(field.value != '') {
                                    fieldIndex = instance;
                                    document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(instance))
                                    this.newJSONRequest = true;
                                    SLs.getJS(field.value+"?",instance);
                                }
                            }
                         };
                         this.field.style.width = (parseInt(this.field.clientWidth) - 10) + 'px';
                         this.field.parentNode.insertBefore(this.reenableButton,this.field.nextSibling);
                         SLs.delete_SLs();
         };
         this.toggleSuggestMode = function(){
            var decay = 1000 * 60 * 60 * 24 * 365;
            var now = new Date();
            var timeout = new Date(now.getTime() + decay);
            var field = this.field;
            var parameter = this.params;
            var suggestvalue;
            if(this.params.useSuggest == true) {
                this.params.useSuggest = false;
            }else{
                this.params.useSuggest = true;
            }
            for(var j=0;j < gFSuggestInstanceCounter; j++) {
                gFSuggestInstances[j].showEnableButton();
                gFSuggestInstances[j].params.useSuggest=false;
            }
            document.cookie = "db4-suggestMode=" + parameter.useSuggest + "; expires=" + timeout.toGMTString() + ";";
            this.field.focus();
            this.params.useSuggest = suggestvalue;
        };

        this.changeOnSubmitOfMyFormular=function(){
               var f=this.field;
               while(f!=null){
                   if(f.nodeName=="FORM"){
                       gFSuggestInstances[this.instance].submitFunction=f.onsubmit;
                       f.onsubmit=new Function("ereignis","return gFSuggestInstances["+this.instance+"].cbonsubmit(ereignis);");
                       return
                   }
                   f=f.parentNode}
        };

        this.cbonsubmit=function(){
                 if(SLs.container){
                      if(typeof(hideWaitIcon)=="function"){
                            hideWaitIcon()
                      }
                      SLs.inputField.focus();
                      return false
                  }else{
                      this.resetHafasSuggest();
                      if(typeof(gFSuggestInstances[this.instance].submitFunction)=="function"){
                          gFSuggestInstances[this.instance].submitFunction()
                      }
                      return true}
                  };



                  this.cbonkeyup=function(g){
                      SLs.extendedSearch = false;
                      test=this.field;currentKC=(g)?g.keyCode:window.event.keyCode;
                      if(this.timer){
                          window.clearTimeout(this.timer)
                      }
                     var locType = SLs.getLocType(this.instance);
                     if((typeof(this.params.minCharPerType) != "undefined") && (this.params.minCharPerType[locType]))
                       {
                       var minChar = this.params.minCharPerType[locType];
                       }
                     else
                       var minChar = this.params.minChar;
                      // Wenn Inputfeld Value kleiner als minimale Zeichenanzahl, zeige Cookie und/oder Toptrefferliste
                      if(test.value.length<minChar && test.value.length >= 0 && this.params.useSuggest == true){
                          if(currentKC!=40&&currentKC!=38&&currentKC!=9&&currentKC!=13){
                              SLs.lastSLSlist = null;
                              var f=this.instance;
                              fieldIndex=f;
                              SLs.inputField=this.field;
                              SLs.delete_SLs(false,true);
                              SLs.inputField=this.field;
                              if(!SLs.container){}
                              if((typeof this.params.useTopFavorites == 'undefined') || this.params.useTopFavorites == true) {
                                 SLs.fillWithCookieValues(this)
                              }
                          }else{
                              this.suggestion(currentKC);
                          }
                      }else{
                          if(test.value.length == 0) {
                              SLs.cachedSuggestions = null;
                              if(currentKC!=40&&currentKC!=38&&currentKC!=9&&currentKC!=13&&currentKC!=16)
                                 SLs.delete_SLs(false,true);
                              SLs.stopWaiting();
                          }
                          if(currentKC!=40&&currentKC!=38&&currentKC!=9 && currentKC!=18 && currentKC!=13 && test.value.length != 0){
                              if((SLs.checkUpdate(currentKC)) || (gFSuggestInstances[this.instance].params.useListCache == false)){
                                  if(this.params.useSuggest == true) {
                                      SLs.waiting();
                                    }
                                  this.timer=window.setTimeout("gFSuggestInstances["+this.instance+"].suggestion(test, currentKC)",this.params.stopDelay)
                              }
                              else{
                                  SLs.delete_SLs();
                                  SLs.showSuggestion();
                              }
                           }else{
                              if(currentKC != 9){
                                 this.suggestion(currentKC)
                              }
                          }
                      }
                 };
                 this.cbonfocus=function(g){
                     SLs.delete_SLs();
                     if(document.getElementById('inputFieldHint'+this.field.id))
                        document.getElementById('inputFieldHint'+this.field.id).style.display = 'none';
                     gFSuggestInstances[this.instance].params.requestURL.match(/REQ0JourneyStopsS0A=(\d+)/);
                     SLs.productbits = parseInt(RegExp.$1);
                     SLs.chboxChecked = 2;
                     test=this.field;
                     if(this.timer){
                         window.clearTimeout(this.timer)
                     }
                     var f=this.instance;
                     fieldIndex=f;
                     SLs.inputField=this.field;
                     var locType = SLs.getLocType(this.instance);
                     if((typeof(this.params.minCharPerType) != "undefined") && (this.params.minCharPerType[locType]))
                       {
                       var minChar = this.params.minCharPerType[locType];
                       }
                     else
                       var minChar = this.params.minChar;
                     if(test.value.length < minChar){
                         if((typeof this.params.useTopFavorites == 'undefined') || this.params.useTopFavorites == true) {
                             SLs.fillWithCookieValues(this)
                         }
                     }
                     SLs.stopWaiting();
                 };
                 this.cbonclick=function(f){
                     if(SLs.container){
                         SLs.delete_SLs()
                     }
                     currentField=(f)?f.target:window.event.target;
                     var locType = SLs.getLocType(this.instance);
                     if((typeof(this.params.minCharPerType) != "undefined") && (this.params.minCharPerType[locType]))
                       {
                       var minChar = this.params.minCharPerType[locType];
                       }
                     else
                       var minChar = this.params.minChar;
                     if(currentField.value.length<minChar && this.params.useSuggest == true){
                         if((typeof this.params.useTopFavorites == 'undefined') || this.params.useTopFavorites == true) {
                             SLs.fillWithCookieValues(this)
                         }
                     }
                 };
                 this.suggestion=function(f){
                     var g=this.instance;
                     fieldIndex=g;
                     SLs.inputField=this.field;
                     if((f==40)&&(SLs.container)){
                         if(SLs.container.getElementsByTagName("div")[SLs.countList+1]){
                             if(SLs.countList!=-1){
                                 if(SLs.container.getElementsByTagName("div")[SLs.countList].className != 'infoLabel') {
                                     SLs.container.getElementsByTagName("div")[SLs.countList].className=SLs.container.getElementsByTagName("div")[SLs.countList].className.substr(0,SLs.container.getElementsByTagName("div")[SLs.countList].className.length-8);
                                 }
                             }else{
                                 SLs.container.scrollTop=0
                             }
                             while((typeof SLs.container.getElementsByTagName("div")[SLs.countList+1] != 'undefined') && (SLs.container.getElementsByTagName("div")[SLs.countList+1].className == 'infoLabel')  && (SLs.container.getElementsByTagName("div")[SLs.countList+1].className != 'furtherMatches')) {
                                    SLs.countList++;
                             }
                             SLs.countList++;
                             SLs.container.scrollTop=SLs.currentTop*15;
                             if(SLs.countList>SLs.currentBottom){
                                 SLs.container.scrollTop=SLs.container.scrollTop+15;
                                 SLs.currentBottom++;
                                 SLs.currentTop++
                             }

                             if((typeof SLs.container.getElementsByTagName("div")[SLs.countList]) && (SLs.container.getElementsByTagName("div")[SLs.countList].className != 'infoLabel')){
                                 SLs.container.getElementsByTagName("div")[SLs.countList].className=SLs.container.getElementsByTagName("div")[SLs.countList].className + "selected";
                                 //SLs.container.getElementsByTagName("div")[SLs.countList].style.width=SLs.container.clientWidth+"px"
                             }
                         }
                     }else{
                         if((f==38)&&(SLs.container)){
                             if(SLs.countList>1){
                                 if(SLs.container.getElementsByTagName("div")[SLs.countList].className != 'infoLabel') {
                                     SLs.container.getElementsByTagName("div")[SLs.countList].className=SLs.classSelect(SLs.container.getElementsByTagName("div")[SLs.countList].className,"selected");
                                 }
                                 SLs.countList--;
                                 while((SLs.container.getElementsByTagName("div")[SLs.countList].className == 'infoLabel')&& (SLs.countList > 1)) {
                                    SLs.countList--;
                                 }
                                 if(SLs.countList==-1){
                                     this.setSLSInput(SLs,this.userInput,SLs.countList)
                                 }else{
                                     SLs.container.scrollTop=SLs.currentTop*15;
                                     if(SLs.countList<SLs.currentTop){
                                         SLs.container.scrollTop=SLs.container.scrollTop-15;
                                         SLs.currentTop--;
                                         SLs.currentBottom--
                                     }
                                     if(SLs.container.getElementsByTagName("div")[SLs.countList].className != 'infoLabel'){
                                         SLs.container.getElementsByTagName("div")[SLs.countList].className=SLs.container.getElementsByTagName("div")[SLs.countList].className + "selected";
                                        // SLs.container.getElementsByTagName("div")[SLs.countList].style.width=SLs.container.clientWidth+"px"

                                     }
                                 }
                             }
                         }else{
                             if(f!=9&&f!=16&&f!=13){
                                 this.userInput=this.field.value;
                                 if(SLs.container){
                                     SLs.delete_SLs(false);
                                     SLs.countList=-1
                                 }
                                 var locType = SLs.getLocType(this.instance);
                                 if((typeof(this.params.minCharPerType) != "undefined") && (this.params.minCharPerType[locType]))
                                   {
                                   var minChar = this.params.minCharPerType[locType];
                                   }
                                 else
                                   var minChar = this.params.minChar;
                                 if((this.field.value.length >= minChar)&&(this.params.useSuggest)){
                                     var suggestContainer = document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(fieldIndex));
                                     if(this.params.requestType=="ajax"){
                                         SLs.holen(this.field.value+"?",fieldIndex)
                                     }else{
                                         this.newJSONRequest = true;
                                         SLs.getJS(this.field.value+"?",fieldIndex)
                                     }
                                 }else{
                                     SLs.fillWithCookieValues(this);
                                 }
                             }else{
                                 if(f==13){
                                      // ersten Eintrag nehmen,wenn nichts ausgewählt ist!
                                      if(SLs.countList == -1) {
                                          SLs.countList = 0;
                                          while(SLs.container.getElementsByTagName("div")[SLs.countList].className == 'infoLabel') {
                                                 SLs.countList++;
                                          }
                                      }
                                      if(SLs.container){
                                         if((SLs.countList == -1) && (this.waitingActive == false)) {
                                             SLs.countList = 0;
                                             while(SLs.container.getElementsByTagName("div")[SLs.countList].className == 'infoLabel') {
                                                 SLs.countList++;
                                             }
                                         }
                                         if(SLs.countList > -1) {
                                             if((SLs.countList>-1) && (SLs.container.getElementsByTagName("div")[SLs.countList].className.indexOf('furtherMatches') == -1) && (SLs.container.getElementsByTagName("div")[SLs.countList].className != 'infoLabel')){
                                                 var content = SLs.clearHTMLTags(SLs.container.getElementsByTagName("div")[SLs.countList].lastChild.innerHTML);
                                                 this.setSLSInput(SLs,content,SLs.container.getElementsByTagName("div")[SLs.countList].id)
                                             }else{
                                                 if(this.field.value.length > 0 && SLs.container.getElementsByTagName("div")[SLs.countList].className == 'furtherMatchesselected') {
                                                     window.setTimeout(function(){SLs.showAllSuggestions();},100);
                                                 }else{
                                                   var content = SLs.clearHTMLTags(SLs.container.getElementsByTagName("div")[SLs.countList].lastChild.innerHTML);
                                                   if(typeof content != 'undefined') {
                                                      this.setSLSInput(SLs,content,0);
                                                   }
                                                 }
                                             }
                                         }
                                         SLs.delete_SLs();
                                    }
                                 }
                             }
                         }
                     }
                 };
                 this.leaveInputField=function(evt){
                     if(document.getElementById('inputFieldHint'+this.field.id) && (this.field.value.length == 0))
                        document.getElementById('inputFieldHint'+this.field.id).style.display = 'block';

                     // auskommentiert von ngr am 21.06.2010
                     //$('HFSFooter').innerHTML += 'LEAVE<br/>';
                     if(SLs.container){
                         if(this.scrollSel&&this.scrollSel==1&&!this.clickSel){
                                 SLs.inputField.focus();
                                 this.scrollSel=0;
                         }else{
                             if(this.clickSel==1){
                                 SLs.inputField.focus();
                                 this.clickSel=0;
                             }else{
                                 if(SLs.countList>-1){
                                 }else{
                                     window.setTimeout(function(){
                                         SLs.delete_SLs();
                                     },200);
                                 }
                             }
                         }
                     }
                 };
                 this.resetHafasSuggest=function(){};
                 this.setInputFieldValue=function(g,f){
                        if(typeof g.inputField!="undefined"){
                                g.inputField.value=f
                        }
                 };

                 this.setSLSInput=function(j,g,h,adrRes){
                        if(((typeof adrRes == 'undefined') || (adrRes!=false)) && (typeof j.sls.suggestions[h] != 'undefined') && (j.sls.suggestions[h].type == "2") && (typeof j.sls.suggestions[h].state == 'undefined')){
                            if(gFSuggestInstances[fieldIndex].params.useHouseNumber) {
                                SLs.resolveAddress(j.sls.suggestions[h].value,this.instance,j.sls.suggestions[h].type,h);
                                return;
                            }
                        }

                        this.setInputFieldValue(j,g);
                        var f="";
                        var k="";
                        if(typeof j.sls.suggestions[h]!="undefined"){
                               if(typeof j.sls.suggestions[h].id!="undefined"){
                                    this.setTripleId(j.sls.suggestions[h].id);
                                    j.sls.suggestions[h].id.match(/L=(\d+)/);
                                    k=RegExp.$1
                               }
                               if(typeof j.sls.suggestions[h].type!="undefined"){
                                    this.setLocationType(j.sls.suggestions[h].type);
                                    f=j.sls.suggestions[h].type
                               }
                               if(typeof this.params.selectCallback!="undefined"){
                                    j.sls.suggestions[h].evaId=k;
                                    this.params.selectCallback(j.sls.suggestions[h]);
                               }
                         }else if(typeof SLs.combinedMatches[h]!='undefined'){
                                   /* j.topCities.suggestions[h].id.match(/L=(\d+)/);
                                    k=RegExp.$1 */
                                    this.setTripleId(SLs.combinedMatches[h].id);
                                   if(typeof SLs.combinedMatches[h].type!="undefined"){
                                    this.setLocationType(SLs.combinedMatches[h].type);
                                    f=SLs.combinedMatches[h].type
                               }
                               if(typeof this.params.selectCallback!="undefined"){
                                    this.params.selectCallback(SLs.combinedMatches[h]);
                              }
                         }
                         SLs.inputField.focus();
                         SLs.delete_SLs();
                 };


                 this.setTripleId=function(h){
                        if(typeof this.params.type!="undefined"){
                               if(document.getElementById(this.field.id+'ID') != null) {
                                  var g = document.getElementById(this.field.id+'ID');
                                  if(g.form != this.field.form)
                                    g = null;
                               }
                               if(this.field.name.charAt(this.field.name.length-1)=="G"){
                                 var f=this.field.name.replace(/G$/,"ID")
                               }else{
                                   var f="REQ0JourneyStops"+this.params.type+"ID"
                               }
                               if(g == null) {
                                   var g=null;
                                   if(this.field.form.elements[f]){
                                         g=this.field.form.elements[f];
                                   }
                                   if(g==null||typeof g=="undefined"){
                                         g=document.createElement("input");
                                         g.type="hidden";
                                         g.name=f;
                                         this.field.parentNode.insertBefore(g,this.field.nextSibling)
                                   }
                               }
                               g.value=h
                        }
                 };
                 this.setLocationType=function(g){
                        if((typeof this.params.type!="undefined")&&(this.field.form!=null)&&((this.field.name.match(/G$/)!=null)||(this.field.name=="S")||(this.field.name=="Z"))){
                                 if(this.field.name=="S"){
                                         f="REQ0JourneyStopsS0A"
                                 }else{
                                        if(this.field.name=="Z"){
                                              f="REQ0JourneyStopsZ0A"
                                        }else{
                                              var f=this.field.name.replace(/G$/,"A")
                                        }
                                 }
                                 //var h=document.getElementsByName(f)[0];
                                 var h=this.field.form.elements[f];
                                 if((h) && (typeof(h.nodeName) == "undefined"))
                                   h = h[0];
                                 if((h!=null)&&((h.nodeName=="SELECT")||((h.type.toLowerCase()!="radio") && (h.value!=7)&&(h.value!=255)))){
                                        h.value=g
                                 }else{
                                        if(h!=null){
                                                var i=document.getElementById("ignoreTypeCheck");
                                                if((i==null)||(typeof(i)=="undefined") || (i.form != this.field.form)){
                                                         i=document.createElement("input");
                                                         i.type="hidden";
                                                         i.name="ignoreTypeCheck";
                                                         i.id="ignoreTypeCheck";
                                                         i.value="yes";
                                                         this.field.parentNode.insertBefore(i,this.field)
                                                }
                                        }else{
                                                var i=document.createElement("input");
                                                i.type="hidden";
                                                i.name=f;
                                                i.value=g;
                                                i.className = "generated";
                                                this.field.parentNode.insertBefore(i,this.field)
                                        }
                                  }
                              }
                    };
                    if(this.instance==0){
                       document.body.onmousedown=function(){
                           if(document.getElementById("suggestion")&&bodySelect){
                                 SLs.delete_SLs();
                           }
                           bodySelect=true
                       }
                    }
                    this.params={
                             useListCache:false,                     // bisherige Suchergebnisse cachen
                             useTypeFilter:a.useTypeFilter,          // Kategoriefilter einblenden
                             useTopFavorites:a.useTopFavorites,      // Topfavoriten nutzen
                             loc:a.loc,                              // Input Field ID
                             type:a.type,                            // Start oder Ziel (S/Z)
                             minChar:a.minChar,                      // minimale Anzahl bevor Request durch
                             minCharPerType:a.minCharPerType,        // minimale Anzahl pro location type
                             requestURL:a.requestURL,                // Anfrage URL, gewöhnlich ajax-getstop.exe
                             detachable:a.detachable,                // Suggest ein bzw. abschaltbar
                             //useMapLimiter:a.useMapLimiter,        // Karte (geht nur wenn externe Karte definiert)
                             cookiename:a.cookiename,                // Name für die Cookie speicherung
                             map:a.map,                              // Verweis auf externe Map
                             charset:a.charset,                      // Charset
                             stopDelay:a.stopDelay,                  // Verzögerung vor nächster Anfrage
                             requestType:a.requestType,              // Ajax oder JS Request
                             delfiSwitchId:a.delfiSwitchId,          // Id of Delfi Checkbox                              //
                             useCategory:a.useCategory,              // Ergebnisse nach Kategorien sortieren
                             useSuggest:a.useSuggest,                // ??
                             useMaps:a.useMaps,                      // Display map button?
                             useFurtherMatches: a.useFurtherMatches, // Link weitere Treffer einblenden!
                             useProducts:a.useProducts,              // Produktübersicht neben Haltestellen
                             useWeight:a.useWeight,                  // Fahrten pro Jahr (Verkehrsgewichtung)
               useRidesPerYear:a.useWeight,
                             useWrap:a.useWrap,                      // Umbruch bei zu langen Namen
                             useTopFavorites:a.useTopFavorites,      // Display top favorites?
                             useHouseNumber:a.useHouseNumber,        // Hausnummer hervorheben und auflösen
                             useHighlighting:a.useHighlighting,      // Highlighting
                             minMatch:1,                             // ??
                             selectCallback:a.selectCallback,        // Callback Funktion bei Auswahl
                             onProductButton:a.onProductButton,      // ??
                             onMapButton:a.onMapButton,              // ??
                             width:a.width,                          // explizit eine Breite für den Suggest Container vorgeben
                             onShow:a.onShow,                        // Callback Funktion beim Zeigen der Liste
                             minimizeList:true                       // ??
                    };
                    a.requestURL.match(/REQ0JourneyStopsS0A=(\d+)/);
                    if(((RegExp.$1)>=7) && (a.useTypeFilter)){
                      this.params.useTypeFilter = true;
                    }else{
                      this.params.useTypeFilter = false;
                    }
                    a.requestURL.match(/REQ0JourneyStopsB=(\d+)/);

                    this.params.amount = RegExp.$1;
                    if(typeof(this.params.requestType)=="undefined"){
                             this.params.requestType="js"
                    }
                    if(typeof(this.params.useSuggest)=="undefined"){
                             this.params.useSuggest=true
                    }

                    if(typeof this.params.loc!="undefined"&&typeof document.getElementById(this.params.loc)!="undefined"){
                             this.field=document.getElementById(this.params.loc);
                             var b=true;
                             for(var c=0;c<this.instance;c++){
                                   if(gFSuggestInstances[c].field.form==this.field.form){
                                               b=false
                                   }
                             }
                             if(b){
                                   this.changeOnSubmitOfMyFormular()
                             }

                             this.field.setAttribute("autocomplete","off");
                                   this.field.onfocus=function(){
                                   currentInput=this.value
                             };
                             this.field.onkeyup=new Function("ereignis","gFSuggestInstances["+this.instance+"].cbonkeyup(ereignis);");
                             this.field.onfocus=new Function("ereignis","gFSuggestInstances["+this.instance+"].cbonfocus(ereignis);");
                             this.field.onblur=new Function("ereignis","window.clearTimeout(gFSuggestInstances["+this.instance+"].timer);gFSuggestInstances["+this.instance+"].leaveInputField(ereignis);");
                             if(this.params.setFocus=="yes"&&(this.instance==0)){
                                     var d=this.field;
                                     var e=true;
                                     while(d){
                                         if((d.tagName=="BODY")||(d.tagName=="HTML")){
                                                 break
                                         }
                                         if((d.style.display=="none")||(d.style.visibility=="hidden")){
                                                 e=false;
                                                 break
                                         }
                                         d=d.parentNode
                                     }
                                     if(e){
                                         this.field.focus()
                                     }
                             }
                         }
                         this.getSuggestFunctionality();
     }
}



var SLs={
    productbits:255,chboxChecked:3,waitingActive:false,container:null,currLocation:null,ajax:false,div_breite:"auto",div_hoehe:170,countList:-1,currentTop:0,currentBottom:9,inputField:null,pos_x:0,pos_y:0,sls:null,lastSLSlist:null,topCities:null,minimap:null,cachedSuggestions:null,extendedSearch:false,erzeugen:function(a){
      if(typeof gSuggest_for_company == 'undefined') {
        this.topCities =  { "suggestions": [
          {"value":"Luxembourg, Gare Centrale","id":"A=1@O=Luxembourg, Gare Centrale@X=6133259@Y=49600652@U=82@L=009217081@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6133259","ycoord":"49600652","state":"id","prodClass":"","weight":""},
          {"value":"Centre, Hamilius","id":"A=1@O=Centre, Hamilius@X=6126274@Y=49611214@U=82@L=000000001@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6126274","ycoord":"49611214","state":"id","prodClass":"","weight":""},
          {"value":"Ettelbruck, Gare","id":"A=1@O=Ettelbruck, Gare@X=6106183@Y=49847729@U=82@L=009258199@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6106183","ycoord":"49847729","state":"id","prodClass":"","weight":""},
          {"value":"Bour","id":"A=1@O=Bour@X=6018053@Y=49700998@U=82@L=009412001@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6018053","ycoord":"49700998","state":"id","prodClass":"","weight":""},
          {"value":"Centre, Fondation Pescatore","id":"A=1@O=Centre, Fondation Pescatore@X=6126427@Y=49616257@U=82@L=009227002@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6126427","ycoord":"49616257","state":"id","prodClass":"","weight":""},
          {"value":"Esch/Alzette, Gare","id":"A=1@O=Esch/Alzette, Gare@X=5983984@Y=49493365@U=82@L=009170001@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6109941","ycoord":"49493365","state":"id","prodClass":"","weight":""},
          {"value":"Mersch, Gare","id":"A=1@O=Mersch, Gare@X=6109941@Y=49752776@U=82@L=009864348@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6109941","ycoord":"49752776","state":"id","prodClass":"","weight":""},
          {"value":"Diekirch, Gare","id":"A=1@O=Diekirch, Gare@X=6152415@Y=49864287@U=82@L=009233001@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6152415","ycoord":"49864287","state":"id","prodClass":"","weight":""},
          {"value":"Echternach, Gare","id":"A=1@O=Echternach, Gare@X=6416320@Y=49815943@U=82@L=009440001@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6416320","ycoord":"49815943","state":"id","prodClass":"","weight":""},
          {"value":"Luxembourg/Centre, Royal","id":"A=1@O=Luxembourg/Centre, Royal@X=6125833@Y=49612284@U=82@L=009863037@B=1@V=82.9,@p=1314194668@","type":"1","typeStr":"[Bhf/Hst]","xcoord":"6125833","ycoord":"49612284","state":"id","prodClass":"","weight":""}
          ]};
        }
        gFSuggestInstances[fieldIndex].params.requestURL.match(/REQ0JourneyStopsS0A=(\d+)/);


        if(document.getElementById('suggestion') == null)
          {
            SLs.container = document.createElement("div");
            SLs.container.id="suggestion";
            SLs.container.setAttribute('style', 'border:none !important');
          }
        else
          {
            SLs.container = document.getElementById('suggestion');
            SLs.container.setAttribute('style', 'border:none !important');
          }
          if(navigator.userAgent.toLowerCase().indexOf("opera")>-1){
              SLs.container.style.minWidth="148px"
          }
          if(typeof gFSuggestInstances[fieldIndex].params.width != 'undefined') {
              SLs.container.style.width = gFSuggestInstances[fieldIndex].params.width;
          }else{
              if(typeof SLs.inputField.style.width != 'undefined') {
                  if(SLs.inputField.style.width.indexOf("%")) {
                     //SLs.container.style.width = SLs.inputField.clientWidth + 'px !important';
                     SLs.container.setAttribute('style', 'width:' + SLs.inputField.clientWidth + 'px !important');
                  }else{
                     SLs.container.style.width = SLs.inputField.style.width;
                  }
              }else{
                  SLs.container.style.width="310px !important";
              }
          }

        SLs.container.style.height="auto";
        SLs.pos_x=SLs.getPosX(SLs.inputField)+0;
        SLs.pos_y=SLs.getPosY(SLs.inputField)+16;
        SLs.container.style.left=SLs.pos_x+"px";
        SLs.container.style.top=SLs.pos_y+"px";



        // auskommentiert von ngr am 21.06.2010 -> "TEST" Ausgabe entfernt
        //SLs.container.onmousedown=new Function("ereignis","$('HFSFooter').innerHTML += 'TEST';bodySelect=false;if((navigator.userAgent.toLowerCase().indexOf('msie')>-1)||(navigator.userAgent.toLowerCase().indexOf('safari')>-1))gFSuggestInstances[fieldIndex].scrollSel=1;");
        SLs.container.onmousedown=new Function("ereignis","bodySelect=false;if((navigator.userAgent.toLowerCase().indexOf('msie')>-1)||(navigator.userAgent.toLowerCase().indexOf('safari')>-1))gFSuggestInstances[fieldIndex].scrollSel=1;");
        return SLs.container
    },speichern:function(userInput, liste){

          if(this.cachedSuggestions == null) {
              this.cachedSuggestions = new Array();
              this.cachedSuggestions[userInput] = liste;
          }else{
              if(this.cachedSuggestions[userInput] == null) {
                 this.cachedSuggestions[userInput] = liste;
                 return true;
              }else{
                  return false;
              }
          }
    },waiting:function(){
        SLs.waitingActive = true;
        if(typeof document.getElementById('waiting') == 'undefined' || document.getElementById('waiting') == null) {
            var waitingscreen = document.body.appendChild(document.createElement("div"));
            SLs.pos_x=SLs.getPosX(SLs.inputField)+1;
            SLs.pos_y=SLs.getPosY(SLs.inputField)+20;
            waitingscreen.style.left=SLs.pos_x + 70 + "px";
            waitingscreen.style.top=SLs.pos_y+ 3 +"px";
            waitingscreen.innerHTML = '|';
            waitingscreen.style.backgroundImage = 'url("' + gImagePath + 'wait_ani.gif")';
            waitingscreen.className = "infoLabel";
            waitingscreen.style.zIndex = '999999999';
            waitingscreen.id = 'waiting';
        }else{
           document.getElementById('waiting').style.display = 'block';
           SLs.pos_x=SLs.getPosX(SLs.inputField)+70;
           SLs.pos_y=SLs.getPosY(SLs.inputField)+13;
           document.getElementById('waiting').style.left=SLs.pos_x -3 + "px";
           document.getElementById('waiting').style.top=SLs.pos_y + 7 + "px";
        }
    },stopWaiting: function(){
         SLs.waitingActive = false;
         if(document.getElementById('waiting')!=null) {
            document.getElementById('waiting').style.display = 'none';
         }
    },laden:function(input){
         if(this.cachedSuggestions != null) {
             return this.cachedSuggestions[input];
         }

    },holen:function(input,fieldIndex){
         try{
             SLs.ajax=new XMLHttpRequest()
         }catch(w3c){
             try{
                 SLs.ajax=new ActiveXObject("Msxml2.XMLHTTP")
             }catch(msie){
                 try{SLs.ajax=new ActiveXObject("Microsoft.XMLHTTP")
             }catch(msie_alt){
                 SLs.delete_SLs();
                 for(var i=0;i<gFSuggestInstances.length;i++){
                     var f=document.getElementById(gFSuggestInstances[i].params.loc);
                     if(f){
                         f.onfocus=null;
                         f.onkeyup=null;
                         f.onblur=null;
                         f.onclick=null
                     }
                 }
                 return false
             }
             }
        }
        var tempURL=gFSuggestInstances[fieldIndex].params.requestURL+input+"&";
        var typeSelectName=gFSuggestInstances[fieldIndex].field.name.replace(/G$/,"A");
        var typeSelectbox=document.getElementsByName(typeSelectName)[0];
        if((typeSelectbox!=null)&&(typeSelectbox.nodeName=="SELECT")){
            var replaceTypeRegExp=/REQ0JourneyStopsS0A=(\d+)&/;
            tempURL=tempURL.replace(replaceTypeRegExp,"REQ0JourneyStopsS0A="+typeSelectbox.value+"&");
            gFSuggestInstances[fieldIndex].selectType=true
        }
        if(gFSuggestInstances[fieldIndex].params.locType&&document.getElementById(gFSuggestInstances[fieldIndex].params.locType+"_hidden")){
            var currentLocType=document.getElementById(gFSuggestInstances[fieldIndex].params.locType+"_hidden").value;
            tempURL=tempURL+gFSuggestInstances[fieldIndex].params.requestURL2+currentLocType+"&"}SLs.ajax.open("GET",tempURL,true);
            SLs.ajax.setRequestHeader("Content-Type","text/xml");
            SLs.ajax.setRequestHeader("If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT");
            SLs.ajax.send(null);
            SLs.ajax.onreadystatechange=function(){
                if(SLs.ajax.readyState==4){
                    if(SLs.ajax.status!=200){
                        SLs.delete_SLs();return false
                    }
                    if(SLs.ajax.responseText){
                        eval(SLs.ajax.responseText);
                        return SLs.showSuggestion()
                    }
                    var nicht_gefunden=document.createTextNode("No suggestions for your input '"+input+"'.");
                    SLs.container.appendChild(nicht_gefunden);return false
                }
            }
         },getBoldCharacters:function(word,suggestion,j){
                 if((typeof this.highlightType != 'undefined') && (this.highlightType == 'bold')) {
                     var wildcard = "u";
                 }else{
                     var wildcard = "b";
                 }
                 j++;
                 var matches = 0;
                 word = this.removeSpecialChars(word);
                 a = new RegExp(word+"(?!(^)*<\/"+wildcard+">)",'g');

                 //a = new RegExp(">([^<]*)?("+word+")([^>]*)?<","g");
                 if((word.toLowerCase() != wildcard.toLowerCase()) && (word!="") && (word != "<"+wildcard+">") && (word.indexOf("/") == -1) && (word.indexOf("<") == -1) && (word.indexOf(">") == -1)) {

                 var found = suggestion.search(a,word);
                 suggestion = suggestion.replace(a,"<"+wildcard+">"+word+"</"+wildcard+">");
                 if(found != -1) { matches++; }
                 suggestion = suggestion.replace(a,"<"+wildcard+">"+word+"</"+wildcard+">");
                 a=new RegExp(word.toUpperCase());
                 found = suggestion.search(a,word.toUpperCase());
                 if(found != -1) { matches++; }
                 suggestion = suggestion.replace(a,"<"+wildcard+">"+word.toUpperCase().bold()+"</"+wildcard+">");
                 var uppercaseFirst = this.upperCaseFirst(word);
                 a=new RegExp(uppercaseFirst+"(?!(^)*<\/"+wildcard+">)",'g');
                 found = suggestion.search(a,uppercaseFirst);
                 if(found != -1) { matches++; }
                 suggestion = suggestion.replace(a,"<"+wildcard+">"+uppercaseFirst+"</"+wildcard+">");
                    if(matches == 0) {
                         if(j < word.length - 1) {
                                 suggestion = this.getBoldCharacters(word.substr(0,word.length-j),suggestion,j);
                                 suggestion = this.getBoldCharacters(word.substr(j,word.length-j),suggestion,j);
                         }
                    }
                 }
                 return suggestion;
         },removeSpecialChars:function(word){
               // reservierte RegExp lÃ¶schen ?{}.
               word = word.replace(/\./g, ""); // .
               word = word.replace(/,/g, "");  // ,
               word = word.replace(/\$/g,"");  // $
               word = word.replace(/\?/g,""); // ?
               word = word.replace(/[\)]/g,"");  // )
               word = word.replace(/[\(]/g,"");  // (
               word = word.replace(/[\+]/g,"");  // +
               word = word.replace(/[\*]/g,"");  // *
               word = word.replace(/[\[]/g,"");  // [
               word = word.replace(/[\]]/g,"");  // ]
               word = word.replace(/\\/g, "");  // \
               word = word.replace(/\|/g, "");  // |
               word = word.replace(/\^/g, ""); // ^
               return word;
         },upperCaseFirst:function(str){
              var f = str.charAt(0).toUpperCase();
              for(var j=1; j < str.length;j++) {
                 f += str.charAt(j).toLowerCase();
              }
              return f;
         },addMenu:function(){
             // HauptmenÃ¼leiste
             if(gFSuggestInstances[fieldIndex].params.detachable) {
                 var labelSuggestions = document.createElement("div");
                 labelSuggestions.style.textAlign = 'right';

                 var closeButton = document.createElement("a");
                 closeButton.className = 'closeButton';
                 labelSuggestions.id = 'suggestionMenu';
                 closeButton.innerHTML = (typeof t_suggestionsoff != 'undefined')?t_suggestionsoff:'Disable Suggestions';
                 closeButton.onmouseup = function(){
                     gFSuggestInstances[fieldIndex].toggleSuggestMode();
                 }
                 labelSuggestions.appendChild(closeButton);
                 labelSuggestions.className = 'infoLabel';



             if(typeof Map != 'undefined') {
                 var labelMapArea = document.createElement("div");
                 labelMapArea.className = 'infoLabel';
                 if(gFSuggestInstances[fieldIndex].params.useMapLimiter != false) {
                    var labelPeri = document.createElement("label");
                    labelPeri.innerHTML = (typeof t_limitSearchMap != 'undefined')?t_limitSearchMap:'Limit search to map content';
                    labelMapArea.appendChild(labelPeri);
                    labelMapArea.style.textAlign = 'right';
                    this.pericheckbox = document.createElement("input");
                    this.pericheckbox.type = 'checkbox';
                    this.pericheckbox.name = 'REQ0JourneyStopsF0A';
                    this.pericheckbox.checked = gFSuggestInstances[fieldIndex].useperi;
                    labelMapArea.appendChild(this.pericheckbox);
                    this.pericheckbox.onchange = function(){
                         SLs.selPerimParams(this);
                         gFSuggestInstances[fieldIndex].useperi = this.checked;
                         SLs.delete_SLs();
                         SLs.getJS(gFSuggestInstances[fieldIndex].field.value+"?",fieldIndex);
                    }
                 }
                 SLs.container.appendChild(labelMapArea);


             }
             if(gFSuggestInstances[fieldIndex].params.useMaps == true) {
             var separator = document.createElement("span");
             separator.innerHTML = ' | ';
             labelSuggestions.appendChild(separator);

                 var closeMap = document.createElement("a");
                 closeMap.className = 'closeButton';
                 if(gFSuggestInstances[fieldIndex].params.useMaps) {
                     closeMap.innerHTML = (typeof t_minimapoff != 'undefined')?t_minimapoff:'Disable mini-map';
                 }
                 /*else{
                     closeMap.innerHTML = (typeof t_minimapon != 'undefined')?t_minimapon:'Enable mini-map';
                 }*/
                 closeMap.onclick = function(){
                     if(document.getElementById('geomap')==null) {
                         SLs.createGeoBox();
                     }

                     if(gFSuggestInstances[fieldIndex].params.useMaps == true){

                        this.innerHTML = ' ' + (typeof t_minimapon != 'undefined')?t_minimapon:'Enable mini-map';
                         document.getElementById('geomap').style.display = 'none';
                         gFSuggestInstances[fieldIndex].params.useMaps = true;
                     }else{

                         document.getElementById('geomap').style.display = 'block';
                         this.innerHTML = ' ' + (typeof t_minimapoff != 'undefined')?t_minimapoff:'Disable mini-map';
                         gFSuggestInstances[fieldIndex].params.useMaps = false;
                        }

                     gFSuggestInstances[fieldIndex].params.useMaps = !(gFSuggestInstances[fieldIndex].params.useMaps);
                 }
                 labelSuggestions.appendChild(closeMap);

             }
             SLs.container.appendChild(labelSuggestions);
            }
         },showSuggestion:function(){
             SLs.stopWaiting();
             if(SLs.currLocation != null) {
                           geoMap.hideContent(SLs.currLocation);
                           geoMap.removeContent(SLs.currLocation);
             }
             if(!SLs.container){
                  document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(fieldIndex))
             }
             SLs.container.innerHTML = '';
             gFSuggestInstances[fieldIndex].params.requestURL.match(/REQ0JourneyStopsS0A=(\d)/);
             var d=RegExp.$1;
             if(navigator.userAgent.indexOf("Safari")>-1){
                 var e="right: 18px;"
             }else{
                 if(navigator.userAgent.indexOf("MSIE")>-1){
                     var e="right: 0px;"
                 }else{
                     var e="right: 0px;"
                 }
              }
             SLs.lastSLSlist = SLs.sls.suggestions;
             if(gFSuggestInstances[fieldIndex].newJSONRequest) {
                 var saved = SLs.speichern(gFSuggestInstances[fieldIndex].field.value,SLs.sls.suggestions);
             }
             gFSuggestInstances[fieldIndex].newJSONRequest = false;
             var c=new Array();
             var addedSuggestions = 0;
             //
             var labelSuggestions = document.createElement("div");
//             labelSuggestions.style.textAlign = 'right';
             labelSuggestions.innerHTML = (typeof t_suggestions != 'undefined')?t_suggestions:'Suggestions';
             labelSuggestions.className = 'infoLabel';
             SLs.container.appendChild(labelSuggestions);
             //
              // je nach Anzahl der Toptreffer entsprechend viele VorschlÃ¤ge zeigen
             var maxSuggestions;
             if((typeof topcities !='undefined') && (topcities != 0)){
                  maxSuggestions = SLs.sls.suggestions.length - (topcities-1);
             }
             else{
                  maxSuggestions = SLs.sls.suggestions.length;
             }
             this.displayResults(false);
           /*
             if(SLs.sls.suggestions.length<1 || addedSuggestions == 0){
                 SLs.delete_SLs()
                 if(SLs.sls.suggestions.length != 0) {
                     gFSuggestInstances[fieldIndex].showSuggestionList = true;
                     gFSuggestInstances[fieldIndex].newJSONRequest = true;
                     SLs.getJS(gFSuggestInstances[fieldIndex].field.value + "?",fieldIndex,false);
                 }
             }
             if(typeof gFSuggestInstances[fieldIndex].params.onShow != 'undefined' /*&& gFSuggestInstances[fieldIndex].params.useMaps == true) {
               gFSuggestInstances[fieldIndex].params.onShow();
                 SLs.lastZoom = geoMap.getZoom();
             }                                */
             SLs.stopWaiting();
             return true

         },showAllSuggestions:function(){
              SLs.delete_SLs();
              gFSuggestInstances[fieldIndex].showSuggestionList = true;
              gFSuggestInstances[fieldIndex].newJSONRequest = true;
              gFSuggestInstances[fieldIndex].scrollSel = 1;
              SLs.getJS(gFSuggestInstances[fieldIndex].field.value + "?",fieldIndex,true);
              gFSuggestInstances[fieldIndex].field.focus();
         },addMapButton:function(x,y,desc,prod,weight, type){
              if(typeof fsugg_map != 'undefined') {
                  var tmp = '<span onmouseout="SLs.restoreOldZoom(true);" onmouseover="SLs.showGeoMap(\''+ x + '\',\'' + y + '\',\'' + desc + '\',\''+prod+'\',\''+weight+'\',\''+type+'\');">' + fsugg_map + '</span>';
                  return tmp;
              }
              return '';
         },addProductsButton:function(){
              var tmp = '<span>' + SLs.getProducts() + '</span>';
              return tmp;
         },resolveAddress:function(d,f,type,selIndex){
              var containerW = SLs.container.clientWidth;
              var h=gFSuggestInstances[f].params.requestURL+d+"!&";
              var b=/REQ0JourneyStopsS0A=(\d+)&/;
              h=h.replace(b,"REQ0JourneyStopsS0A="+type+"&");
              if(document.getElementById("hafasCallJS")!=null){
                  document.getElementsByTagName("head")[0].removeChild(document.getElementById("hafasCallJS"))
              }
              var tmpValue = d;
              var e=document.createElement("script");
              e.type="text/javascript";
              e.src=h+"suggestMethod=none&js=true&REQ0JourneyStopsB=1";
              e.id="hafasCallJS";
              if(typeof gFSuggestInstances[f].params.charset != 'undefined') {
                e.charset = gFSuggestInstances[f].params.charset;
              }
              e.onload = function(){
                 if(SLs.sls.suggestions[0].value != tmpValue){
                     setAdr(d,f,type,containerW);
                 }else{
                     gFSuggestInstances[f].setSLSInput(SLs,SLs.sls.suggestions[0].value,0,false)
                 }
              };
              e.onreadystatechange = function() {
                if (this.readyState == 'complete' || this.readyState == 'loaded') {
                   if(SLs.sls.suggestions[0].value != tmpValue){
                      setAdr(d,f,type,containerW);
                   }else{
                     gFSuggestInstances[f].setSLSInput(SLs,SLs.sls.suggestions[0].value,0,false)
                   }
                }
              };
              document.getElementsByTagName("head")[0].appendChild(e);
              function setAdr(d,f,type,containerW){
                  if(typeof SLs.sls.suggestions[0].value != 'undefined') {
                         gFSuggestInstances[f].field.focus();
                         gFSuggestInstances[fieldIndex].setSLSInput(SLs,SLs.sls.suggestions[0].value,0)
                         var houseNumberPos = gFSuggestInstances[f].field.value.search(/\d+/);
                         var comma = gFSuggestInstances[f].field.value.indexOf(houseNumberPos);
                         var houseNumberMatch = gFSuggestInstances[f].field.value.match(/\d+/);
                         if(navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
                             var r = gFSuggestInstances[f].field.createTextRange();
                             r.findText(houseNumberMatch);
                             r.select();
                         }else{
                             gFSuggestInstances[f].field.selectionStart = houseNumberPos;
                             gFSuggestInstances[f].field.selectionEnd = gFSuggestInstances[f].field.value.length;
                         }
                  }
//                  if((typeof gFSuggestInstances[f].params.useTooltip == 'undefined') || (gFSuggestInstances[f].params.useTooltip == true)) {
                  if(gFSuggestInstances[f].params.useTooltip == true) {
                      if(document.getElementById('tooltipHint') == null) {
                          var tooltip = document.body.appendChild(document.createElement("div"));
                          tooltip.id = 'tooltipHint';
                          tooltip.className = 's-tooltip';
                          tooltip.style.position = 'absolute';
                          var innerTooltip = tooltip.appendChild(document.createElement("span"));
                          //innerTooltip.innerHTML = 'Hausnummer auswählen';
                          innerTooltip.innerHTML = 'Select house number';
                      }
                      document.getElementById('tooltipHint').style.display = 'none';
                      document.getElementById('tooltipHint').style.left = SLs.pos_x + containerW - 35 + 'px';
                      document.getElementById('tooltipHint').style.top = (SLs.pos_y - 15) +'px';
                      document.getElementById('tooltipHint').style.display = 'block';
                      window.setTimeout(function(){
                          Effect.Fade('tooltipHint', { duration: 1.0 });
                      },3500);
                  }
              }
         },addIcons:function(x,y,desc,prod,weight, type){
              var icons = '';
              if(gFSuggestInstances[fieldIndex].params.useProducts) {
                      icons +=  SLs.addProductsButton();
              }
              // Maps eingeschaltet?
              if((gFSuggestInstances[fieldIndex].params.useMaps) && (x != "") && (y != "")) {
                     icons += ' ' + SLs.addMapButton(x,y,desc,prod,weight, type);
              }
              return icons;

         },toggleChbox:function(){
            if(document.getElementById('ch_stop').checked == true) {
               document.getElementById('ch_stop').disabled = true;
            }else if(document.getElementById('ch_tar').checked == true){
               document.getElementById('ch_tar').disabled = true;
            }
         },createCheckbox:function(id,index,bitval){
             var ch = document.createElement("input");
             ch.type = "checkbox";
             ch.id = id;
             ch.onclick = function(){
                 if(!this.checked) {
                    SLs.productbits = parseInt(SLs.productbits) - parseInt(index);
                    var prodStr = SLs.productbits;
                    SLs.chboxChecked--;
                    if(SLs.chboxChecked == 1) {
                        SLs.toggleChbox();
                    }
                 }else{
                    //SLs.productbits = parseInt(SLs.productbits) + parseInt(index);
                    SLs.chboxChecked++;
                 }
                 SLs.delete_SLs();
                 SLs.getJS(gFSuggestInstances[fieldIndex].field.value + "?",fieldIndex,false);
             }
             if(parseInt(bitval)==1) {
                 ch.checked = true;
                 ch.defaultChecked = true;
                 if(SLs.chboxChecked == 1) {
                     ch.disabled = true;
                 }
             }
             return ch;
         },addTypeFilter:function(){
             var bits_binary = SLs.productbits.toString(2);
             var typefilter = document.createElement("div");
             typefilter.className = 'infoLabel';
             typefilter.id="typefilter";
             typefilter.appendChild(SLs.createCheckbox("ch_stop",1,bits_binary.charAt(bits_binary.length-1)));
             var label1 = typefilter.appendChild(document.createElement("label"));
             label1.innerHTML = 'Hst.';
//             typefilter.appendChild(SLs.createCheckbox("ch_address",2,bits_binary.charAt(bits_binary.length-2)));
//             var label2 = typefilter.appendChild(document.createElement("label"));
//             label2.innerHTML = 'Adressen';
//             typefilter.appendChild(SLs.createCheckbox("ch_poi",4,bits_binary.charAt(bits_binary.length-3)));
//             var label3 = typefilter.appendChild(document.createElement("label"));
//             label3.innerHTML = 'POI';
             typefilter.appendChild(SLs.createCheckbox("ch_tar",32,bits_binary.charAt(bits_binary.length-6)));
             var label4 = typefilter.appendChild(document.createElement("label"));
             label4.innerHTML = 'Tarifgebiet';
             SLs.container.appendChild(typefilter);
             document.getElementById('textBit').value = 'PROD ' + SLs.productbits;
         },addFurtherMatchesButton: function(){
              var showAllMatches = document.createElement("div");
              showAllMatches.style.textAlign = 'left';
              showAllMatches.className = 'furtherMatches';
              showAllMatches.style.borderTop = '1px solid #333333';
              var allMatchesLink = document.createElement("a");
              var that = this;
              allMatchesLink.innerHTML = (typeof t_furtherMatches != 'undefined')?t_furtherMatches:'Show additional matches...';
              allMatchesLink.onclick = function(){
                   SLs.showAllSuggestions();
              }
              showAllMatches.appendChild(allMatchesLink);
              SLs.container.appendChild(showAllMatches);
         },mouseSelect:function(obj,mode){
              if(SLs.countList!=-1 && document.getElementById(SLs.countList)) {
                 var oldClassName = document.getElementById(SLs.countList).className;
                 if(oldClassName != 'infoLabel') {
                     document.getElementById(SLs.countList).className = SLs.classSelect(oldClassName,"selected");
                 }
              }
              obj.className+='selected';
              if(mode == "bottom") {
                   SLs.countList = parseInt(obj.id)+ 1 + gFSuggestInstances[fieldIndex].topMatches;
              }else{
                  SLs.countList = parseInt(obj.id)+1;
              }

          },addTopCities:function(){
          },getJS:function(d,f,ngramm_ext){
              var backupURL;
               // Erweiterung der NGRAMM
              if(ngramm_ext == true) {
                  gFSuggestInstances[f].params.requestURL = gFSuggestInstances[f].params.requestURL.replace("REQ0JourneyStopsB="+gFSuggestInstances[f].params.amount,"REQ0JourneyStopsB=50");
                  this.extendedSearch = false;
              }else{
                  gFSuggestInstances[f].params.requestURL = gFSuggestInstances[f].params.requestURL.replace("REQ0JourneyStopsB=50","REQ0JourneyStopsB="+gFSuggestInstances[f].params.amount);
                  this.extendedSearch = true;
              }
              var h=gFSuggestInstances[f].params.requestURL+d+"&";
              if(typeof(this.selectPerimeterFilterParam) == "string")
                h+=this.selectPerimeterFilterParam+"&";
              if(this.selectPerimeterFilterParam!=null) {
                  this.selectPerimeterFilterParam = "";
              }

              if(SLs.getLocType(f))
                {
                var b=/REQ0JourneyStopsS0A=(\d+)&/;
                h=h.replace(b,"REQ0JourneyStopsS0A="+SLs.getLocType(f)+"&");
                }
              if(gFSuggestInstances[f].params.locType&&document.getElementById(gFSuggestInstances[f].params.locType+"_hidden")){
                  var a=document.getElementById(gFSuggestInstances[f].params.locType+"_hidden").value;
                  h=h+gFSuggestInstances[f].params.requestURL2+a+"&"
              }if(document.getElementById("hafasCallJS")!=null){
                  document.getElementsByTagName("head")[0].removeChild(document.getElementById("hafasCallJS"))
              }
              if((typeof SLs.productbits != 'undefined') && (gFSuggestInstances[f].params.useTypeFilter)){
                var b=/REQ0JourneyStopsS0A=(\d+)&/;h=h.replace(b,"REQ0JourneyStopsS0A="+SLs.productbits+"&");
              }
              // Delfi?
              if((typeof(gFSuggestInstances[f].params.delfiSwitchId) != "undefined") && (document.getElementById(gFSuggestInstances[f].params.delfiSwitchId)))
                {
                if(document.getElementById(gFSuggestInstances[f].params.delfiSwitchId).checked)
                  {
                  h = h.replace(/&/,"&iER=yes&REQ0JourneyStopsS0B=5&getring=1&");
                  }
                }
              var e=document.createElement("script");
              e.type="text/javascript";
              e.src=h+"js=true&";
              if(typeof gFSuggestInstances[f].params.charset != 'undefined') {
                e.charset = gFSuggestInstances[f].params.charset;
              }
              e.id="hafasCallJS";
              document.getElementsByTagName("head")[0].appendChild(e);
              SLs.stopWaiting();
          },getLocType:function(fieldIndex){
              var locType = null;
              if(gFSuggestInstances[fieldIndex].field.name=="S")
                var typeInputName="REQ0JourneyStopsS0A";
              else if(gFSuggestInstances[fieldIndex].field.name=="Z")
                var typeInputName="REQ0JourneyStopsZ0A";
              else
                var typeInputName=gFSuggestInstances[fieldIndex].field.name.replace(/G$/,"A");
              if(gFSuggestInstances[fieldIndex].field.form != null)
                {
                if(gFSuggestInstances[fieldIndex].field.form[typeInputName] != null)
                  var g=gFSuggestInstances[fieldIndex].field.form[typeInputName][0];
                else
                  var g = null;
                if(g == null)
                  var g=gFSuggestInstances[fieldIndex].field.form[typeInputName];
                }
              else
                g = null;
              if((g != null) && (g.className.match(/\bgenerated\b/)))
                g = null;
              var getTypeFromUrl = /REQ0JourneyStopsS0A=(\d*)/
              getTypeFromUrl.exec(gFSuggestInstances[fieldIndex].params.requestURL);
              locType = parseInt(RegExp.$1);
              if((typeInputName == "input") || (typeInputName == "stationname"))
                locType = 1;
              if((g!=null)&&(g.nodeName=="SELECT")){
                  gFSuggestInstances[fieldIndex].selectType=true
                  locType = g.value;
              }
              else if ((g != null) && (g.nodeName == "INPUT") && (g.type == "radio"))
                {
                var typeInput = gFSuggestInstances[fieldIndex].field.form[typeInputName];
                for(var i = 0; i < typeInput.length; i++)
                  {
                  if((typeInput[i].type="radio") && (typeInput[i].checked))
                    {
                    locType = typeInput[i].value;
                    }
                  }
                }
              else if ((g != null) && (g.nodeName == "INPUT") && (typeInputName != gFSuggestInstances[fieldIndex].field.name))
              {
                locType = g.value
              }
              return locType;
            },hafasurl2utf8:function(a){
             a=a.replace(/\+/g,"%20");
             a=a.replace(/%A7/g,"%C2%A7");
             a=a.replace(/%E4/g,"%C3%A4");
             a=a.replace(/%F6/g,"%C3%B6");
             a=a.replace(/%FC/g,"%C3%BC");
             a=a.replace(/%DF/g,"%C3%9F");
             a=a.replace(/%C4/g,"%C3%84");
             a=a.replace(/%D6/g,"%C3%96");
             a=a.replace(/%DC/g,"%C3%9C");
             a=a.replace(/%E9/g,"%C3%A9");
             return a
          },getCookieValue:function(d,c,b){
               if(typeof d=="undefined"||d==""){
                   return""
               }
               var e=d.search(c);
               if(e<0){
                   return""
               }
               var a=d.substr(e+c.length);
               e=a.search(b);if(e>0){
                   a=a.substr(0,e)
               }

              return decodeURIComponent(a)
          },displayResults:function(checkNeeded){
               var l=new Array();
               var g="right: 0px;";
               var topcities;
               // Ergebnisse nach Kategorien sortieren
               if(gFSuggestInstances[fieldIndex].params.useCategory) {
                   var stopArr = new Array();
                   var adrArr = new Array();
                   var poiArr = new Array();
                   for(var o=0;o<SLs.sls.suggestions.length;o++){
                       switch(parseInt(SLs.sls.suggestions[o].type)){
                          case 1: stopArr.push(SLs.sls.suggestions[o]);break;
                          case 2: adrArr.push(SLs.sls.suggestions[o]);break;
                          case 4: poiArr.push(SLs.sls.suggestions[o]);break;
                       }
                   }
                   SLs.sls.suggestions = null;
                   SLs.sls.suggestions = new Array();
                   for(var i=0;i < stopArr.length;i++) {
                      SLs.sls.suggestions.push(stopArr[i]);
                   }
                   for(var i=0;i < adrArr.length;i++) {
                      SLs.sls.suggestions.push(adrArr[i]);
                   }
                   for(var i=0;i < poiArr.length;i++) {
                      SLs.sls.suggestions.push(poiArr[i]);
                   }
               }

               gFSuggestInstances[fieldIndex].topMatches = 0;
               SLs.addMenu();
               var addedSuggestions = 0;
               for(var c=0;c<SLs.sls.suggestions.length;c++){
                    if(SLs.container){
                        // Zeige Ergebnisse wenn
                        if((!checkNeeded) || (gFSuggestInstances[fieldIndex].field.value.length == 0) || (SLs.checkForMatches("substr",gFSuggestInstances[fieldIndex].field.value,SLs.sls.suggestions[c].value))){
                           var tmpSuggestion = SLs.sls.suggestions[c].value;
                           var userInput = gFSuggestInstances[fieldIndex].field.value;
                           tmpSuggestion = SLs.replaceSpecialChars(tmpSuggestion);
                              l[addedSuggestions]=SLs.container.appendChild(document.createElement("div"));
                           l[addedSuggestions].id=c;
                           if((typeof(historyCookieTypeString)!="undefined")&&(typeof(historyCookieTypeString[SLs.sls.suggestions[c].type])!="undefined")){
                               var f="<span style='display: block;position: absolute; background-color: #fff;"+g+"'>"+historyCookieTypeString[SLs.sls.suggestions[c].type]+"</span>"
                           }else{
                               var f=""
                           }
                           if(SLs.sls.suggestions[c].type == 4) {
                               l[addedSuggestions].className = 'poi';

                           }else if(SLs.sls.suggestions[c].type == 2){
                               l[addedSuggestions].className = 'adr';
                           }
                           var inputTokens = new Array();
                           inputTokens = userInput.split(" ");
                           for(var k=0; k < inputTokens.length; k++) {
                               if((inputTokens[k] != "") && (gFSuggestInstances[fieldIndex].params.useHighlighting)) {
                                   tmpSuggestion = this.getBoldCharacters(inputTokens[k],tmpSuggestion,0);
                               }
                           }
                           if((typeof(SLs.sls.suggestions[c].ringRegion) != "undefined") && (SLs.sls.suggestions[c].ringRegion == "yes"))
                             {
                             tmpSuggestion += delfiString;
                             }
                           l[addedSuggestions].innerHTML = "<span style='float:right'>"+SLs.addIcons(SLs.sls.suggestions[c].xcoord,SLs.sls.suggestions[c].ycoord,SLs.sls.suggestions[c].value,SLs.sls.suggestions[c].prodClass,SLs.sls.suggestions[c].weight,SLs.sls.suggestions[c].type) +"</span>"+ f+"<span>" + tmpSuggestion + "</span>";
                           l[addedSuggestions].onmousedown=function(){
                               var content = this.lastChild.innerHTML;
                               if(typeof(delfiStringRegExp) != "undefined")
                                 content = content.replace(delfiStringRegExp,"");
                               content = content.replace(/<b>/g,"");
                               content = content.replace(/<\/b>/g,"");
                               content = content.replace(/<B>/g,"");
                               content = content.replace(/<\/B>/g,"");
                               gFSuggestInstances[fieldIndex].clickSel=1;
                               gFSuggestInstances[fieldIndex].setSLSInput(SLs,content,parseInt(this.id))
                               // ALter Parameter, jetzt content !!! this.lastChild.firstChild.nodeValue
                           }
                           l[addedSuggestions].onmouseover=function(){
                              SLs.mouseSelect(this,"bottom");
                           }
                           l[addedSuggestions].onmouseout= function(){
                              this.className = SLs.classSelect(this.className,"selected");
                           }
                           addedSuggestions++;
                       }

                  }else{
                      return false
                  }
               }
               // Add notice when no results are found
               if((addedSuggestions == 0) && (gFSuggestInstances[fieldIndex].params.useSuggest == true)){
                   this.addNoResultInfo();
               }
               // Typefilter anzeigen?
               if(gFSuggestInstances[fieldIndex].params.useTypeFilter) {
                   this.addTypeFilter();
               }
               // Button fÃ¼r weitere Treffer anzeigen?
               if((gFSuggestInstances[fieldIndex].field.value.length > 0) && (gFSuggestInstances[fieldIndex].params.useFurtherMatches)) {
                   this.addFurtherMatchesButton();
               }
               gFSuggestInstances[fieldIndex].showSuggestionList = false;
               SLs.container.style.border="";
               SLs.container.style.borderWidth="1px";
               SLs.container.style.zIndex="99999999";
               SLs.container.style.height="auto";
               //SLs.container.style.maxHeight=SLs.div_hoehe+124+"px";
               if(navigator.userAgent.toLowerCase().indexOf("msie")>-1){
                  // SLs.container.style.width=SLs.container.clientWidth+20
               }
               if(SLs.container.scrollWidth > SLs.container.clientWidth) {
                  SLs.container.style.width = SLs.container.clientWidth + 20 + 'px';
               }
               if(navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.indexOf("7.0")<0){
                   if(SLs.container.scrollHeight > (SLs.div_hoehe+124)){
                       SLs.container.style.height= SLs.div_hoehe + 124 + "px";
                       SLs.container.overflow = "auto";
                   }
                   else{
                       SLs.container.style.height="auto";
                   }
                   // IE 6 Fix , Select boxen verstecken!
                   SLs.hideSelect();
               }
          },addNoResultInfo:function(){
               var locType = SLs.getLocType(fieldIndex);
               if((typeof(gFSuggestInstances[fieldIndex].params.minCharPerType) != "undefined") && (gFSuggestInstances[fieldIndex].params.minCharPerType[locType]))
                 {
                 var minChar = gFSuggestInstances[fieldIndex].params.minCharPerType[locType];
                 }
               else
                 var minChar = gFSuggestInstances[fieldIndex].params.minChar;
               var labelSuggestions = document.createElement("div");
               labelSuggestions.innerHTML = t_suggestHint1 + minChar + ' ' + t_suggestHint2;
               labelSuggestions.style.wordWrap = 'break-word';
               labelSuggestions.className = 'infoLabel';
               labelSuggestions.id = 'note';
               SLs.container.insertBefore(labelSuggestions,null);
          },fillWithCookieValues:function(h){
                        // Wenn Container noch nicht vorhanden ist
                       if(!SLs.container){
                            document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(fieldIndex))
                       }
                       if((typeof h.params.cookiename=="undefined") && (gFSuggestInstances[fieldIndex].useTopFavorites != true)){
                           return
                       }
                       // Aus Cookies Treffer zusammenbauen
                       var j=document.cookie;
                       var b=h.params.cookiename;
                       j=this.getCookieValue(j,b+"=",";");
                       if((j=="") && (gFSuggestInstances[fieldIndex].useTopFavorites != true)){
                           return
                       }
                       j=this.getCookieValue(j,"history=",";");
                       if((j=="") && (gFSuggestInstances[fieldIndex].useTopFavorites != true)){
                           return
                       }
                       j=this.hafasurl2utf8(j);
                       if(!SLs.container){
                           document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(this.instance))
                       }
                       var k=new Array;
                       var e=0;
                       for(var a=1;a<=6;a++){
                           var d=this.getCookieValue(j,"Stop"+a,"&");
                           if(d!=""){
                               k[e]=new Object;k[e].text=d;e++
                           }
                       }
                       // get selected type
                      var typeInputValue = SLs.getLocType(fieldIndex);

                       SLs.sls=new Object;
                       SLs.sls.suggestions=new Array;
                       for(a=0;a<k.length;a++){
                          if(this.getCookieValue(k[a].text,"A=","@") & typeInputValue)
                            {
                             SLs.sls.suggestions[a]=new Object;
                             SLs.sls.suggestions[a].id=this.getCookieValue(k[a].text,"Â§L=","Â§");
                             SLs.sls.suggestions[a].value=this.getCookieValue(k[a].text,"O=","@");
                             SLs.sls.suggestions[a].type=this.getCookieValue(k[a].text,"A=","@")
                            }
                       }
                       // display my stops?
                       if(gFSuggestInstances[fieldIndex].useProfileStops == true && gFSuggestInstances[fieldIndex].field.value.length >= 0 && (typeof(profileStops) != "undefined")) {
                          for(var i=0; i < profileStops.length; i++){
                            if(profileStops[i].type & typeInputValue)
                              {
                                var index = SLs.sls.suggestions.length;
                                SLs.sls.suggestions[index] = new Object;
                                SLs.sls.suggestions[index] =  profileStops[i];
                              }
                          }
                       }
                       // Toptreffer anzeigen ja / nein?
                       if(gFSuggestInstances[fieldIndex].useTopFavorites == true && gFSuggestInstances[fieldIndex].field.value.length >= 0) {
                         var i = 0;
                         while(SLs.topCities.suggestions[i]){
                            if(SLs.topCities.suggestions[i].type & typeInputValue)
                              {
                                var index = SLs.sls.suggestions.length;
                                SLs.sls.suggestions[index] = new Object;
                                SLs.sls.suggestions[index] =  SLs.topCities.suggestions[i];
                              }
                            i++;
                          }
                       }

                       // Cookie Values
                       if(typeof favHash != 'undefined')
                       {
                           var matchingCookieValues = new Array();
                           for(var i=0; i < favHash.suggestions.length;i++) {
                              if((favHash.suggestions[i].value.toLowerCase().indexOf(gFSuggestInstances[fieldIndex].field.value.toLowerCase()) == 0) || (gFSuggestInstances[fieldIndex].field.value.length == 0)) {
                                  var index = SLs.sls.suggestions.length;
                                  SLs.sls.suggestions[index] = new Object;
                                  SLs.sls.suggestions[index] = favHash.suggestions[i];
                              }
                           }
                       }



                       var labelSuggestions = document.createElement("div");
          //             labelSuggestions.style.textAlign = 'right';
                       labelSuggestions.innerHTML = (typeof t_suggestions != 'undefined')?t_suggestions:'Suggestions';
                       labelSuggestions.className = 'infoLabel';
                       if(SLs.container)
                        SLs.container.appendChild(labelSuggestions);
                       //
                       this.displayResults(true);
                       /*if(addedSuggestions == 0) {

                       }else{
                           var labelSuggestions = document.createElement("div");
                           labelSuggestions.innerHTML = 'Favouriten';
                           labelSuggestions.style.textAlign = 'right';
                           labelSuggestions.className = 'infoLabel';
                           SLs.container.insertBefore(labelSuggestions,l[0]);
                      }
                      SLs.container.style.borderWidth="1px";
                      SLs.container.style.zIndex="10002";
                      SLs.container.style.height="auto";
                      SLs.container.style.maxHeight=SLs.div_hoehe+124+"px";
                      if(gFSuggestInstances[fieldIndex].field.value.length > 0) {
                          this.addFurtherMatchesButton();
                      }
                      if(navigator.userAgent.toLowerCase().indexOf("msie")>-1){
                          //SLs.container.style.width=SLs.container.clientWidth+20
                      }
                      if(navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.indexOf("7.0")<0){
                          SLs.hideSelect()
                      }
                      if(SLs.sls.length<1 && gFSuggestInstances[fieldIndex].useTopFavorites != true){
                          SLs.delete_SLs()
                      } */
          },delete_SLs:function(mode, force){
             if(document.getElementById('tooltip')!=null) {
                 document.getElementById('tooltip').style.display = 'none';
             }
             if (!blockHide) {
               if((SLs.container)&&(SLs.container.parentNode)){
                   if(typeof mode == 'undefined' || mode == true)
                     {
                     document.getElementsByTagName("body")[0].removeChild(SLs.container);
                     SLs.container=null;
                     }
                   else
                     {
                       if((typeof force != 'undefined') && (force==true))
                         SLs.container.innerHTML = '';
                     }
                   if(navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.indexOf("7.0")<0){
                       SLs.showSelect()
                   }
                   SLs.countList=-1;
                   SLs.currentTop=0;
                   SLs.currentBottom=9
               }
               if(document.getElementById('overlayProducts')){
                    document.getElementById('overlayProducts').style.display = 'none';
               }
               if(document.getElementById('geomap')) SLs.hideGeoMap();
               SLs.stopWaiting();
               SLs.extendedSearch = true;
             }
          },checkUpdate: function(keycode){
               var cached;
               if(!SLs.cachedSuggestions) {
                   return true;
               }else{
                   SLs.stopWaiting();
                   if(cached = SLs.laden(gFSuggestInstances[fieldIndex].field.value)) {
                       SLs.sls.suggestions = cached;
                       return false;
                   }else{
                       if(typeof SLs.sls.suggestions[0] != 'undefined') {
                           var matches = SLs.checkForMatches("prefix", gFSuggestInstances[fieldIndex].field.value, SLs.sls.suggestions[0].value);
                           if(matches == false || (keycode == 8)) {  return true; }
                           else { return false; }
                       }else{
                           return true;
                       }
                   }
               }
           },checkForMatches:function(type,userInput,sugg){
            if(type == 'prefix') {
                matchedWordStart = sugg.toString().toLowerCase().indexOf(userInput.toString().toLowerCase());
                if(matchedWordStart != 0) {
                   return false;
                }else{
                    return true;
                }
            }else{
                var inputTokens = new Array();
                var prefixMatch = false;
                inputTokens = userInput.split(" ");
                    for(var j=0; j < inputTokens.length; j++) {
                       var matches = 0;
                       var checkedWords = 0;

                       if(inputTokens[j] != '' && inputTokens[j] != ' ') {
                           matchedWordStart = sugg.toString().toLowerCase().indexOf(inputTokens[j].toLowerCase());
                           if(matchedWordStart == 0 && j == 0) {
                                prefixMatch = true;
                                matches++
                           }
                           else if(matchedWordStart != -1 && j > 0) {
                               matches++;
                           }
                           checkedWords++;
                       }
                    }
                if(matches == checkedWords && prefixMatch == true) {
                    return true;
                }else{
                    return false;
                }

            }



          },getPosX:function(a){
               var b=0;if(a.offsetParent){
                   while(a.offsetParent){
                       b+=a.offsetLeft;a=a.offsetParent
                   }
               }else{
                   if(a.x){
                       b+=a.x
                   }
               }
               return b
          },getPosY:function(a){
               var b=0;
               if(a.offsetParent){
                   while(a.offsetParent){
                       b+=a.offsetTop;
                       a=a.offsetParent
                   }
               }
               else{
                   if(a.y){
                       b+=a.y
                   }
               }
               return b
          },hideSelect:function(){
               var f=document.getElementsByTagName("select");
               for(var e=0;e<f.length;e++){
                   var d=false;
                   var c=false;
                   var b=SLs.getPosX(f[e]);
                   var a=SLs.getPosY(f[e]);
                   if(SLs.pos_x<=b&&b<SLs.pos_x+SLs.container.clientWidth){
                       d=true
                   }else{
                       if(SLs.pos_x<b+f[e].clientWidth&&b+f[e].clientWidth<=SLs.pos_x+SLs.container.clientWidth){
                           d=true
                       }else{
                           if(SLs.pos_x>b&&b+f[e].clientWidth>SLs.pos_x){
                               d=true
                           }
                       }
                   }
                   if(SLs.pos_y<a&&a<SLs.pos_y+SLs.container.clientHeight){
                       c=true
                   }else{
                       if(SLs.pos_y<a+f[e].clientHeight&&a+f[e].clientHeight<SLs.pos_y+SLs.container.clientHeight){
                           c=true
                       }
                   }
                   if((d)&&(c)){
                       f[e].style.visibility="hidden"
                   }
               }
           },clearHTMLTags:function(str){
                if(typeof str != 'undefined') {
                    str = str.replace(/<b>/g,"");
                    str = str.replace(/<\/b>/g,"");
                    str = str.replace(/<B>/g,"");
                    str = str.replace(/<\/B>/g,"");
                    return str;
                }
           },showSelect:function(){
                var b=document.getElementsByTagName("select");
                for(var a=0;a<b.length;a++){
                    if(b[a].style.visibility=="hidden"){
                        b[a].style.visibility="visible"}
                }
           },replaceSpecialChars:function(str){
                str = str.replace(/&#252;/, "Ã¼");
                str = str.replace(/&#223;/, "ÃŸ");
                str = str.replace(/&#220;/, "Ãœ");
                str = str.replace(/&#228;/, "Ã¤");
                str = str.replace(/&#196;/, "Ã„");
                str = str.replace(/&#246;/, "Ã¶");
                str = str.replace(/&#214;/, "Ã–");
                return str;
           },getProducts:function(){
                var str = "";
                var products = new Array("ice_16x16.gif","sbahn_16x16.gif","ubahn_16x16.gif","ec_ic_16x16.gif");
                a = 1 + (products.length-1)*(Math.random());
                a = Math.round(a);
                if(typeof fsugg_products != 'undefined') {
                    str += fsugg_products;
                }
                return str;
           },classSelect:function(str,keyword){
                 if(str.length >= keyword.length) {
                     return str.substr(0,str.length - keyword.length);
                 }else{
                     return str;
                 }
           },createGeoBox:function(){
                  // Creates the div container for the map in relation to the suggestbox
                  var geomapid = 'geomap';
                  var mapcontid = 'mapcontainer';
                  effectDuration = 0.4;
                  var mapContainer = document.getElementById(geomapid);
                  if(!mapContainer) {
                            // create container
                            mapContainer = document.createElement("div");
                            mapContainer.className = 'hfsSuggestMap';
                            mapContainer.id = geomapid;

                            mapContainer.style.left = SLs.getPosX(SLs.container) + parseInt(SLs.container.clientWidth)  + 3 + 'px';
                            mapContainer.style.top = SLs.getPosY(SLs.container) + 'px';
                            mapContainer.onmouseover = function() { blockHide=true }
                            mapContainer.onmouseout = function() { blockHide=false }
                            document.getElementsByTagName("body")[0].appendChild(mapContainer);

                            // create map headtitle
                            var mapTitle = document.createElement("div");
                            mapTitle.id = 'maptitle';
                            mapTitle.className = 'hfsSuggestMapTitle';
                            mapContainer.appendChild(mapTitle);

                            // Productinfobox anzeigen?
                            if(gFSuggestInstances[fieldIndex].params.useProducts) {
                               var products = document.createElement("div");
                               products.id = 'suggestProducts';
                               //products.innerHTML = 'Und hier kommen die Produkte hin.. tada!';
                               mapContainer.appendChild(products);
                            }

                            // create map area
                            var mapArea = document.createElement("div");
                            mapArea.style.height = '290px';
                            mapArea.style.width = '300px';
                            mapArea.id = mapcontid;
                            mapContainer.appendChild(mapArea);

                            geoMap = new CPTVMap(mapcontid, {mode:"simple",coord:new CCoord({latitude:52520501,longitude:13386987}),profileGroup:'lux',zoom:1400});
                            geoMap.show();

                  }
                  mapContainer.style.left = SLs.getPosX(SLs.container) + parseInt(SLs.container.clientWidth)  + 3 + 'px';
                  mapContainer.style.top = SLs.getPosY(SLs.container) + 'px';

                  return mapContainer;
           },showGeoMap:function(coordx, coordy, ptitle, productbits, weight, type){
                       // create container, title and map area if not done yet
                       var mapContainer = SLs.createGeoBox();
                       // set place specific values (coords and place title) to container
                       var coordset = new CCoord({latitude:coordy,longitude:coordx});
                       geoMap.centerToGeo(coordset);
                       geoMap.setZoom(1400);
                       if(SLs.currLocation != null) {
                           geoMap.hideContent(SLs.currLocation);
                           geoMap.removeContent(SLs.currLocation);
                       }
                       if((type) && (marker_icons) && (marker_icons[type]))
                         var currentMarkerIcon = marker_icons[type];
                       else
                         var currentMarkerIcon = gImagePath + '/icons/selected_location.png'
                       SLs.currLocation = geoMap.createContent({
                         type: 'location',
                         coord: coordset,
                         imageurl: currentMarkerIcon,
                         imagewidth: 14,
                         imageheight: 14,
                         hotspot: {x:7, y:7}
                       });
                       geoMap.showContent(SLs.currLocation);
//                       document.getElementById('maptitle').innerHTML = '<b>&nbsp;' + ((typeof t_location != 'undefined')?t_location:'Location:') + ':</b>&nbsp;<span title="' + ptitle + '">' + ptitle + '</span>';
                       document.getElementById('maptitle').innerHTML = '<span title="' + ptitle + '">' + ptitle + '</span>';
                       // products at this location
                       if((gFSuggestInstances[fieldIndex].params.useProducts) && (productbits != 'undefined')) {
                          if(typeof getProductsFromBitfield == 'function'){
                             var resultProducts = getProductsFromBitfield(productbits);
                             var resultProductsString = '';

                             if((gFSuggestInstances[fieldIndex].params.useRidesPerYear) && (weight != 'undefined')) {
                                resultProductsString += '<p style="margin-top:0px; float:left; width:90%;">' + t_fsugg_mot + ' ' + ptitle + '</p>';
                                resultProductsString += '<div style="float:right;">' + SLs.getWeightIcon(weight) + '</div>';
                                resultProductsString += '<div style="clear:both;"></div>';
                             } else {
                                resultProductsString += '<p style="margin-top:0px;">' + t_fsugg_mot + ' ' + ptitle + '</p>';
                             }

                             if(productbits > 0)
                               {
                               $for(gProductImageHTML,function(i,obj){
                                   var productCssClass = 'inactive';
                                   for(var k=0; k < resultProducts.length; k++) {
                                       if( i == resultProducts[k]) {
                                           productCssClass='active';
                                       }
                                   }
                                   resultProductsString += '<span class="'+productCssClass+'">'+gProductImageHTML[i]+'</span>';

                               });
                               //}
                               $('suggestProducts').removeClassName('hide');
                               $('suggestProducts').innerHTML = resultProductsString;
                               }
                             else
                               $('suggestProducts').addClassName('hide');
                          }
                       } else {
                          if (gFSuggestInstances[fieldIndex].params.useProducts)
                          $('suggestProducts').addClassName('hide');
                       }
                        // move container if suggestbox moved
                       if(SLs.container.scrollHeight > SLs.container.clientHeight) { var addwidth=20;
                       }else{ var addwidth=0;}
                       // move container if suggestbox moved
                       mapContainer.style.left = (SLs.getPosX(SLs.container)+ parseInt(SLs.container.clientWidth)) + addwidth + 3 + 'px';
                       mapContainer.style.top = SLs.getPosY(SLs.container) + 'px';

                       // animate incoming box
                       //SLs.fadeIn('mapcontainer');  // fade opacity
                       //if (mapContainer.style.display == 'none') mapContainer.style.width = '0px';
                       mapContainer.style.display = 'block';  // blind left
                       geoMap.setZoom(1400);
           },hideGeoMap:function(){
                       // Hides the div container
                       //SLs.fadeOut('mapcontainer'); // fade opacity
                       document.getElementById('geomap').style.display = 'none';  // blind left
           },restoreOldZoom:function(keepContent){
               if(typeof geoMap != 'undefined') {
                      if(typeof SLs.lastZoom != 'undefined') {
                          geoMap.setZoom(SLs.lastZoom);
                      }else{
                          geoMap.setZoom(1400);
                      }
                      if(!(keepContent))
                        {
                        geoMap.hideContent(SLs.currLocation);
                        geoMap.removeContent(SLs.currLocation);
                        }
               }

           },addLabel:function(label,id){
                var labeldiv = document.createElement("div");
                labeldiv.innerHTML = label;
                labeldiv.className = 'infoLabel';
                labeldiv.id = id;
                labeldiv.style.textAlign = 'right';
                SLs.container.appendChild(labeldiv);
           },getProductIcon:function(prodclass,name){
                var actObj = this;
                if(typeof product_icons != 'undefined') {
                    if(typeof productNamesCustomer == 'undefined') {
                        var productNames = new Array('ICE', 'IC/EC', 'IR/D', 'IRE/RE/RB','S-Bahn','Bus','Schiff','U-Bahn','Bahn','Taxi');
                    }else{
                        var productNames = productNamesCustomer;
                    }
                    if(prodclass != '0') {
                        var num = parseInt(prodclass);
                        var bits = num.toString(2);
                        var pclass = -1;
                        var j=0;
                        var title = '';

                        for(var i=bits.length;i>=0;i--) {
                            if(bits.charAt(i)=='1') {
                                if(j <= pclass || pclass == -1) {
                                    pclass = j;
                                }
                                title += productNames[j-1] + ' ';
                            }
                            j++;
                        }
                        var imageProduct = document.createElement("img");
                        imageProduct.style.height = '14px';
                        imageProduct.style.width = '14px';

                        imageProduct.src = product_icons[pclass-1];
                        imageProduct.onmousemove = function(evt){
                             if(typeof evt == 'undefined' && window.event != null) {
                                 evt = window.event;
                             }
                             SLs.createTooltip(evt,title,name,bits);
                        }
                        imageProduct.onmouseout = function(evt){
                             document.getElementById('tooltip').style.opacity = '0';
                        }
                        imageProduct.onmouseover = function(evt){
                             if(document.getElementById('tooltip')==null) {
                                actObj.makeTooltip();
                             }
                             document.getElementById('tooltip').style.opacity = '0';
                             SLs.fadeIn('tooltip');
                        }
                        return imageProduct;
                        //return '<img id=' src="' + product_icons[pclass-1] + '" height="14" width="14" title="Produktklassen:' + title + '"/>';
                    }else{
                        return '<img src="" height="14" width="14"/>';
                    }
                }
                return '';
           },getWeightIcon:function(weight){
                var image = '';
                if(weight < 200)
                    image = 'icons/icon_weight_01.gif';
                else if(weight >= 200 && weight < 5000) {
                    image = 'icons/icon_weight_03.gif';
                }else if(weight >=5000 && weight < 10000){
                    image = 'icons/icon_weight_05.gif';
                }else if(weight >=10000 && weight < 15000){
                    image = 'icons/icon_weight_07.gif';
                }else{
                    image = 'icons/icon_weight_08.gif';
                }
                //return '<img style="vertical-align:middle;" title="' + weight +  ' ' + ((typeof t_connectionsPerYear != 'undefined') ? t_connectionsPerYear:'rides per year') + '" src="' + gImagePath + image + '" height="14" width="14"/>';
                return '<img style="vertical-align:middle;" title="" src="' + gImagePath + image + '" height="14" width="14"/>';
           },createTooltip:function(evt,title,name,bits){
                if(document.getElementById('tooltip')==null) {
                   this.makeTooltip();
                }
                if(typeof productNamesCustomer == 'undefined') {
                    var productNames = new Array('ICE', 'IC/EC', 'IR/D', 'IRE/RE/RB','S-Bahn','Bus','Schiff','U-Bahn','Bahn','Taxi');
                }else{
                    var productNames = productNamesCustomer;
                }
                document.getElementById('tooltip').style.left = evt.clientX + 18 + 'px';
                document.getElementById('tooltip').style.top = evt.clientY + 'px';

                var content = '';
                for(var i=bits.length; i >= 0 ; i--) {
                    if(bits.charAt(i) == '1') {
                        content += '<li style="text-align:center;width:60px;list-style-type:none;float:left"><img src="'+ product_icons[bits.length - i - 1] + '"/><br/>' + productNames[bits.length - i -1] + '</li>';
                    }
                }
                document.getElementById('tooltip').innerHTML = ((typeof t_meansOfTransport != 'undefined')?t_meansOfTransport:'means of transport') + ' <b>' + name + '</b>:<br/><ul style="margin-left:-40px;">' + content + '</ul>';

           },makeTooltip:function(){
              // creates Tooltip for products
              var tooltip = document.body.appendChild(document.createElement("div"));
              tooltip.style.width = 'auto';
              tooltip.className = 'suggestTooltip';
           },fadeIn:function(elemid){
                       // Fades Opacity
                       elem = document.getElementById(elemid);
                       elem.style.display = 'block';
                       elem.style.opacity = '1.0';
                       var oldOpac = parseFloat(elem.style.opacity)*100;
                       var opac = oldOpac + 4;
                       if (opac > 100) opac = 100;
                       elem.style.opacity = (opac/100);
                       elem.style.filters = 'Alpha(opacity=' + opac + ')';
                       if (opac < 100) window.setTimeout("SLs.fadeIn('" + elemid + "');", 20);
           },fadeOut:function(elemid){
                       // Fades Opacity
                       elem = document.getElementById(elemid);
                       var oldOpac = parseFloat(elem.style.opacity)*100;
                       var opac = oldOpac - 4;
                       if (opac < 0) opac = 0;
                       elem.style.opacity = (opac/100);
                       elem.style.filters = 'Alpha(opacity=' + opac + ')';
                       if (opac > 0) window.setTimeout("SLs.fadeOut('" + elemid + "');", 20);
                       else elem.style.display = 'none';
           },selPerimParams:function(checkbox){
                if(checkbox.checked){
                    var param = "selectPerimeterFilter;"
                        param += Map.getCenter().lon+";";
                        param += Map.getCenter().lat+";";
                        var zoom = Map.getZoom();
                        zoom = Math.round(zoom/2000);
                        if(zoom == 0)
                          zoom= 1;
                        param += zoom+";";
                        checkbox.value = param;
                        this.selectPerimeterFilterParam = checkbox.name+"="+param;
                }
                else
                    this.selectPerimeterFilterParam = "";
           }

};







