	
(function(){
    jQuery.fn.bgIframe=jQuery.fn.bgiframe=function(a){
        if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7){
            var a=jQuery.extend({
                top:"auto",left:"auto",width:"auto",height:"auto",opacity:!0,src:"javascript:false;"
            }
            ,a||{}),b=function(a){
                return a&&a.constructor==Number?a+"px":a
            }
            ,c='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+a.src+'"style="display:block;position:absolute;z-index:-1;'+(a.opacity!==!1?"filter:Alpha(Opacity='0');":"")+"top:"+(a.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":
            b(a.top))+";left:"+(a.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(a.left))+";width:"+(a.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(a.width))+";height:"+(a.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(a.height))+';"/>';
            return this.each(function(){
                jQuery("> iframe.bgiframe",this).length==0&&this.insertBefore(document.createElement(c),this.firstChild)
            })
        }
        return this
    }
    
})(jQuery);
jQuery.cookie=function(a,b,c){
    if(typeof b!="undefined"){
        c=c||{};
        if(b===null)b="",c.expires=-1;
        var d="";
        if(c.expires&&(typeof c.expires=="number"||c.expires.toUTCString))typeof c.expires=="number"?(d=new Date,d.setTime(d.getTime()+c.expires*864E5)):d=c.expires,d="; expires="+d.toUTCString();
        var e=c.path?"; path="+c.path:"",f=c.domain?"; domain="+c.domain:"",c=c.secure?"; secure":"";
        document.cookie=[a,"=",encodeURIComponent(b),d,e,f,c].join("")
    }
    else{
        b=null;
        if(document.cookie&&document.cookie!=""){
            c=
            document.cookie.split(";");
            for(d=0;
            d<c.length;
            d++)if(e=jQuery.trim(c[d]),e.substring(0,a.length+1)==a+"="){
                b=decodeURIComponent(e.substring(a.length+1));
                break
            }
            
        }
        return b
    }
    
};
jQuery.fn.extend({
    selectbox:function(a){
        return this.each(function(){
            new jQuery.SelectBox(this,a)
        })
    }
    
});
//if(!window.console)var console={
//    log:function(){}
//};
jQuery.SelectBox=function(a,b){
    function c(a){
        var b=jQuery("li",k);
        if(!b||b.length==0)return!1;
        f+=a;
        f<0?f=b.size():f>b.size()&&(f=0);
        var c=jQuery(b[f]).get(0),a=k.get(0);
        if(c.offsetTop+c.offsetHeight>a.scrollTop+a.clientHeight)a.scrollTop=c.offsetTop+c.offsetHeight-a.clientHeight;
        else if(c.offsetTop<a.scrollTop)a.scrollTop=c.offsetTop;
        b.removeClass(d.hoverClass);
        jQuery(b[f]).addClass(d.hoverClass)
    }
    var d=b||{};
    d.inputClass=d.inputClass||"selectbox";
    d.containerClass=d.containerClass||"selectbox-wrapper";
    d.hoverClass=d.hoverClass||"current";
    d.currentClass=d.selectedClass||"selected";
    d.debug=d.debug||!1;
    var e=a.id,f=0,g=!1,h=0,l=jQuery(a),k=function(a){
        var b=document.createElement("div");
        k=jQuery(b);
        k.attr("id",e+"_container");
        k.addClass(a.containerClass);
        return k
    }
    (d),i=function(a){
        var b=document.createElement("div"),b=jQuery(b);
        b.attr("id",e+"_input");
        b.addClass(a.inputClass);
        b.attr("tabIndex",l.attr("tabindex"));
        return b
    }
    (d);
    l.hide().before(i).before(k);
    k.append(function(){
        var a=document.createElement("ul");
        $ul=jQuery(a);
        l.children("option").each(function(){
            var a=document.createElement("li");
            $li=jQuery(a);
            $li.attr("id",jQuery(this).val());
            $li.addClass(jQuery(this).attr("class"));
            $li.html(jQuery(this).html());
            jQuery(this).is(":selected")||$ul.append($li);
            jQuery(this).is(":selected")&&(i.append("<div id='divselected'></div>"),jQuery("#divselected").text(jQuery(this).html()),jQuery("#divselected").addClass(jQuery(this).attr("xml:lang")),jQuery(a).addClass(d.currentClass));
            jQuery(a).mouseover(function(a){
                h=
                1;
                d.debug&&console.log("over on : "+this.id);
                jQuery(a.target,k).addClass(d.hoverClass)
            }).mouseout(function(a){
                h=-1;
                d.debug&&console.log("out on : "+this.id);
                jQuery(a.target,k).removeClass(d.hoverClass)
            }).click(function(){
                var a=jQuery(this).attr("id");
                location.href=a
            })
        });
        return a
    }
    (i.attr("id"))).hide();
    k.width("5.6em");
    i.click(function(){
        g||k.toggle()
    }).focus(function(){
        k.not(":visible")&&(g=!0,k.show(),i.addClass("noBottomBorder"))
    }).keydown(function(a){
        switch(a.keyCode){
            case 38:a.preventDefault();
            c(-1);
            break;
            case 40:a.preventDefault();
            c(1);
            break;
            case 13:a.preventDefault();
            jQuery("li."+d.hoverClass).trigger("click");
            break;
            case 27:h=0,k.hide()
        }
        
    }).blur(function(){
        k.is(":visible")&&h>0?d.debug&&console.log("container visible and has focus"):jQuery.browser.browser=="Internet Explorer"?document.activeElement.getAttribute("id").indexOf("_container")==-1?(h=0,k.hide(),i.removeClass("noBottomBorder")):i.focus():(h=0,k.hide(),i.removeClass("noBottomBorder"))
    })
};



