var it_TravelMultiForm=function(a,l){var k=this;var e=[{name:"flight",panelId:"it_fl_Panel",scroller:"fl_scroller",element:null,form:null,panelContainer:null,panelBackground:null,panelOverlay:null},{name:"vacation",panelId:"it_vac_Panel",scroller:"vac_scroller"},{name:"hotel",panelId:"it_hot_Panel",scroller:"hot_scroller"},{name:"car",panelId:"it_car_Panel",scroller:"car_scroller"}];it_Utils.indexArray(e,"name");l=it_Utils.extendIfNonNull({cssPrefix:"tabbedPane",sections:["flight","vacation","hotel","car"],foregroundColor:"#ff0000",backgroundColor:"#999999",foregroundBright:null,backgroundBright:null,textColor:null,overlay:"bumpy",imgDir:"img/",buttonBarOptions:null,maxButtonCount:4,searchButtonColor:"#333333",searchButtonShape:"8",searchButtonText:"1",customSearchButton:null,forceIE6Version:false},l);l.imgDir=it_StringUtils.ensureEndsWith(l.imgDir,"/");l.sections=l.sections.filter(function(n){var m=e[n];return $(m.panelId)!=null});if(l.sections.length<1){throw new Error("The TravelMultiForm must contain at least 1 section")}if(!["flat","gradient","bumpy","opaque"].contains(l.overlay)){throw new Error("Unknown options.overlay: '"+l.overlay+"'")}var f;var g=[];var i=[];var h=[];var j=function(){a=it_ComponentUtils.init(k,a,l);e.forEach(function(q){q.element=$(q.panelId);if(!q.element){return}q.form=q.element.getElement("form");it_FormUtils.ensureContainsSubmit(q.form);q.element.dispose()});k.applyRedirections();l.sections.forEach(function(t,r){var q=e[t];q.panelContainer=it_ComponentUtils.createAbsoluteDiv(null,a);q.panelBackground=it_ComponentUtils.createAbsoluteDiv(l.cssPrefix.getClass(["ContentBackground","Content"+r+"Background"]),q.panelContainer);q.panelOverlay=it_ComponentUtils.createAbsoluteDiv(l.cssPrefix.getClass("ContentOverlay"),q.panelContainer);var s=q.element;s.inject(q.panelContainer);q.panelContainer.setProperty("id",s.getProperty("id")+"Container")});var n=new it_TabbedPane(a,l);l.sections.forEach(function(r){var q=e[r];it_ComponentUtils.absoluteAllOverParent(q.panelContainer);it_ComponentUtils.absoluteAllOverParent(q.panelBackground);it_ComponentUtils.absoluteAllOverParent(q.panelOverlay);it_ComponentUtils.absoluteAllOverParent(q.element)});var m=document.getElements(".multiFormSearchButton");m.setStyle("position","relative");m.addEvent("click",function(q){$(q.target).getParent("form").submit()});if(l.customSearchButton){m.forEach(function(q){q.setStyles({backgroundImage:"url("+l.customSearchButton+")",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%",cursor:"pointer"})})}else{m.forEach(function(q){g.push(it_ComponentUtils.createAbsoluteDiv("searchButtonColor",q));i.push(it_ComponentUtils.createAbsoluteDiv(null,q));h.push(it_ComponentUtils.createAbsoluteDiv(null,q))})}var o=null;var p=[];l.sections.forEach(function(r){var q=e[r];var s=window[q.scroller];if(s!=undefined){if(o==null){o=s}p.push(s);it_ComponentUtils.linkImageScrollerAndTabbedPane(s,n,q.panelId+"Container")}});if(o){o.resume()}setTimeout(function(){p.forEach(function(q){if(q.init()){q.canvas.setStyle("display","none")}})},10000);k.applyStyle()};this.applyStyle=function(n){it_Utils.extendSelected(l,n,["foregroundColor","backgroundColor","foregroundBright","backgroundBright","textColor","overlay","searchButtonColor","searchButtonShape","searchButtonText"]);l.foregroundColor=it_StringUtils.ensureStartsWith(l.foregroundColor,"#");l.backgroundColor=it_StringUtils.ensureStartsWith(l.backgroundColor,"#");if(l.textColor!==null){l.textColor=it_StringUtils.ensureStartsWith(l.textColor,"#")}if(l.searchButtonColor!==null){l.searchButtonColor=it_StringUtils.ensureStartsWith(l.searchButtonColor,"#")}var m=!l.forceIE6Version&&(!it_IE6||l.overlay==="opaque");b();var q=l.cssPrefix.getClassArray();var o=q[q.length-1];document.getElements("."+o+"TitleOn, ."+o+"HeaderContent").setStyle("backgroundColor",l.foregroundColor);document.getElements("."+o+"TitleOff, ."+o+"Title").setStyle("backgroundColor",l.backgroundColor);document.getElements("."+o+"HeaderSeparator").setStyle("backgroundColor",l.backgroundColor);var s=m?l.overlay.capitalize():"Flat";d("."+o+"HeaderOverlay",l.cssPrefix.getClassArray([l.sections.length+"ButtonBarOverlay",s+"ButtonBarOverlay",s+l.sections.length+"ButtonBarOverlay"]));if(m){var p=l.foregroundBright!==null?l.foregroundBright:it_ColorUtils.hexToHsl(l.foregroundColor)[2]>0.5;var t=l.backgroundBright!==null?l.backgroundBright:it_ColorUtils.hexToHsl(l.backgroundColor)[2]>0.5;l.sections.forEach(function(A,v){var u=e[A];var z=o+"Title"+v;var w=l.overlay=="opaque"?"Overlay":"";d("."+z+w+"On",l.cssPrefix.getClassArray(u.name.capitalize()+(p?"Dark":"Bright")));d("."+z+w+"Off",l.cssPrefix.getClassArray(u.name.capitalize()+(t?"Dark":"Bright")));var y;if(v==0){y="Left"}else{if(v==l.sections.length-1){y="Right"}else{y="Middle"}}var x=l.overlay=="opaque"?"":"Overlay";d("."+z+x+"On",l.cssPrefix.getClassArray(y+"ButtonOn"));d("."+z+x+"Off",l.cssPrefix.getClassArray(y+"ButtonOff"));["10","20","40","80","100"].forEach(function(B){d("."+o+"Title"+v+"BarOverlay"+B,[o+s+"TitleBarOverlay",o+s+"Title"+v+"BarOverlay"+B])})})}else{l.sections.forEach(function(y,v){var u=e[y];var x="."+o+"Title"+v;var w=it_message("multiFormIE6."+u.name+"Label");document.getElement(x+"On").set("text",w);document.getElement(x+"Off").set({text:w,styles:{color:t?"#161616":"#f1f1f1"}})})}l.sections.forEach(function(w,v){var u=e[w];u.panelBackground.setStyle("backgroundColor",l.foregroundColor);if(m){d(u.panelBackground,l.cssPrefix.getClassArray(["Content"+v+"Background",s+"ContentBackground",s+"Content"+v+"Background"]))}d(u.panelOverlay,l.cssPrefix.getClassArray(s+"ContentOverlay"))});var r;if(l.textColor!=null){r=l.textColor}else{r=p?"#161616":"#f1f1f1"}if(f!==r){f=r;k.canvas.getElements(".it_form_TD td, .it_form_TD2 td, .it_form_TD3 td, .it_form_TD4 td").setStyle("color",r)}if(!l.customSearchButton){if(m){g.forEach(function(u){u.className="searchButtonColor searchButtonColor"+l.searchButtonShape;u.setStyle("backgroundColor",l.searchButtonColor)});i.forEach(function(u){u.className="searchButtonShape searchButtonShape"+l.searchButtonShape});h.forEach(function(u){u.className="searchButtonText searchButtonText"+l.searchButtonText})}else{g.forEach(function(u){u.setStyle("backgroundColor",l.searchButtonColor);u.set("text",it_message("multiFormIE6.search"))})}}};this.applyRedirections=function(m){it_Utils.extendSelected(l,m,["redirectionUrls","openInNewWindow"]);e.forEach(function(n){if(l.redirectionUrls!=null){var q=l.redirectionUrls[n.name];if(q!=null){n.form.setProperty("action",q)}}if(l.openInNewWindow!=null){var o=l.openInNewWindow[n.name];if(o!==undefined){var p;if(o){p="_blank"}else{p="_top"}n.form.setProperty("target",p)}}})};var c=[];var d=function(p,o){var n;if($type(p)==="string"){n=document.getElements(p)}else{n=it_Utils.ensureArray(p)}var m={elements:n,classNames:o};c.push(m);n.forEach(function(q){it_Utils.forEach(o,function(r){q.addClass(r)})})};var b=function(){c.forEach(function(m){m.elements.forEach(function(n){it_Utils.forEach(m.classNames,function(o){n.removeClass(o)})})})};j()};