var tb_pathToImage="/common/view/static/v8/img/icon-loading-circle.gif",screenHeight=tb_getPageSize()[1];
function search_tb_init(a){
    jQuery(a).submit(function(){
        var a=this.rel||!1,c=jQuery("#search").attr("action");
        c+="?q="+escape(jQuery("#search-query").val());
        c+="&s="+escape(jQuery("#search-site").val());
        c+="&l="+escape(jQuery("#search-lang").val());
        c+="&t="+escape(jQuery("#search-template").val());
        c+="&a=1&ie=iso-8859-1&oe=utf-8";
        c+=jQuery("#search-query-load-query").val();
        tb_show(null,c,a);
        this.blur();
        return!1
    });
    imgLoader=new Image;
    imgLoader.src=tb_pathToImage
}
function contentsearch_tb_init(a){
    jQuery(a).submit(function(){
        var a=this.rel||!1,c=jQuery("#contentSearch").attr("action");
        c+="?q="+escape(jQuery("#contentSearch-query").val());
        c+="&s="+escape(jQuery("#contentSearch-site").val());
        c+="&l="+escape(jQuery("#contentSearch-lang").val());
        c+="&t="+escape(jQuery("#contentSearch-template").val());
        c+="&a=1&ie=iso-8859-1&oe=utf-8";
        c+=jQuery("#search-query-load-query").val();
        tb_show(null,c,a);
        this.blur();
        return!1
    });
    imgLoader=new Image;
    imgLoader.src=tb_pathToImage
}
function setTBHeight(){
    jQuery.browser.msie()&&jQuery.browser.version.number()<7&&(jQuery("#TB_window").height(jQuery("#getIE6Height").height()+40),jQuery("#TB_window").css({
        marginTop:"0px"
    }),jQuery("html").css("overflow","scroll"))
}
function tb_init(a){
    jQuery(a).click(function(){
        tb_show(this.title||this.name||null,this.href||this.alt,this.rel||!1);
        this.blur();
        return!1
    });
    imgLoader=new Image;
    imgLoader.src=tb_pathToImage
}
function isIE6(){
    if(jQuery.browser.msie()&&jQuery.browser.version.number()==6)return!0
}
function tb_show(a,b,c){
    isIE6&&(jQuery("#language-select").hide(),jQuery("#berater-widget").hide(),jQuery("#quickfinder select").hide());
    try{
        typeof document.body.style.maxHeight==="undefined"?(jQuery("body","html").css({
            height:"100%",width:"100%"
        }),jQuery("html").css("overflow","hidden"),document.getElementById("TB_HideSelect")===null&&(jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"),jQuery("#TB_overlay").click(tb_remove))):document.getElementById("TB_overlay")===
        null&&(jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"),jQuery("#TB_overlay").click(tb_remove));
        tb_detectMacXFF()?jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack"):jQuery("#TB_overlay").addClass("TB_overlayBG");
        a===null&&(a="");
        jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");
        jQuery("#TB_load").show();
        var d=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/,e=(b.indexOf("?")!==-1?b.substr(0,b.indexOf("?")):b).toLowerCase().match(d);
        if(e==".jpg"||
        e==".jpeg"||e==".png"||e==".gif"||e==".bmp"){
            TB_imageCount=TB_NextHTML=TB_NextURL=TB_NextCaption=TB_PrevHTML=TB_PrevURL=TB_PrevCaption="";
            TB_FoundURL=!1;
            if(c){
                TB_TempArray=jQuery("a[@rel="+c+"]").get();
                for(TB_Counter=0;
                TB_Counter<TB_TempArray.length&&TB_NextHTML==="";
                TB_Counter++)TB_TempArray[TB_Counter].href.toLowerCase().match(d),TB_TempArray[TB_Counter].href!=b?TB_FoundURL?(TB_NextCaption=TB_TempArray[TB_Counter].title,TB_NextURL=TB_TempArray[TB_Counter].href,TB_NextHTML="<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>"):
                (TB_PrevCaption=TB_TempArray[TB_Counter].title,TB_PrevURL=TB_TempArray[TB_Counter].href,TB_PrevHTML="<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>"):(TB_FoundURL=!0,TB_imageCount="Image "+(TB_Counter+1)+" of "+TB_TempArray.length)
            }
            imgPreloader=new Image;
            imgPreloader.onload=function(){
                imgPreloader.onload=null;
                var d=tb_getPageSize(),e=d[0]-150,d=d[1]-150,f=imgPreloader.width,g=imgPreloader.height;
                f>e?(g*=e/f,f=e,g>d&&(f*=d/g,g=d)):g>d&&(f*=d/g,g=d,f>e&&(g*=e/f,f=e));
                TB_WIDTH=f+30;
                TB_HEIGHT=g+60;
                jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+b+"' width='"+f+"' height='"+g+"' alt='"+a+"'/></a><div id='TB_caption'>"+a+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
                jQuery("#TB_closeWindowButton").click(tb_remove);
                if(TB_PrevHTML!==""){
                    var h=function(){
                        jQuery(document).unbind("click",h)&&jQuery(document).unbind("click",
                        h);
                        jQuery("#TB_window").remove();
                        jQuery("body").append("<div id='TB_window'></div>");
                        tb_show(TB_PrevCaption,TB_PrevURL,c);
                        return!1
                    };
                    jQuery("#TB_prev").click(h)
                }
                if(TB_NextHTML!==""){
                    var m=function(){
                        jQuery("#TB_window").remove();
                        jQuery("body").append("<div id='TB_window'></div>");
                        tb_show(TB_NextCaption,TB_NextURL,c);
                        return!1
                    };
                    jQuery("#TB_next").click(m)
                }
                document.onkeydown=function(a){
                    keycode=a==null?event.keyCode:a.which;
                    if(keycode==27)tb_remove();
                    else if(keycode==190){
                        if(TB_NextHTML!="")document.onkeydown=
                        "",m()
                    }
                    else if(keycode==188&&TB_PrevHTML!="")document.onkeydown="",h()
                };
                tb_position();
                jQuery("#TB_load").remove();
                jQuery("#TB_ImageOff").click(tb_remove);
                jQuery("#TB_window").css({
                    display:"block"
                })
            };
            imgPreloader.src=b
        }
        else{
            var f=b.replace(/^[^\?]+\??/,""),g=tb_parseQuery(f);
            TB_WIDTH=g.width*1+30||630;
            TB_HEIGHT=g.height*1+40||440;
            TB_HEIGHT=screenHeight-85;
            ajaxContentW=TB_WIDTH-30;
            ajaxContentH=TB_HEIGHT-45;
            b.indexOf("TB_iframe")!=-1?(urlNoQuery=b.split("TB_"),jQuery("#TB_iframeContent").remove(),g.modal!=
            "true"?jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+a+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1E3)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;' > </iframe>"):(jQuery("#TB_overlay").unbind(),jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+
            urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1E3)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;'> </iframe>"))):jQuery("#TB_window").css("display")!="block"?g.modal!="true"?jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+a+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>Schliessen</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+
            "px'></div>"):(jQuery("#TB_overlay").unbind(),jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px'></div>")):(jQuery("#TB_ajaxContent")[0].scrollTop=0,jQuery("#TB_ajaxWindowTitle").html(a));
            jQuery("#TB_closeWindowButton").click(tb_remove);
            b.indexOf("TB_inline")!=-1?(jQuery("#TB_ajaxContent").append(jQuery("#"+g.inlineId).children()),jQuery("#TB_window").unload(function(){
                jQuery("#"+g.inlineId).append(jQuery("#TB_ajaxContent").children())
            }),tb_position(),
            jQuery("#TB_load").remove(),jQuery("#TB_window").css({
                display:"block"
            })):b.indexOf("TB_iframe")!=-1?(tb_position(),jQuery.browser.safari&&(jQuery("#TB_load").remove(),jQuery("#TB_window").css({
                display:"block"
            }))):jQuery("#TB_ajaxContent").load(b+="&random="+(new Date).getTime(),function(){
                tb_position();
                jQuery("#TB_load").remove();
                tb_init("#TB_ajaxContent a.thickbox");
                jQuery("#TB_window").css({
                    display:"block"
                })
            });
            isIE6()&&(jQuery("#TB_window").height(jQuery("#getIE6Height").innerHeight()+40),jQuery("#TB_window").css({
                marginTop:"0px"
            }))
        }
        if(!g.modal)document.onkeyup=
        function(a){
            keycode=a==null?event.keyCode:a.which;
            keycode==27&&tb_remove()
        }
        
    }
    catch(h){}
}
function tb_showIframe(){
    jQuery("#TB_load").remove();
    jQuery("#TB_window").css({
        display:"block"
    })
}
function tb_remove(){
    isIE6&&(jQuery("#language-select").show(),jQuery("#berater-widget").show(),jQuery("#quickfinder select").show());
    jQuery("#TB_imageOff").unbind("click");
    jQuery("#TB_closeWindowButton").unbind("click");
    jQuery("#TB_window").fadeOut("fast",function(){
        jQuery("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove()
    });
    jQuery("#TB_load").remove();
    typeof document.body.style.maxHeight=="undefined"&&(jQuery("body","html").css({
        height:"auto",width:"auto"
    }),jQuery("html").css("overflow",
    ""));
    document.onkeydown="";
    document.onkeyup="";
    return!1
}
function tb_position(){
    jQuery("#TB_window").css({
        marginLeft:"-208px",width:TB_WIDTH+"px"
    });
    jQuery.browser.msie&&jQuery.browser.version<7||jQuery("#TB_window").css({
        marginTop:"12px"
    })
}
function tb_parseQuery(a){
    var b={};
    if(!a)return b;
    for(var a=a.split(/[;&]/),c=0;
    c<a.length;
    c++){
        var d=a[c].split("=");
        if(d&&d.length==2){
            var e=unescape(d[0]),d=unescape(d[1]),d=d.replace(/\+/g," ");
            b[e]=d
        }
        
    }
    return b
}
function tb_getPageSize(){
    var a=document.documentElement;
    return arrayPageSize=[window.innerWidth||self.innerWidth||a&&a.clientWidth||document.body.clientWidth,window.innerHeight||self.innerHeight||a&&a.clientHeight||document.body.clientHeight]
}
function tb_detectMacXFF(){
    var a=navigator.userAgent.toLowerCase();
    if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1)return!0
};
var ModalLayer=function(){
    var a="modallayer-content",b="Schlie\ufffden",c="#f2f2f2",d=0.5,e="Die gew\ufffdnschten Informationen stehen vor\ufffdbergehend nicht zur Verf\ufffdgung",f="Aufgrund eines technischen Problems k\ufffdnnen wir die weiteren Informationen derzeit nicht zur Verf\ufffdgung stellen. Bitte versuchen Sie es sp\ufffdter noch einmal.",g,h,l,k,i,n=0,q=this;
    this.configure=function(){
        var g=document.createElement("div");
        g.id="modallayer-fadeout";
        g.className="modallayer-fadeout";
        document.body.appendChild(g);
        jQuery("#layer-opacity").length>0&&(d=jQuery("#layer-opacity").val(),jQuery("#modallayer-fadeout").css("opacity",d).css("filter","alpha(opacity="+d+")"));
        jQuery("#layer-background-color").length>0&&(c=jQuery("#layer-background-color").val(),jQuery("#modallayer-fadeout").css("background-color",c));
        jQuery("#layer-error-timeout-title").length>0&&(e=jQuery("#layer-error-timeout-title").val());
        jQuery("#layer-error-timeout-message").length>0&&(f=jQuery("#layer-error-timeout-message").val());
        g=jQuery("#layer-close-text");
        g.length>0&&(b=g.val());
        jQuery("#layer-content-id").length>0&&(a=jQuery("#layer-content-id").val());
        u()
    };
    this.activate=function(){
        m()
    };
    this.loadJSONP=function(a){
        k.html("");
        k.addClass("loading");
        m();
        n=1;
        window.clearTimeout(i);
        i=window.setTimeout(function(){
            o()
        }
        ,5E3);
        a.length>0&&jQuery.ajax({
            type:"GET",url:a,dataType:"jsonp",success:function(a){
                timedOut||(k.removeClass("loading"),window.clearTimeout(i),k.append(a.results))
            }
            ,error:function(){
                timedOut||o()
            }
            
        })
    };
    this.deactivate=function(){
        n=0;
        h.removeClass("active");
        g.removeClass("active")
    };
    var m=function(){
        timedOut=0;
        g.height(jQuery(document).height()).addClass("active");
        var a=jQuery(window).scrollTop()+100;
        h.css("top",a).addClass("active")
    }
    ,o=function(){
        timedOut=1;
        n==1&&(window.clearTimeout(i),k.removeClass("loading"),k.html("<h1>"+e+"</h1><p>"+f+"</p>"))
    }
    ,r=function(){
        return'<div class="modallayer-header header clearfix">'+p()+"</div>"
    }
    ,p=function(){
        return'<a href="#" class="info-right close" id="modallayer-close">'+b+"</a>"
    }
    ,u=function(){
        jQuery("#modallayer-layer").length?
        (h=jQuery("#modallayer-layer"),h.wrapInner("<form></form>"),document.body.appendChild(document.getElementById("modallayer-layer"))):jQuery("body").append('<div id="modallayer-layer" class="modallayer-layer">'+('<div id = "'+a+'" class="modallayer-content">'+r()+'<div class="modallayer-body"></div></div>')+"</div>");
        g=jQuery("#modallayer-fadeout");
        h=jQuery("#modallayer-layer");
        jQuery("#"+a);
        l=jQuery("div#modallayer-layer div.modallayer-header");
        k=jQuery("div#modallayer-layer div.modallayer-body");
        l.length==0&&jQuery("#modallayer-layer").html(r());
        var b=jQuery("#modallayer-close");
        b.length==0&&(l.append(p()),b=jQuery("#modallayer-close"));
        b.bind("click",function(a){
            a.preventDefault();
            q.deactivate()
        });
        h.bgiframe&&h.bgiframe();
        b=jQuery("#modallayer-fadeout");
        b.bgiframe&&b.bgiframe()
    }
    
};
jQuery.fn.replaceWith=function(a){
    return this.each(function(){
        var b=jQuery(this);
        if(a===void 0)b.parent().append(b.html());
        else{
            b.after(a).next().html(b.html());
            for(var c=0;
            c<this.attributes.length;
            c++)b.next().attr(this.attributes[c].nodeName,this.attributes[c].nodeValue)
        }
        b.remove()
    })
};
jQuery.fn.extend({
    getAnchor:function(){
        if(window.location.href.indexOf("#")!=-1){
            var a=window.location.href.split("#");
            if(a[1])return a[1]
        }
        
    }
    
});
function initBeraterToolCalendar(){
    var a=jQuery("input#qf-months-texts").val(),b="";
    a&&(b=a.split(","));
    var c=jQuery("input#qf-weekday-texts-short").val(),a="";
    c&&(a=c.split(","));
    c=jQuery("input#qf-cal-close-text").val();
    calman.config={
        today:new Date,viewPeriodS:parseUserDateInput("01.01.1900"),viewPeriodE:parseUserDateInput("31.12.2099"),dataPeriodS:parseUserDateInput("01.01.1900"),dataPeriodE:parseUserDateInput("31.12.2099"),monthsTexts:b,weekdaysTexts:a,closeText:c,showShortYear:!1,styleClass:"calendardiv",
        useWeekdays:!1
    }
    
}
jQuery.noConflict();
var BAHN={
    key_tab:9,key_return:13,key_space:32,key_backspace:8,key_pageup:33,key_pagedown:34,key_left:37,key_up:38,key_right:39,key_down:40,key_minus:86,key_plus:93,key_add:132,key_substract:140,rowOpenerTimeout:1E3,init:function(){
        BAHN.initDefaults();
        BAHN.initHoverOverButton();
        BAHN.initLanguageSelection();
        BAHN.initRowOpener();
        BAHN.initTabElement();
        BAHN.initNav();
//        BAHN.initAutocomplete();
        BAHN.initFontResize();
        BAHN.initClapContent();
        BAHN.initCountrySelect();
        BAHN.initTooltips();
        BAHN.initScramblecode();
        BAHN.setIntLocationCookie();
        BAHN.initIE6ButtonHover();
        document.createElement("abbr");
        typeof search_tb_init!=="undefined"&&search_tb_init("#search");
        BAHN.initModalLayer()
    }
    ,initDefaults:function(){
        jQuery("input.hasDefault, textarea.hasDefault").blur(BAHN.inputDefaults).focus(BAHN.inputDefaults).click(BAHN.inputDefaults);
        jQuery("input.hasDefault, textarea.hasDefault").blur();
        jQuery("button.deleteDefaults").click(BAHN.delInputDefaults);
        jQuery("input.deleteDefaults").click(BAHN.delInputDefaults);
        jQuery("textarea.deleteDefaults").click(BAHN.delInputDefaults)
    }
    ,
    initRowOpener:function(){
        var a=0;
        BAHN.setFaqTabindex();
        jQuery("#openAll").click(function(){
            BAHN.openRow()
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&BAHN.openRow()
        }).mouseover(function(){
            jQuery(this).toggleClass("active")
        }).mouseout(function(){
            jQuery(this).toggleClass("active")
        });
        jQuery("#closeAll").click(function(){
            BAHN.closeRow()
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&BAHN.closeRow()
        }).mouseover(function(){
            jQuery(this).toggleClass("active")
        }).mouseout(function(){
            jQuery(this).toggleClass("active")
        });
        jQuery("h2.opener, h3.opener").click(function(){
            jQuery(this).stopTime("rowopener");
            a==1&&(a=0,jQuery(this).toggleClass("openerActive"));
            jQuery(this).next().toggle();
            jQuery(this).next().next().toggle();
            a=1
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&(jQuery(this).next().toggle(),jQuery(this).next().next().toggle(),jQuery(this).toggleClass("openerActive"))
        }).mouseover(function(){
            a==1?a=0:jQuery(this).toggleClass("openerActive");
            triggerElement=jQuery(this);
            jQuery(this).oneTime(BAHN.rowOpenerTimeout,
            "rowopener",function(){
                jQuery(this).click()
            })
        }).mouseout(function(){
            jQuery(this).stopTime("rowopener");
            a==1?a=0:jQuery(this).toggleClass("openerActive")
        }).attr(BAHN.nTabindex(),"0");
        if(jQuery("#content h2.opener").length>0){
            var b=parseInt(jQuery(document).getAnchor());
            b>0&&(b=jQuery("h2.opener:eq("+(b-1)+")"),b.toggleClass("openerActive"),b.next().toggle(),b.next().next().toggle())
        }
        jQuery("h2.openSection, a.openSection, h3.openerSection").click(function(){
            BAHN.openSitemapSection(this)
        }).keydown(function(a){
            BAHN.isKeyOk(a)===
            !0&&BAHN.openSitemapSection(this)
        }).mouseover(function(){});
        jQuery("h2.closeSection, a.closeSection, h3.closeSection").click(function(){
            BAHN.closeSitemapSection(this)
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&BAHN.closeSitemapSection(this)
        });
        jQuery("td.opener").click(function(){
            jQuery(this).parent().next().children("td.opener-content").children("div.more").toggle();
            jQuery(this).parent().next().children("td.opener-content").children("div.more").length&&(jQuery(this).parent().toggleClass("active"),
            jQuery(this).parent().next().toggleClass("active"))
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&(jQuery(this).parent().next().children("td.opener-content").children("div.more").toggle(),jQuery(this).parent().next().children("td.opener-content").children("div.more").length&&(jQuery(this).parent().toggleClass("active"),jQuery(this).parent().next().toggleClass("active")))
        }).mouseover(function(){
            jQuery(this).parent().toggleClass("hover")
        }).mouseout(function(){
            jQuery(this).parent().toggleClass("hover")
        }).attr(BAHN.nTabindex(),
        "0");
        jQuery("#a-z-show-hide-button a").click(function(a){
            var b=jQuery("#a-z-toggle-description").val(),e=jQuery("#a-z-show-hide-button a span").text();
            jQuery("#a-z-toggle-description").val(e);
            jQuery("#a-z-show-hide-button a span").text(b);
            a.preventDefault();
            jQuery("div.a-z li li p").toggle()
        });
        BAHN.updateBuffer()
    }
    ,initTabElement:function(){
        jQuery("ul.reiterlist").each(function(){
            jQuery(this).removeClass("hide")
        });
        jQuery("ul.reiterlist li.first").each(function(){
            jQuery(this).addClass("active")
        });
        jQuery("div.tabcontent").hide();
        jQuery("div.t-content-1").show();
        jQuery("ul.reiterlist li a").each(function(){
            jQuery(this).click(BAHN.tabClick);
            jQuery(this).keydown(BAHN.tabClick)
        });
        BAHN.updateBuffer()
    }
    ,tabClick:function(a){
        var b=BAHN.getTarget(a),c=a.type,d=b.nodeName.toLowerCase(),e=a.keyCode,a=!a.altKey&&(e===BAHN.key_return||e===BAHN.key_down||e===BAHN.key_space);
        if(!(d!=="a"||c==="keydown"&&a===!1))return b=jQuery(b),b.parents("ul.reiterlist li").siblings().removeClass("active"),b.parents("ul.reiterlist").siblings("div.tabcontent").hide(),
        b.parents("ul.reiterlist li").addClass("active"),b.parents("div.tabelement ul.reiterlist").siblings("div."+b.attr("aria-controls")).show(),BAHN.updateBuffer(),!1
    }
    ,isKeyOk:function(a){
        a=a.keyCode;
        if(a==BAHN.key_right||a==BAHN.key_down||a==BAHN.key_left||a==BAHN.key_up||a==BAHN.key_return||a==BAHN.key_space)return!0;
        return!1
    }
    ,openSitemapSection:function(a){
        a=jQuery(a).parent().prev();
        a.find("div.threeColumnRow").show();
        a.find("div.liner").hide();
        a.find("h2.opener").addClass("openerActive")
    }
    ,closeSitemapSection:function(a){
        a=
        jQuery(a).parent().prev();
        a.find("div.threeColumnRow").hide();
        a.find("div.liner").show();
        a.find("h2.opener").removeClass("openerActive")
    }
    ,openRow:function(){
        jQuery("div.threeColumnContainer div.threeColumnRow").show();
        jQuery("div.threeColumnContainer div.oneColumnContainerAnswer").show();
        jQuery("div.foldingBox.simple div.foldingBoxRow").show();
        jQuery("div.liner").hide();
        jQuery("h2.opener, h3.opener").addClass("openerActive")
    }
    ,closeRow:function(){
        jQuery("div.threeColumnContainer div.threeColumnRow").hide();
        jQuery("div.threeColumnContainer div.oneColumnContainerAnswer").hide();
        jQuery("div.foldingBox.simple div.foldingBoxRow").hide();
        jQuery("div.liner").show();
        jQuery("h2.opener, h3.opener").removeClass("openerActive")
    }
    ,initHoverOverButton:function(){
        jQuery("button.linkButton").mouseover(function(){
            jQuery("button.linkButton").toggleClass("linkButtonHover")
        });
        jQuery("button.linkButton").mouseout(function(){
            jQuery("button.linkButton").toggleClass("linkButtonHover")
        })
    }
    ,qfInteger:function(a){
        return a?parseFloat(a.replace(/[^\d]*/,
        "")):!1
    }
    ,inputDefaults:function(a){
        var b=jQuery("#"+this.id+"-default").val();
        if(a.type==="blur"&&this.value==="")jQuery(this).val(b);
        else if((a.type==="click"||a.type==="focus")&&this.value===b)return this.value="",!1
    }
    ,delInputDefaults:function(a){
        for(a=oTarget=BAHN.getTarget(a);
        a&&a.tagName.toUpperCase()!=="FORM";
        )a=a.parentNode;
        jQuery("#"+a.id+" :input.hasDefault").click()
    }
    ,initNav:function(){
        var a=!1;
        jQuery("#main-nav a.jhover").mouseover(function(){
            var b=jQuery(this).parent().attr("id");
            jQuery(this).parent().addClass("rollover");
            a&&a!==b&&jQuery("#"+a).removeClass("rollover");
            a=b
        }).focus(function(){
            jQuery(this).parent().addClass("rollover")
        }).blur(function(){
            a&&jQuery("#"+a).removeClass("rollover");
            jQuery(this).parent().removeClass("rollover")
        });
        jQuery("#main-nav-left li h3, #main-nav-left li ul").mouseout(function(){
            a&&jQuery("#"+a).removeClass("rollover");
            jQuery(this).parents("li").removeClass("rollover")
        }).mouseover(function(){
            jQuery(this).parents("li").addClass("rollover")
        }).bgiframe();
        jQuery("#main-nav-right li h3, #main-nav-right li ul").mouseover(function(){
            jQuery(this).parent().addClass("rollover")
        });
        jQuery("#key-visual, #header, #content").mouseover(function(){
            jQuery("#mn-login").removeClass("rollover")
        }).bgiframe();
        jQuery("#main-nav ul ul a").focus(function(){
            jQuery(this).parent().parent().parent().addClass("rollover");
            a=jQuery(this).parents("li").attr("id")
        }).blur(function(){
            a&&jQuery("#"+a).removeClass("rollover");
            jQuery(this).parent().parent().parent().removeClass("rollover")
        });
        jQuery("#main-nav li#mn-login a.jhover").mouseover(function(){
            jQuery("#mn-login-username").focus()
        }).focus(function(){
            jQuery("#mn-login-username").focus();
            jQuery(this).next().addClass("rollover");
            jQuery(this).next().next().addClass("rollover")
        });
        jQuery("#language-selector-layer span").click(function(){
            jQuery(this).parent().toggleClass("active")
        }).focus(function(){
            jQuery(this).parent().toggleClass("active")
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&jQuery(this).parent().toggleClass("active")
        }).attr(BAHN.nTabindex(),"0");
        jQuery("#language-selector-layer").mouseover(function(){
            jQuery(this).addClass("hover")
        }).mouseout(function(){
            jQuery(this).removeClass("hover")
        });
        jQuery("#link-print").click(function(){
            if(window.print)return window.print(),!1
        });
        jQuery("#link-close").click(function(){
            if(window.close)return window.close(),!1
        })
    }
//    ,initAutocomplete:function(){
//        jQuery("#search-ac").length>0&&jQuery("#search-ac").val()==1&&(jQuery("#search-query").autocomplete(null,{
//            multiple:!0,multipleSeparator:" ",customcacheUrl:"/q/l",customcacheSite:jQuery("#search-site").val(),customcacheLang:jQuery("#search-lang").val(),formatItem:function(a){
//                return a
//            }
//            
//        }),(jQuery.browser.safari||
//        jQuery.browser.msie&&jQuery.browser.version<7)&&jQuery("#search-query").keydown(function(a){
//            a.keyCode==BAHN.key_backspace&&jQuery("#search-query").val().length-1>0&&jQuery("#search-query").search()
//        }))
//    }
//    ,initContentSearch:function(){
//        jQuery("#search-ac").length>0&&jQuery("#search-ac").val()==1&&(jQuery("#contentSearch-query").autocomplete(null,{
//            multiple:!0,multipleSeparator:" ",customcacheUrl:"/q/l",customcacheSite:jQuery("#contentSearch-site").val(),customcacheLang:jQuery("#contentSearch-lang").val(),
//            formatItem:function(a){
//                return a
//            }
//            
//        }),(jQuery.browser.safari||jQuery.browser.msie&&jQuery.browser.version<7)&&jQuery("#contentSearch-query").keydown(function(a){
//            a.keyCode==BAHN.key_backspace&&jQuery("#contentSearch-query").val().length-1>0&&jQuery("#contentSearch-query").search()
//        }))
//    }
    ,initIE6ButtonHover:function(){
        jQuery.browser.msie&&jQuery.browser.version<7&&jQuery("button").mouseover(function(){
            jQuery(this).addClass("hover")
        }).mouseout(function(){
            jQuery(this).removeClass("hover")
        })
    }
    ,initLanguageSelection:function(){
        jQuery("#country-select").length>
        0?jQuery("#country-select").selectbox():jQuery("#language-select").length>0&&jQuery("#language-select").change(function(){
            location.href=jQuery("#language-select").val()
        })
    }
    ,initFontResize:function(){
        jQuery("#font-sizer").click(BAHN.fontResize);
        var a=jQuery.cookie("bahn-font");
        a!==""&&BAHN.fontResize(null,a)
    }
    ,fontResize:function(a,b){
        var c=BAHN.getTarget(a),c=a?jQuery(c).attr("class"):b,d=window.location.hostname;
        d!="localhost"&&(d=d.split("."),d.shift(),d="."+d.join("."));
        jQuery("body").attr("class",
        c);
        jQuery.cookie("bahn-font",c,{
            expires:"",path:"/",domain:d
        });
        return!1
    }
    ,css:function(a,b){
        return parseInt(jQuery.css(a[0],b),10)||0
    }
    ,width:function(a){
        return a[0].offsetWidth+BAHN.css(a,"marginLeft")+BAHN.css(a,"marginRight")
    }
    ,updateBuffer:function(){
        jQuery("#bufferUpdater").val(Math.random())
    }
    ,getTarget:function(a){
        if(!a)return!1;
        return a.target||a.srcElement
    }
    ,setTabindex:function(a){
        jQuery("#carousel a").attr(BAHN.nTabindex(),"-1");
        jQuery("a",a).removeAttr(BAHN.nTabindex())
    }
    ,nTabindex:function(){
        return jQuery.browser.msie?
        "tabIndex":"tabindex"
    }
    ,setFaqTabindex:function(){
        jQuery("h2.opener").attr(BAHN.nTabindex(),"0");
        jQuery("h2#openAll").attr(BAHN.nTabindex(),"0");
        jQuery("h2#closeAll").attr(BAHN.nTabindex(),"0")
    }
    ,optionTextSorter:function(a,b){
        return a.text!==b.text?a.text<b.text?-1:1:0
    }
    ,initScramblecode:function(){
        BAHN.initScramblecodeRCP();
        BAHN.initScramblecodeRCPSND();
        BAHN.initScramblecodeFM()
    }
    ,initScramblecodeRCP:function(){
        jQuery("form.validate-rcp input.rcp")&&jQuery("form.validate-rcp input.rcp").change(function(){
            var a=
            "/pbin/scramble.pl?m=a;X=R:"+encodeURI(jQuery("form.validate-rcp input.rcp").val());
            jQuery.getJSON(a,function(a){
                jQuery("form.validate-rcp img.scramble").attr({
                    src:a.img,width:a.width,heigth:a.height
                });
                jQuery("form.validate-rcp input.scramble").val(a.scramble);
                jQuery("form.validate-rcp div.jsscramble").removeClass("jsscramble")
            })
        })
    }
    ,initScramblecodeRCPSND:function(){
        jQuery("form.validate-rcp-snd input.rcp")&&jQuery("form.validate-rcp-snd input.snd")&&(jQuery("form.validate-rcp-snd input.rcp").change(function(){
            if(!(jQuery("form.validate-rcp-snd input.rcp").val().length==
            0||jQuery("form.validate-rcp-snd input.snd").val().length==0)){
                var a="/pbin/scramble.pl?m=a;X=R:"+encodeURI(jQuery("form.validate-rcp-snd input.rcp").val())+";X=S:"+encodeURI(jQuery("form.validate-rcp-snd input.snd").val());
                jQuery.getJSON(a,function(a){
                    jQuery("form.validate-rcp-snd img.scramble").attr({
                        src:a.img,width:a.width,heigth:a.height
                    });
                    jQuery("form.validate-rcp-snd input.scramble").val(a.scramble);
                    jQuery("form.validate-rcp-snd div.jsscramble").removeClass("jsscramble")
                })
            }
            
        }),jQuery("form.validate-rcp-snd input.snd").change(function(){
            if(!(jQuery("form.validate-rcp-snd input.rcp").val().length==
            0||jQuery("form.validate-rcp-snd input.snd").val().length==0)){
                var a="/pbin/scramble.pl?m=a;X=R:"+encodeURI(jQuery("form.validate-rcp-snd input.rcp").val())+";X=S:"+encodeURI(jQuery("form.validate-rcp-snd input.snd").val());
                jQuery.getJSON(a,function(a){
                    jQuery("form.validate-rcp-snd img.scramble").attr({
                        src:a.img,width:a.width,heigth:a.height
                    });
                    jQuery("form.validate-rcp-snd input.scramble").val(a.scramble);
                    jQuery("form.validate-rcp-snd div.jsscramble").removeClass("jsscramble")
                })
            }
            
        }))
    }
    ,initScramblecodeFM:function(){
        jQuery("form .scramblethis").each(function(){
            jQuery(this).attr("name");
            jQuery(this).change(function(){
                var a=1,b="",c=[];
                jQuery("form input.scramblethis[type=checkbox], form input.scramblethis[type=radio]").each(function(){
                    jQuery(this).is(":checked")?(c[jQuery(this).attr("name")]=1,b+=";X="+jQuery(this).attr("name")+":"+encodeURI(jQuery(this).val())):c[jQuery(this).attr("name")]==void 0&&(c[jQuery(this).attr("name")]=0)
                });
                for(var d in c)c[d]||(a=0);
                jQuery("form select.scramblethis, form textarea.scramblethis, form input.scramblethis[type!=checkbox][type!=radio]").each(function(){
                    jQuery(this).val().length==
                    0&&(a=0);
                    b+=";X="+jQuery(this).attr("name")+":"+encodeURI(jQuery(this).val())
                });
                a&&jQuery.getJSON("/pbin/scramble.pl?m=a"+b,function(a){
                    jQuery("form img.scramble").attr({
                        src:a.img,width:a.width,heigth:a.height
                    });
                    jQuery("form input.scramble").val(a.scramble);
                    jQuery("form div.jsscramble").removeClass("jsscramble");
                    jQuery("form fieldset.jsscramble_forms").removeClass("jsscramble_forms")
                })
            })
        })
    }
    ,initClapContent:function(){
        if(jQuery("#inhalt h2.clap").length||jQuery("#inhalt h3.clap").length){
            var a=0;
            jQuery("#inhalt h2.clap, #inhalt h3.clap").click(function(){
                a==
                1&&(a=0,jQuery(this).toggleClass("clap-active"));
                jQuery(this).children("div.clap-content").length?jQuery(this).children("div.clap-content").toggle():jQuery(this).parent().next().children("div.clap-content").length&&jQuery(this).parent().next().children("div.clap-content").toggle();
                a=1
            }).keydown(function(a){
                BAHN.isKeyOk(a)===!0&&(jQuery(this).children("div.clap-content").length?jQuery(this).children("div.clap-content").toggle():jQuery(this).parent().next().children("div.clap-content").length&&jQuery(this).parent().next().children("div.clap-content").toggle(),
                jQuery(this).toggleClass("clap-active"))
            }).mouseover(function(){
                a==1?a=0:jQuery(this).toggleClass("clap-active")
            }).mouseout(function(){
                a==1?a=0:jQuery(this).toggleClass("clap-active")
            }).attr(BAHN.nTabindex(),"0")
        }
        jQuery("#inhalt #open-all-clap-content").length&&jQuery("#inhalt div.clap-content").length&&(jQuery("#inhalt h2.clap").length||jQuery("#inhalt h3.clap").length)&&jQuery("#open-all-clap-content").click(function(){
            jQuery("#inhalt h2.clap").length?jQuery("#inhalt h2.clap").addClass("clap-active"):
            jQuery("#inhalt h3.clap")&&jQuery("#inhalt h3.clap").addClass("clap-active");
            jQuery("#inhalt div.clap-content").show()
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&(jQuery("#inhalt h2.clap").length?jQuery("#inhalt h2.clap").addClass("clap-active"):jQuery("#inhalt h3.clap")&&jQuery("#inhalt h3.clap").addClass("clap-active"),jQuery("#inhalt div.clap-content").show())
        }).mouseover(function(){
            jQuery(this).toggleClass("clap-active")
        }).mouseout(function(){
            jQuery(this).toggleClass("clap-active")
        });
        jQuery("#inhalt #close-all-clap-content").length&&
        jQuery("#inhalt div.clap-content").length&&(jQuery("#inhalt h2.clap").length||jQuery("#inhalt h3.clap").length)&&jQuery("#close-all-clap-content").click(function(){
            jQuery("#inhalt h2.clap").length?jQuery("#inhalt h2.clap").removeClass("clap-active"):jQuery("#inhalt h3.clap")&&jQuery("#inhalt h3.clap").removeClass("clap-active");
            jQuery("#inhalt div.clap-content").hide()
        }).keydown(function(a){
            BAHN.isKeyOk(a)===!0&&(jQuery("#inhalt h2.clap").length?jQuery("#inhalt h2.clap").removeClass("clap-active"):
            jQuery("#inhalt h3.clap")&&jQuery("#inhalt h3.clap").removeClass("clap-active"),jQuery("#inhalt div.clap-content").hide())
        }).mouseover(function(){
            jQuery(this).toggleClass("clap-active")
        }).mouseout(function(){
            jQuery(this).toggleClass("clap-active")
        })
    }
    ,initTooltips:function(){
        jQuery(".showtt").each(function(){
            jQuery(this).tooltip({
                track:!0,delay:0,fade:250
            })
        })
    }
    ,initCountrySelect:function(){
        var a=["che","bel","deu"];
        jQuery("#country-select-large")&&(jQuery("#country-map area").click(function(b){
            var c=
            jQuery(this).attr("country");
            jQuery.inArray(c,a)!="-1"&&(b.preventDefault(),BAHN.showCountryLanguagesLayer(b,c))
        }),jQuery("#country-map area").mouseover(function(){
            var a=jQuery(this).attr("country");
            jQuery("div#country-select-large .map").hide();
            jQuery("#country_"+a).show();
            jQuery("ul.countries span."+a).addClass("lihover");
            a=="oc"&&jQuery("ul.countries span.usa").addClass("lihover")
        }),jQuery("#country-map area").mouseout(function(){
            var a=jQuery(this).attr("country");
            jQuery("#country_"+jQuery(this).attr("country")).hide();
            jQuery("ul.countries span."+a).removeClass("lihover");
            a=="oc"&&jQuery("ul.countries span.usa").removeClass("lihover")
        }),jQuery("ul.countries li span").mouseover(function(){
            var a=jQuery(this).attr("class");
            a=="usa"&&(a="oc");
            jQuery("#country_"+a).show()
        }),jQuery("ul.countries li span").mouseout(function(){
            var a=jQuery(this).attr("class");
            a=="usa"&&(a="oc");
            jQuery("#country_"+a).hide()
        }),jQuery(".countries .bel").click(function(a){
            a.preventDefault();
            BAHN.showCountryLanguagesLayer(a,"bel")
        }),jQuery(".countries .che").click(function(a){
            a.preventDefault();
            BAHN.showCountryLanguagesLayer(a,"che")
        }),jQuery(".countries .deu").click(function(a){
            a.preventDefault();
            BAHN.showCountryLanguagesLayer(a,"deu")
        }),jQuery("div.close").click(function(){
            jQuery(".country-languages-layer, #country-select-large .map").hide();
            jQuery("ul.countries span.bel").removeClass("lihover");
            jQuery("ul.countries span.che").removeClass("lihover");
            jQuery("ul.countries span.deu").removeClass("lihover")
        }),jQuery.browser.msie&&jQuery.browser.version<7&&jQuery("#country-map area").trigger("mouseout"))
    }
    ,
    showCountryLanguagesLayer:function(a,b){
        var c=a?a:window.event,d=c.clientX+jQuery("html").scrollLeft()-jQuery("#country-select-large").offset().left,e=c.clientY+jQuery("html").scrollTop()-jQuery("#country-select-large").offset().top,f=jQuery(".country-languages-layer").outerHeight()+10,c=jQuery(".country-languages-layer").outerWidth(),g=jQuery("#country-select-large").outerHeight(),h=jQuery("#country-select-large").outerWidth()-2,e=e-f>0?e-f:e+f>g?g-f+5:e-70,d=d-c*0.75<0?2:d+c*0.25>h?h-200:d;
        jQuery(".country-languages-layer").hide();
        jQuery("#country-languages-layer_"+b).css("top",e-20).css("left",d).show();
        jQuery("#country-languages-layer_"+b).mouseover(function(){
            jQuery("#country_"+b).show()
        });
        jQuery("ul.countries span."+b).addClass("lihover")
    }
    ,setIntLocationCookie:function(){
        if(jQuery("#p-intredirect").length>0&&jQuery("#p-intredirect").val()==1){
            var a=["DEUT/de","MLT/ml"],b=jQuery.cookie("bahn-intlocation");
            b.length>0&&jQuery.inArray(b,a)==-1&&window.location.replace("http://www.bahn.de/i/view/"+b+"/index.shtml")
        }
        else jQuery("#p-intlocation").length>
        0&&jQuery.cookie("bahn-intlocation",jQuery("#p-intlocation").val(),{
            expires:"",path:"/"
        })
    }
    ,initPraemienlayer:function(){
        var a=jQuery("input#layer-content-id"),b=jQuery("input#layer-praemiendetails-url");
        a.length>0&&a.val()=="praemienlayer-content"&&b.length>0&&jQuery("div.cf-praemien a.praemie").click(function(a){
            a.preventDefault();
            BAHN.modalLayer.loadJSONP(b.val()+"?q="+this.href)
        })
    }
    ,initModalLayer:function(){
        BAHN.modalLayer=new ModalLayer;
        BAHN.modalLayer.configure();
        BAHN.initPraemienlayer()
    }
    
};
jQuery(document).ready(function(){
    BAHN.init()
});
var PORTAL={
    aCampaignImg:[],bcbToolTipData:[],init:function(){
        PORTAL.initHomeSchnelleinstieg();
        PORTAL.carouselInit();
        PORTAL.initDbCmf();
        PORTAL.initFAQ();
        PORTAL.initPOPUP();
        PORTAL.initClickTracker();
        PORTAL.initServicemenu();
        PORTAL.initQuickfinderStadtverkehr();
        PORTAL.initRegioSelect();
        PORTAL.initAccordionBox();
        PORTAL.initStageMenu();
        PORTAL.initFormFahrgastrechte();
        PORTAL.initBeraterToolsWidget();
        PORTAL.initBcbToolTips();
        PORTAL.initBcbFormSubmit();
        jQuery(window).load(PORTAL.initCampaignTool)
    }
    ,initDbCmf:function(){
        var a=
        /dbkanal_(\d*)/.exec(document.URL);
        if(a!=null){
            var b=window.location.hostname;
            b!="localhost"&&(b=b.split("."),b.shift(),b="."+b.join("."));
            jQuery.cookie("bahn-cmf",a[0],{
                expires:1,path:"/",domain:b
            })
        }
        
    }
    ,initFAQ:function(){
        jQuery("a[target='faq']").click(function(){
            if(window.open)return window.open(this.href,"FAQ","menubar=no,status=no,location=no,resizeable=no,toolbar=no"),!1
        })
    }
    ,initPOPUP:function(){
        jQuery("a[target='popup']").click(function(){
            if(window.open)return window.open(this.href,"popup","menubar=no,status=no,location=no,resizeable=no,toolbar=no"),
            !1
        })
    }
    ,initClickTracker:function(){
        jQuery(".clicktracker").click(function(a){
            var a=BAHN.getTarget(a),b=jQuery(a).attr("id"),c=s_gi(s_account);
            b.length==0&&(b=jQuery(a).parent().attr("id"));
            c.tl(this,"o",b)
        })
    }
    ,initHomeSchnelleinstieg:function(){
        jQuery("#schnelleinstieg h3").each(function(a){
            jQuery(this).attr("aria-controls","s-content-"+(a+1))
        }).attr(BAHN.nTabindex(),"0").removeClass("open");
        jQuery("#schnelleinstieg h3.first").addClass("open");
        jQuery("#schnelleinstieg").mouseover(function(a){
            PORTAL.accordeonHover(a);
            jQuery(this).oneTime(BAHN.rowOpenerTimeout,"rowopener",function(){
                PORTAL.accordeonClick(a)
            })
        }).focus(PORTAL.accordeonHover).mouseout(function(a){
            PORTAL.accordeonHover(a);
            jQuery(this).stopTime("rowopener")
        }).blur(PORTAL.accordeonHover).click(function(a){
            PORTAL.accordeonClick(a);
            jQuery(this).stopTime("rowopener")
        }).keydown(PORTAL.accordeonClick)
    }
    ,accordeonHover:function(a){
        var b=BAHN.getTarget(a),a=a.type;
        if(b.nodeName.toLowerCase()==="h3"){
            var b=jQuery(b),a=a==="mouseover"||a==="focus",c=b.next().css("display")===
            "block";
            a&&c||!a&&!c?b.removeClass("open"):b.addClass("open")
        }
        
    }
    ,accordeonClick:function(a){
        var b=BAHN.getTarget(a),c=a.type,d=b.nodeName.toLowerCase(),e=a.keyCode,a=!a.altKey&&(e===BAHN.key_return||e===BAHN.key_down||e===BAHN.key_space);
        if(!(d!=="h3"||c==="keydown"&&a===!1))return jQuery("h3","#schnelleinstieg").removeClass("open"),jQuery("div","#schnelleinstieg").hide(),jQuery("div.foldingBoxRow",this).hide(),jQuery(b).addClass("open").next().show(),BAHN.updateBuffer(),!1
    }
    ,carouselInit:function(){
        var a=
        jQuery("#carousel"),b;
        a.length>0&&(function(){
            jQuery.fn.jCarouselLite=function(a){
                a=jQuery.extend({
                    btnPrev:jQuery("#carousel-prev"),btnNext:jQuery("#carousel-next"),btnGo:null,mouseWheel:!1,auto:null,speed:300,easing:null,vertical:!1,circular:!0,visible:2,start:0,scroll:2,beforeStart:null,afterEnd:null,autorotate:!0
                }
                ,a||{});
                return this.each(function(){
                    function d(b){
                        e||(b<=a.start-i-1?(h.css(f,-((q-i*2)*o)+"px"),m=b==a.start-i-1?q-i*2-1:q-i*2-a.scroll):b>=q-i+1?(h.css(f,-(i*o)+"px"),m=b==q-i+1?i+1:
                        i+a.scroll):m=b,e=!0,h.animate({
                            left:-(m*o)
                        }
                        ,a.speed,a.easing,function(){
                            BAHN.setTabindex(n.slice(m).slice(0,i));
                            BAHN.updateBuffer();
                            e=!1
                        }));
                        return!1
                    }
                    var e=!1,f="left",g=jQuery("#carousel-wrapper"),h=jQuery("#carousel"),l=h.children("li"),k=l.size(),i=a.visible;
                    h.prepend(l.slice(k-i-1+1).clone()).append(l.slice(0,i).clone());
                    a.start+=i;
                    var n=h.children("li"),q=n.size(),m=a.start;
                    g.css("visibility","visible");
                    BAHN.setTabindex(n.slice(m).slice(0,i));
                    var o=BAHN.width(n);
                    h.css("width",o*q+16+"px").css(f,
                    -(m*o));
                    a.btnPrev&&jQuery(a.btnPrev).removeAttr("aria-disabled").attr(BAHN.nTabindex(),0).click(function(){
                        window.clearInterval(r);
                        p=!1;
                        jQuery("#carousel-pause").attr("title","Fortfahren");
                        return d(m-a.scroll)
                    }).keydown(function(e){
                        if(!e.altKey)if((b=e.keyCode)&&(b==BAHN.key_return||b==BAHN.key_left||b==BAHN.key_up))return d(m-a.scroll);
                        else if(b==BAHN.key_right||b==BAHN.key_down)return d(m+a.scroll)
                    });
                    a.btnNext&&jQuery(a.btnNext).removeAttr("aria-disabled").attr(BAHN.nTabindex(),0).click(function(){
                        window.clearInterval(r);
                        p=!1;
                        jQuery("#carousel-pause").attr("title","Fortfahren");
                        return d(m+a.scroll)
                    }).keydown(function(e){
                        if(!e.altKey)if((b=e.keyCode)&&(b==BAHN.key_return||b==BAHN.key_right||b==BAHN.key_down))return d(m+a.scroll);
                        else if(b==BAHN.key_left||b==BAHN.key_up)return d(m-a.scroll)
                    });
                    jQuery("#carousel-pause")&&jQuery("#carousel-pause").removeAttr("aria-disabled").attr(BAHN.nTabindex(),0).click(function(){
                        p?(window.clearInterval(r),p=!1,jQuery("#carousel-pause").attr("title","Fortfahren")):(d(m+a.scroll),r=
                        window.setInterval(function(){
                            d(m+a.scroll)
                        }
                        ,u),p=!0,jQuery("#carousel-pause").attr("title","Anhalten"))
                    });
                    var r,p=!1,u=9E3;
                    a.autorotate&&(r=window.setInterval(function(){
                        d(m+a.scroll)
                    }
                    ,u),p=!0)
                })
            }
            
        }
        (jQuery),a.jCarouselLite())
    }
    ,initServicemenu:function(){
        PORTAL.initServiceSelect()
    }
    ,initServiceSelect:function(){
        jQuery("#frmservicemenu").append('<select id="0data_servicegroup_basis" onchange="PORTAL.setServicemenu(this.value)">');
        jQuery("#0data_servicegroup_basis").append('<option value="0">Alle Services</option>');
        jQuery("#0data_servicegroup_basis").append('<option value="3">Vielfahrer und Pendler</option>');
        jQuery("#0data_servicegroup_basis").append('<option value="1">Gesch&auml;ftlich unterwegs</option>');
        jQuery("#0data_servicegroup_basis").append('<option value="4">Reisen mit Kindern</option>');
        jQuery("#0data_servicegroup_basis").append('<option value="8">Senioren</option>');
        jQuery("#0data_servicegroup_basis").append('<option value="6">Barrierefreies Reisen</option>');
        jQuery("#frmservicemenu").append("</select>")
    }
    ,
    setServicemenu:function(a){
        a=="0"?jQuery(".threeColumnRow").find("li").removeClass("inactive"):jQuery(".threeColumnRow").find("li").each(function(){
            rel=this.getAttribute("rel");
            bit=rel.substr(a-1,1);
            this.className=bit=="1"?"":"inactive"
        })
    }
    ,initCampaignTool:function(){
        var a=document.getElementById("kampagnen");
        document.getElementById("key-visual-content");
        a&&(jQuery("input.cvalue","#kampagnen-defaults").each(function(a){
            var c=jQuery(this).val().split("::");
            PORTAL.aCampaignImg[a]=new Image;
            PORTAL.aCampaignImg[a].src=
            c[0];
            PORTAL.aCampaignImg[a].alt=c[1];
            PORTAL.aCampaignImg[a].longdesc=c[2]
        }),jQuery(a).mouseover(PORTAL.campaignHover).mouseout(PORTAL.campaignOut).bind("focusin",PORTAL.campaignHover).bind("focusout",PORTAL.campaignOut),a.addEventListener&&(a.addEventListener("focus",PORTAL.campaignHover,!0),a.addEventListener("blur",PORTAL.campaignOut,!0)),a.attachEvent&&(a.attachEvent("focus",PORTAL.campaignHover),a.attachEvent("blur",PORTAL.campaignOut)))
    }
    ,campaignHover:function(a){
        var b=BAHN.getTarget(a),a=b.nodeName.toLowerCase(),
        b=jQuery(b).attr("id");
        a==="a"&&PORTAL.campaignReplaceImage(b)
    }
    ,campaignOut:function(a){
        var b=BAHN.getTarget(a),a=b.nodeName.toLowerCase(),b=jQuery(b),c=b.attr("id");
        BAHN.qfInteger(c);
        a==="a"&&PORTAL.campaignMarkLink(b)
    }
    ,campaignReplaceImage:function(a){
        var a=BAHN.qfInteger(a),b=PORTAL.aCampaignImg[a-1];
        if(b)jQuery("#key-visual-content").attr("href",b.longdesc),jQuery("#key-visual img").attr("alt",b.alt),a=document.createElement("img"),a.src=b.src,a.id="key-visual-replacement",document.getElementById("key-visual").appendChild(a),
        jQuery("#key-visual-content img").fadeOut("fast",function(){
            jQuery("#key-visual-content img").show().attr("src",b.src).css("opacity","1");
            jQuery("#key-visual-replacement").remove()
        })
    }
    ,campaignMarkLink:function(a){
        a.parent().attr("class","active");
        jQuery("#kampagnen a").not(jQuery(a)).parent().removeAttr("class");
        BAHN.updateBuffer()
    }
    ,initQuickfinderStadtverkehr:function(){
        jQuery("#quickfinder-stadtverkehr ul.tablist a").click(function(a){
            a.preventDefault();
            jQuery("#quickfinder-stadtverkehr div.wrapper").toggleClass("with-linklist");
            jQuery("#qf-stadtverkehr-content").toggle()
        })
    }
    ,initRegioSelect:function(){
        jQuery("#regioselect")&&(jQuery("#regiomap area").mouseover(function(a){
            var b=a?a:window.event,a=b.clientX+jQuery("html").scrollLeft()-jQuery("#regioselect").offset().left,c=b.clientY+jQuery("html").scrollTop()-jQuery("#regioselect").offset().top,b=jQuery(this).attr("rel"),d=jQuery("#"+b+"-tt").outerHeight()+10,e=jQuery("#"+b+"-tt").outerWidth(),f=jQuery("#regioselect").outerHeight(),g=jQuery("#regioselect").outerWidth()-2,
            c=c-d>0?c-d:c+d>f?f-d+5:c+10,a=a-e*0.75<0?2:a+e*0.25>g?g-200:a-e*0.75;
            jQuery("#"+b).show();
            jQuery("#"+b+"-tt").css("top",c).css("left",a).show()
        }),jQuery("#regiomap area").mouseout(function(){
            var a=jQuery(this).attr("rel");
            jQuery("#"+a+", #"+a+"-tt").hide()
        }))
    }
    ,initAccordionBox:function(){
        jQuery(".foldingBox.accordeon h3").attr(BAHN.nTabindex(),"0").removeClass("open");
        jQuery(".foldingBox.accordion h3.first").addClass("open");
        jQuery(".foldingBox.accordion").mouseover(PORTAL.accordeonHover).focus(PORTAL.accordeonHover).mouseout(PORTAL.accordeonHover).blur(PORTAL.accordeonHover).click(PORTAL.accordeonClick).keydown(PORTAL.accordeonClick)
    }
    ,
    initFormFahrgastrechte:function(){
        jQuery("#cf-fahrgastrechte")&&(jQuery("#cf-fahrgastrechte-ausfallversp").change(function(){
            var a=jQuery(this).val();
            a.length===0&&(jQuery("#cf-fahrgastrechte-zugausfall").hide(),jQuery("#cf-fahrgastrechte-anschlussverpasst").hide());
            a==="verspaetet"&&(jQuery("#cf-fahrgastrechte-zugausfall").hide(),jQuery("#cf-fahrgastrechte-anschlussverpasst").show());
            a==="ausgefallen"&&(jQuery("#cf-fahrgastrechte-zugausfall").show(),jQuery("#cf-fahrgastrechte-anschlussverpasst").hide())
        }).change(),
        jQuery("#cf-fahrgastrechte-entschaedigung").change(function(){
            var a=jQuery(this).val();
            if(a.length===0||a==="gutscheinvk25"||a==="auszahlungvk26")jQuery("#cf-fahrgastrechte-persdata").hide(),jQuery("#cf-fahrgastrechte-bankverbindung").hide();
            a==="gutscheinpost27"&&(jQuery("#cf-fahrgastrechte-persdata").show(),jQuery("#cf-fahrgastrechte-bankverbindung").hide());
            a==="ueberwsg28"&&(jQuery("#cf-fahrgastrechte-persdata").show(),jQuery("#cf-fahrgastrechte-bankverbindung").show())
        }).change())
    }
    ,initBeraterToolsWidget:function(){
        PORTAL.initTabs();
        PORTAL.initBeraterToolDatepickers();
        PORTAL.initFilterRegionByCountry();
        PORTAL.initFilterFlugTyp();
        PORTAL.initBeraterFormSubmit();
        jQuery("#content-shadow span.calendar-nav a, #berater-widget span.calendar-nav a").click(PORTAL.tabSetDate);
        PORTAL.initTarifberater()
    }
    ,initTabs:function(){
        var a=jQuery("#berater-widget ul.tablist"),b=0;
        jQuery("#berater-widget ul.tablist li").attr(BAHN.nTabindex(),"-1");
        jQuery("#berater-widget ul.tablist li.active").attr(BAHN.nTabindex(),"0");
        jQuery("#berater-widget ul.tablist a").attr("rel",
        "link").removeAttr("href").click(function(){
            jQuery(this).parent("li").focus();
            return!1
        });
        jQuery("#berater-widget ul.tablist input:radio").click(function(){
            jQuery(this).parent("li").focus();
            return!0
        });
        jQuery("#berater-widget ul.tablist a").replaceWith();
        jQuery("#berater-widget ul.tablist nobr").replaceWith();
        for(jQuery("#berater-widget ul.tablist input.radio, #berater-widget ul.tablist a").click(function(){
            jQuery(this).parent().bind("click",PORTAL.onTabClick).click()
        });
        a[b];
        )a[b].addEventListener?
        (a[b].addEventListener("click",PORTAL.onTabClick,!0),a[b].addEventListener("focus",PORTAL.onTabClick,!0),a[b].addEventListener("keydown",PORTAL.onTabKeydown,!1),a[b].addEventListener("keypress",PORTAL.onTabKeypress,!1)):a[b].attachEvent&&jQuery("#berater-widget ul.tablist").bind("click",PORTAL.onTabClick).keydown(PORTAL.onTabKeydown).keypress(PORTAL.onTabKeypress),b++
    }
    ,onTabClick:function(a){
        if(typeof a.type!=="undefined")var b=a||window.event;
        a=typeof b!=="undefined"?BAHN.getTarget(b):a;
        b=jQuery(a).siblings("li.active");
        b.length>0&&(b.removeClass("active").attr(BAHN.nTabindex(),"-1"),b=b.attr("id").replace(/(tab-)([0-9])/,"tabpanel-$2"),jQuery("#"+b).removeClass("active"),jQuery(a).addClass("active").attr(BAHN.nTabindex(),"0").focus(),b=jQuery(a).attr("id").replace(/(tab-)([0-9])/,"tabpanel-$2"),jQuery("#"+b).addClass("active"),jQuery(a).children("input.radio").addClass("checked").attr("checked","checked"),BAHN.updateBuffer())
    }
    ,initBeraterToolDatepickers:function(){
        initBeraterToolCalendar();
        jQuery("#content-shadow span.date-picker a, #berater-widget span.date-picker a").each(function(a){
            var b=
            jQuery(this).attr("aria-controls"),c=jQuery("#"+b).attr("name"),d,e,f=0;
            do d=a+8+f,e="callink"+d,f++;
            while(calman.calcons[e]!==void 0||jQuery("#"+e).length);
            jQuery(this).attr("id",e);
            qfInitCalendar(d.toString(),b,c);
            jQuery(this).click(function(){
                return calman.toggleDisplay(e)
            })
        })
    }
    ,tabSetDate:function(a){
        var b=BAHN.getTarget(a),b=b.nodeName.toLowerCase()=="img"?jQuery(b).parent():jQuery(b),a=b.attr("aria-controls"),c=jQuery("#"+a),d=[],e=[];
        d[a]=PORTAL.tabGetDate(c);
        e[a]=d[a]=b.attr("class").indexOf("next")!=
        -1?new Date(d[a].getTime()-864E5):new Date(d[a].getTime()+864E5);
        b=e[a].getDate();
        b=b<10?"0"+b:b;
        d=e[a].getMonth()+1;
        c.val(b+"."+(d<10?"0"+d:d)+"."+e[a].getFullYear());
        return!1
    }
    ,tabGetDate:function(a){
        var a=a.val().split("."),b=new Date;
        b.setYear(a[2]);
        b.setMonth(a[1]-1);
        b.setDate(a[0]);
        return b
    }
    ,onTabKeydown:function(a){
        var a=a||window.event,b=new PORTAL.KeyObject(a);
        b.oTarget.id.match(/[tab-]([0-9]*)/);
        if((b.iKey===BAHN.key_left||b.iKey===BAHN.key_up)&&!b.bAltKey&&!b.bShiftKey&&!b.bCtrlKey||b.iKey===
        BAHN.key_tab&&b.bCtrlKey&&b.bShiftKey){
            if(jQuery(b.oTarget).is(":first-child"))PORTAL.onTabClick(jQuery(b.oTarget).siblings(":last"));
            else PORTAL.onTabClick(jQuery(b.oTarget).prev());
            PORTAL.stopPropagation(a)
        }
        else if((b.iKey===BAHN.key_right||b.iKey===BAHN.key_down)&&!b.bAltKey&&!b.bShiftKey&&!b.bCtrlKey||b.iKey===BAHN.key_tab&&b.bCtrlKey&&!b.bShiftKey){
            if(jQuery(b.oTarget).is(":last-child"))PORTAL.onTabClick(jQuery(b.oTarget).siblings(":first"));
            else PORTAL.onTabClick(jQuery(b.oTarget).next());
            PORTAL.stopPropagation(a)
        }
        
    }
    ,
    onTabKeypress:function(a){
        var a=a||window.event,b=new PORTAL.KeyObject(a);
        ((b.iKey===BAHN.key_left||b.iKey===BAHN.key_up||b.iKey===BAHN.key_right||b.iKey===BAHN.key_down)&&!b.bAltKey&&!b.bShiftKey&&!b.bCtrlKey||b.iKey===BAHN.key_tab&&b.bCtrlKey)&&PORTAL.stopPropagation(a)
    }
    ,stopPropagation:function(a){
        a.stopPropagation&&a.stopPropagation();
        a.preventDefault&&a.preventDefault();
        a.cancelBubble=!0;
        return a.returnValue=!1
    }
    ,KeyObject:function(a){
        return{
            iKey:a.keyCode,bCtrlKey:a.ctrlKey,bAltKey:a.altKey,
            bShiftKey:a.shiftKey,oTarget:BAHN.getTarget(a)
        }
        
    }
    ,checkRadioButton:function(a){
        var b=a+" > input.radio";
        jQuery(a).hasClass("active")&&jQuery(a).children(".radio")&&jQuery(b).attr("checked","checked")
    }
    ,initFilterRegionByCountry:function(){
        if(jQuery("#berater-widget select.land").length){
            var a="";
            jQuery("#berater-widget select.land").change(function(){
                var b=this.value,c=b.split("_"),d="#"+jQuery(this).attr("rel");
                if(b==""&&a!="")jQuery(d).html(a);
                else if(c.length>2){
                    for(var b=[],e=0,f=0;
                    f<c.length;
                    ++f)c[f].length==
                    2&&c[f]===c[f].toUpperCase()&&(b[e++]="_"+c[f]+"_");
                    if(jQuery(d).length){
                        a!=""&&jQuery(d).html(a);
                        for(var c=jQuery(d).children("option"),g=e="",f=0;
                        f<c.length;
                        ++f){
                            g+='<option value="'+c[f].value+'">'+c[f].innerHTML+"</option>";
                            for(var h=0;
                            h<b.length;
                            ++h)c[f].value.indexOf(b[h])>0&&(e+='<option value="'+c[f].value+'">'+c[f].innerHTML+"</option>")
                        }
                        jQuery(d).html('<option value="">beliebig</option>'+e);
                        a==""&&(a=g)
                    }
                    
                }
                
            })
        }
        
    }
    ,initFilterFlugTyp:function(){
        jQuery("#berater-widget select.onewayswitch").length&&
        jQuery("#berater-widget select.onewayswitch").change(function(){
            this.value==1?jQuery("#"+jQuery(this).attr("rel")).hide():jQuery("#"+jQuery(this).attr("rel")).show()
        })
    }
    ,initBeraterFormSubmit:function(){
        jQuery("#berater-widget form input[name=MEWurl]").length&&jQuery("#berater-widget form input[name=MEWurl]").click(function(){
            jQuery(this).parent().parent().children("label").removeClass("checked");
            jQuery(this).parent().addClass("checked");
            jQuery("#wid-trip-type-form").submit()
        });
        jQuery("#berater-widget input.link").length&&
        jQuery("#berater-widget input.link").click(function(){
            jQuery("#berater-widget input[name=start]").length&&jQuery("#berater-widget input[name=start]").val("")
        });
        jQuery("#berater-widget .tabpanel form").length&&jQuery("#berater-widget .tabpanel form").submit(function(){
            var a=jQuery("[name=f-fr]",this).val(),b=jQuery("[name=f-to]",this).val();
            a&&a.length&&(jQuery("[name=fdyfr]",this).val(a.substr(0,2)),jQuery("[name=fmofr]",this).val(a.substr(6,4)+a.substr(3,2)));
            b&&b.length&&(jQuery("[name=fdyto]",
            this).val(b.substr(0,2)),jQuery("[name=fmoto]",this).val(b.substr(6,4)+b.substr(3,2)));
            a=jQuery("[name=startDate1]",this).val();
            b=jQuery("[name=endDate1]",this).val();
            a&&a.length&&(jQuery("[name=startDateDay]",this).val(a.substr(0,2)),jQuery("[name=startDateMonth]",this).val(a.substr(3,2)),jQuery("[name=startDateYear]",this).val(a.substr(6,4)),jQuery("[name=startDate]",this).val(a.substr(6,4)+"-"+a.substr(3,2)+"-"+a.substr(0,2)));
            b&&b.length&&(jQuery("[name=endDateDay]",this).val(b.substr(0,2)),jQuery("[name=endDateMonth]",
            this).val(b.substr(3,2)),jQuery("[name=endDateYear]",this).val(b.substr(6,4)),jQuery("[name=endDate]",this).val(a.substr(6,4)+"-"+b.substr(3,2)+"-"+b.substr(0,2)));
            a=jQuery("[name=startDate2]",this).val();
            b=jQuery("[name=endDate2]",this).val();
            a&&a.length&&(a.substr(0,1)==="0"?jQuery("[name=Day]",this).val("0"+a.substr(1,1)):jQuery("[name=Day]",this).val(a.substr(0,2)),a.substr(0,1)==="0"?jQuery("[name=day]",this).val("0"+a.substr(1,1)):jQuery("[name=day]",this).val(a.substr(0,2)),a.substr(3,1)===
            "0"?jQuery("[name=month_1]",this).val("0"+a.substr(4,1)+"-"+a.substr(6,4)):jQuery("[name=month_1]",this).val(a.substr(3,2)+"-"+a.substr(6,4)));
            b&&b.length&&(b.substr(0,1)==="0"?jQuery("[name=RetDay]",this).val("0"+b.substr(1,1)):jQuery("[name=RetDay]",this).val(b.substr(0,2)),b.substr(0,1)==="0"?jQuery("[name=retDay]",this).val("0"+b.substr(1,1)):jQuery("[name=retDay]",this).val(b.substr(0,2)),b.substr(3,1)==="0"?jQuery("[name=month_2]",this).val("0"+b.substr(4,1)+"-"+b.substr(6,4)):jQuery("[name=month_2]",
            this).val(b.substr(3,2)+"-"+b.substr(6,4)));
            jQuery("input[type=text]",this).each(function(){
                jQuery(this).attr("placeholder").length&&jQuery(this).attr("placeholder")==jQuery(this).val()&&jQuery(this).val("")
            })
        })
    }
    ,initBcbToolTips:function(){
        PORTAL.addBcbToolTip(251);
        PORTAL.addBcbToolTip(252);
        PORTAL.addBcbToolTip(501);
        PORTAL.addBcbToolTip(502)
    }
    ,addBcbToolTip:function(a){
        if(jQuery("#bcbLinkBc"+a)&&jQuery("#bcbTipBc"+a))PORTAL.bcbToolTipData[a]=[],PORTAL.bcbToolTipData[a].linkHover=!1,PORTAL.bcbToolTipData[a].tipHover=
        !1,jQuery("#bcbLinkBc"+a).mouseover(function(){
            PORTAL.bcbToolTipData[a].linkHover=!0;
            PORTAL.bcbToolTipData[a].tipHover=!1;
            jQuery("#bcbTipBc"+a).show();
            window.clearTimeout(BAHN.bcbToolTipData[a].timeout)
        }).focus(function(){
            PORTAL.bcbToolTipData[a].linkHover=!0;
            PORTAL.bcbToolTipData[a].tipHover=!1;
            jQuery("#bcbTipBc"+a).show();
            window.clearTimeout(BAHN.bcbToolTipData[a].timeout)
        }).mouseout(function(){
            PORTAL.bcbToolTipData[a].linkHover=!1;
            PORTAL.bcbToolTipData[a].timeout=window.setTimeout("BAHN.removeBcbToolTip"+
            a+"()",10)
        }).blur(function(){}),jQuery("#bcbTipBc"+a).mouseover(function(){
            PORTAL.bcbToolTipData[a].tipHover=!0;
            PORTAL.bcbToolTipData[a].linkHover=!1;
            jQuery("#bcbTipBc"+a).show();
            window.clearTimeout(BAHN.bcbToolTipData[a].timeout)
        }).mouseout(function(){
            PORTAL.bcbToolTipData[a].tipHover=!1;
            PORTAL.bcbToolTipData[a].timeout=window.setTimeout("BAHN.removeBcbToolTip"+a+"()",10)
        }),jQuery("#bcbTipBc"+a+" a.link-highlight").focus(function(){
            PORTAL.bcbToolTipData[a].tipHover=!0;
            PORTAL.bcbToolTipData[a].linkHover=
            !1;
            jQuery("#bcbTipBc"+a).show();
            window.clearTimeout(BAHN.bcbToolTipData[a].timeout)
        }).blur(function(){
            PORTAL.bcbToolTipData[a].tipHover=!1;
            PORTAL.bcbToolTipData[a].timeout=window.setTimeout("BAHN.removeBcbToolTip"+a+"()",10)
        }),jQuery("#bcbTipBc"+a+" > a.closeButton").click(function(){
            PORTAL.bcbToolTipData[a].linkHover=!1;
            PORTAL.bcbToolTipData[a].tipHover=!1;
            jQuery("#bcbTipBc"+a).hide()
        })
    }
    ,removeBcbToolTip251:function(){
        PORTAL.bcbToolTipData[251].linkHover==!1&&PORTAL.bcbToolTipData[251].tipHover==
        !1&&jQuery("#bcbTipBc251").hide()
    }
    ,removeBcbToolTip501:function(){
        PORTAL.bcbToolTipData[501].linkHover==!1&&PORTAL.bcbToolTipData[501].tipHover==!1&&jQuery("#bcbTipBc501").hide()
    }
    ,removeBcbToolTip252:function(){
        PORTAL.bcbToolTipData[252].linkHover==!1&&PORTAL.bcbToolTipData[252].tipHover==!1&&jQuery("#bcbTipBc252").hide()
    }
    ,removeBcbToolTip502:function(){
        PORTAL.bcbToolTipData[502].linkHover==!1&&PORTAL.bcbToolTipData[502].tipHover==!1&&jQuery("#bcbTipBc502").hide()
    }
    ,initBcbFormSubmit:function(){
        jQuery("#bcbForm")&&
        (jQuery("#bcbForm button[type=reset]").click(function(){
            jQuery("div.bcbResult").hide();
            jQuery("#bcbStart").show()
        }),jQuery("#bcbForm button[type=submit]").click(function(){
            if(!jQuery("input[@name=travelBehaviour]:checked").length)return jQuery("#bcbForm div.questionContainer p.bcbError:eq(0)").show().fadeOut(2E3),!1;
            if(!jQuery("input[@name=travelDistance]:checked").length)return jQuery("#bcbForm div.questionContainer p.bcbError:eq(1)").show().fadeOut(2E3),!1;
            if(!jQuery("input[@name=travelFrequence]:checked").length)return jQuery("#bcbForm div.questionContainer p.bcbError:eq(2)").show().fadeOut(2E3),
            !1;
            if(!jQuery("input[@name=travelPreferences]:checked").length)return jQuery("#bcbForm div.questionContainer p.bcbError:eq(3)").show().fadeOut(2E3),!1;
            var a=[],b="";
            a[0]=jQuery("input[@name=travelBehaviour]:checked").val();
            a[1]=jQuery("input[@name=travelDistance]:checked").val();
            a[2]=jQuery("input[@name=travelFrequence]:checked").val();
            a[3]=jQuery("input[@name=travelPreferences]:checked").val();
            b=a[0]=="spontaneous"&&a[1]=="supraRegional"&&a[2]=="often"?"bcb50":a[1]=="supraRegional"&&a[2]=="veryOften"?
            "bcb50":"bcb25";
            b+=a[3]=="comfort"?"1":"2";
            jQuery("div.bcbResult").hide();
            jQuery("#bcbStart").hide();
            jQuery("#"+b).show();
            return!1
        }))
    }
    ,initTarifberater:function(){
        var a=jQuery("#inhalt #tarifvergleich button"),b=jQuery("#inhalt #tarifvergleich input.checkbox"),c=jQuery("#inhalt #tarifvergleich p.error-msg, #tarifvergleich-ergebnis p.error-msg");
        a.length>0&&a.click(function(){
            var a=jQuery("#inhalt #tarifvergleich input:checked");
            a.length>1?(c.hide(),jQuery("#tarifvergleich-ergebnis table").show(),
            jQuery("#tarifvergleich-ergebnis thead th").hide(),jQuery("#tarifvergleich-ergebnis tbody td").hide(),jQuery("#tarifvergleich-ergebnis tfoot td").hide(),a.each(function(){
                var a=jQuery(this).val();
                jQuery("#tarifvergleich-ergebnis thead th[id="+a+"]").show();
                jQuery("#tarifvergleich-ergebnis tbody td[headers="+a+"]").show();
                jQuery("#tarifvergleich-ergebnis tfoot td[headers="+a+"]").show()
            })):(c.show(),jQuery("#tarifvergleich-ergebnis table").hide())
        });
        b.length>0&&b.change(function(){
            jQuery("#inhalt #tarifvergleich input:checked").length>
            1?(c.hide(),a.removeClass("no-thickbox")):a.addClass("no-thickbox")
        })
    }
    ,initStageMenu:function(){
        jQuery("#stage_menu li").length&&jQuery("#stage_menu li").click(function(){
            jQuery(this).attr("class").indexOf("moreCities")==-1?(jQuery("#stage_menu li").removeClass("active"),jQuery(this).addClass("active"),jQuery(".stage_content").hide(),jQuery(".stage_content").eq(jQuery("#stage_menu li").index(this)).show()):jQuery("#stage_menu li.toggle").toggle(0)
        })
    }
    
};
jQuery(document).ready(function(){
    PORTAL.init()
});
jQuery.fn.extend({
    getQueryParams:function(){
        for(var a=[],b,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;
        d<c.length;
        d++)b=c[d].split("="),a.push(b[0]),a[b[0]]=b[1];
        return a
    }
    ,getQueryParam:function(a){
        return jQuery(document).getQueryParams()[a]
    }
    
});
var SEARCH={
    t:[],init:function(){
//        SEARCH.initAutocomplete();
        SEARCH.openQuestion()
    }
//    ,initAutocomplete:function(){
//        jQuery("#searchform input.search-field").length>0&&(SEARCH.t.sort(),jQuery("#searchform input.search-field").autocomplete(SEARCH.t,{
//            multiple:!0,multipleSeparator:" "
//        }))
//    }
    ,openQuestion:function(){
        if(jQuery(document).getQueryParam("uid")){
            var a=jQuery(document).getQueryParam("uid");
            jQuery("#"+a).addClass("openerActive");
            jQuery("#"+a).next().show()
        }
        
    }
    
};
jQuery(document).ready(function(){
    SEARCH.init()
});
BAHN_PACKAGE=new function(){
    var a={};
    this.pckg=function(b){
        var c,d=window;
        if(!a[b]){
            a[b]=!0;
            c=b.split(".");
            for(b=0;
            b<c.length;
            b+=1)d[c[b]]=d[c[b]]||{},d=d[c[b]]
        }
        
    };
    this.requireClass=function(a){
        var c=a.split("."),d,e=window,f="";
        for(j=0;
        j<c.length;
        j+=1){
            d=c[j];
            f.length>0&&(f+=".");
            f+=d;
            if(!e[d]){
                alert("Importieren der Klasse ("+a+") ist fehlgeschlagen:\n"+f+" nicht vorhanden");
                break
            }
            e=e[d]
        }
        
    }
    
};
BAHN_PACKAGE.pckg("de.bahn.util");
de.bahn.util.Uhrzeit={
    getUhrzeit:function(a,b){
        var c=Math.floor(a/60);
        a%=60;
        b&&c<10&&(c="0"+c);
        a<10&&(a="0"+a);
        return c+":"+a
    }
    ,getTime:function(a){
        a=a.split(":");
        return parseInt(a[0],10)*60+parseInt(a[1],10)
    }
    
};
BAHN_PACKAGE.pckg("de.bahn.webgets");
de.bahn.webgets.Slider=function(){
    var a=this;
    this.checkSliderTimeframe=function(a,c){
        if(c.values[1]-c.values[0]<a)return!1;
        return!0
    };
    this.createTimeSlider=function(a){
        this.createTimeSlider(a,null)
    };
    this.createTimeSlider=function(b,c){
        var d=jQuery("#"+b+"RangeVal").val();
        jQuery("#"+b+"RangeMin").val();
        jQuery("#"+b+"RangeMax").val();
        var e=parseInt(jQuery("#"+b+"StepVal").val()),f=parseInt(jQuery("#"+b+"MinVal").val()),g=parseInt(jQuery("#"+b+"MaxVal").val()),h=parseInt(jQuery("#"+b+"CurrentFromVal").val()),
        l=parseInt(jQuery("#"+b+"CurrentTillVal").val()),k=parseInt(jQuery("#"+b+"TimeframeVal").val());
        if(d=="true"||d=="false")d=Boolean(d);
        jQuery("#"+b).slider({
            range:d,step:e,min:f,max:g,values:[h,l],slide:function(d,e){
                var f=!0;
                if(f=a.checkSliderTimeframe(k,e))value1=de.bahn.util.Uhrzeit.getUhrzeit(e.values[0],!1),value2=de.bahn.util.Uhrzeit.getUhrzeit(e.values[1],!1),jQuery("#"+b+"_from").empty(),jQuery("#"+b+"_till").empty(),jQuery("#"+b+"_from").text(value1),jQuery("#"+b+"_till").text(value2),jQuery("#h"+
                b+"_from").val(e.values[0]),jQuery("#h"+b+"_till").val(e.values[1]),c&&c();
                else return!1
            }
            
        });
        jQuery("#"+b+"_from").text(de.bahn.util.Uhrzeit.getUhrzeit(jQuery("#"+b+"").slider("values",0),!1));
        jQuery("#"+b+"_till").text(de.bahn.util.Uhrzeit.getUhrzeit(jQuery("#"+b+"").slider("values",1),!1));
        jQuery("#h"+b+"_from").val(jQuery("#"+b).slider("values",0));
        jQuery("#h"+b+"_till").val(jQuery("#"+b).slider("values",1))
    };
    this.createDurationSlider=function(a){
        this.createDurationSlider(a,null)
    };
    this.createDurationSlider=
    function(a,c){
        var d=jQuery("#"+a+"RangeVal").val(),e=parseInt(jQuery("#"+a+"StepVal").val()),f=parseInt(jQuery("#"+a+"MinVal").val()),g=parseInt(jQuery("#"+a+"MaxVal").val()),h=parseInt(jQuery("#"+a+"CurrentTillVal").val());
        jQuery("#"+a).slider({
            range:d,step:e,min:f,max:g,value:h,slide:function(d,e){
                tillValue=de.bahn.util.Uhrzeit.getUhrzeit(e.value,!0);
                jQuery("#"+a+"_till").empty();
                jQuery("#"+a+"_till").text(tillValue);
                jQuery("#h"+a+"_till").val(e.value);
                c&&c()
            }
            
        });
        jQuery("#"+a+"_till").text(de.bahn.util.Uhrzeit.getUhrzeit(jQuery("#"+
        a).slider("value"),!0));
        jQuery("#h"+a+"_till").val(jQuery("#"+a+"").slider("value"))
    };
    this.setTimeSliderValues=function(a,c){
        jQuery("#"+a+"_from").empty();
        jQuery("#"+a+"_till").empty();
        jQuery("#"+a+"_from").text(de.bahn.util.Uhrzeit.getUhrzeit(c[0],!1));
        jQuery("#"+a+"_till").text(de.bahn.util.Uhrzeit.getUhrzeit(c[1],!1));
        jQuery("#h"+a+"_from").val(c[0]);
        jQuery("#h"+a+"_till").val(c[1]);
        jQuery("#"+a+"CurrentFromVal").val(c[0]);
        jQuery("#"+a+"CurrentTillVal").val(c[1]);
        jQuery("#"+a).slider("option",
        "values",c)
    };
    this.getTimeSliderValues=function(a){
        var c=[];
        c.push(jQuery("#h"+a+"_from").val());
        c.push(jQuery("#h"+a+"_till").val());
        return c
    };
    this.setDurationSliderValue=function(a,c){
        jQuery("#"+a+"_till").empty();
        jQuery("#"+a+"_till").text(de.bahn.util.Uhrzeit.getUhrzeit(c,!1));
        jQuery("#h"+a+"_till").val(c);
        jQuery("#"+a+"CurrentTillVal").val(c);
        jQuery("#"+a).slider("option","value",c)
    };
    this.getDurationSliderValue=function(a){
        return jQuery("#h"+a+"_till").val()
    };
    this.setMinMax=function(a,c,d){
        jQuery("#"+
        a+"MinVal").val(c);
        jQuery("#"+a+"MaxVal").val(d)
    };
    this.setRangeMinMax=function(a,c,d){
        jQuery("#"+a+"RangeMin").val(c);
        jQuery("#"+a+"RangeMax").val(d)
    }
    
};
var historyCookieTypeString="";
function qfSetHistCookieTypeStr(){
    var a=jQuery("input#qf-bhf-typeahead-historycookie-typestring").val();
    a&&(historyCookieTypeString=a.split(","))
}
function qfInitCalendars(){
    var a=jQuery("input#qf-months-texts").val(),b="";
    a&&(b=a.split(","));
    var c=jQuery("input#qf-weekday-texts-short").val(),a="";
    c&&(a=c.split(","));
    c=jQuery("input#qf-cal-close-text").val();
    calman.config={
        today:new Date,viewPeriodS:parseUserDateInput("01.01.1900"),viewPeriodE:parseUserDateInput("31.12.2099"),dataPeriodS:parseUserDateInput("01.01.1900"),dataPeriodE:parseUserDateInput("31.12.2099"),monthsTexts:b,weekdaysTexts:a,closeText:c,showShortYear:!0,styleClass:"calendardiv"
    }
    
}
function qfInitCalendar(a,b,c,d,e){
    a={
        formName:"document.".concat(document.getElementById(b).form.name),fieldName:c,referenceObject:"callink".concat(a),returnCalId:d?"callink".concat(d):null,returnCalShift:e
    };
    calman.createCalendar(a)
}
var BAHN_QF={
    TRIPLE_ID_EXT:"-tripleid",QF_MAX_REISENDE:5,QF_REISENDER_TYP_ERW:"E",QF_REISENDER_TYP_FKIND:"F",QF_REISENDER_TYP_AKIND:"K",QF_REISENDER_TYP_KKIND:"B",QF_REISEPROFIL_CHANGED_EVENT:99,QF_REISEPROFIL_SELECTBOX_ID:1,QF_REISEPROFIL_FAST_BOOK_MODE_ID:2,QF_REISEPROFIL_PREFIX_KLASSE_RADIO_ID:3,QF_REISEPROFIL_FAST_BOOK_MODE_MARKER:4,QF_KEY_ADULTS_ID:1,QF_KEY_CHILDREN_ID:2,QF_KEY_INFANTS_ID:3,QF_KEY_PREFIX_TRAV_TYPE_ID:4,QF_KEY_PREFIX_TRAV_BC_ID:5,QF_KEY_PREFIX_TRAV_AGE_ID:6,QF_KEY_PREFIX_TRAV_BDAY_ID:7,
    QF_KEY_TRAVS_CONT_ID:8,QF_KEY_TRAVS_JS_CONT_ID:9,QF_KEY_PREFIX_TRAV_ROWS:10,QF_KEY_SHOW_AGE_FIELD_FOR_CHILDREN:11,qfWebclient:!1,qfTabInits:[],slider:null,init:function(){
        var a=document.getElementById("quickfinder");
        if(a){
            var b=jQuery("#qf-wec").val();
            if(b&&b.length>0)BAHN_QF.qfWebclient=!0;
            qfInitCalendars();
            BAHN_QF.qfInitDateAndTime();
            BAHN_QF.qfInitTypeAhead();
            BAHN_QF.qfTabSetFocus();
            (b=jQuery("#quickfinder ul.tablist li.active a").attr("rel"))&&b.length>0&&BAHN_QF.qfInitActiveTab(b);
            jQuery("#quickfinder ul.tablist a").click(BAHN_QF.qfTabSetFocus);
            jQuery(a).keydown(BAHN_QF.qfKeydown).bind("focusin",BAHN_QF.qfKeydown).bind("focusout",BAHN_QF.qfKeydown);
            a.addEventListener&&(a.addEventListener("focus",BAHN_QF.qfKeydown,!0),a.addEventListener("blur",BAHN_QF.qfKeydown,!0));
            a.attachEvent&&(a.attachEvent("focus",BAHN_QF.qfKeydown),a.attachEvent("blur",BAHN_QF.qfKeydown),a.attachEvent("keydown",BAHN_QF.qfKeydown));
            jQuery("#quickfinder a.closeButton").click(BAHN_QF.qfClose)
        }
        jQuery(a).bgiframe&&(jQuery(a).bgiframe(),jQuery("div.qf-number-desc").bgiframe())
    }
    ,
    qfRandomNumber:function(a,b){
        return Math.floor(Math.random()*(b-a+1))+a
    }
    ,qfCheckSendInitialAvail:function(){
        var a=jQuery("#qf-auskunft-initialavail-likelihood").val();
        !a||a<0?a=0:a>100&&(a=100);
        var b=BAHN_QF.qfRandomNumber(1,100);
        a>0&&b<=a?jQuery("#qf-bahn-initialavail").removeAttr("disabled"):jQuery("#qf-bahn-initialavail").attr("disabled","disabled");
        return!0
    }
    ,qfOnSubmitTabBahn:function(){
        BAHN_QF.qfCheckSendInitialAvail();
        return!0
    }
    ,qfInitActiveTab:function(a){
        BAHN_QF.qfIsTabInitialized(a)||("bahn"===
        a?BAHN_QF.qfInitTabBahn():"hotel"===a?BAHN_QF.qfInitTabHotel():"mietwagen"===a||"mwagent"===a||"mweuropcar"===a?BAHN_QF.qfInitTabMietwagen():"mobil"===a||"vtv"===a||"vtvmwagent"===a||"vtvmweuropcar"===a?BAHN_QF.qfInitTabMobil():"preissuche"==a&&BAHN_QF.qfInitTabPreissuche(),BAHN_QF.qfTabInits.push(a))
    }
    ,qfInitTabBahn:function(){
        BAHN_QF.qfInitDatePicker("0","qf-departure-date","date",1);
        BAHN_QF.qfInitDatePicker("1","qf-return-date","returnDate");
        BAHN_QF.qfInitTimeField("qf-time");
        BAHN_QF.qfInitTimeField("qf-return-time");
        var a=new BAHN_QF.QfTripType("qf_form_bahn","qf-departure-date","qf-return-date","qf-return-time","qf-trip-type-single","qf-trip-type-return");
        jQuery("#quickfinder #qf_form_bahn p.trip-type input").change(a.handleTripTypeChanged).click(a.handleTripTypeChanged);
        a={};
        a[BAHN_QF.QF_REISEPROFIL_SELECTBOX_ID]="qf-rprofil-select";
        a[BAHN_QF.QF_REISEPROFIL_FAST_BOOK_MODE_ID]="qf-rprofil-fastbm";
        a[BAHN_QF.QF_REISEPROFIL_PREFIX_KLASSE_RADIO_ID]="qf-class-";
        a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT]="qfBahnReiseprofilChangedEvent";
        a[BAHN_QF.QF_REISEPROFIL_FAST_BOOK_MODE_MARKER]="qf-rp-marker-fastbooking";
        new BAHN_QF.QfReiseprofilUpdater(a);
        new BAHN_QF.QfStreckePicker("qf-strecken-bahn","qf-departure-point","qf-via1-point","qf-via2-point","qf-destination-point");
        a={};
        a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT]="qfBahnReiseprofilChangedEvent";
        a[BAHN_QF.QF_KEY_ADULTS_ID]="qf-adult-number";
        a[BAHN_QF.QF_KEY_CHILDREN_ID]="qf-children-number";
        a[BAHN_QF.QF_KEY_INFANTS_ID]="qf-infant-number";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_TYPE_ID]="qf-trav-type-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_BC_ID]="qf-trav-bc-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_AGE_ID]="qf-trav-age-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]="qf-trav-bday-";
        a[BAHN_QF.QF_KEY_TRAVS_CONT_ID]="qf-travs";
        a[BAHN_QF.QF_KEY_TRAVS_JS_CONT_ID]="qf-travs-js";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]="qf-travrow-";
        a[BAHN_QF.QF_KEY_SHOW_AGE_FIELD_FOR_CHILDREN]=!1;
        new BAHN_QF.QfReisendeUpdater(a)
    }
    ,qfInitTabHotel:function(){
        jQuery("div.qf-hotel-hrs").get(0)||(BAHN_QF.qfWebclient===!0?(BAHN_QF.qfInitDatePicker("6","qf-hotel-arrival-date",
        "REQ0JourneyDate","7",1),BAHN_QF.qfInitDatePicker("7","qf-hotel-departure-date","REQ1JourneyDate")):(BAHN_QF.qfInitDatePicker("6","qf-hotel-arrival-date","hotel_anreise","7",1),BAHN_QF.qfInitDatePicker("7","qf-hotel-departure-date","hotel_abreise")))
    }
    ,qfInitTabPreissuche:function(){
        BAHN_QF.checkPreissuchePreconditions();
        BAHN_QF.qfWebclient===!0?(BAHN_QF.qfInitDatePicker("8","qf-preissuche-departure-date","ps.date","9",1),BAHN_QF.qfInitDatePicker("9","qf-preissuche-return-date","ps.returnDate")):(BAHN_QF.qfInitDatePicker("8",
        "qf-preissuche-departure-date","date","9",1),BAHN_QF.qfInitDatePicker("9","qf-preissuche-return-date","returnDate"));
        slider=new de.bahn.webgets.Slider;
        slider.createTimeSlider("sucheSliderHinfahrt");
        slider.createTimeSlider("sucheSliderRueckfahrt");
        var a=new BAHN_QF.QfTripType("qf_form_preissuche","qf-preissuche-departure-date","qf-preissuche-return-date","qf-preissuche-return-time","qf-preissuche-trip-type-single","qf-preissuche-trip-type-return");
        jQuery("#qf_form_preissuche p.trip-type input").change(a.handleTripTypeChanged).click(a.handleTripTypeChanged);
        jQuery("#qf-preissuche-trip-type-return").click();
        a={};
        a[BAHN_QF.QF_REISEPROFIL_SELECTBOX_ID]="qf-preissuche-rprofil-select";
        a[BAHN_QF.QF_REISEPROFIL_FAST_BOOK_MODE_ID]="qf-preissuche-rprofil-fastbm";
        a[BAHN_QF.QF_REISEPROFIL_PREFIX_KLASSE_RADIO_ID]="qf-preissuche-class-";
        a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT]="qfPsReiseprofilChangedEvent";
        a[BAHN_QF.QF_REISEPROFIL_FAST_BOOK_MODE_MARKER]="qf-preissuche-rp-marker-fastbooking";
        new BAHN_QF.QfReiseprofilUpdater(a);
        a={};
        a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT]=
        "qfPsReiseprofilChangedEvent";
        a[BAHN_QF.QF_KEY_ADULTS_ID]="preissuche-qf-adult-number";
        a[BAHN_QF.QF_KEY_CHILDREN_ID]="preissuche-qf-children-number";
        a[BAHN_QF.QF_KEY_INFANTS_ID]="preissuche-qf-infant-number";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_TYPE_ID]="preissuche-qf-trav-type-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_BC_ID]="preissuche-qf-trav-bc-";
        a[BAHN_QF.QF_KEY_TRAVS_JS_CONT_ID]="preissuche-qf-travs-js";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]="preissuche-qf-travrow-";
        a[BAHN_QF.QF_KEY_SHOW_AGE_FIELD_FOR_CHILDREN]=!1;
        new BAHN_QF.QfReisendeUpdater(a);
        jQuery("#qf-preissucheContainer :input.loadpscaptcha").bind("focus",BAHN_QF.qfInitPreissucheCaptcha).bind("click",BAHN_QF.qfInitPreissucheCaptcha)
    }
    ,qfInitTabMietwagen:function(){
        jQuery("#qf-mietwagen-rental-date").length>0?(BAHN_QF.qfInitDatePicker("4","qf-mietwagen-rental-date","REQ0JourneyDate","5",1),BAHN_QF.qfInitDatePicker("5","qf-mietwagen-return-date","REQ1JourneyDate"),BAHN_QF.qfInitTimeField("qf-mietwagen-rental-time"),BAHN_QF.qfInitTimeField("qf-mietwagen-return-time")):
        (BAHN_QF.qfInitDatePicker("4","qf-mietwagen-anmietdatum","qf-mietwagen-anmietdatum","5",1),BAHN_QF.qfInitDatePicker("5","qf-mietwagen-rueckgabedatum","qf-mietwagen-rueckgabedatum"),BAHN_QF.qfInitTimeField("qf-mietwagen-anmietzeit"),BAHN_QF.qfInitTimeField("qf-mietwagen-rueckgabezeit"),jQuery("#qf-mietwagen-anmietstation").bind("change",BAHN_QF.handleMietwagenAnmietstationChanged))
    }
    ,handleMietwagenAnmietstationChanged:function(){
        jQuery("#qf-mietwagen-rueckgabestation").val(jQuery("#qf-mietwagen-anmietstation").val())
    }
    ,
    qfInitTabMobil:function(){
        if(jQuery("#qf_form_mobil").get(0))BAHN_QF.qfInitDatePicker("2","qf-mobil-departure-date","date"),BAHN_QF.qfInitTimeField("qf-mobil-time"),BAHN_QF.qfInitDatePicker("3","qf-uwmobil-departure-date","date"),BAHN_QF.qfInitTimeField("qf-uwmobil-time");
        else if(jQuery("#qf_form_mobil_vtv").get(0)){
            BAHN_QF.qfWebclient===!0?(BAHN_QF.qfInitDatePicker("2","qf-mobil-vtv-departure-date","vtv.date","3"),BAHN_QF.qfInitDatePicker("3","qf-mobil-vtv-return-date","vtv.returnDate")):(BAHN_QF.qfInitDatePicker("2",
            "qf-mobil-vtv-departure-date","date","3"),BAHN_QF.qfInitDatePicker("3","qf-mobil-vtv-return-date","returnDate"));
            BAHN_QF.qfInitTimeField("qf-mobil-vtv-time");
            BAHN_QF.qfInitTimeField("qf-mobil-vtv-return-time");
            var a=new BAHN_QF.QfTripType("qf_form_mobil_vtv","qf-mobil-vtv-departure-date","qf-mobil-vtv-return-date","qf-mobil-vtv-return-time","qf-mobil-vtv-trip-type-single","qf-mobil-vtv-trip-type-return");
            jQuery("#qf_form_mobil_vtv p.trip-type input").change(a.handleTripTypeChanged).click(a.handleTripTypeChanged);
            jQuery("#qf-mobil-vtv-trip-type-single").click();
            jQuery("#tabMietwagenInTabVtv").get(0)&&!BAHN_QF.qfIsTabInitialized("mietwagen")&&BAHN_QF.qfInitTabMietwagen()
        }
        new BAHN_QF.QfStreckePicker("qf-strecken-mobil","qf-mobil-departure-point","qf-mobil-via1-point","qf-mobil-via2-point","qf-mobil-destination-point");
        new BAHN_QF.QfStreckePicker("qf-strecken-uwmobil","qf-uwmobil-departure-point","qf-uwmobil-via1-point","qf-uwmobil-via2-point","qf-uwmobil-destination-point");
        a={};
        a[BAHN_QF.QF_KEY_ADULTS_ID]=
        "vtv-qf-adult-number";
        a[BAHN_QF.QF_KEY_CHILDREN_ID]="vtv-qf-children-number";
        a[BAHN_QF.QF_KEY_INFANTS_ID]="vtv-qf-infant-number";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_TYPE_ID]="vtv-qf-trav-type-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_BC_ID]="vtv-qf-trav-bc-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_AGE_ID]="vtv-qf-trav-age-";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]="vtv-qf-trav-bday-";
        a[BAHN_QF.QF_KEY_TRAVS_CONT_ID]="vtv-qf-travs";
        a[BAHN_QF.QF_KEY_TRAVS_JS_CONT_ID]="vtv-qf-travs-js";
        a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]="vtv-qf-travrow-";
        a[BAHN_QF.QF_KEY_SHOW_AGE_FIELD_FOR_CHILDREN]=!0;
        new BAHN_QF.QfReisendeUpdater(a)
    }
    ,qfIsTabInitialized:function(a){
        for(var b=0;
        b<BAHN_QF.qfTabInits.length;
        b++)if(BAHN_QF.qfTabInits[b]===a)return!0;
        return!1
    }
    ,qfInitDatePicker:function(a,b,c,d,e){
        qfInitCalendar(a,b,c,d,e);
        var b=jQuery("#"+b).closest(".qf-cal"),f="callink"+a;
        BAHN_QF.qfWebclient===!0?(b.find("img.cal_button_later").click(function(){
            calman.shiftDate(f,1)
        }),b.find("img.cal_button_earlier").click(function(){
            calman.shiftDate(f,-1)
        })):(b.find("a.next").click(function(){
            calman.shiftDate(f,
            1)
        }).click(),b.find("a.prev").click(function(){
            calman.shiftDate(f,-1)
        }).click());
        b.find("a.calendar").click(function(){
            return calman.toggleDisplay(f)
        })
    }
    ,qfInitTimeField:function(a){
        var b=document.getElementById(a),a=jQuery(b).closest(".qf-time");
        BAHN_QF.qfWebclient===!0?(a.find("img.time_button_later").click(function(){
            BAHN_QF.qfShiftTime(b,1)
        }),a.find("img.time_button_earlier").click(function(){
            BAHN_QF.qfShiftTime(b,-1)
        })):(a.find("a.next").click(function(){
            BAHN_QF.qfShiftTime(b,1)
        }),a.find("a.prev").click(function(){
            BAHN_QF.qfShiftTime(b,
            -1)
        }))
    }
    ,qfShiftTime:function(a,b){
        if(a==null)return!1;
        var c=a.value,d;
        if(c.match(/^([0-2]?\d):?(\d\d)?$/)==null)return!1;
        d=RegExp.$1*1;
        var e=RegExp.$2*1;
        if(c.indexOf(":")<0&&c<1E3)c<=24?(d=c*1,c=0):(d=Math.floor(c/100),c%=100);
        else if(c=e,d>24||c>59)return;
        c!=0&&b<0&&(b+=1);
        d+=b;
        d%=24;
        d<0&&(d+=24);
        a.value=d<10?"0"+d+":00":d+":00"
    }
    ,qfInitTypeAhead:function(){
        qfSetHistCookieTypeStr();
        var a=jQuery("#qf-bhf-typeahead-history-cookiename").val(),b=jQuery("#qf-bhf-typeahead-minchars").val(),c=jQuery("#qf-bhf-typeahead-delay").val(),
        d=jQuery("#qf-bhf-typeahead-requrl").val(),e=jQuery("#qf-bhf-typeahead-reqalltypeurl").val();
        jQuery("#qf_form_bahn").get(0)&&(new FSuggest({
            loc:"qf-departure-point",type:"S",minChar:b,cookiename:a,requestURL:d,stopDelay:c,requestType:"js"
        }),new FSuggest({
            loc:"qf-destination-point",type:"Z",minChar:b,cookiename:a,requestURL:d,stopDelay:c,requestType:"js"
        }),jQuery("#qf-departure-point").blur(BAHN_QF.checkTripleId),jQuery("#qf-destination-point").blur(BAHN_QF.checkTripleId));
        jQuery("#qf_form_mobil").get(0)&&
        (new FSuggest({
            loc:"qf-uwmobil-departure-point",type:"S",minChar:b,cookiename:a,requestURL:d,stopDelay:c,requestType:"js"
        }),new FSuggest({
            loc:"qf-uwmobil-destination-point",type:"Z",minChar:b,cookiename:a,requestURL:d,stopDelay:c,requestType:"js"
        }),new FSuggest({
            loc:"qf-mobil-departure-point",type:"S",minChar:b,cookiename:a,requestURL:d,stopDelay:c,requestType:"js"
        }),new FSuggest({
            loc:"qf-mobil-destination-point",type:"Z",minChar:b,cookiename:a,requestURL:d,stopDelay:c,requestType:"js"
        }),jQuery("#qf-mobil-departure-point").blur(BAHN_QF.checkTripleId),
        jQuery("#qf-mobil-destination-point").blur(BAHN_QF.checkTripleId),jQuery("#qf-uwmobil-departure-point").blur(BAHN_QF.checkTripleId),jQuery("#qf-uwmobil-destination-point").blur(BAHN_QF.checkTripleId));
        jQuery("#qf_form_mobil_vtv").get(0)&&(new FSuggest({
            loc:"qf-mobil-vtv-departure-point",type:"S",minChar:b,cookiename:a,requestURL:e,stopDelay:c,requestType:"js"
        }),new FSuggest({
            loc:"qf-mobil-vtv-destination-point",type:"Z",minChar:b,cookiename:a,requestURL:e,stopDelay:c,requestType:"js"
        }),jQuery("#qf-mobil-vtv-departure-point").blur(BAHN_QF.checkTripleId),
        jQuery("#qf-mobil-vtv-destination-point").blur(BAHN_QF.checkTripleId));
        jQuery("#qf_form_preissuche").get(0)&&(new FSuggest({
            loc:"qf-preissuche-departure-point",type:"S",minChar:b,requestURL:d,stopDelay:c,requestType:"js",locType:1,filter:"germany",type:"S1"
        }),new FSuggest({
            loc:"qf-preissuche-destination-point",type:"Z",minChar:b,requestURL:d,stopDelay:c,requestType:"js",locType:1,filter:"germany",type:"Z1"
        }),jQuery("#qf-preissuche-departure-point").blur(BAHN_QF.checkTripleId),jQuery("#qf-preissuche-destination-point").blur(BAHN_QF.checkTripleId))
    }
    ,
    qfSetSearchFlag:function(a,b,c){
        jQuery("#"+a).attr("name",b).val(c)
    }
    ,qfDatePartStr:function(a){
        return a<10?"0"+a:a
    }
    ,qfInitDateAndTime:function(){
        if(BAHN_QF.qfWebclient!==!0){
            var a=new Date,b=BAHN_QF.qfDatePartStr(a.getDate())+"."+BAHN_QF.qfDatePartStr(a.getMonth()+1)+"."+a.getFullYear(),a=BAHN_QF.qfDatePartStr(a.getHours())+":"+BAHN_QF.qfDatePartStr(a.getMinutes()),c=new Date;
            c.setDate(c.getDate()+1);
            var c=BAHN_QF.qfDatePartStr(c.getDate())+"."+BAHN_QF.qfDatePartStr(c.getMonth()+1)+"."+c.getFullYear(),
            d=new Date;
            d.setDate(d.getDate()+2);
            var d=BAHN_QF.qfDatePartStr(d.getDate())+"."+BAHN_QF.qfDatePartStr(d.getMonth()+1)+"."+d.getFullYear(),e=new Date;
            e.setDate(e.getDate()+3);
            var e=BAHN_QF.qfDatePartStr(e.getDate())+"."+BAHN_QF.qfDatePartStr(e.getMonth()+1)+"."+e.getFullYear(),f=new Date;
            f.setDate(f.getDate()+4);
            var f=BAHN_QF.qfDatePartStr(f.getDate())+"."+BAHN_QF.qfDatePartStr(f.getMonth()+1)+"."+f.getFullYear(),g;
            jQuery("#qf_form_bahn").length>0&&(g=jQuery("#qf-departure-date"),g.val().length==
            0&&g.val(b),g=jQuery("#qf-time"),g.val().length==0&&g.val(a),g=jQuery("#qf-return-date"),g.val().length==0&&g.val(b),g=jQuery("#qf-return-time"),g.val().length==0&&g.val("12:00"));
            jQuery("#qf_form_hotel").length>0&&g.length>0&&(g=jQuery("#qf-hotel-arrival-date"),g.val().length==0&&g.val(b),g=jQuery("#qf-hotel-departure-date"),g.val().length==0&&g.val(c));
            jQuery("#qf_form_mietwagen").length>0&&BAHN_QF.qfInitDateAndTimeTabMietwagen(c,"10:00",d,"10:00");
            jQuery("#qf_form_mobil").length>0&&(g=jQuery("#qf-mobil-departure-date"),
            g.val().length==0&&g.val(b),g=jQuery("#qf-mobil-time"),g.val().length==0&&g.val(a),g=jQuery("#qf-uwmobil-departure-date"),g.val().length==0&&g.val(b),g=jQuery("#qf-uwmobil-time"),g.val().length==0&&g.val(a));
            jQuery("#qf_form_mobil_vtv").length>0&&(g=jQuery("#qf-mobil-vtv-departure-date"),g.val().length==0&&g.val(b),g=jQuery("#qf-mobil-vtv-time"),g.val().length==0&&g.val(a),g=jQuery("#qf-mobil-vtv-return-date"),g.val().length==0&&g.val(b),g=jQuery("#qf-mobil-vtv-return-time"),g.val().length==0&&g.val("12:00"),
            jQuery("#tabMietwagenInTabVtv").length>0&&BAHN_QF.qfInitDateAndTimeTabMietwagen(c,"10:00",d,"10:00"));
            jQuery("#qf_form_preissuche").length>0&&(g=jQuery("#qf-preissuche-departure-date"),g.val().length==0&&g.val(e),g=jQuery("#qf-preissuche-return-date"),g.val().length==0&&g.val(f))
        }
        
    }
    ,qfInitDateAndTimeTabMietwagen:function(a,b,c,d){
        var e=jQuery("#qf-mietwagen-rental-date");
        e.length>0?(e.val().length==0&&e.val(a),e=jQuery("#qf-mietwagen-rental-time"),e.val().length==0&&e.val(b),e=jQuery("#qf-mietwagen-return-date"),
        e.val().length==0&&e.val(c),e=jQuery("#qf-mietwagen-return-time")):(e=jQuery("#qf-mietwagen-anmietdatum"),e.val().length==0&&e.val(a),e=jQuery("#qf-mietwagen-anmietzeit"),e.val().length==0&&e.val(b),e=jQuery("#qf-mietwagen-rueckgabedatum"),e.val().length==0&&e.val(c),e=jQuery("#qf-mietwagen-rueckgabezeit"));
        e.val().length==0&&e.val(d)
    }
    ,qfInitPreissucheCaptcha:function(){
        jQuery("#qf-ps-captcha").removeClass("hidden").show();
        (new BAHN_QF.QfCaptcha).create();
        jQuery("#qf-preissucheContainer :input").unbind("focus",
        BAHN_QF.qfInitPreissucheCaptcha).unbind("click",BAHN_QF.qfInitPreissucheCaptcha)
    }
    ,QfReiseprofilUpdater:function(a){
        var b=a[BAHN_QF.QF_REISEPROFIL_SELECTBOX_ID],c=a[BAHN_QF.QF_REISEPROFIL_FAST_BOOK_MODE_ID],d=a[BAHN_QF.QF_REISEPROFIL_PREFIX_KLASSE_RADIO_ID],e=a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT],f=a[BAHN_QF.QF_REISEPROFIL_FAST_BOOK_MODE_MARKER],g;
        (function(){
            var a=jQuery("#qf-cookiename-mrp").val();
            if(a){
                var d=jQuery.cookie(a),e=document.getElementById(b);
                if(d&&e){
                    jQuery("#quickfinder p.reiseprofile").show();
                    d=new BAHN_QF.QfReiseprofilCookieHandler;
                    d.setCookieName(a);
                    d.parseCookie();
                    g=d.getReiseprofile();
                    e.options.length=1;
                    a=jQuery("#"+f).val();
                    for(d=0;
                    d<g.length;
                    d++){
                        var i=g[d];
                        if(i){
                            var n=document.createElement("option");
                            n.value=i.index;
                            var q=i.name;
                            i.schnellbuchung&&i.schnellbuchung>0&&(q+=" "+a);
                            n.text=q;
                            e.options.add(n)
                        }
                        
                    }
                    jQuery("#"+c).removeAttr("disabled");
                    BAHN.updateBuffer()
                }
                
            }
            
        })();
        jQuery("#"+b).change(function(a){
            var a=BAHN.getTarget(a),b;
            if(g&&g.length>0&&a.value>=0)for(var f=0;
            f<g.length;
            f++){
                if(b=
                g[f],b.index===a.value)break
            }
            else b=new BAHN_QF.QfReiseprofil,b.setDefaults();
            b&&(jQuery("#"+c).val(b.schnellbuchung),b.klasse==1?(jQuery("#"+d.concat("1")).attr("checked","checked"),jQuery("#"+d.concat("2")).removeAttr("checked")):(jQuery("#"+d.concat("2")).attr("checked","checked"),jQuery("#"+d.concat("1")).removeAttr("checked")),jQuery("*").trigger(e,[b]))
        })
    }
    ,QfReisendeUpdater:function(a){
        var b=document.getElementById(a[BAHN_QF.QF_KEY_ADULTS_ID]),c=document.getElementById(a[BAHN_QF.QF_KEY_CHILDREN_ID]),
        d=document.getElementById(a[BAHN_QF.QF_KEY_INFANTS_ID]),e=function(a,b){
            if(a!=null){
                var c=a.options.length,d=a.selectedIndex,e=parseInt(c>0?a.options[0].value:0),c=parseInt(c>0?a.options[c-1].value:0);
                if(c<b)for(c=eval(c+1);
                c<=b;
                c++)e=document.createElement("option"),e.text=c,e.value=c,a.options.add(e);
                else a.options.length=b+(e==0?1:0);
                f(a,d)
            }
            
        }
        ,f=function(a,b){
            if(a!=null)a.selectedIndex=b>=a.options.length?0:b
        }
        ,g=function(g){
            var g=BAHN.getTarget(g),h=parseInt(a[BAHN_QF.QF_KEY_ADULTS_ID].length>0&&
            b!=null?b.value:0),i=parseInt(a[BAHN_QF.QF_KEY_CHILDREN_ID].length>0&&c!=null?c.value:0),k=parseInt(a[BAHN_QF.QF_KEY_INFANTS_ID].length>0&&d!=null?d.value:0),l=parseInt(a[BAHN_QF.QF_KEY_ADULTS_ID].length>0&&b!=null?b.selectedIndex:0),p=parseInt(a[BAHN_QF.QF_KEY_CHILDREN_ID].length>0&&c!=null?c.selectedIndex:0),u=parseInt(a[BAHN_QF.QF_KEY_INFANTS_ID].length>0&&d!=null?d.selectedIndex:0);
            h==0&&(k=0,d!=null&&(u=0),i>1&&(i=1,c!=null&&(p=1)));
            h+i+k==0&&(g.id===a[BAHN_QF.QF_KEY_ADULTS_ID]?c!=null&&(i=p=
            1):g.id===a[BAHN_QF.QF_KEY_CHILDREN_ID]&&b!=null&&(h=l=1));
            h==0?(e(b,BAHN_QF.QF_MAX_REISENDE-i-k),e(c,i),e(d,k)):(e(b,BAHN_QF.QF_MAX_REISENDE-i-k),e(c,BAHN_QF.QF_MAX_REISENDE-h-k),e(d,BAHN_QF.QF_MAX_REISENDE-h-i));
            f(b,l);
            f(c,p);
            f(d,u)
        }
        ,h=function(a,b){
            for(var c=[],d=0;
            d<a;
            d++){
                var e=new BAHN_QF.QfReisender;
                e.typ=b;
                c.push(e)
            }
            return c
        }
        ,l=function(b){
            for(var c=1,d="",e=0;
            e<b.length;
            e++){
                var f=b[e],g=eval(e+1);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_TYPE_ID]+g).val(f.typ);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BC_ID]+
                g).val(f.bahncard);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+g).val(f.geburtsdatum);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+g+"_day").val(f.geb_tag);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+g+"_month").val(f.geb_monat);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+g+"_year").val(f.geb_jahr);
                jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_AGE_ID]+g).val(f.getAlter());
                if(d!==f.typ)c=1,d=f.typ;
                var h=c+". "+jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_TYPE_ID]+"name-"+f.typ).val();
                jQuery("label[for='"+
                a[BAHN_QF.QF_KEY_PREFIX_TRAV_BC_ID]+g+"']").text(h);
                a[BAHN_QF.QF_KEY_SHOW_AGE_FIELD_FOR_CHILDREN]&&(BAHN_QF.QF_REISENDER_TYP_ERW==f.typ?jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_AGE_ID]+g).hide():jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_AGE_ID]+g).show().removeClass("hide").blur());
                c++
            }
            b=b.length;
            for(c=1;
            c<=BAHN_QF.QF_MAX_REISENDE;
            c++)1<=c&&c<=b?(jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]+c+" :input").removeAttr("disabled"),jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]+c).show().removeClass("hide")):
            (jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]+c+" :input").attr("disabled","disabled"),jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]+c).hide());
            BAHN.updateBuffer()
        }
        ,k=function(e){
            g(e);
            for(var f=[],e=1;
            e<=BAHN_QF.QF_MAX_REISENDE;
            e++)if(jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_ROWS]+e).is(":visible")){
                var i=new BAHN_QF.QfReisender;
                i.typ=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_TYPE_ID]+e).val();
                i.bahncard=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BC_ID]+e).val();
                i.geburtsdatum=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+
                e).val();
                i.alter=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_AGE_ID]+e).val();
                i.geb_tag=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+e+"_day").val();
                i.geb_monat=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+e+"_month").val();
                i.geb_jahr=jQuery("#"+a[BAHN_QF.QF_KEY_PREFIX_TRAV_BDAY_ID]+e+"_year").val();
                f.push(i)
            }
            for(var e=[],i=[],k=[],r=0;
            r<f.length;
            r++){
                var p=f[r];
                BAHN_QF.QF_REISENDER_TYP_ERW===p.typ?e.push(p):BAHN_QF.QF_REISENDER_TYP_FKIND===p.typ||BAHN_QF.QF_REISENDER_TYP_AKIND===p.typ?i.push(p):
                BAHN_QF.QF_REISENDER_TYP_KKIND===p.typ&&k.push(p)
            }
            f=[];
            f=0;
            b!=null&&(f=e.length-b.value,f>=0?e.length-=f:(f=h(Math.abs(f),BAHN_QF.QF_REISENDER_TYP_ERW),e=e.concat(f)));
            c!=null&&(f=i.length-c.value,f>=0?i.length-=f:(f=h(Math.abs(f),BAHN_QF.QF_REISENDER_TYP_FKIND),i=i.concat(f)));
            d!=null&&(f=k.length-d.value,f>=0?k.length-=f:(f=h(Math.abs(f),BAHN_QF.QF_REISENDER_TYP_KKIND),k=k.concat(f)));
            f=[];
            f=f.concat(e);
            f=f.concat(i);
            f=f.concat(k);
            l(f);
            jQuery("#quickfinder div.qf-number-desc a.closeButton").click()
        }
        ,
        i=function(a,f){
            e(b,BAHN_QF.QF_MAX_REISENDE);
            e(c,BAHN_QF.QF_MAX_REISENDE);
            e(d,BAHN_QF.QF_MAX_REISENDE);
            BAHN_QF.qfSelectByValue(b,f.adults.length);
            BAHN_QF.qfSelectByValue(c,f.children.length);
            BAHN_QF.qfSelectByValue(d,f.infants.length);
            g(a);
            var h=[],h=h.concat(f.adults),h=h.concat(f.children),h=h.concat(f.infants);
            l(h)
        };
        if(BAHN_QF.qfWebclient===!1||BAHNCONSISTENCY.isJsLoadedSuccessful)jQuery("#"+a[BAHN_QF.QF_KEY_TRAVS_CONT_ID]+" :input").attr("disabled","disabled"),jQuery("#"+a[BAHN_QF.QF_KEY_TRAVS_JS_CONT_ID]+
        " :input").removeAttr("disabled"),jQuery("#"+a[BAHN_QF.QF_KEY_ADULTS_ID]).removeAttr("disabled").change(k),jQuery("#"+a[BAHN_QF.QF_KEY_CHILDREN_ID]).removeAttr("disabled").change(k),jQuery("#"+a[BAHN_QF.QF_KEY_INFANTS_ID]).removeAttr("disabled").change(k),a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT]!=null&&jQuery("#"+a[BAHN_QF.QF_KEY_ADULTS_ID]).bind(a[BAHN_QF.QF_REISEPROFIL_CHANGED_EVENT],i),k();
        BAHN.updateBuffer()
    }
    ,QfTripType:function(a,b,c,d,e,f){
        this.handleTripTypeChanged=function(g){
            g=BAHN.getTarget(g);
            g.id===e?(jQuery("#quickfinder #"+a+" fieldset.depends-trip-type").hide(),jQuery("#quickfinder #"+a+" fieldset.depends-trip-type :input").attr("disabled","disabled"),jQuery("#quickfinder #"+a+" p.depends-trip-type").hide(),jQuery("#quickfinder #"+a+" p.depends-trip-type :input").attr("disabled","disabled"),jQuery("#quickfinder #"+a+" input.depends-trip-type").removeAttr("disabled"),jQuery("#quickfinder #"+a+" #qf-mobil-vtv-hwai").val("QUERY!direction=single!")):g.id===f&&(jQuery("#quickfinder #"+
            a+" input.depends-trip-type").attr("disabled","disabled"),jQuery("#quickfinder #"+a+" fieldset.depends-trip-type :input").removeAttr("disabled"),jQuery("#quickfinder #"+a+" fieldset.depends-trip-type").show().removeClass("hide"),jQuery("#quickfinder #"+a+" p.depends-trip-type :input").removeAttr("disabled"),jQuery("#quickfinder #"+a+" p.depends-trip-type").show().removeClass("hide"),jQuery("#quickfinder #"+a+" #qf-mobil-vtv-hwai").val("QUERY!direction=both!"),a!="qf_form_preissuche"&&(g=jQuery("#"+
            b).val(),jQuery("#"+c).val(g)),jQuery("#"+d).val("12:00"));
            BAHN.updateBuffer()
        }
        
    }
    ,QfStreckePicker:function(a,b,c,d,e){
        var f,g,h=!1,l=function(b){
            b=b||window.event;
            BAHN.getTarget(b);
            var b=b.keyCode,c=jQuery("#"+a+"-layer .active").get(0);
            b==BAHN.key_down?jQuery(c).next().length>0&&(jQuery(c).removeClass("active"),jQuery(c).next().focus()):b==BAHN.key_up?jQuery(c).prev().length>0&&(jQuery(c).removeClass("active"),jQuery(c).prev().focus()):b==BAHN.key_tab&&r()
        }
        ,k=function(b){
            (b||window.event).keyCode==
            BAHN.key_down&&jQuery("#"+a+"-layer div:first").get(0).focus()
        }
        ,i=function(){
            jQuery(this).addClass("active")
        }
        ,n=function(){
            if(h==!1){
                if(!f||f.length===0){
                    var b=new BAHN_QF.QfStreckenCookieHandler;
                    b.setCookieName(jQuery("#qf-cookiename-mstr").val());
                    b.parseCookie();
                    f=b.getStrecken()
                }
                if(f&&f.length>0){
                    b=jQuery("#"+a+"-layer");
                    b.empty();
                    for(var c=0;
                    c<f.length;
                    c++){
                        var d=f[c],e=document.createElement("div");
                        jQuery(e).attr("name",c).text(d.name).focus(i).click(q);
                        b.append(e)
                    }
                    
                }
                h=!0
            }
            b=jQuery("#"+a).position();
            c=eval(b.top+jQuery("#"+a).outerHeight());
            jQuery("#"+a+"-layer").css("left",b.left).css("top",c).keydown(l).bgiframe()
        }
        ,q=function(a){
            a=BAHN.getTarget(a);
            a=parseInt(jQuery(a).attr("name"));
            g=f[a];
            b&&(jQuery("#"+b).val(g.start?g.start.name:"").blur(m),jQuery("#"+b+BAHN_QF.TRIPLE_ID_EXT).val(g.start?g.start.getTripleID():""));
            e&&(jQuery("#"+e).val(g.ziel?g.ziel.name:"").blur(m),jQuery("#"+e+BAHN_QF.TRIPLE_ID_EXT).val(g.ziel?g.ziel.getTripleID():""));
            c&&(jQuery("#"+c).val(g.via1?g.via1.name:"").removeAttr("disabled"),
            jQuery("#"+c+BAHN_QF.TRIPLE_ID_EXT).val(g.via1?g.via1.getTripleID():"").removeAttr("disabled"));
            d&&(jQuery("#"+d).val(g.via2?g.via2.name:"").removeAttr("disabled"),jQuery("#"+d+BAHN_QF.TRIPLE_ID_EXT).val(g.via2?g.via2.getTripleID():"").removeAttr("disabled"));
            r()
        }
        ,m=function(a){
            var c=BAHN.getTarget(a);
            g&&a.type==="blur"&&(c.id==b?g.start&&g.start.name!=c.value&&(o(),jQuery("#"+b).unbind("blur",m)):c.id==e&&g.ziel&&g.ziel.name!=c.value&&(o(),jQuery("#"+e).unbind("blur",m)))
        }
        ,o=function(){
            c&&(jQuery("#"+
            c).val("").attr("disabled","disabled"),jQuery("#"+c+BAHN_QF.TRIPLE_ID_EXT).val("").attr("disabled","disabled"));
            d&&(jQuery("#"+d).val("").attr("disabled","disabled"),jQuery("#"+d+BAHN_QF.TRIPLE_ID_EXT).val("").attr("disabled","disabled"))
        }
        ,r=function(){
            jQuery("#"+a+"-layer").removeAttr("style");
            jQuery("#"+a+"-layer .active").removeClass("active");
            jQuery("#"+a).parent().get(0).focus()
        }
        ,p=jQuery("#"+a);
        if(p.size()>0)p.parent().click(n).keydown(k);
        else if(k=jQuery("#"+c).attr("value"),n=jQuery("#"+d).attr("value"),
        k&&k.length>0||n&&n.length>0){
            var k=jQuery("#"+b).attr("value"),n=jQuery("#"+b+"-default").attr("value"),p=jQuery("#"+e).attr("value"),u=jQuery("#"+e+"-default").attr("value");
            if(k&&k!=n||p&&p!=u)g=new BAHN_QF.QfStrecke,g.start=new BAHN_QF.QfLoc,g.start.name=k,g.ziel=new BAHN_QF.QfLoc,g.ziel.name=p,jQuery("#"+b).blur(m),jQuery("#"+e).blur(m)
        }
        
    }
    ,qfShowTab:function(a,b){
        a&&jQuery("#quickfinder div.tabpanel").removeClass("active").removeAttr(BAHN.nTabindex());
        jQuery("#quickfinder ul.tablist a").each(function(c){
            var e=
            jQuery(this).attr("rel"),f=jQuery("#qf-tabpanel-"+(c+1)),g=jQuery(this.parentNode.parentNode);
            e!==a||b==="close"?(a||!a&&g.attr("class").indexOf("active")==-1?(g.removeAttr("class"),jQuery(this).hide().show().attr("href","#"+e)):jQuery(this).removeAttr("href"),b==="close"&&jQuery("#quickfinder").attr("class","closed")):(jQuery(this).removeAttr("href"),g.addClass("active"),f.addClass("active"),b==="tab"&&jQuery("#qf-tabpanel-"+(c+1)+"-focuspoint").focus(),jQuery("#quickfinder").attr("class","open"),
            BAHN_QF.qfInitActiveTab(a))
        });
        if(jQuery("#quickfinder.open").length>0&&jQuery("#quickfinder ul.tablist li.active").length===0){
            var c=jQuery("#quickfinder ul.tablist li").first().find("a").attr("rel");
            BAHN_QF.qfShowTab(c)
        }
        BAHN.updateBuffer()
    }
    ,qfClose:function(a){
        a=BAHN.getTarget(a);
        jQuery(a).parent().attr("class")=="qf-number-desc"?jQuery(a).parent().parent().removeAttr("class"):jQuery(a).parent().attr("class")=="strecken-layer"?jQuery(a).parent().removeAttr("style"):BAHN_QF.qfShowTab(jQuery("#quickfinder ul.tablist li.active a").attr("rel"),
        "close");
        return!1
    }
    ,qfTabSetFocus:function(a){
        var b=(a=BAHN.getTarget(a))&&a.href?this.hash:document.location.hash,b=b.replace("#","");
        a?a.href?BAHN_QF.qfShowTab(b):document.getElementById("quickfinder-always-open")||BAHN_QF.qfShowTab(jQuery("#quickfinder ul.tablist li.active a").attr("rel"),"close"):BAHN_QF.qfShowTab(b)
    }
    ,qfKeydown:function(a){
        var b=a||window.event,a=b.keyCode,c=b.altKey,d=b.shiftKey,e=BAHN.getTarget(b),b=b.type,f,g=jQuery(e).attr("id");
        if(g=="qf-adult-number"||g=="qf-children-number"||
        g=="qf-infant-number"||g=="vtv-qf-adult-number"||g=="vtv-qf-children-number"||g=="preissuche-qf-adult-number"||g=="preissuche-qf-children-number"||g=="preissuche-qf-infant-number"){
            if(b==="focus"||b==="focusin"){
                jQuery(e).parent().addClass("qf-number-active");
                f=null;
                g=="qf-infant-number"?f=["#qf-children-number","#qf-adult-number"]:g=="qf-children-number"?f=["#qf-infant-number","#qf-adult-number"]:g=="qf-adult-number"?f=["#qf-infant-number","#qf-children-number"]:g=="vtv-qf-children-number"?f=["#vtv-qf-adult-number"]:
                g=="vtv-qf-adult-number"?f=["#vtv-qf-children-number"]:g=="preissuche-qf-adult-number"?f=["#preissuche-qf-children-number","#preissuche-qf-infant-number"]:g=="preissuche-qf-children-number"?f=["#preissuche-qf-adult-number","#preissuche-qf-infant-number"]:g=="preissuche-qf-infant-number"&&(f=["#preissuche-qf-adult-number","#preissuche-qf-children-number"]);
                for(var h=0;
                h<f.length;
                h++)jQuery(f[h]).parent().removeAttr("class")
            }
            
        }
        else if(!(b==="blur"||b==="focusout"))if(g=jQuery(e).parents("div.tabpanel").attr("id"),
        h=BAHN.qfInteger(g),g=jQuery(e).attr("class").indexOf("tabpanel-focus")!=-1,!c&&!(d&&b==="keydown"||h&&b==="keydown"&&!g))if(c=jQuery(e).parents("li").attr("id"),c=BAHN.qfInteger(c),d=a==BAHN.key_left||a==BAHN.key_right||a==BAHN.key_up||a==BAHN.key_down,!(!c&&!h||(g||c)&&!d)){
            d=jQuery("#quickfinder ul.tablist li.active").attr("id");
            d=BAHN.qfInteger(d);
            if((h=c||h)&&a)if((a===BAHN.key_left||a===BAHN.key_up)&&h>1)f=h-1;
            else{
                if((a===BAHN.key_right||a===BAHN.key_down)&&h<jQuery("#quickfinder ul.tablist li").length)f=
                h+1
            }
            else if(b==="focus"||b==="focusin")f=h;
            if(f&&(b==="keydown"||f!==d))BAHN_QF.qfShowTab(jQuery("#qf-tab-"+f+" a").attr("rel"),c||g?"tab":"tabpanel")
        }
        
    }
    ,QfLoc:function(){
        this.getTripleID=function(){
            var a="";
            this.loctyp&&(a+="A="+this.loctyp+"@");
            this.name&&(a+="O="+this.name+"@");
            this.id&&(a+="L="+this.id+"@");
            this.x&&(a+="X="+this.x+"@");
            this.y&&(a+="Y="+this.y+"@");
            return a
        };
        this.fromTripleID=function(a){
            if(a!=null)for(var a=a.split("@"),b=0;
            b<a.length;
            b++){
                var c=a[b].split("="),d=c[0],c=c[1];
                if("A"==
                d)this.loctyp=c;
                else if("O"==d)this.name=c;
                else if("L"==d)this.id=c;
                else if("X"==d)this.x=c;
                else if("Y"==d)this.y=c
            }
            
        }
        
    }
    ,QfStrecke:function(){},qfCookieAttributeValue:function(a){
        var a=a.split("="),b=null;
        a.length==2&&(b=a[1]);
        return b
    }
    ,QfStreckenCookieHandler:function(){
        var a,b;
        this.setCookieName=function(b){
            b&&(a=b)
        };
        this.getStrecken=function(){
            return b
        };
        this.parseCookie=function(c){
            if(a&&(c=jQuery.cookie(a)))for(b=[];
            c&&c.length>0&&c.indexOf("st=[")==0;
            ){
                for(var d=c,c=new BAHN_QF.QfStrecke,e=void 0,
                f=void 0,f=void 0,d=d.substring(4);
                d.length>0&&d.indexOf("]#")!=0;
                )if(e=d.indexOf("#"),f=d.substring(0,e),f=BAHN_QF.qfCookieAttributeValue(f),d.indexOf("s=[")==0||d.indexOf("z=[")==0||d.indexOf("v1=[")==0||d.indexOf("v2=[")==0){
                    f=c;
                    e=new BAHN_QF.QfLoc;
                    if(d.indexOf("s=[")==0)f.start=e,d=d.substring(3);
                    else if(d.indexOf("z=[")==0)f.ziel=e,d=d.substring(3);
                    else if(d.indexOf("v1=[")==0)f.via1=e,d=d.substring(4);
                    else if(d.indexOf("v2=[")==0)f.via2=e,d=d.substring(4);
                    for(var g=f=void 0,g=void 0;
                    d.length>
                    0&&d.indexOf("]#")!=0;
                    ){
                        f=d.indexOf("#");
                        g=d.substring(0,f);
                        g=BAHN_QF.qfCookieAttributeValue(g);
                        if(d.indexOf("n=")==0)e.name=g;
                        else if(d.indexOf("lt=")==0)e.locTyp=g;
                        else if(d.indexOf("id=")==0)e.id=g;
                        else if(d.indexOf("x=")==0)e.x=g;
                        else if(d.indexOf("y=")==0)e.y=g;
                        else continue;
                        d=d.substring(f+1)
                    }
                    d.indexOf("]#")==0&&(d=d.substring(2))
                }
                else{
                    if(d.indexOf("n=")==0)c.name=f;
                    else if(d.indexOf("i=")==0)c.index=f;
                    else continue;
                    d=d.substring(e+1)
                }
                c.index>=0&&c.name&&b.length<5&&b.push(c);
                d.indexOf("]#")==
                0&&(d=d.substring(2));
                c=d
            }
            
        }
        
    }
    ,QfReisender:function(){
        this.typ="";
        this.bahncard=0;
        this.geb_jahr=this.geb_monat=this.geb_tag=this.alter=this.geburtsdatum="";
        this.getAlter=function(){
            if(!this.geburtsdatum||!this.geburtsdatum.length>0||this.geburtsdatum.length>10)return this.alter&&this.alter.length>0?this.alter:"";
            var a=new Date,b=this.geburtsdatum.split(".");
            if(b.length===3)a=new Date(b[2],b[1]-1,b[0]);
            else return"";
            var b=a.getDate(),c=a.getMonth(),d=a.getFullYear(),e=new Date,a=e.getDate(),f=e.getMonth(),
            d=e.getFullYear()-d;
            (f<c||f===c&&a<b)&&d--;
            return d<0?"":d
        }
        
    }
    ,QfReiseprofil:function(){
        this.reisende=[];
        this.adults=[];
        this.children=[];
        this.infants=[];
        this.getReisender=function(a){
            var b=null;
            this.index>=0&&this.index<this.reisende.length&&(b=this.reisende[a]);
            return b
        };
        this.setDefaults=function(){
            this.name="";
            this.index=-1;
            this.schnellbuchung=0;
            this.klasse=2;
            var a=new BAHN_QF.QfReisender;
            a.typ="E";
            a.bahncard=0;
            a.geburtsdatum="";
            a.geb_tag="";
            a.geb_monat="";
            a.geb_jahr="";
            this.adults=[];
            this.adults.push(a);
            this.children=[];
            this.infants=[];
            this.reisende=[];
            this.reisende.push(a)
        }
        
    }
    ,QfReiseprofilCookieHandler:function(){
        var a,b;
        this.setCookieName=function(b){
            b&&(a=b)
        };
        this.getReiseprofile=function(){
            return b
        };
        this.parseCookie=function(c){
            if(a&&(c=jQuery.cookie(a))){
                for(b=[];
                c&&c.length>0&&c.indexOf("pr=[")==0;
                ){
                    for(var d=c,c=new BAHN_QF.QfReiseprofil,e=void 0,f=void 0,f=void 0,d=d.substring(4);
                    d.length>0&&d.indexOf("]#")!=0;
                    )if(e=d.indexOf("#"),f=d.substring(0,e),f=BAHN_QF.qfCookieAttributeValue(f),d.indexOf("rl=[")==
                    0){
                        for(var f=d,d=c,g=void 0,g=void 0,e=[],f=f.substring(4);
                        f.length>0&&f.indexOf("]#")!=0;
                        )if(g=f.indexOf("#"),g=f.substring(0,g),BAHN_QF.qfCookieAttributeValue(g),f.indexOf("r=[")==0){
                            for(var g=e,h=void 0,l=void 0,l=void 0,k=new BAHN_QF.QfReisender,f=f.substring(3);
                            f.length>0&&f.indexOf("]#")!=0;
                            ){
                                h=f.indexOf("#");
                                l=f.substring(0,h);
                                l=BAHN_QF.qfCookieAttributeValue(l);
                                if(f.indexOf("t=")==0)k.typ=l;
                                else if(f.indexOf("g=")==0)k.geburtsdatum=l;
                                else if(f.indexOf("bc=")==0)k.bahncard=l;
                                else continue;
                                f=f.substring(h+1)
                            }
                            g.length<BAHN_QF.QF_MAX_REISENDE&&g.push(k);
                            f.indexOf("]#")==0&&(f=f.substring(2))
                        }
                        d.reisende=e;
                        f.indexOf("]#")==0&&(f=f.substring(2));
                        d=f
                    }
                    else if(d.indexOf("rp=[")==0){
                        e=void 0;
                        for(d=d.substring(4);
                        d.length>0&&d.indexOf("]#")!=0;
                        )e=d.indexOf("#"),d=d.substring(e+1);
                        d.indexOf("]#")==0&&(d=d.substring(2))
                    }
                    else{
                        if(d.indexOf("n=")==0)c.name=f;
                        else if(d.indexOf("i=")==0)reiseprofilIndex=f,c.index=f;
                        else if(d.indexOf("s=")==0)c.schnellbuchung=f;
                        else if(d.indexOf("kl=")==0)c.klasse=f;
                        else continue;
                        d=d.substring(e+1)
                    }
                    c.index>=0&&b.length<5&&b.push(c);
                    d.indexOf("]#")==0&&(d=d.substring(2));
                    c=d
                }
                for(e=0;
                e<b.length;
                e++){
                    c=b[e];
                    for(f=0;
                    f<c.reisende.length;
                    f++)d=c.reisende[f],BAHN_QF.QF_REISENDER_TYP_ERW===d.typ?c.adults.push(d):BAHN_QF.QF_REISENDER_TYP_FKIND===d.typ||BAHN_QF.QF_REISENDER_TYP_AKIND===d.typ?c.children.push(d):BAHN_QF.QF_REISENDER_TYP_KKIND===d.typ&&c.infants.push(d)
                }
                
            }
            
        }
        
    }
    ,checkTripleId:function(a){
        var a=BAHN.getTarget(a),b=document.getElementById(a.id+BAHN_QF.TRIPLE_ID_EXT),
        c=b.value,d=new BAHN_QF.QfLoc;
        d.fromTripleID(c);
        if(!d.name==a.value)b.value=""
    }
    ,QfCaptcha:function(){
        var a=this;
        this.searchTimeout=1E3;
        this.create=function(){
            jQuery("#captchaReloadLink").bind("click",a.provideCaptcha);
            this.provideCaptcha()
        };
        this.provideCaptcha=function(){
            var b=jQuery("#preissuche-qf-captcha-request-url").val();
            a.searchTimeout=parseInt(jQuery("#preissuche-qf-captcha-searchtimeout").val());
            jQuery.ajax({
                async:!0,cache:!1,context:a,dataType:"json",error:a.processErrorCallback,success:a.processSuccessCallback,
                timeout:a.searchTimeout,type:"GET",url:b
            });
            setTimeout(a.isCaptchaLoaded,a.searchTimeout+500)
        };
        this.isCaptchaLoaded=function(){
            var b=jQuery("#quickfinder #scrambleCode").val();
            (b==null||b.length==0)&&a.handleCaptchaError("isCaptchaLoaded: Timeout Error")
        };
        this.processSuccessCallback=function(b){
            if(b==void 0||b==null)a.handleCaptchaError("processSuccess, AJAX ERROR: bad data from captcha server");
            else{
                var c=jQuery("#preissuche-qf-captcha-image-url").val();
                jQuery("#quickfinder #scrambleImage").attr({
                    src:c+
                    b.img,width:154,height:b.height
                });
                jQuery("#quickfinder #scrambleCode").val(b.scramble);
                jQuery("#quickfinder #captchaloadImage").hide();
                jQuery("#quickfinder #captchaImage").show().removeClass("hide");
                jQuery("#quickfinder #captchaReload").show().removeClass("hide")
            }
            
        };
        this.processErrorCallback=function(b,c){
            a.handleCaptchaError(b.status==0?"You are offline!!\n Please Check Your Network.":b.status==404?"Requested URL not found.":b.status==500?"Internal Server Error.":c=="parsererror"?"Parsing JSON Request failed.":
            c=="timeout"?"Request Time out.":"Unknow Error.\n"+b.responseText)
        };
        this.handleCaptchaError=function(){
            jQuery("#qf-preissucheContainer").hide();
            jQuery("#qf-ps-captchafehler").show().removeClass("hidden")
        }
        
    }
    ,checkPreissuchePreconditions:function(){
        jQuery.browser.msie&&jQuery.browser.version<7?(jQuery("#qf-ps-technischeVoraussetzungen").show(),jQuery("#qf-preissucheContainer").hide()):(jQuery("#qf-ps-technischeVoraussetzungen").hide(),jQuery("#qf-preissucheContainer").show())
    }
    ,qfOnSubmitTabPreissuche:function(a){
        var b=
        {};
        b.startBhfName=document.getElementById("qf-preissuche-departure-point").value;
        if(b.startBhfName==document.getElementById("qf-preissuche-departure-point-default").value)b.startBhfName="";
        var c=new BAHN_QF.QfLoc,d=document.getElementById("qf-preissuche-departure-point-tripleid").value;
        if(d!=null&&d!=""&&(c.fromTripleID(d),c.name==b.startBhfName))b.startBhfId=c.id,b.startBhfLocType=c.loctyp;
        b.zielBhfName=document.getElementById("qf-preissuche-destination-point").value;
        if(b.zielBhfName==document.getElementById("qf-preissuche-destination-point-default").value)b.zielBhfName=
        "";
        c=new BAHN_QF.QfLoc;
        d=document.getElementById("qf-preissuche-destination-point-tripleid").value;
        if(d!=null&&d!=""&&(c.fromTripleID(d),c.name==b.zielBhfName))b.zielBhfId=c.id,b.zielBhfLocType=c.loctyp;
        b.tripType=jQuery("input:radio:checked[name='ps-trip-type']").val();
        b.datumHin=document.getElementById("qf-preissuche-departure-date").value;
        c=slider.getTimeSliderValues("sucheSliderHinfahrt");
        b.sliderHinMin=c[0];
        b.sliderHinMax=c[1];
        if(b.tripType=="return")b.datumRueck=document.getElementById("qf-preissuche-return-date").value,
        c=slider.getTimeSliderValues("sucheSliderRueckfahrt"),b.sliderRueckMin=c[0],b.sliderRueckMax=c[1];
        b.schnelleVerbindungen=document.getElementById("qf-preissuche-travel-optimization").checked;
        b.reiseprofilIndex=document.getElementById("qf-preissuche-rprofil-select").value;
        b.schnellbuchung=document.getElementById("qf-preissuche-rprofil-fastbm").value;
        c=[];
        for(d=1;
        d<=BAHN_QF.QF_MAX_REISENDE;
        d++)if(jQuery("#preissuche-qf-travrow-"+d+":visible").length>0){
            var e={};
            e.typ=document.getElementById("preissuche-qf-trav-type-"+
            d).value;
            e.bc=document.getElementById("preissuche-qf-trav-bc-"+d).value;
            c.push(e)
        }
        b.travellers=c;
        b.klasse=jQuery("input:radio:checked[name='ps.tariffClass']").val();
        b.captchaScrambleCode=jQuery("#scrambleCode").val();
        b.captchaUserInput=jQuery("#captchaInputField").val();
        if(a)b.startSucheSofort=!0;
        a=jQuery.toJSON(b);
        document.getElementById("psc-anfragedata-json").value=a;
        window.name="";
        return!0
    }
    ,qfSelectByValue:function(a,b){
        if(!(a==null||b==null))for(var c=0;
        c<a.options.length;
        c++)a.options[c].selected=
        a.options[c].value==b?!0:!1
    }
    ,qfShowInfolinkWindow:function(a,b,c){
        a=window.open(a,"hilfe","width="+b+",height="+c+",menubar=no,resizable=yes,scrollbars=yes");
        if(document.layers&&a.scrollbars&&a.scrollbars.visible==!1)a.scrollbars.visibility=!0;
        a.focus()
    }
    ,qfDatePicker:function(){},qfOnSubmitTabHotel:function(a){
        var b=[];
        b.push(document.getElementById("ibeUrl").value);
        b.push("&ibe=");
        b.push(a);
        b.push("&lang=");
        b.push(document.getElementById("lang").value);
        b.push("&country=");
        b.push(document.getElementById("country").value);
        var a=document.getElementById("qf-hotel-location-default").value,c=document.getElementById("qf-hotel-location").value;
        c!=""&&c!=a&&(b.push("&location="),b.push(c));
        a=parseUserDateInput(document.getElementById("qf-hotel-arrival-date").value);
        b.push("&startDateDay=");
        b.push(a.getDate());
        b.push("&startDateMonth=");
        b.push(a.getMonth()+1);
        b.push("&startDateYear=");
        b.push(a.getFullYear());
        a=parseUserDateInput(document.getElementById("qf-hotel-departure-date").value);
        b.push("&endDateDay=");
        b.push(a.getDate());
        b.push("&endDateMonth=");
        b.push(a.getMonth()+1);
        b.push("&endDateYear=");
        b.push(a.getFullYear());
        b.push("&singleRooms=");
        b.push(document.getElementById("qf-hotel-rooms-single").value);
        b.push("&doubleRooms=");
        b.push(document.getElementById("qf-hotel-rooms-double").value);
        a=document.getElementById("qf-hotel-guests-e").value;
        a!=""&&(b.push("&adults="),b.push(a));
        b.push("&children=");
        b.push(document.getElementById("qf-hotel-guests-k").value);
        b.push("&minRating=");
        b.push(document.getElementById("qf-hotel-category").value);
        b.push("&dbkanal_007=");
        b.push(document.getElementById("dbkanal_007").value);
        window.location=b.join("");
        return!1
    }
    ,qfOnSubmitTabMietwagen:function(a){
        var b=[];
        b.push(document.getElementById("ibeUrl").value);
        b.push("&ibe=");
        b.push(a);
        b.push("&lang=");
        b.push(document.getElementById("lang").value);
        b.push("&country=");
        b.push(document.getElementById("country").value);
        b.push("&STATIONCO=");
        b.push(document.getElementById("qf-mietwagen-anmietstation").value);
        b.push("&STATIONCI=");
        b.push(document.getElementById("qf-mietwagen-rueckgabestation").value);
        b.push("&DATECO=");
        b.push(BAHN_QF.qfConvertToEuropcarTimestamp(document.getElementById("qf-mietwagen-anmietdatum").value,document.getElementById("qf-mietwagen-anmietzeit").value));
        b.push("&DATECI=");
        b.push(BAHN_QF.qfConvertToEuropcarTimestamp(document.getElementById("qf-mietwagen-rueckgabedatum").value,document.getElementById("qf-mietwagen-rueckgabezeit").value));
        b.push("&dbkanal_007=");
        b.push(document.getElementById("dbkanal_007").value);
        window.location=b.join("");
        return!1
    }
    ,qfConvertToEuropcarTimestamp:function(a,
    b){
        var c=de.bahn.util.Uhrzeit.getTime(b),d=Math.floor(c/60);
        c%=60;
        var e=parseUserDateInput(a);
        e.setHours(d);
        e.setMinutes(c);
        var f="";
        f+=e.getFullYear();
        var g=e.getMonth()+1;
        g<10&&(g="0"+g);
        f+=g;
        e=e.getDate();
        e<10&&(e="0"+e);
        f+=e;
        d<10&&(d="0"+d);
        f+=d;
        c<10&&(c="0"+c);
        f+=c;
        return f
    }
    ,dCurDate:new Date
};
jQuery(document).ready(function(){
    BAHN_QF.init()
});
if(typeof gFSUGGEST=="undefined"){
    var gFSUGGEST="defined",gFSuggestInstanceCounter=0,gFSuggestInstances=[];
    bodySelect=!0;
    var FSuggest=function(a){
        gFSuggestInstances[gFSuggestInstanceCounter]=this;
        this.instance=gFSuggestInstanceCounter++;
        this.currentInput="";
        this.timer=null;
        this.scrollSel=this.clickSel=0;
        this.userInput="";
        this.field=this.params=null;
        this.selectType=!1;
        this.changeOnSubmitOfMyFormular=function(){
            for(var a=this.field;
            a!=null;
            ){
                if(a.nodeName=="FORM"){
                    submitFunction=a.onsubmit;
                    a.onsubmit=
                    new Function("ereignis","return gFSuggestInstances["+this.instance+"].cbonsubmit(ereignis);");
                    break
                }
                a=a.parentNode
            }
            
        };
        this.cbonsubmit=function(){
            return SLs.container?(typeof hideWaitIcon=="function"&&hideWaitIcon(),SLs.inputField.focus(),!1):(this.resetHafasSuggest(),typeof submitFunction=="function"&&submitFunction(),!0)
        };
        this.cbonkeyup=function(a){
            test=this.field;
            currentKC=a?a.keyCode:window.event.keyCode;
            this.timer&&window.clearTimeout(this.timer);
            test.value.length<this.params.minChar?currentKC!=
            40&&currentKC!=38&&currentKC!=9&&currentKC!=16&&currentKC!=13?(this.setTripleId(""),fieldIndex=this.instance,SLs.inputField=this.field,SLs.delete_SLs(),SLs.inputField=this.field,SLs.fillWithCookieValues(this)):this.suggestion(currentKC):currentKC!=40&&currentKC!=38&&currentKC!=9&&currentKC!=16&&currentKC!=13?(this.setTripleId(""),this.timer=window.setTimeout("gFSuggestInstances["+this.instance+"].suggestion(test, currentKC)",this.params.stopDelay)):this.suggestion(currentKC)
        };
        this.cbonfocus=function(){
            test=
            this.field;
            this.timer&&window.clearTimeout(this.timer);
            if(test.value.length<this.params.minChar)SLs.container&&SLs.delete_SLs(),fieldIndex=this.instance,SLs.inputField=this.field,SLs.fillWithCookieValues(this)
        };
        this.cbonclick=function(a){
            SLs.container&&SLs.delete_SLs();
            currentField=a?a.target:window.event.target;
            currentField.value.length<this.params.minChar&&SLs.fillWithCookieValues(this)
        };
        this.suggestion=function(a){
            fieldIndex=this.instance;
            SLs.inputField=this.field;
            if(a==40&&SLs.container){
                if(SLs.container.getElementsByTagName("div")[SLs.countList+
                1])SLs.countList!=-1?SLs.container.getElementsByTagName("div")[SLs.countList].className="":SLs.container.scrollTop=0,SLs.countList++,SLs.container.scrollTop=SLs.currentTop*15,SLs.countList>SLs.currentBottom&&(SLs.container.scrollTop+=15,SLs.currentBottom++,SLs.currentTop++),SLs.container.getElementsByTagName("div")[SLs.countList].className="selected",SLs.container.getElementsByTagName("div")[SLs.countList].style.width=SLs.container.clientWidth+"px"
            }
            else if(a==38&&SLs.container){
                if(SLs.countList>=
                0)SLs.container.getElementsByTagName("div")[SLs.countList].className="",SLs.countList--,SLs.countList==-1?this.setSLSInput(SLs,this.userInput,SLs.countList):(SLs.container.scrollTop=SLs.currentTop*15,SLs.countList<SLs.currentTop&&(SLs.container.scrollTop-=15,SLs.currentTop--,SLs.currentBottom--),SLs.container.getElementsByTagName("div")[SLs.countList].className="selected",SLs.container.getElementsByTagName("div")[SLs.countList].style.width=SLs.container.clientWidth+"px")
            }
            else if(a!=9&&a!=16&&a!=13){
                this.userInput=
                this.field.value;
                if(SLs.container)SLs.delete_SLs(),SLs.countList=-1;
                this.field.value!=""&&this.params.useSuggest&&(document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(fieldIndex)),this.params.requestType=="ajax"?SLs.holen(this.field.value+"?",fieldIndex):SLs.getJS(this.field.value+"?",fieldIndex))
            }
            else a==13&&SLs.container&&(SLs.countList>-1&&this.setSLSInput(SLs,SLs.container.getElementsByTagName("div")[SLs.countList].lastChild.firstChild.nodeValue,SLs.countList),SLs.inputField.focus(),
            SLs.delete_SLs())
        };
        this.leaveInputField=function(){
            if(SLs.container)this.scrollSel&&this.scrollSel==1&&!this.clickSel?(SLs.inputField.focus(),this.scrollSel=0):(this.clickSel==1?(SLs.inputField.focus(),this.clickSel=0):SLs.countList>-1&&this.setSLSInput(SLs,SLs.container.getElementsByTagName("div")[SLs.countList].lastChild.firstChild.nodeValue,SLs.countList),window.setTimeout("SLs.delete_SLs();",200))
        };
        this.resetHafasSuggest=function(){};
        this.setInputFieldValue=function(a,b){
            if(typeof a.inputField!=
            "undefined")a.inputField.value=b
        };
        this.setSLSInput=function(a,b,e){
            this.setInputFieldValue(a,b);
            var f="",g="";
            if(typeof a.sls.suggestions[e]!="undefined"){
                if(typeof a.sls.suggestions[e].id!="undefined")this.setTripleId(a.sls.suggestions[e].id),a.sls.suggestions[e].id.match(/L=(\d+)/),g=RegExp.$1;
                if(typeof a.sls.suggestions[e].type!="undefined")this.setLocationType(a.sls.suggestions[e].type),f=a.sls.suggestions[e].type;
                typeof this.params.callback!="undefined"&&this.params.callback(b,a.sls.suggestions[e].xcoord,
                a.sls.suggestions[e].ycoord,f,g)
            }
            
        };
        this.setTripleId=function(a){
            if(typeof this.params.type!="undefined"){
                var b=this.field.name.charAt(this.field.name.length-1)=="G"?this.field.name.replace(/G$/,"ID"):"REQ0JourneyStops"+this.params.type+"ID",e=null;
                document.getElementsByName(b)&&(e=document.getElementsByName(b)[0]);
                if(e==null||typeof e=="undefined")e=document.createElement("input"),e.type="hidden",e.name=b,this.field.parentNode.insertBefore(e,this.field.nextSibling);
                e.value=a
            }
            
        };
        this.setLocationType=
        function(a){
            if(typeof this.params.type!="undefined"&&(this.field.name.match(/G$/)!=null||this.field.name=="S"||this.field.name=="Z")){
                var b=this.field.name=="S"?"REQ0JourneyStopsS0A":this.field.name=="Z"?"REQ0JourneyStopsZ0A":this.field.name.replace(/G$/,"A"),e=document.getElementsByName(b)[0];
                if(e!=null&&(e.nodeName=="SELECT"||e.value!=7&&e.value!=255))e.value=a;
                else if(e!=null){
                    if(e=document.getElementById("ignoreTypeCheck"),e==null||typeof e=="undefined")e=document.createElement("input"),e.type=
                    "hidden",e.name="ignoreTypeCheck",e.id="ignoreTypeCheck",e.value="yes",this.field.parentNode.insertBefore(e,this.field)
                }
                else e=document.createElement("input"),e.type="hidden",e.name=b,e.value=a,this.field.parentNode.insertBefore(e,this.field)
            }
            
        };
        if(this.instance==0)document.body.onmousedown=function(){
            document.getElementById("suggestion")&&bodySelect&&SLs.delete_SLs();
            bodySelect=!0
        };
        this.params={
            loc:a.loc,type:a.type,locType:a.locType,minChar:a.minChar,requestURL:a.requestURL,cookiename:a.cookiename,
            stopDelay:a.stopDelay,callback:a.callback,requestType:a.requestType,useSuggest:a.useSuggest,historyType:a.historyType,filter:a.filter,height:a.height,width:a.width,encoding:a.encoding
        };
        if(typeof this.params.requestType=="undefined")this.params.requestType="js";
        if(typeof this.params.useSuggest=="undefined")this.params.useSuggest=!0;
        if(typeof this.params.encoding!="undefined"&&this.params.encoding=="utf-8")this.params.requestURL=this.params.requestURL.replace(/&/,"&encoding=utf-8&");
        if(typeof this.params.height==
        "undefined")this.params.height="auto";
        if(typeof this.params.width=="undefined")this.params.width="310px";
        if(typeof this.params.loc!="undefined"&&typeof document.getElementById(this.params.loc)!="undefined"){
            this.field=document.getElementById(this.params.loc);
            for(var a=!0,b=0;
            b<this.instance;
            b++)gFSuggestInstances[b].field.form==this.field.form&&(a=!1);
            a&&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();");
            if(this.params.setFocus=="yes"&&this.instance==0){
                a=this.field;
                for(b=!0;
                a;
                ){
                    if(a.tagName=="BODY"||a.tagName=="HTML")break;
                    if(a.style.display=="none"||
                    a.style.visibility=="hidden"){
                        b=!1;
                        break
                    }
                    a=a.parentNode
                }
                b&&this.field.focus()
            }
            
        }
        
    }
    
}
var SLs={
    container:null,ajax:!1,div_breite:"auto",div_hoehe:170,countList:-1,currentTop:0,currentBottom:9,inputField:null,pos_x:0,pos_y:0,sls:null,erzeugen:function(a){
        SLs.container=document.createElement("div");
        SLs.container.id="suggestion";
        if(navigator.userAgent.toLowerCase().indexOf("opera")>-1)SLs.container.style.minWidth="148px";
        SLs.container.style.width=gFSuggestInstances[a].params.width;
        SLs.container.style.height=gFSuggestInstances[a].params.height;
        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";
        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
    }
    ,holen:function(a,b){
        if(gFSuggestInstances[b].params.locType)var c=gFSuggestInstances[b].params.locType;
        else{
            var d=gFSuggestInstances[b].field.name.replace(/G$/,
            "A");
            if(d=document.getElementsByName(d)[0])c=d.value
        }
        if(c!=null&&c!=1)return SLs.delete_SLs(),!1;
        try{
            SLs.ajax=new XMLHttpRequest
        }
        catch(e){
            try{
                SLs.ajax=new ActiveXObject("Msxml2.XMLHTTP")
            }
            catch(f){
                try{
                    SLs.ajax=new ActiveXObject("Microsoft.XMLHTTP")
                }
                catch(g){
                    SLs.delete_SLs();
                    for(c=0;
                    c<gFSuggestInstances.length;
                    c++)if(d=document.getElementById(gFSuggestInstances[c].params.loc))d.onfocus=null,d.onkeyup=null,d.onblur=null,d.onclick=null;
                    return!1
                }
                
            }
            
        }
        var h=gFSuggestInstances[b].params.requestURL+a+"&";
        if(d!=
        null&&d.nodeName=="SELECT")h=h.replace(/REQ0JourneyStopsS0A=(\d+)&/,"REQ0JourneyStopsS0A="+d.value+"&"),gFSuggestInstances[b].selectType=!0;
        gFSuggestInstances[b].params.filter=="germany"&&c&&c==1&&(h=h.replace(/&/,"&REQ0JourneyStopsS0F=selectStationNumberFilter;008000000;008099999&"));
        SLs.ajax.open("GET",h,!0);
        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)return SLs.delete_SLs(),!1;
                if(SLs.ajax.responseText)return eval(SLs.ajax.responseText),SLs.showSuggestion();
                var b=document.createTextNode("No suggestions for your input '"+a+"'.");
                SLs.container.appendChild(b);
                return!1
            }
            
        }
        
    }
    ,showSuggestion:function(){
        gFSuggestInstances[fieldIndex].params.requestURL.match(/REQ0JourneyStopsS0A=(\d)/);
        for(var a=RegExp.$1,b=navigator.userAgent.indexOf("Safari")>-1?"right: 18px;":navigator.userAgent.indexOf("MSIE")>-1?"right: 18px;":"right: 0px;",
        c=[],d=0;
        d<SLs.sls.suggestions.length;
        d++)if(SLs.container)c[d]=SLs.container.appendChild(document.createElement("div")),c[d].id=d,c[d].innerHTML="<span style='display: block;position: absolute; background-color: #fff;"+b+"'>"+((a==7||a==255)&&typeof SLs.sls.suggestions[d].typeStr!="undefined"&&!gFSuggestInstances[fieldIndex].selectType?SLs.sls.suggestions[d].typeStr:"")+"</span><span>"+SLs.sls.suggestions[d].value+"</span>",c[d].onmousedown=function(){
            gFSuggestInstances[fieldIndex].clickSel=1;
            gFSuggestInstances[fieldIndex].setSLSInput(SLs,
            this.lastChild.firstChild.nodeValue,parseInt(this.id))
        };
        else return!1;
        SLs.container.style.borderWidth="1px";
        SLs.container.style.zIndex="10002";
        if(SLs.sls.length<10){
            if(SLs.container.style.height="auto",gFSuggestInstances[fieldIndex].params.height!="auto"&&SLs.container.offsetHeight>gFSuggestInstances[fieldIndex].params.height.match(/\d./)[0])SLs.container.style.height=gFSuggestInstances[fieldIndex].params.height
        }
        else SLs.container.style.height=gFSuggestInstances[fieldIndex].params.height;
        SLs.container.style.maxHeight=
        SLs.div_hoehe+"px";
        if(navigator.userAgent.toLowerCase().indexOf("msie")>-1)SLs.container.style.width=SLs.container.clientWidth+20;
        navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.indexOf("7.0")<0&&SLs.hideSelect();
        SLs.sls.length<1&&SLs.delete_SLs();
        return!0
    }
    ,getJS:function(a,b){
        var c=gFSuggestInstances[b].params.requestURL+a+"&";
        if(gFSuggestInstances[b].params.locType)var d=gFSuggestInstances[b].params.locType;
        else{
            var e=gFSuggestInstances[b].field.name.replace(/G$/,"A");
            if(e.indexOf("A")>=0)var f=document.getElementsByName(e)[0],d=f.value
        }
        if(typeof d!="undefined"&&!(d&gFSuggestInstances[b].params.useSuggest))SLs.delete_SLs();
        else{
            if(f!=null&&f.nodeName=="SELECT")c=c.replace(/REQ0JourneyStopsS0A=(\d+)&/,"REQ0JourneyStopsS0A="+f.value+"&"),gFSuggestInstances[b].selectType=!0;
            gFSuggestInstances[b].params.filter=="germany"&&d&&d==1&&(c=c.replace(/&/,"&REQ0JourneyStopsS0F=selectStationNumberFilter;008000000;008099999&"));
            document.getElementById("hafasCallJS")!=null&&
            document.getElementsByTagName("head")[0].removeChild(document.getElementById("hafasCallJS"));
            d=document.createElement("script");
            d.type="text/javascript";
            d.src=c+"js=true&";
            d.id="hafasCallJS";
            document.getElementsByTagName("head")[0].appendChild(d)
        }
        
    }
    ,hafasurl2utf8:function(a){
        a=a.replace(/\+/g,"%20");
        a=a.replace(/%C([\d,A-F])/g,"%C3%8$1");
        a=a.replace(/%D([\d,A-F])/g,"%C3%9$1");
        a=a.replace(/%E([\d,A-F])/g,"%C3%A$1");
        a=a.replace(/%F([\d,A-F])/g,"%C3%B$1");
        return a=a.replace(/%A7/g,"%C2%A7")
    }
    ,getCookieValue:function(a,
    b,c){
        if(typeof a=="undefined"||a=="")return"";
        var d=a.search(b);
        if(d<0)return"";
        a=a.substr(d+b.length);
        d=a.search(c);
        d>0&&(a=a.substr(0,d));
        return decodeURIComponent(a)
    }
    ,fillWithCookieValues:function(a){
        if(typeof a.params.cookiename!="undefined"){
            var b=document.cookie,b=this.getCookieValue(b,a.params.cookiename+"=",";");
            if(b!=""&&(b=this.getCookieValue(b,"history=",";"),b!="")){
                b=this.hafasurl2utf8(b);
                SLs.container||document.getElementsByTagName("body")[0].appendChild(SLs.erzeugen(a.instance));
                for(var c=
                [],d=0,e=1;
                e<=6;
                e++){
                    var f=this.getCookieValue(b,"Stop"+e,"&");
                    if((typeof a.params.historyType!="number"||this.getCookieValue(f,"A=","@")&a.params.historyType)&&f!="")c[d]={},c[d].text=f,d++
                }
                if(d!=0){
                    SLs.sls={};
                    SLs.sls.suggestions=[];
                    for(e=0;
                    e<c.length;
                    e++)SLs.sls.suggestions[e]={},SLs.sls.suggestions[e].id=this.getCookieValue(c[e].text,"\ufffdL=","\ufffd"),SLs.sls.suggestions[e].value=this.getCookieValue(c[e].text,"O=","@"),SLs.sls.suggestions[e].type=this.getCookieValue(c[e].text,"A=","@");
                    a=[];
                    for(b=0;
                    b<SLs.sls.suggestions.length;
                    b++)if(SLs.container)a[b]=SLs.container.appendChild(document.createElement("div")),a[b].id=b,a[b].innerHTML=(typeof historyCookieTypeString!="undefined"&&typeof historyCookieTypeString[SLs.sls.suggestions[b].type]!="undefined"?"<span style='display: block;position: absolute; background-color: #fff;right: 0px;'>"+historyCookieTypeString[SLs.sls.suggestions[b].type]+"</span>":"")+"<span>"+SLs.sls.suggestions[b].value+"</span>",a[b].onmousedown=function(){
                        gFSuggestInstances[fieldIndex].clickSel=
                        1;
                        gFSuggestInstances[fieldIndex].setSLSInput(SLs,this.lastChild.firstChild.nodeValue,parseInt(this.id))
                    };
                    else return!1;
                    SLs.container.style.borderWidth="1px";
                    SLs.container.style.zIndex="10002";
                    SLs.container.style.height="auto";
                    if(gFSuggestInstances[fieldIndex].params.height!="auto"&&SLs.container.offsetHeight>gFSuggestInstances[fieldIndex].params.height.match(/\d./)[0])SLs.container.style.height=gFSuggestInstances[fieldIndex].params.height;
                    if(navigator.userAgent.toLowerCase().indexOf("msie")>-1)SLs.container.style.width=
                    SLs.container.clientWidth+20;
                    navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.indexOf("7.0")<0&&SLs.hideSelect();
                    SLs.sls.length<1&&SLs.delete_SLs()
                }
                
            }
            
        }
        
    }
    ,delete_SLs:function(){
        if(SLs.container&&SLs.container.parentNode)document.getElementsByTagName("body")[0].removeChild(SLs.container),navigator.userAgent.toLowerCase().indexOf("msie")>-1&&navigator.userAgent.indexOf("7.0")<0&&SLs.showSelect(),SLs.countList=-1,SLs.container=null,SLs.currentTop=0,SLs.currentBottom=9
    }
    ,getPosX:function(a){
        var b=
        0;
        if(a.offsetParent)for(;
        a.offsetParent;
        )b+=a.offsetLeft,a=a.offsetParent;
        else a.x&&(b+=a.x);
        return b
    }
    ,getPosY:function(a){
        var b=0;
        if(a.offsetParent)for(;
        a.offsetParent;
        )b+=a.offsetTop,a=a.offsetParent;
        else a.y&&(b+=a.y);
        return b
    }
    ,hideSelect:function(){
        for(var a=document.getElementsByTagName("select"),b=0;
        b<a.length;
        b++){
            var c=!1,d=!1,e=SLs.getPosX(a[b]),f=SLs.getPosY(a[b]);
            SLs.pos_x<=e&&e<SLs.pos_x+SLs.container.clientWidth?c=!0:SLs.pos_x<e+a[b].clientWidth&&e+a[b].clientWidth<=SLs.pos_x+SLs.container.clientWidth?
            c=!0:SLs.pos_x>e&&e+a[b].clientWidth>SLs.pos_x&&(c=!0);
            SLs.pos_y<f&&f<SLs.pos_y+SLs.container.clientHeight?d=!0:SLs.pos_y<f+a[b].clientHeight&&f+a[b].clientHeight<SLs.pos_y+SLs.container.clientHeight&&(d=!0);
            if(c&&d)a[b].style.visibility="hidden"
        }
        
    }
    ,showSelect:function(){
        for(var a=document.getElementsByTagName("select"),b=0;
        b<a.length;
        b++)if(a[b].style.visibility=="hidden")a[b].style.visibility="visible"
    }
    
};
(function(a,b,c){
    function d(a){
        a=a||location.href;
        return"#"+a.replace(/^[^#]*#?(.*)$/,"$1")
    }
    var e="hashchange",f=document,g,h=a.event.special,l=f.documentMode,k="on"+e in b&&(l===c||l>7);
    a.fn[e]=function(a){
        return a?this.bind(e,a):this.trigger(e)
    };
    a.fn[e].delay=50;
    h[e]=a.extend(h[e],{
        setup:function(){
            if(k)return!1;
            a(g.start)
        }
        ,teardown:function(){
            if(k)return!1;
            a(g.stop)
        }
        
    });
    g=function(){
        function g(){
            var c=d(),f=p(m);
            if(c!==m)r(m=c,f),a(b).trigger(e);
            else if(f!==m)location.href=location.href.replace(/#.*/,
            "")+f;
            l=setTimeout(g,a.fn[e].delay)
        }
        var h={},l,m=d(),o=function(a){
            return a
        }
        ,r=o,p=o;
        h.start=function(){
            l||g()
        };
        h.stop=function(){
            l&&clearTimeout(l);
            l=c
        };
        a.browser.msie&&!k&&function(){
            var b,c;
            h.start=function(){
                if(!b)c=(c=a.fn[e].src)&&c+d(),b=a('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){
                    c||r(d());
                    g()
                }).attr("src",c||"javascript:0").insertAfter("body")[0].contentWindow,f.onpropertychange=function(){
                    try{
                        if(event.propertyName==="title")b.document.title=f.title
                    }
                    catch(a){}
                }
                
            };
            h.stop=o;
            p=function(){
                return d(b.location.href)
            };
            r=function(c,d){
                var g=b.document,h=a.fn[e].domain;
                if(c!==d)g.title=f.title,g.open(),h&&g.write('<script>document.domain="'+h+'"<\/script>'),g.close(),b.location.hash=c
            }
            
        }
        ();
        return h
    }
    ()
})(jQuery,this);
(function(a){
    a.extend({
        getUrlVars:function(){
            for(var a=[],c,d=window.location.href.slice(window.location.href.indexOf("#")+1).split("&"),e=0;
            e<d.length;
            e++)c=d[e].split("="),a.push(c[0]),a[c[0]]=c[1];
            return a
        }
        ,getUrlVar:function(b){
            return a.getUrlVars()[b]
        }
        
    })
})(jQuery);
(function(a){
    a.widget("ui.filterTrains",{
        name:"f_trains",invalid:!1,disabledTrains:[],options:{
            checked:[0,0,0]
        }
        ,_allBoxes:{},_create:function(){
            this._allBoxes=a("input",this.element)
        }
        ,_init:function(){
            var b=this,c=this.options;
            this._allBoxes.each(function(d){
                var e="";
                a(this).data("id",d);
                c.checked[d]==1&&(e="checked");
                a(this).attr("checked",e);
                a(this).click(a.proxy(b._onCheckboxChange,b))
            });
            a(".train",this.element).each(function(c){
                a(this).click(function(){
                    if(b.disabledTrains[c]!=0){
                        var e=a("input",
                        b.element).eq(c);
                        e.attr("checked")==!1?e.attr("checked",!0):e.attr("checked",!1);
                        b._onCheckboxChange()
                    }
                    
                })
            });
            this._updateState()
        }
        ,setDisabledState:function(b){
            b==void 0&&(b=[1,1,1]);
            this.disabledTrains=b;
            var c=a('input[value="fv"]',this.element),d=a('input[value="nv"]',this.element),e=a('input[value="cnl"]',this.element);
            b[0]==0?this._disableTrain(c,"t01"):this._enableTrain(c,"t01");
            b[1]==0?this._disableTrain(d,"t02"):this._enableTrain(d,"t02");
            b[2]==0?this._disableTrain(e,"t03"):this._enableTrain(e,
            "t03")
        }
        ,_disableTrain:function(b,c){
            b.attr("disabled",!0);
            b.hide();
            a("."+c,this.element).addClass(c+"disabled")
        }
        ,_enableTrain:function(b,c){
            b.removeAttr("disabled");
            b.show();
            a("."+c,this.element).removeClass(c+"disabled")
        }
        ,arrayToString:function(a){
            for(var c="",d=a.length,e=0;
            e<d;
            e++)c+=a[e]==0?"0":"1",e<a.length-1&&(c+="-");
            return c
        }
        ,reset:function(){
            var a=[1,1,1];
            this.setDisabledState(a);
            if(this.arrayToString(this.options.checked)!=this.arrayToString(a))this.invalid=!0,this.options.checked=a
        }
        ,disable:function(){
            this.element.addClass("disabledText");
            a("input",this.element).attr("disabled",!0);
            a(".train",this.element).addClass("disabled")
        }
        ,enable:function(){
            a("input",this.element).attr("disabled",!1);
            a(".train",this.element).removeClass("disabled");
            this.element.removeClass("disabledText")
        }
        ,_onCheckboxChange:function(){
            var b=this;
            this._allBoxes.each(function(c){
                b.options.checked[c]=a(this).attr("checked")?1:0
            });
            this._updateState()
        }
        ,_updateState:function(){
            var b=this;
            this._allBoxes.each(function(c){
                b.options.checked[c]==0?(a(this).attr("checked",
                ""),a(".train",this.element).eq(c).removeClass("t0"+(c+1)+"active")):(a(this).attr("checked","checked"),a(".train",this.element).eq(c).addClass("t0"+(c+1)+"active"))
            });
            this.invalid=!1;
            this.element.trigger("trainChange",{
                id:this.name,value:this.option("checked")
            });
            this.element.trigger("stateChange",{
                id:this.name,value:this.option("checked")
            })
        }
        ,destroy:function(){
            a.widget.prototype.destroy.apply(this,arguments)
        }
        ,refresh:function(){
            this.invalid&&this._updateState()
        }
        ,onHashChange:function(){
            var b=[],
            b=decodeURIComponent(a.getUrlVar("f_trains")).split("-");
            if(b!="undefined"&&b.length&&this.options.checked.toString()!=b.toString())this.option("checked",b),this.invalid=!0
        }
        ,getSerialized:function(){
            for(var b="",c=0;
            c<this.options.checked.length;
            c++)b+=this.options.checked[c]==0?"0":"1",c<this.options.checked.length-1&&(b+="-");
            return a.param({
                f_trains:b
            })
        }
        
    })
})(jQuery);
(function(a){
    a.widget("bahn.abcResults",{
        options:{
            preselected:"b"
        }
        ,timer:0,_init:function(){
            var b=this;
            a("#abcContent > div.listbox").hide();
            a("#abcContent").hide();
            var c=a("#abc a",this.element);
            c.click(a.proxy(this._onABCclick,this));
            c.mouseenter(function(){
                var c=this;
                b.timer=window.setTimeout(function(){
                    a(c).trigger("click")
                }
                ,1500)
            }).mouseleave(function(){
                window.clearTimeout(b.timer)
            });
            a(".close","#abcContent").click(a.proxy(this._closeABClayer,this));
            a("#abc a.activated").length>0&&this._showLayer(a("#abc a.activated").attr("href"))
        }
        ,
        reset:function(){},_closeABClayer:function(){
            a("#abcContent").hide();
            a("a","#abcBar").removeClass("activated")
        }
        ,_showLayer:function(b){
            a("#abcContent").show();
            a("#abcBar a[href=#"+b+"]").addClass("activated");
            a("#abcContent > div.listbox").delay(200).hide();
            a("#abcContent > div#"+b+"_content").delay(200).fadeIn(400)
        }
        ,_onABCclick:function(b){
            b.preventDefault();
            window.clearTimeout(this.timer);
            b=a(b.currentTarget);
            a("a","#abcBar").removeClass("activated");
            var c=b.attr("href").substring(1);
            b.blur();
            this._showLayer(c)
        }
        
    })
})(jQuery);
(function(a){
    a.widget("bahn.personFilter",{
        name:"f_persons",sliderInstance:{},invalid:!1,stepValues:[0,24,37,51,64,76,100],options:{
            activeValueID:0
        }
        ,_create:function(){
            var b=this;
            a(".man",this.element).each(function(c){
                a(this).data("id",c+1);
                a(this).bind("mouseenter",a.proxy(b._onMouseOverMan,b));
                a(this).bind("mouseleave",a.proxy(b._onMouseOutMan,b));
                a(this).click(a.proxy(b._onManClick,b))
            });
            a(".nochoice",this.element).bind("mouseenter",a.proxy(this._onMouseOverNochoice,this)).data("id",0).bind("mouseleave",
            a.proxy(this._onMouseLeaveNochoice,this)).click(a.proxy(b._onNochoiceClick,b));
            a(".group",this.element).bind("mouseenter",a.proxy(this._onMouseOverGroup,this)).data("id",6).bind("mouseleave",a.proxy(this._onMouseLeaveGroup,this)).click(a.proxy(b._onClickGroup,b));
            this.sliderInstance=this.element.find(".sliderhandle").slider({
                slide:function(c,d){
                    b.sliderInstance.slider("value",b._findNearest(c.keyCode!=a.ui.keyCode.RIGHT,c.keyCode!=a.ui.keyCode.LEFT,d.value));
                    return!1
                }
                ,change:a.proxy(b._onSliderChange,
                b)
            })
        }
        ,_init:function(){
            this._updatePeopleAndSlider()
        }
        ,_findNearest:function(a,c,d){
            for(var e=null,f=null,g=this.stepValues,h=0;
            h<g.length;
            h++)if(a&&g[h]<=d||c&&g[h]>=d){
                var l=Math.abs(d-g[h]);
                if(f==null||l<f)e=g[h],f=l
            }
            return e
        }
        ,_onMouseOverNochoice:function(){},_onMouseLeaveNochoice:function(){},_onNochoiceClick:function(){
            0!=this.option("activeValueID")&&(this.option("activeValueID",0),this._updateState())
        }
        ,_onMouseOverGroup:function(b){
            this._highlightUpToIndex(a(b.currentTarget).data("id"))
        }
        ,_onMouseLeaveGroup:function(b){
            this.option("activeValueID")<
            6&&a(b.currentTarget).removeClass("groupActive",!1);
            this._checkManActive()
        }
        ,_onClickGroup:function(){
            6!=this.option("activeValueID")&&(this.option("activeValueID",6),this._updateState())
        }
        ,reset:function(){
            if(this.options.activeValueID!=0)this.invalid=!0,this.options.activeValueID=0
        }
        ,disable:function(){
            this.element.addClass("disabledText");
            this.sliderInstance.slider("disable");
            a("#personSlider .sliderbox",this.element).addClass("disabled");
            a(".man,.group, .nochoice",this.element).unbind().addClass("disabled")
        }
        ,
        enable:function(){
            this.element.removeClass("disabledText");
            this.sliderInstance.slider("enable");
            a(".man,.group",this.element).removeClass("disabled").bind("mouseenter",a.proxy(this._onMouseOverMan,this)).bind("mouseleave",a.proxy(this._onMouseOutMan,this)).click(a.proxy(this._onManClick,this));
            a("#personSlider .sliderbox",this.element).removeClass("disabled")
        }
        ,_onManClick:function(b){
            b=a(b.currentTarget).data("id");
            b!=this.option("activeValueID")&&(this.option("activeValueID",b),this._updateState())
        }
        ,
        _highlightUpToIndex:function(b){
            a(".man,.group",this.element).each(function(){
                var c=a(this).data("id");
                c<=b&&(c==6?a(this).toggleClass("groupActive",!0):a(this).toggleClass("active",!0))
            })
        }
        ,_onMouseOverMan:function(b){
            this._highlightUpToIndex(a(b.currentTarget).data("id"))
        }
        ,_onMouseOutMan:function(){
            this._checkManActive()
        }
        ,_checkManActive:function(){
            var b=this.option("activeValueID");
            a(".man",this.element).each(function(){
                a(this).data("id")>b&&a(this).toggleClass("active",!1)
            })
        }
        ,_onSliderChange:function(a,
        c){
            var d=this._getIndexByValue(c.value);
            this.option("activeValueID")!=d&&(this.option("activeValueID",d),this._updateState())
        }
        ,_getIndexByValue:function(a){
            for(var c,d=0;
            d<this.stepValues.length;
            d++)this.stepValues[d]==a&&(c=d);
            return c
        }
        ,_updatePeopleAndSlider:function(){
            var b=this.option("activeValueID");
            b>0&&this.element.trigger("onPersonChosen");
            a(".man",this.element).toggleClass("active",!1).each(function(c){
                c<=b-1&&a(this).toggleClass("active")
            });
            a(".group",this.element).removeClass("groupActive",
            !1).each(function(){
                b==6&&a(this).addClass("groupActive")
            });
            this.sliderInstance.slider("value",this.stepValues[b])
        }
        ,_updateState:function(){
            this._updatePeopleAndSlider();
            this.invalid=!1;
            this.element.trigger("stateChange",{
                id:this.name,value:this.option("activeValueID")
            })
        }
        ,refresh:function(){
            this.invalid&&this._updateState()
        }
        ,onHashChange:function(){
            var b=a.getUrlVar(this.name);
            if(b>=0&&b<=6&&b!=this.option("activeValueID"))this.option("activeValueID",b),this.invalid=!0
        }
        ,getSerialized:function(){
            var b=
            {
                f_persons:this.option("activeValueID")
            };
            return a.param(b)
        }
        
    })
})(jQuery);
(function(a){
    a.widget("bahn.familyFilter",{
        options:{
            preselected:0
        }
        ,name:"f_family",_currValue:0,_checkbox:{},invalid:!1,_init:function(){
            this._checkbox=a("input",this.element);
            this._currValue=this.options.preselected;
            this._checkbox.bind("click",a.proxy(this.onCheckChange,this));
            this._updateUI()
        }
        ,refresh:function(){
            if(this.invalid)this._updateState(),this.invalid=!1
        }
        ,reset:function(){
            if(this._currValue!=0)this.invalid=!0,this._currValue=0
        }
        ,onCheckChange:function(){
            this._checkbox.attr("checked")==!0?
            (this._currValue=1,this.element.trigger("familyActivated")):this._currValue=0;
            this.element.trigger("stateChange",{
                id:this.name,value:this._currValue
            })
        }
        ,_updateUI:function(){
            this._currValue==1?a("input",this.element).attr("checked","checked"):a("input",this.element).attr("checked","")
        }
        ,_updateState:function(){
            this._updateUI();
            this.element.trigger("stateChange",{
                id:this.name,value:this._currValue
            });
            this.invalid=!1
        }
        ,changeCheckBox:function(){
            a("input",this.element).attr("checked",this._currValue)
        }
        ,getSerialized:function(){
            return a.param({
                f_family:this._currValue
            })
        }
        ,
        disable:function(){
            a("input",this.element).attr("disabled",!0)
        }
        ,enable:function(){
            a("input",this.element).attr("disabled",!1)
        }
        ,onHashChange:function(){
            var b=decodeURIComponent(a.getUrlVar(this.name));
            if(b!="undefined"&&b!=this._currValue)this._currValue=b,this.invalid=!0
        }
        
    })
})(jQuery);
(function(a){
    a.widget("bahn.resultSlider",{
        options:{
            startIndex:1,idsToShow:[]
        }
        ,_coinContainer:{},_initBoxCount:0,_coinWidth:0,_coinMinWidth:8,_coinMaxWidth:16,_sliderWidth:0,counter:{},_create:function(){
            this._boxCount=this._currIndex=0;
            this._sliderbox={};
            a("#positionIndicator").append('<div id="indicatorbar">&nbsp;</div>');
            this.counter=a("#resultCount")
        }
        ,_init:function(){
            this._coinContainer=a("#positionIndicator",this.element);
            this._sliderbox=this.element.find("#resultSlider");
            this.element.find("#resultViewport").addClass("noScroll");
            this._rightArrow=this.element.find(".resultArrowRight").click(a.proxy(this._onArrowClick,this));
            this._leftArrow=this.element.find(".resultArrowLeft").click(a.proxy(this._onArrowClick,this));
            this._initBoxCount=this._boxCount=this.element.find(".resultContainerBox").length;
            this._grabIDs();
            this._updateCounter();
            this._generateCoins();
            this._checkArrow();
            this._updatePosition();
            this._makeSliderDraggable();
            a("#noResults .historyback",this.element).click(function(a){
                a.preventDefault();
                history.back()
            })
        }
        ,_makeSliderDraggable:function(){
            a("#indicatorbar",
            this.element).draggable({
                axis:"x",containment:"parent",drag:a.proxy(this._onDragBar,this),stop:a.proxy(this._onDragStop,this)
            })
        }
        ,_onDragStop:function(){
            var b=a("#indicatorbar");
            this._currIndex=Math.round(b.position().left/(this._coinWidth+5));
            this._updatePosition()
        }
        ,_onDragBar:function(){
            var b=a("#indicatorbar",this.element),c=b.outerWidth(!0),d=this._coinContainer.width(),b=b.position().left/(d-c);
            a("#resultSlider").css("left",-this._sliderWidth*b)
        }
        ,_grabIDs:function(){
            var b=this;
            a("[id^=offer_]",
            this.element).each(function(){
                var c=a(this).attr("id").split("_")[1];
                b.options.idsToShow.push(c)
            })
        }
        ,onNewResult:function(b){
            this.option("idsToShow",a.parseJSON(b));
            this._showCurrentIDs();
            this._updateCounter();
            this._boxCount=a(".resultContainerBox:visible","#resultContainer").length
        }
        ,_updateCounter:function(){
            var b=this.option("idsToShow").length;
            a(".count",this.counter).html(b);
            if(b==this._initBoxCount)return a("p",this.counter).show(),a(".counterbox",this.counter).hide(),!0;
            else b==1?(a(".singplural",
            this.counter).html("Angebot"),a(".count",this.counter).html(b)):b>1&&(a(".singplural",this.counter).html("Angebote"),a(".count",this.counter).html(b));
            a("p",this.counter).hide();
            a(".counterbox",this.counter).show()
        }
        ,_showCurrentIDs:function(){
            a('[id^="offer_"]',this.element).hide();
            var b=this.option("idsToShow"),c=b.length,d="";
            c==0?(a("#indicatorbar",this.element).hide(),a("#noResults",this.element).fadeIn()):(a("#noResults",this.element).hide(),a("#indicatorbar",this.element).show());
            for(var e=
            0;
            e<c;
            e++)d=e==c-1?d.concat("#offer_"+b[e]):d.concat("#offer_"+b[e]+", ");
            a(d,this.element).show();
            this._generateCoins();
            this._checkDraggable();
            this._moveToIndex(0)
        }
        ,_adjustIndicatorbarWidth:function(){
            var b=a(".coin",this.element).width()*4+20;
            a("#indicatorbar",this.element).width(b)
        }
        ,_checkDraggable:function(){
            this.options.idsToShow.length<=4?a("#indicatorbar",this.element).draggable({
                disabled:!0
            }):a("#indicatorbar",this.element).draggable({
                disabled:!1
            })
        }
        ,_updateIndexIndicatorPosition:function(){
            var b=
            a("#coinlayer .coin",this.element).width()*this._currIndex+this._currIndex*5;
            jQuery.browser.version.substr(0,1)=="6"&&(b+=3);
            this._currIndex==0?a("#indicatorbar",this.element).css({
                left:0
            }):a("#indicatorbar",this.element).animate({
                left:b
            }
            ,750)
        }
        ,_updatePosition:function(){
            var b=a(".resultContainerBox:visible","#resultContainer").outerWidth()+6,c=this._currIndex*b;
            this._sliderWidth=b*(this._boxCount-4);
            this._centerIndicatorbar();
            this._updateIndexIndicatorPosition();
            this._currIndex==0?this._sliderbox.animate({
                left:-c
            }
            ,
            {
                duration:200
            }):this._sliderbox.animate({
                left:-c
            }
            ,{
                duration:750
            });
            this._checkArrow()
        }
        ,_centerIndicatorbar:function(){
            var b=a("#positionIndicator",this.element),c=this._boxCount;
            c<4&&(c=4);
            var c=this._coinWidth*c+(c-1)*5+6,d=475-c/2;
            d<0&&(d=0);
            jQuery.browser.version.substr(0,1)=="6"&&(c+=6);
            b.width(c).animate({
                left:d
            }
            ,{
                duration:300
            })
        }
        ,_generateCoins:function(){
            var b=a("#positionIndicator #coinlayer");
            a(".coin",this.element).unbind().detach();
            this._boxCount=this.element.find(".resultContainerBox").not(":hidden").length;
            for(var c=0;
            c<this._boxCount;
            c++){
                var d=a('<div class="coin">&nbsp;</div>');
                d.click(a.proxy(this._onCoinClick,this));
                d.data("id",c);
                c==this._boxCount-1&&a(d).addClass("lastCoin");
                b.append(d)
            }
            this._calculateBestCoinWidth();
            this._adjustIndicatorbarWidth()
        }
        ,_calculateBestCoinWidth:function(){
            var b=Math.round((865-this._boxCount*5)/this._boxCount);
            if(b<this._coinMinWidth)b=this._coinMinWidth;
            else if(b>this._coinMaxWidth)b=this._coinMaxWidth;
            a(".coin",this.element).css("width",b);
            this._coinWidth=b
        }
        ,_onCoinClick:function(b){
            var b=
            a(b.currentTarget).data("id"),c=b-this._currIndex,d=0;
            c<0?(d=this._currIndex+c,this._moveToIndex(d)):c>=4&&this._moveToIndex(b+1-4)
        }
        ,_checkArrow:function(){
            this._currIndex==0?this._leftArrow.addClass("resultArrowLeftDisabled"):this._leftArrow.removeClass("resultArrowLeftDisabled");
            var b=a(".coin",a(this.element)).length;
            b<4||this._currIndex>=b-4?this._rightArrow.addClass("resultArrowRightDisabled"):this._rightArrow.removeClass("resultArrowRightDisabled")
        }
        ,_moveToIndex:function(a){
            this._currIndex=
            this._bringIndexInRange(a);
            this._updatePosition()
        }
        ,_bringIndexInRange:function(a){
            var c=this._boxCount-4;
            c<0&&(c=4);
            a>c?a=c:a<0&&(a=0);
            return a
        }
        ,_calcIndex:function(a){
            return this._bringIndexInRange(this._currIndex+a)
        }
        ,_next:function(){
            if(!this._rightArrow.hasClass("disabled")&&this._boxCount>4)this._currIndex=this._calcIndex(4),this._updatePosition()
        }
        ,_prev:function(){
            if(!this._leftArrow.hasClass("disabled"))this._currIndex=this._calcIndex(-4),this._updatePosition()
        }
        ,_onArrowClick:function(b){
            a(b.currentTarget).hasClass("resultArrowRight")?
            this._next():this._prev()
        }
        
    });
    a.widget("bahn.country",{
        options:{
            startCountry:0
        }
        ,name:"f_country",currValue:0,selNational:{},filter:{},selInternational:{},_create:function(){},_init:function(){
            this.currValue=this.options.startCountry;
            var b=this;
            this.selNational=a('input[value="DEU"]',this.element);
            this.selInternational=a('input[value!="DEU"]',this.element);
            a("input",this.element).click(function(){
                if(a(this).val()=="DEU")a("select",this.element).attr("disabled","disabled"),a(".icon.europe",this.element).addClass("europedisabled"),
                a(".icon.germany",this.element).removeClass("germanydisabled"),b.currValue="DEU",this.invalid=!0,b._updateState();
                else if(b.currValue==0||b.currValue=="DEU")a("select",this.element).removeAttr("disabled"),a(".icon.germany",this.element).addClass("germanydisabled"),a(".icon.europe",this.element).removeClass("europedisabled"),b.currValue="INT",b._updateState()
            });
            a(".germany",this.element).click(function(){
                a('input[value="DEU"]',this.element).trigger("click")
            });
            a(".europe",this.element).click(function(){
                a('input[value="europe"]',
                this.element).trigger("click")
            });
            a('select[name="countries"]',this.element).bind("change",a.proxy(this._onCountrySelectChange,this));
            this._updateState()
        }
        ,_onCountrySelectChange:function(b){
            var c=this,d=a("select option:selected",this.element).val(),e=a("select option",this.element).get(0);
            a(e).attr("selected")==!0&&(d=0);
            if(jQuery.browser.version.substr(0,1)=="6"||jQuery.browser.version.substr(0,1)=="7")if(e=a('select[name="countries"]').data("disabled"),e!=null){
                for(var f=!1,g=e.length,h=0;
                h<g;
                h++)if(e[h]==
                d){
                    f=!0;
                    b.preventDefault();
                    break
                }
                f?this.currValue==0?this._updateState():a("option",this.element).each(function(){
                    a(this).val()==c.currValue&&a(this).attr("selected",!0)
                }):(this.currValue=d?d:0,this._updateState())
            }
            else this.currValue=d,this._updateState();
            else this.currValue=d,this._updateState()
        }
        ,reset:function(){
            a("select",this.element).removeAttr("disabled");
            a("input",this.element).removeAttr("checked");
            if(0!=this.currValue)this.invalid=!0,this.currValue=0;
            this._releaseAllCountries()
        }
        ,disableCountries:function(b){
            this._releaseAllCountries();
            var c=a("option",this.element);
            a('select[name="countries"]').data("disabled",b);
            for(var d=0;
            d<b.length;
            d++){
                var e=c.filter("[value="+b[d]+"]");
                e.attr("disabled",!0);
                e.css({
                    color:"#6d6d6d"
                })
            }
            
        }
        ,_releaseAllCountries:function(){
            a("option",this.element).each(function(){
                a(this).removeAttr("disabled");
                a(this).css({
                    color:""
                })
            })
        }
        ,enable:function(){
            this.element.removeClass("disabledText");
            a(".germany",this.element).removeClass("germanydisabled");
            a(".europe",this.element).removeClass("europedisabled");
            a("input",
            this.element).attr("disabled",!1)
        }
        ,disable:function(){
            this.element.addClass("disabledText");
            a(".germany",this.element).addClass("germanydisabled");
            a(".europe",this.element).addClass("europedisabled");
            a("input",this.element).attr("disabled",!0)
        }
        ,_updateState:function(){
            var b=this;
            this.currValue=="DEU"?(this.selNational.attr("checked","checked"),a(".europe",this.element).addClass("europedisabled"),a(".icon.germany",this.element).removeClass("germanydisabled"),a("select",this.element).attr("disabled",
            "disabled").val("DEU")):this.currValue==0?(a(".europe",this.element).addClass("europedisabled"),a(".germany",this.element).addClass("germanydisabled"),a("select option:first",this.element).attr("selected",!0)):(a(".germany",this.element).addClass("germanydisabled"),a(".europe",this.element).removeClass("europedisabled"),a("option",this.element).each(function(){
                a(this).val()==b.currValue&&(a(this).attr("selected",!0),a("select",b.element).removeAttr("disabled"),b.selInternational.attr("checked","checked"))
            }));
            this.invalid=!1;
            this.element.trigger("countrySelect",{
                id:this.name,value:this.currValue
            });
            this.element.trigger("stateChange",{
                id:this.name,value:this.currValue
            })
        }
        ,onHashChange:function(){
            var b=a.getUrlVar(this.name);
            if(b!=void 0&&b!=this.currValue)this.invalid=!0,this.currValue=b
        }
        ,refresh:function(){
            this.invalid&&this._updateState()
        }
        ,getSerialized:function(){
            return a.param({
                f_country:this.currValue
            })
        }
        
    });
    a.widget("bahn.dayFilter",{
        options:{
            selected:[1,1,1]
        }
        ,name:"f_days",invalid:!1,_init:function(){
            var b=
            this;
            a("input",this.element).each(function(c){
                c=b.options.selected[c]?!0:!1;
                a(this).attr("checked",c);
                a(this).click(a.proxy(b._onCheckboxChange,b))
            })
        }
        ,reset:function(){
            var a=[1,1,1];
            if(this.arrayToString(a)!=this.arrayToString(this.options.selected))this.invalid=!0,this.options.selected=a
        }
        ,_updateState:function(){
            var b=this;
            a("input",this.element).each(function(c){
                b.options.selected[c]==0?a(this).attr("checked",""):a(this).attr("checked","checked")
            });
            this.invalid=!1;
            this.element.trigger("stateChange",
            {
                id:this.name,value:this.option("selected")
            })
        }
        ,enable:function(){
            a("input",this.element).attr("disabled",!1);
            this.element.removeClass("disabledText")
        }
        ,disable:function(){
            a("input",this.element).attr("disabled",!0);
            this.element.addClass("disabledText")
        }
        ,_onCheckboxChange:function(){
            var b=this;
            a("input",this.element).each(function(c){
                b.options.selected[c]=a(this).attr("checked")?1:0
            });
            this._updateState()
        }
        ,onHashChange:function(){
            var b=[],b=decodeURIComponent(a.getUrlVar(this.name)).split("-");
            if(b!=
            "undefined"&&b.length&&this.options.selected.toString()!=b.toString())this.option("selected",b),this.invalid=!0
        }
        ,refresh:function(){
            this.invalid&&this._updateState()
        }
        ,arrayToString:function(a){
            for(var c="",d=a.length,e=0;
            e<d;
            e++)c+=a[e]==0?"0":"1",e<a.length-1&&(c+="-");
            return c
        }
        ,getSerialized:function(){
            var b={
                f_days:this.arrayToString(this.options.selected)
            };
            return a.param(b)
        }
        
    });
    a.widget("bahn.howOften",{
        options:{
            selected:0
        }
        ,name:"f_howOften",currValue:0,invalid:!1,_create:function(){},_init:function(){
            var b=
            this;
            this.currValue=this.options.selected;
            a("input",this.element).click(function(){
                b.currValue=a(this).val();
                b._updateState()
            });
            this._updateUI()
        }
        ,refresh:function(){
            this.invalid&&this._updateState()
        }
        ,disable:function(){
            this.element.addClass("disabledText");
            a("input",this.element).attr("disabled",!0)
        }
        ,enable:function(){
            this.element.removeClass("disabledText");
            a("input",this.element).attr("disabled",!1)
        }
        ,_updateUI:function(){
            this.currValue==0?a("input:first",this.element).attr("checked","checked"):
            this.currValue==1?a("input",this.element).eq(1).attr("checked","checked"):this.currValue==2&&a("input",this.element).eq(2).attr("checked","checked")
        }
        ,_updateState:function(){
            this._updateUI();
            this.invalid=!1;
            this.element.trigger("stateChange",{
                id:this.name,value:this.currValue
            })
        }
        ,getSerialized:function(){
            return a.param({
                f_howOften:this.currValue
            })
        }
        ,reset:function(){
            if(0!=this.currValue)this.invalid=!0,this.currValue=0
        }
        ,onHashChange:function(){
            var b=decodeURIComponent(a.getUrlVar(this.name));
            if(b!=
            "undefined"&&b!=this.currValue)this.invalid=!0,this.currValue=b
        }
        
    })
})(jQuery);
var service;
(function(a){
    service={
        self:service,widgets:[],resultSlider:{},counter:{},personFilter:{},countryFilter:{},trainFilter:{},familyFilter:{},lastRequest:"",lockedForSubmit:!1,queryPool:[],setWidgets:function(b){
            this.widgets=b;
            for(var c=0;
            c<this.widgets.length;
            c++)a(b[c].element).bind("stateChange",a.proxy(this._changeURIParameters,this))
        }
        ,init:function(){
            a("div.resultContainerHide").hide();
            var b=a("#resultContainer").resultSlider().data("resultSlider");
            this.countryFilter=a("#filterDestination").country({
                filter:countriesAndTrains,
                startCountry:countryInit
            }).data("country");
            this.personFilter=a("#filterPersons").personFilter({
                activeValueID:personInit
            }).data("personFilter");
            this.familyFilter=a("#filterFamily").familyFilter({
                preselected:familyInit
            }).data("familyFilter");
            this.trainFilter=a("#filterTrains").filterTrains({
                checked:trainInit
            }).data("filterTrains");
            var c=a("#filterDay").dayFilter({
                selected:dayInit
            }).data("dayFilter"),d=a("#filterHowOften").howOften({
                selected:pendlerInit
            }).data("howOften");
            this.countryFilter.element.bind("countrySelect",
            a.proxy(this._lookupCountryTrainTable,this));
            this.trainFilter.element.bind("trainChange",a.proxy(this._checkAvailableCountries,this));
            this.setResultSlider(b);
            this.familyFilter.element.bind("familyActivated",a.proxy(this._onFamilyActivated,this));
            this.personFilter.element.bind("onPersonChosen",a.proxy(this._onPersonChosen,this));
            this.trainFilter.setDisabledState(countriesAndTrains[this.countryFilter.currValue]);
            this.setWidgets([this.countryFilter,this.familyFilter,this.personFilter,this.trainFilter,
            c,d]);
            a("#resetFilter").click(a.proxy(this._resetAllFilter,this));
            this.initClickTracker()
        }
        ,_onPersonChosen:function(){
            this.lockedForSubmit=!0;
            this.familyFilter.reset();
            this.familyFilter.refresh();
            this.lockedForSubmit=!1
        }
        ,_onFamilyActivated:function(){
            this.lockedForSubmit=!0;
            this.personFilter.reset();
            this.personFilter.refresh();
            this.lockedForSubmit=!1
        }
        ,_checkAvailableCountries:function(a,c){
            var d=[],e;
            for(e in countriesAndTrains){
                for(var f=countriesAndTrains[e],g=!0,h=0;
                h<3;
                h++)if(c.value[h]==1&&f[h]==
                1){
                    g=!1;
                    break
                }
                g&&d.push(e)
            }
            this.countryFilter.disableCountries(d)
        }
        ,_lookupCountryTrainTable:function(a,c){
            this.trainFilter.setDisabledState(countriesAndTrains[c.value])
        }
        ,_resetAllFilter:function(){
            for(var a=0;
            a<this.widgets.length;
            a++)this.widgets[a].reset();
            this.lockedForSubmit=!0;
            for(a=0;
            a<this.widgets.length;
            a++)this.widgets[a].refresh();
            this.lockedForSubmit=!1;
            this._changeURIParameters()
        }
        ,setResultSlider:function(a){
            self.resultSlider=a
        }
        ,_changeURIParameters:function(){
            this.lockedForSubmit||(this.setURIParameter(),
            this.submit())
        }
        ,submit:function(){
            var b=a(location).attr("hash"),c=this.getResultFromRequestPool(b);
            c.length?this._onResultFromPool(c):(this.lastRequest=b,b=this.lastRequest.substring(2),a.post("/pbin/angebotsberater.pl",b,a.proxy(this._onServerAnswer,this)));
            return!1
        }
        ,_onResultFromPool:function(a){
            resultSlider.onNewResult(a)
        }
        ,_onServerAnswer:function(a,c){
            c=="success"&&(this.queryPool[this.lastRequest]=a,resultSlider.onNewResult(a))
        }
        ,getResultFromRequestPool:function(a){
            var c=[];
            this.queryPool[a]!=
            void 0&&(c=this.queryPool[a]);
            return c
        }
        ,setURIParameter:function(){
            for(var b="",c=0;
            c<this.widgets.length;
            c++){
                var d=this.widgets[c].getSerialized();
                b+="&"+d
            }
            a(location).attr("hash",b)
        }
        ,onHashChange:function(a){
            for(var a=a.split("#")[1],c=0;
            c<this.widgets.length;
            c++)this.widgets[c].onHashChange(a);
            for(a=0;
            a<this.widgets.length;
            a++)this.widgets[a].refresh()
        }
        ,initClickTracker:function(){
            jQuery("a.abclicktracker").click(function(){
                for(var a="AB_",c=0;
                c<service.widgets.length;
                c++){
                    var d=service.widgets[c].getSerialized().split("=")[1].replace(/-/g,
                    "");
                    a+=c>0?"-"+d:d
                }
                s_gi(s_account).tl(this,"o",a)
            })
        }
        
    }
    
})(jQuery);
jQuery(document).ready(function(a){
    a("#app-wrapper").length>0&&(a("#htmlFallback").addClass("jscriptEnabled"),a("#app-wrapper").addClass("jscriptEnabled"),a("#abcSearch").abcResults(),service.init(),a(window).hashchange(function(){
        var b=a(window.location).attr("hash");
        service.onHashChange(b)
    }),a(window).trigger("hashchange"))
});
jQuery.fx.prototype.cur=function(){
    if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];
    var a=parseFloat(jQuery.css(this.elem,this.prop));
    return typeof a=="undefined"?0:a
};
var ANREISE={
    imgBaseUrl:"/common/view/static/v8/img/anreisebutton/",imgTextureSuffix:"jpg",imgTransSuffix:"gif",buttons:{
        metal:{
            typo:"typo-a",submit:"link",icons:!0,logo:!0
        }
        ,lightplastic:{
            typo:"typo-b",submit:"link",icons:!0,logo:!0
        }
        ,darkplastic:{
            typo:"typo-a",submit:"link",icons:!0,logo:!0
        }
        ,print:{
            typo:"typo-print",submit:"link",icons:!1,logo:!0
        }
        ,"visual-ice":{
            typo:"typo-b",submit:"start",icons:!1,logo:!1
        }
        ,"visual-regio":{
            typo:"typo-b",submit:"start",icons:!1,logo:!1
        }
        
    }
    ,sizes:{
        l:"large",m:"medium",
        s:"small",xs:"xs",sq:"square"
    }
    ,init:function(){
        if(jQuery("div.travelbutton").length>0){
            jQuery("div.travelbutton").addClass("js");
            var a=document.getElementById("buttonForm");
            jQuery("#buttonForm").click(ANREISE.buttonListener).bind("focusout",ANREISE.inputValidator);
            a&&a.addEventListener&&a.addEventListener("blur",ANREISE.inputValidator,!0);
            a&&a.attachEvent&&(a.attachEvent("blur",ANREISE.inputValidator),jQuery(".imgSelection img").click(function(){
                oPrev=jQuery(this).prev();
                oPrev.click();
                ANREISE.toggleVisual(oPrev)
            }));
            jQuery("#termslink").click(function(){
                jQuery("#terms").show()
            });
            jQuery("#terms").click(function(){
                jQuery("#terms").hide()
            });
            var a=jQuery("#ab-typeahead-minchars").val(),b=jQuery("#ab-typeahead-delay").val(),c=jQuery("#ab-typeahead-requrl").val();
            new FSuggest({
                loc:"preset-address",type:"S",minChar:a,requestURL:c,stopDelay:b,requestType:"js",callback:ANREISE.setAddressType
            })
        }
        
    }
    ,setAddressType:function(a,b,c,d){
        jQuery("#preset-address-type").val(d)
    }
    ,buttonListener:function(a,b){
        var c=new PORTAL.KeyObject(a||
        window.event),b=b?b:c.oTarget.id,d=jQuery(c.oTarget),b=!b&&d.hasClass("opener")?"opener":b;
        b.indexOf("bg-")===0?b="bg":b.indexOf("hl-")===0?b="hl":b.indexOf("image-")===0&&(b="visual");
        switch(b){
            case "preset-dest":case "preset-dept":ANREISE.toggleAddress("show");
            break;
            case "preset-none":ANREISE.toggleAddress("hide");
            break;
            case "size-sq":case "size-l":case "size-m":case "size-s":case "size-xs":ANREISE.toggleSize(b);
            break;
            case "opener":ANREISE.setExpanded(d);
            break;
            case "bg":ANREISE.toggleBg(d);
            break;
            case "hl":ANREISE.toggleText(d);
            break;
            case "visual":ANREISE.toggleVisual(d);
            break;
            default:if(c.oTarget.nodeName.toLowerCase()==="button"||c.oTarget.nodeName.toLowerCase()==="span")if(c=!0,jQuery(".step_1").length&&!ANREISE.validate_step_1()&&(c=!1),c===!0){
                if(c=jQuery("#fsu").val())c=c.replace("--1--",jQuery("input.size:checked").val()),c=c.replace("--2--",jQuery("input.language:checked").val()),jQuery("#buttonForm").attr("action",c);
                jQuery("#buttonForm").submit()
            }
            else return!1
        }
        
    }
    ,inputValidator:function(a){
        var a=
        new PORTAL.KeyObject(a||window.event),b=a.oTarget.id;
        jQuery(a.oTarget).val();
        ANREISE.validator(b)
    }
    ,validator:function(a){
        var b=jQuery("#"+a).val();
        switch(a){
            case "email":return ANREISE.inputFeedback(a,/^([a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)$/i.test(b));
            case "url":return b.match(/^(http\:\/\/|https\:\/\/)/)||(b="http://"+b,jQuery("#"+a).val(b)),ANREISE.inputFeedback(a,/^((http\:\/\/|https\:\/\/)(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9]))([\/]?([a-z0-9!#$%&\'\.*+\/=?^_`{|}~-]*))$/i.test(b));
            case "name":return ANREISE.inputFeedback(a,/\w+.?/i.test(b))
        }
        
    }
    ,inputFeedback:function(a,b){
        var c=b?"pass":"fail",d=jQuery("#"+a);
        d.attr("aria-invalid",!b);
        d.next().length===0||!d.next().hasClass("feedback")?d.after('<span class="feedback '+c+'"></span>'):d.next().attr("class","feedback "+c);
        return b
    }
    ,toggleAddress:function(a){
        var a=a==="show",b=jQuery("#preset-address-cont");
        a?b.addClass("selected"):b.removeClass("selected");
        BAHN.updateBuffer()
    }
    ,toggleSize:function(a){
        jQuery("#size-preview").attr("class",
        a)
    }
    ,setExpanded:function(a){
        var b=a.next().css("display")==="block"?"true":"false";
        a.attr("aria-expanded",b)
    }
    ,toggleBg:function(a){
        var b=0,c=["button-preview-img","button-preview-submit"],d=["","Button"],e=jQuery("#preview").attr("class").match(/(size-)([\w]*)/)[2],a=a.val(),f=jQuery("#langField").val(),g=jQuery("#buttonLogo");
        if(e==="s"||e==="xs")ANREISE.buttons[a].submit="link";
        if(e==="sq")ANREISE.buttons[a].logo=!0;
        var h=ANREISE.buttons[a].logo===!0?g.attr("src"):"",f=[ANREISE.imgBaseUrl+ANREISE.sizes[e]+
        "/button-"+e+"-bg-"+a+"."+ANREISE.imgTextureSuffix,ANREISE.imgBaseUrl+ANREISE.sizes[e]+"/button-"+e+"-"+ANREISE.buttons[a].submit+"-"+f+"."+ANREISE.imgTransSuffix];
        for(jQuery("#preview").attr("class","size-"+e+" "+a);
        c[b];
        )oContainer=jQuery("#"+c[b]),oContainer.length?f[b]!==oContainer.attr("src")&&oContainer.load(function(){
            jQuery(this).removeClass("hide")
        }).addClass("hide").attr("src",f[b]):jQuery("#button-preview").append('<img id="'+c[b]+'" src='+f[b]+' alt="'+d[b]+'" />'),b++;
        jQuery("#imgBg").val(f[0]);
        jQuery("#imgButton").val(f[1]);
        jQuery("#imgLogo").val(h);
        (oText=jQuery('input[name="text"]:checked'))&&ANREISE.toggleText(oText);
        (oVisual=jQuery('input[name="image"]:checked'))&&ANREISE.toggleVisual(oVisual);
        ANREISE.buttons[a].logo&&g.show()
    }
    ,toggleText:function(a){
        var b=jQuery("#button-preview-text"),c=a.attr("id")||"hl-10",d=jQuery("#preview").attr("class").match(/(size-)([\w]*)/)[2],e=jQuery('input[name="bg"]:checked').val()||"metal",f=jQuery("#langField").val(),g=ANREISE.buttons[e].typo||"typo-a";
        if((d==="s"||d==="xs")&&(e==="visual-ice"||e==="visual-regio"))g="typo-visual";
        if(c==="hl-10"&&d!=="s")return!1;
        c=ANREISE.imgBaseUrl+ANREISE.sizes[d]+"/"+g+"/button-"+d+"-"+c+"-"+g+"-"+f+"."+ANREISE.imgTransSuffix;
        b.length?b.attr("alt",a.next().text()).attr("class",g+" hide").load(function(){
            jQuery(this).removeClass("hide")
        }).attr("src",c):jQuery("#button-preview").append('<img id="button-preview-text" class="'+g+'" src='+c+' alt="" />');
        jQuery("#imgText").val(c)
    }
    ,toggleVisual:function(a){
        if(a.length===
        0)return!1;
        var b=jQuery("#button-preview-visual"),c=jQuery("#preview").attr("class").match(/(size-)([\w]*)/)[2],d=jQuery('input[name="bg"]:checked').val()||"lightplastic";
        jQuery("#langField").val();
        var e=a.val(),f=d==="print"||d.indexOf("visual")===0;
        f?(jQuery('input[name="image"]:first').click(),jQuery('input[name="image"]:gt( 0 )').attr("disabled","disabled").parent().addClass("disabled")):jQuery('input[name="image"]').removeAttr("disabled").parent().removeClass("disabled");
        if(e===""||f)return b.remove(),
        jQuery("#imgVisual").val(""),!1;
        c=e==="5"?ANREISE.imgBaseUrl+ANREISE.sizes[c]+"/images-"+c+"-"+e+"-"+d+"."+ANREISE.imgTextureSuffix:ANREISE.imgBaseUrl+ANREISE.sizes[c]+"/images-"+c+"-"+e+"."+ANREISE.imgTransSuffix;
        b.length?b.attr("alt",a.next("img").attr("alt")).attr("class","img-"+e+" hide").load(function(){
            jQuery(this).removeClass("hide")
        }).attr("src",c):jQuery("#button-preview").append('<img id="button-preview-visual" class="img-'+e+'" src='+c+' alt="'+a.next().find("img").attr("alt")+'" />');
        jQuery("#imgVisual").val(c)
    }
    ,validate_step_1:function(){
        var a=!0;
        jQuery("#label_preset").removeClass("error");
        jQuery("#label_lang").removeClass("error");
        jQuery("#label_email").removeClass("error");
        jQuery("#label_url").removeClass("error");
        jQuery("#label_salutation").removeClass("error");
        jQuery("#label_name").removeClass("error");
        jQuery("[name=preset]:checked").val()!="none"&&jQuery("[name=preset-address]").val().length<=0&&(jQuery("#label_preset").addClass("error"),a=!1);
        jQuery("[name=l]:checked").val()||
        (jQuery("#label_lang").addClass("error"),a=!1);
        if(jQuery("#email").val().length<=0||ANREISE.validator("email")===!1)jQuery("#label_email").addClass("error"),a=!1;
        if(jQuery("#url").val().length<=0||ANREISE.validator("url")===!1)jQuery("#label_url").addClass("error"),a=!1;
        jQuery("[name=anrede]:checked").val()||(jQuery("#label_salutation").addClass("error"),a=!1);
        jQuery("#name").val().length<=0&&(jQuery("#label_name").addClass("error"),a=!1);
        a===!1?(window.location="#error_msg",jQuery("#error_msg").show()):
        jQuery("#error_msg").hide();
        return a
    }
    
};
jQuery(document).ready(function(){
    ANREISE.init()
});
function eId(a){
    return document.getElementById(a)
}
function isFunction(a){
    return typeof a=="function"
}
function isObject(a){
    return typeof a=="object"&&!!a||isFunction(a)
}
function isArray(a){
    return isObject(a)&&a.constructor==Array
}
function isDate(a){
    return isObject(a)&&a.constructor==Date
}
function isString(a){
    return typeof a=="string"
}
function moveToBody(a){
    isObject(a)&&(a=a.parentNode!=null?a.parentNode.removeChild(a):a,document.body.appendChild(a));
    return a
}
Date.prototype.isLeapYear=function(){
    var a=this.getFullYear();
    return(a&3)==0&&(a%100||a%400==0&&a)
};
Date.prototype.getDaysInMonth=function(){
    daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];
    daysInMonth[1]=this.isLeapYear()?29:28;
    return Date.daysInMonth[this.getMonth()]
};
Date.prototype.getWeek=function(){
    var a=new Date(this);
    a.setDate(a.getDate()-(a.getDay()+6)%7+3);
    var b=a.valueOf();
    a.setMonth(0);
    a.setDate(4);
    return Math.round((b-a.valueOf())/6048E5)+1
};
Date.prototype.shiftD=function(a){
    this.setDate(this.getDate()+a)
};
Date.prototype.shiftM=function(a){
    this.setMonth(this.getMonth()+a)
};
Date.prototype.shiftY=function(a){
    this.setYear(this.getYear()+a)
};
function parseUserDateInput(a){
    if(isString(a)&&a.length>0&&!isDate(a)){
        if(a.length>2||a.indexOf("+")!=-1){
            /(\d+)\D+(\d+)\D+(\d+)\D*/.exec(a);
            var a=1*RegExp.$1,b=1*RegExp.$2,c=1*RegExp.$3;
            b!=""&&(b-=1,b<0?b=11:b>11&&(b=0));
            c!=""&&(c<100?c+=c<50?2E3:1900:c<1E3&&(c+=c<200?1900:1E3));
            if(c!=0&&a!=0)return new Date(c,b,a)
        }
        
    }
    else if(isDate(a))return a;
    return new Date
}
var Class={
    create:function(){
        return function(){
            this.initialize.apply(this,arguments)
        }
        
    }
    
};
CalUtils=Class.create();
CalUtils.prototype={
    initialize:function(){},getDimensions:function(a){
        for(var b=a.style.display,c={},d=a,e=0,f=0;
        d!=null;
        e+=d.offsetLeft,f+=d.offsetTop,d=d.offsetParent);
        c.x=e;
        c.y=f;
        b!="none"&&b!=null?(c.w=a.offsetWidth,c.h=a.offsetHeight):(b=a.style,d=b.visibility,e=b.position,f=b.display,b.visibility="hidden",b.position="absolute",b.display="block",c.w=a.clientWidth,c.h=a.clientHeight,b.display=f,b.position=e,b.visibility=d);
        return c
    }
    
};
function inherits(a,b){
    for(var c in a)try{
        b[c]=a[c]
    }
    catch(d){}
}
function makeObservable(a,b){
    inherits(new Observable,a);
    b!=void 0&&a.addObserver(b)
}
Array.prototype.forEach=function(a,b){
    for(var c=b||window,d=0,e=this.length;
    d<e;
    ++d)a.call(c,this[d],d,this)
};
Array.prototype.filter=function(a,b){
    for(var c=b||window,d=[],e=0,f=this.length;
    e<f;
    ++e)a.call(c,this[e],e,this)&&d.push(this[e]);
    return d
};
Observer=Class.create();
Observer.prototype={
    initialize:function(){},observe:function(){}
};
function Observable(){
    this.fns=[]
}
Observable.prototype={
    addObserver:function(a){
        this.fns.push(a)
    }
    ,removeObserver:function(a){
        this.fns=this.fns.filter(function(b){
            if(b!==a)return b
        })
    }
    ,notify:function(a){
        this.fns.forEach(function(b){
            b.observe(a)
        })
    }
    
};
CalendarControl=Class.create();
CalendarControl.prototype={
    version:"1.1",type:"calendarcontrol",value:"",today:"",fieldName:"",returnFormname:"",viewPeriodS:"",viewPeriodE:"",dataPeriodS:"",dataPeriodE:"",monthsTexts:null,weekdaysTexts:null,useWeekdays:!0,closeText:null,calendar:null,calendar_config:null,initialize:function(a){
        inherits(new Observer,this);
        inherits(a,this);
        if(!isDate(this.value))this.value=this.today;
        if(!isDate(this.today))this.value=this.today=new Date
    }
    ,getNewCalendar:function(a){
        if(typeof a=="object")var b=new Calendar(a);
        else typeof this.calendar_config=="object"?b=new Calendar(this.calendar_config):alert("no calendar configuration found!");
        b.viewPeriodS=this.viewPeriodS;
        b.viewPeriodE=this.viewPeriodE;
        b.dataPeriodS=this.dataPeriodS;
        b.dataPeriodE=this.dataPeriodE;
        b.monthsTexts=this.monthsTexts;
        b.weekdaysTexts=this.weekdaysTexts;
        b.useWeekdays=this.useWeekdays;
        b.closeText=this.closeText;
        b.value=this.value;
        b.today=this.today;
        b.myparent=this;
        b.id=this.id;
        b.name=this.id;
        b.setOneMonthOnly(!0);
        inherits(a,b);
        makeObservable(b,
        this);
        b.jumpToValue();
        pdiv=document.createElement("DIV");
        pdiv.id="calendar"+this.id;
        pdiv.className=this.styleClass;
        pdiv.style.display="none";
        myparent=eId(this.referenceObject).parentNode;
        myparent.appendChild(pdiv);
        b.div=document.createElement("DIV");
        cal=eId("calendar"+this.id);
        div=document.createElement("DIV");
        tt=document.createElement("TABLE");
        tt.style.width="100%";
        t=document.createElement("TBODY");
        tr=document.createElement("TR");
        td=document.createElement("TD");
        tr.appendChild(td);
        td=document.createElement("TD");
        td.innerHTML='<a href="#" onClick="calman.toggleDisplay(\''+this.id+"');return false;\">"+this.closeText+"</a>";
        td.style.textAlign="right";
        tr.appendChild(td);
        t.appendChild(tr);
        tt.appendChild(t);
        div.appendChild(tt);
        cal.appendChild(div);
        eId("calendar"+this.id).appendChild(b.div);
        b.draw();
        return this.calendar=b
    }
    ,getStartDateFrom:function(a){
        eval("userInput = "+this.formName+"."+a+".value;");
        this.getStartDateFromString(userInput)
    }
    ,getStartDateFromString:function(a){
        if(a=="today")this.viewPeriodS=new Date;
        else if(this.viewPeriodS=parseUserDateInput(a),this.viewPeriodS==void 0)this.viewPeriodS=new Date
    }
    ,getEndDateFrom:function(a){
        eval("userInput = "+this.returnForm+"."+a+".value;");
        this.getEndDateFromString(userInput)
    }
    ,getEndDateFromString:function(a){
        this.viewPeriodE=parseUserDateInput(a)
    }
    ,mydoWeekday:function(a){
        if(a.length==2){
            var b=this.weekdaysTexts.join("|").toLowerCase(),c=eval("/^ *("+b+") */"),a=a.toLowerCase(),c=a.match(c);
            if(c!=null){
                var d=new Date,a=d.getDay()-1,a=a==-1?a=6:a,b=b.indexOf(c[0])/
                3;
                b<a?b=b+7-a:b-=a;
                d.shiftD(b)
            }
            return d
        }
        else return a
    }
    ,formatDate:function(a,b,c){
        if(isDate(a)){
            var d=a.getDate(),e=a.getMonth()+1,f=a.getFullYear();
            d<10&&(d="0"+d);
            e<10&&(e="0"+e);
            b&&(f-=2E3,f<10&&(f="0"+f));
            return c?(a=a.getDay()-1,a=a==-1?a=6:a,this.weekdaysTexts[a]+", "+d+"."+e+"."+f):d+"."+e+"."+f
        }
        else return""
    }
    ,setDate:function(a){
        isDate(a)||(a=parseUserDateInput(a));
        this.value=a;
        if(typeof this.calendar=="object")this.calendar.value=a,this.calendar.jumpToValue(),this.calendar.draw()
    }
    ,setDateFromField:function(){
        v=
        document.forms[this.formName.replace(/document\./,"")].elements[this.fieldName].value;
        this.setDate(v)
    }
    ,toggleDisplay:function(a){
        this.setDateFromField();
        var b=this.id,c=eId(calman.calcons[b].referenceObject);
        if(c.hasChildNodes())c=c.firstChild;
        var d=eId("calendar"+b);
        moveToBody(d);
        d.style.position="absolute";
        var e=eId("calendariframe"+b);
        e==null&&(e=document.createElement("iframe"));
        document.body.appendChild(e);
        e.id="calendariframe"+b;
        e.style.position="absolute";
        calUtils=new CalUtils;
        b=calUtils.getDimensions(d);
        e.width=b.w+"px";
        e.height=b.h+"px";
        c=calUtils.getDimensions(c);
        a?(d.style.top=c.y+c.h-b.h+"px",d.style.left=c.x-1+"px",e.style.top=c.y+c.h-b.h+"px",e.style.left=c.x-1+"px"):(d.style.top=c.y-1+"px",d.style.left=c.x-1+"px",e.style.top=c.y+1+"px",e.style.left=c.x+1+"px");
        d.style.display=d.style.display!="none"?"none":"inline";
        e.style.display=d.style.display;
        return!1
    }
    
};
Calendar=Class.create();
Calendar.prototype={
    version:"1.0",type:"calendar",value:"",initialize:function(a){
        if(isObject(a)&&(this.id=this.name=a.id,isDate(a.value)))this.value=a.value;
        this.useDataPeriod=!0;
        this.showWeekNumbers=this.readOnly=!1;
        this.internalScrollers=!0;
        this.preSelectedDay=this.selectedDay=null;
        this.multipleSelect=!1;
        this.scrollable=this.fullMonthsOnly=!0;
        this.closeText=this.weekdaysTexts=this.monthsTexts=null;
        this.prevMonthHTML="&laquo";
        this.nextMonthHTML="&raquo";
        this.weekNoHTML="&nbsp;";
        this.howManyDays=
        0
    }
    ,prevMonth:function(){
        this.viewPeriodS.setDate(1);
        this.viewPeriodS.shiftM(-1);
        this.viewPeriodE.setDate(1);
        this.viewPeriodE.shiftD(-1);
        this.selectedDay=null;
        this.draw()
    }
    ,nextMonth:function(){
        this.viewPeriodS.setDate(1);
        this.viewPeriodS.shiftM(1);
        this.viewPeriodE.setDate(1);
        this.viewPeriodE.shiftM(2);
        this.viewPeriodE.setDate(1);
        this.viewPeriodE.shiftD(-1);
        this.selectedDay=null;
        this.draw()
    }
    ,setFullMonthsOnly:function(a){
        if(this.fullMonthsOnly=a)this.viewPeriodE=new Date(this.viewPeriodE.getFullYear(),
        this.viewPeriodE.getMonth()+1,1),this.viewPeriodE.setDate(1),this.viewPeriodE.shiftD(-1)
    }
    ,setOneMonthOnly:function(a){
        if(this.oneMonthOnly=a)this.viewPeriodS=new Date(this.viewPeriodS.getFullYear(),this.viewPeriodS.getMonth(),1),this.viewPeriodE=new Date(this.viewPeriodS.getFullYear(),this.viewPeriodS.getMonth()+1,1),this.viewPeriodE.shiftD(-1)
    }
    ,getHowManyDays:function(){
        for(var a=new Date(this.viewPeriodS.getFullYear(),this.viewPeriodS.getMonth(),this.viewPeriodS.getDate()),b=0;
        a.getTime()<=this.viewPeriodE.getTime();
        )b++,
        a.shiftD(1);
        return b
    }
    ,setPreselectedDate:function(a){
        date=parseUserDateInput(a);
        if(date<this.datePeriodS)date=this.datePeriodS;
        else if(date>this.datePeriodE)date=this.datePeriodE;
        this.preSelectedDay=date;
        this.selectedDay=this.getCellName(date);
        this.viewPeriodS=new Date(date);
        this.viewPeriodS.setDate(1);
        this.viewPeriodE=new Date(date);
        this.viewPeriodE.setDate(1);
        this.viewPeriodE.shiftM(1);
        this.viewPeriodE.setDate(1);
        this.viewPeriodE.shiftD(-1)
    }
    ,jumpToValue:function(){
        this.setPreselectedDate(this.value)
    }
    ,
    hideCallBack:function(){
        if(isString(this.hideCallBackName)){
            var a=this.id;
            isNaN(a)&&(a="");
            a=this.hideCallBackName+"('"+a+"');";
            eval(a)
        }
        else alert("No callback method (hideCallBackName) defined!")
    }
    ,getCellName:function(a){
        return this.name+"_df_"+a.getFullYear()+"/"+a.getMonth()+"/"+a.getDate()
    }
    ,setDate:function(a){
        if(!this.readOnly)if(this.multipleSelect){
            var b=eId(a);
            b.className=b.className=="active"?"enabled":"active"
        }
        else{
            if(this.selectedDay!=null)b=eId(this.selectedDay),b.className=typeof this.bitfield!=
            "undefined"?"working":"enabled";
            this.selectedDay=a;
            b=eId(a);
            b.className=b.className=="active"?"enabled":"active";
            this.name=""+this.name;
            a=a.substring(this.name.length+4,a.length).split("/");
            this.value=new Date(1*a[0],1*a[1],1*a[2]);
            this.notify(this);
            this.myparent.toggleDisplay()
        }
        
    }
    ,draw:function(){
        this.howManyDays=this.getHowManyDays();
        if(this.bitfield&&this.useDataPeriod){
            var a=new Date(this.dataPeriodS),b=0;
            if(a.getTime()<this.viewPeriodS.getTime())for(;
            a.getTime()<this.viewPeriodS.getTime();
            )b++,
            a.shiftD(1);
            else for(;
            a.getTime()>this.viewPeriodS.getTime();
            )b--,a.shiftD(-1)
        }
        var c=this.div,a=eId(this.name+"_table");
        if(a==null){
            a=document.createElement("TABLE");
            c.insertBefore(a,c.firstChild);
            a.setAttribute("cellSpacing","0");
            if(typeof isIE=="undefined")a.style.width="auto";
            a.style.width="100%";
            a.id=this.name+"_table";
            a.className="calendar"
        }
        c=eId(this.name+"_tbody");
        c!=null&&c.parentNode.removeChild(c);
        c=document.createElement("TBODY");
        a.appendChild(c);
        c.id=this.name+"_tbody";
        a=new Date(this.viewPeriodS);
        if(this.oneMonthOnly){
            current_row=document.createElement("TR");
            if(this.scrollable){
                this.internalScrollers?(current_cell=document.createElement("TH"),current_cell.id=this.name+"_heading_months_lt"):current_cell=eId(this.name+"prev");
                var d=new Date(a);
                d.setDate(1);
                !this.useDataPeriod||!this.dataPeriodS||this.dataPeriodS&&d.getTime()>this.dataPeriodS.getTime()?(current_cell.innerHTML=this.prevMonthHTML,current_cell.className="prevMonth",current_cell.onclick=this.internalScrollers?function(){
                    var a=this.id.substring(0,
                    this.id.indexOf("_heading_months_lt"));
                    calman.calcons[a].calendar.prevMonth()
                }
                :function(){
                    var a=this.id.substring(0,this.id.indexOf("prev"));
                    calman.calcons[a].calendar.prevMonth()
                }):(current_cell.innerHTML="",current_cell.className="disabled");
                this.internalScrollers&&current_row.appendChild(current_cell)
            }
            current_cell=document.createElement("TH");
            var e=this.scrollable&&this.internalScrollers?6:8;
            this.showWeekNumbers||(e-=1);
            current_cell.colSpan=e;
            current_cell.innerHTML=this.monthsTexts[a.getMonth()]+
            "&nbsp;"+a.getFullYear();
            current_cell.textAlign="center";
            current_cell.id=this.name+"_heading_months"+a.getMonth();
            this.multipleSelect?(current_cell.className="heading_months_enabled",current_cell.onclick=function(){
                var a=this.id.substring(0,this.id.indexOf("_heading_months")),b=this.id.substring(this.id.indexOf("_heading_months")+15,this.id.length);
                calman.calcons[a].calendar.selectMonth(b)
            }):current_cell.className="heading_months_disabled";
            current_row.appendChild(current_cell);
            if(this.scrollable)this.internalScrollers?
            (current_cell=document.createElement("TH"),current_cell.id=this.name+"_heading_months_gt"):current_cell=eId(this.name+"next"),d=new Date(a),d.setDate(1),d.shiftM(1),d.shiftD(-1),!this.useDataPeriod||!this.dataPeriodE||this.dataPeriodE&&d.getTime()<this.dataPeriodE.getTime()?(current_cell.innerHTML=this.nextMonthHTML,current_cell.className="nextMonth",current_cell.onclick=this.internalScrollers?function(){
                var a=this.id.substring(0,this.id.indexOf("_heading_months_gt"));
                calman.calcons[a].calendar.nextMonth()
            }
            :
            function(){
                var a=this.id.substring(0,this.id.indexOf("next"));
                calman.calcons[a].calendar.nextMonth()
            }):(current_cell.innerHTML="",current_cell.className="disabled"),this.internalScrollers&&current_row.appendChild(current_cell);
            c.appendChild(current_row)
        }
        var f=document.createElement("TR");
        if(this.showWeekNumbers)d=document.createElement("TH"),d.id=this.name+"_heading_"+i,d.className="heading_daynames",d.innerHTML=this.weekNoHTML,f.appendChild(d);
        for(i=0;
        i<7;
        i++)d=document.createElement("TH"),d.id=
        this.name+"_heading_"+i,d.innerHTML=this.weekdaysTexts[i],this.multipleSelect?(d.className="enabled",d.onclick=function(){
            var a=this.id.substring(0,this.id.indexOf("_heading_")),b=this.id.substring(this.id.indexOf("_heading_")+9,this.id.length);
            calman.calcons[a].calendar.selectDays(b)
        }):d.className="heading_daynames",f.appendChild(d);
        c.appendChild(f);
        daystoskip=a.getDay()-1<0?6:a.getDay()-1;
        for(var f=0,g=!1,h=-1,l=a.getWeek(),k=!0;
        k;
        ){
            h++;
            if((a.getDate()==1&&g||f==0)&&a.getTime()>=this.viewPeriodS.getTime())if(daystoskip=
            a.getDay()-1<0?6:a.getDay()-1,this.oneMonthOnly==!1)current_row=document.createElement("TR"),current_cell=document.createElement("TD"),current_cell.colSpan=7,current_cell.innerHTML=this.monthsTexts[a.getMonth()]+" - "+a.getFullYear(),current_cell.id=this.name+"_heading_months"+a.getMonth(),this.multipleSelect?(current_cell.className="enabled",current_cell.onclick=function(){
                var a=this.id.substring(0,this.id.indexOf("_heading_months")),b=this.id.substring(this.id.indexOf("_heading_months")+15,this.id.length);
                calman.calcons[a].calendar.selectMonth(b)
            }):current_cell.className="disabled",current_row.appendChild(current_cell),c.appendChild(current_row);
            current_row=eId(this.name+"_row_"+h);
            if(current_row==null)current_row=document.createElement("TR"),current_row.id=this.name+"_row_"+h,c.appendChild(current_row);
            if(this.showWeekNumbers)d=document.createElement("TD"),d.className="weekno",d.innerHTML=l++,current_row.appendChild(d);
            for(var i=0;
            i<7;
            i++){
                if(a.getDate()==1&&g==!1&&f!=0){
                    for(g=!0;
                    i<7;
                    i++)d=document.createElement("TD"),
                    d.className="disabled",d.innerHTML="&nbsp;",current_row!=null&&current_row.appendChild(d);
                    break
                }
                d=document.createElement("TD");
                daystoskip<=0&&f<this.howManyDays?(g=!1,d.id=this.getCellName(a),this.useDataPeriod&&b+f>=0&&this.dataPeriodS&&this.dataPeriodE&&a.getTime()<=this.dataPeriodE.getTime()?(this.bitfield.charAt(b+f)=="1"?(d.className="working",d.onclick=function(){
                    var a=this.id.substring(0,this.id.indexOf("_df"));
                    calman.calcons[a].calendar.setDate(this.id)
                }):(d.className="notworking",d.onclick=
                null),this.today.getTime()==a.getTime()&&(d.className+=" today"),this.value.getTime()==a.getTime()&&(d.className+=" active")):(d.className=this.readOnly==!0?"disabled":"enabled",d.onclick=function(){
                    var a=this.id.substring(0,this.id.indexOf("_df"));
                    calman.calcons[a].calendar.setDate(this.id)
                }),d.innerHTML=a.getDate(),a.shiftD(1),f+=1):(d.className="disabled",d.innerHTML="&nbsp;",d.onclick=null,daystoskip-=1);
                a.shiftD(-1);
                if(a.getTime()<this.dataPeriodS.getTime())d.className="disabled before_period",
                d.onclick=null;
                if(a.getTime()>this.dataPeriodE.getTime())d.className="disabled beyond_period",d.onclick=null;
                a.shiftD(1);
                current_row.appendChild(d)
            }
            if(a>this.viewPeriodE||f>=this.howManyDays)k=!1
        }
        if(h<5){
            f=document.createElement("TR");
            for(b=0;
            b<=e;
            b++)d=document.createElement("TD"),d.className="disabled",d.innerHTML="&nbsp;",f.appendChild(d);
            c.appendChild(f)
        }
        this.div.style.width="auto";
        this.preSelectedDay!=void 0&&(tempday=eId(this.getCellName(this.preSelectedDay)),tempday!=void 0&&(tempday.className+=
        " active"))
    }
    ,getFromVKHEXBitfield:function(a){
        this.dataPeriodS=new Date("20"+a.substr(4,2),a.substr(2,2),a.substr(0,2));
        this.dataPeriodS.shiftM(-1);
        this.dataPeriodE=new Date("20"+a.substr(10,2),a.substr(8,2),a.substr(6,2));
        this.dataPeriodE.shiftM(-1);
        for(var a=a.substring(12,a.length),b=this.bitfield="",c=0;
        c<a.length;
        c+=2){
            for(b=parseInt(a.substring(c,c+2),16).toString(2);
            b.length<8;
            )b="0"+b;
            this.bitfield+=b
        }
        return this.bitfield
    }
    
};
CalendarManager=Class.create();
CalendarManager.prototype={
    type:"CalendarManager",calcons:[],initialize:function(){},getNewCalCon:function(a){
        var b=new CalendarControl(a);
        inherits(this.config,b);
        b.myparent=this;
        this.calcons[a.referenceObject]=b;
        b.id=a.referenceObject;
        b.observe=function(a){
            this.setDate(a.value);
            document.forms[this.formName.replace(/document\./,"")].elements[this.fieldName].value=this.formatDate(this.value,this.showShortYear,this.useWeekdays);
            b.callback!=null&&b.callback(a)
        };
        makeObservable(document.forms[b.formName.replace(/document\./,
        "")].elements[b.fieldName],b);
        return b
    }
    ,createCalendar:function(a){
        a=calman.getNewCalCon(a);
        a.getNewCalendar();
        return a.id
    }
    ,shiftDate:function(a,b){
        var c=this.calcons[a];
        c.setDateFromField();
        c.value.shiftD(b);
        c.observe(c)
    }
    ,toggleDisplay:function(a){
        this.calcons[a].toggleDisplay()
    }
    
};
calman=new CalendarManager;

