function submitenter(c,b){var a;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}else{return true}}if(a==13){c.form.submit();return false}else{return true}}function is_child_of(a,b){if(b!=null){while(b.parentNode){if((b=b.parentNode)==a){return true}}}return false}function fixOnMouseOut(element,event,JavaScript_code){var current_mouse_target=null;if(event.toElement){current_mouse_target=event.toElement}else{if(event.relatedTarget){current_mouse_target=event.relatedTarget}}if(!is_child_of(element,current_mouse_target)&&element!=current_mouse_target){eval(JavaScript_code)}}var prefix_right="o:";var prefix_left="ma";var prefix_middle="ilt";var at="@";var domain_right="tel";var domain_left="eh";var domain_middle="o";var tld="de";function doSend(c,b,d,a){location.href=prefix_left+prefix_middle+prefix_right+b+d+c+at+domain_left+domain_middle+domain_right+"."+tld+"?subject="+a;return}var dojoSearchIds=new Array();function parseDojoSearchIds(){for(var b=0;b<dojoSearchIds.length;b++){var e=dojoSearchIds[b];var a=dojo.byId(e);var d=new dojo.xml.Parse();var c=d.parseElement(a,null,true);dojo.widget.getParser().createComponents(c)}}function enableToolTip(a,d){a.onmouseover="";var c=$(a);var b=Selector.findElement(c.nextSiblings(),".toolTip");var e=new Tooltip(c,b);e.showTooltip(d)}function enableToolTipWithImage(a,f,d){a.onmouseover="";var c=$(a);var b=Selector.findElement(c.nextSiblings(),".toolTip");var g=Selector.findElement(b.childElements(),".toolTipImage");if(g!="undefined"){g.src=f}var e=new Tooltip(c,b);e.showTooltip(d)}function checkLength(b,a){if(b.value.length>=a){b.value=b.value.substring(0,a)}}function selectCheckboxes(ids,selected){var checkboxIds=eval(ids);for(var i=0;i<checkboxIds.length;i++){var checkbox=document.getElementById(checkboxIds[i]);if(checkbox){checkbox.checked=selected}}}function blockToggle(b){var a=document.getElementById(b);if(a){if(a.style.display=="none"){a.style.display="block"}else{a.style.display="none"}}}var toolTip=null;var toolTipParent=null;var toolTipParentBackgroundColor=null;function updateToolTip(a){if(toolTip!=null){x=(document.all)?window.event.x+toolTip.offsetParent.scrollLeft:a.clientX;y=(document.all)?window.event.y+toolTip.offsetParent.scrollTop:a.clientY;toolTip.style.left=(x+20)+"px";toolTip.style.top=(y+20)+"px"}}function showToolTip(d,g,c){c=c||{};c.vGap=c.vGap||0;toolTipParent=d;toolTip=document.getElementById(g);if(document.all){if(toolTip.parentNode!="BODY"){toolTip.parentNode.removeChild(toolTip);var a=document.getElementsByTagName("body")[0];a.appendChild(toolTip)}var f=findPos(d);var b=f[0];var e=f[1];toolTip.style.top=e+d.offsetHeight+c.vGap;toolTip.style.display="block";toolTip.style.left=b+d.offsetWidth-toolTip.offsetWidth}else{toolTip.style.top=(d.offsetTop+d.offsetHeight+c.vGap)+"px";toolTip.style.display="block";toolTip.style.left=(d.offsetLeft+d.offsetWidth-toolTip.offsetWidth)+"px"}toolTip.style.zIndex="100";if(c.parentBackgroundColor){toolTipParentBackgroundColor=d.style.backgroundColor;d.style.backgroundColor=c.parentBackgroundColor}}function hideToolTip(){toolTip.style.display="none";toolTip.style.zIndex="0";if(toolTipParent!=null){if(toolTipParentBackgroundColor!=null){toolTipParent.style.backgroundColor=toolTipParentBackgroundColor}}}function findPos(b){var a=curTop=0;if(b.offsetParent){do{a+=b.offsetLeft;curTop+=b.offsetTop}while(b=b.offsetParent)}return[a,curTop]}var filterValues=[];var sliderArray=new Array();var filteringFinished=false;function setFilter(filterValues){var form=document.forms.SearchFilterForm;var filters=eval(filterValues);for(var i=0;i<filters.length;i++){var filter=filters[i];var hiddenFieldName="";if(filter.key=="filterType"){hiddenFieldName="FilterTypeHiddenField"}else{if(filter.key=="amenities"){hiddenFieldName="AmenityHiddenField"}else{if(filter.key=="stars"){hiddenFieldName="StarsHiddenField"}else{if(filter.key=="rating"){hiddenFieldName="RatingHiddenField"}else{if(filter.key=="distance"){hiddenFieldName="DistanceHiddenField"}else{if(filter.key=="maxResponses"){hiddenFieldName="MaxResponsesHiddenField"}else{if(filter.key=="sortPrefTop"){hiddenFieldName="SortPrefTopHiddenField"}else{if(filter.key=="sort"){hiddenFieldName="SortHiddenField"}else{if(filter.key=="order"){hiddenFieldName="OrderHiddenField"}else{if(filter.key=="more"){hiddenFieldName="MoreHiddenField"}else{if(filter.key=="minRate"){hiddenFieldName="MinRateHiddenField"}else{if(filter.key=="maxRate"){hiddenFieldName="MaxRateHiddenField"}else{if(filter.key=="minRating"){hiddenFieldName="MinRatingHiddenField"}else{if(filter.key=="maxRating"){hiddenFieldName="MaxRatingHiddenField"}else{if(filter.key=="hotelName"){hiddenFieldName="HotelNameField"}else{if(filter.key=="message"){var element=$("WaitMessage");if(element){element.innerHTML=filter.value}}}}}}}}}}}}}}}}}if(hiddenFieldName!=""){form.elements[hiddenFieldName].value=filter.value}}}function doSearchFilterSubmit(c){var b=c||{};filteringFinished=false;tapestry.form.submitAsync($("SearchFilterForm"));if(Object.isString(b.scrollTo)){var e=$(b.scrollTo).cumulativeOffset().top;var a=document.viewport.getScrollOffsets();if(e<a.top){var d=b.duration||0;var f=b.offset||0;Effect.ScrollTo(b.scrollTo,{duration:d,offset:f});showWaitDialog.delay(d+0.1)}else{showWaitDialog()}}else{showWaitDialog()}}function showWaitDialog(){if(!filteringFinished){dojo.widget.byId("SearchFilterDialog").show()}}function subscribeSearchFilterTopic(){dojo.event.topic.subscribe("/search/filter",function(){filteringFinished=true;dojo.widget.byId("SearchFilterDialog").hide()})}function setHotelListParameter(filterValues){var form=document.forms.AddToListForm;var filters=eval(filterValues);for(var i=0;i<filters.length;i++){filter=filters[i];hiddenFieldName=filter.key;if(filter.key=="message"){var element=document.getElementById("WaitMessage");if(element){element.innerHTML=filter.value}}else{if(hiddenFieldName!=""&&form.elements[hiddenFieldName]!=null){form.elements[hiddenFieldName].value=filter.value}}}}function updateTabs(b){var f=new Array("HotelPricesTab","HotelDetailsTab","HotelPicturesTab","HotelMapTab","HotelRatingTab");var e=new Array("HotelPricesTabContainer","HotelDetailsTabContainer","HotelPicturesTabContainer","HotelMapTabContainer","HotelRatingTabContainer");for(var c=0;c<f.length;c++){var d=$(f[c]);var a=$(e[c]);if(d!=null){if(b==f[c]){d.addClassName("current");a.show()}else{d.removeClassName("current");a.hide()}}}if(b=="HotelPicturesTab"){initializePictures()}if(b=="HotelMapTab"){showHotelMap()}if($("BookNowButton")){if(b=="HotelPricesTab"){$("BookNowButton").hide();$("NoteHotelButtonWrapper").show()}else{$("BookNowButton").show();$("NoteHotelButtonWrapper").hide()}}}function updateRoomRateTabs(b){var f=new Array("RoomRateAllTab","RoomRateFlexibleTab","RoomRateNonFlexibleTab","RoomRatePrepaidTab");var e=new Array("RoomRateAllTabContainer","RoomRateFlexibleTabContainer","RoomRateNonFlexibleTabContainer","RoomRatePrepaidTabContainer");for(var c=0;c<f.length;c++){var d=$(f[c]);var a=$(e[c]);if(d!=null){if(b==f[c]){d.addClassName("current");a.show()}else{d.removeClassName("current");a.hide()}}}}function toggleTableRows(d,a){var c=$(d);if(c){for(var b=a+1;b<c.rows.length;b++){$(c.rows[b]).toggle()}}}function toggleRoomRateTableRows(b,d){var a=$(b);if(a){Element.select(a,"tr td div.moreRoomRateInfoContainer").each(Element.hide);var c=0;Element.select(a,"tr").each(function(e){if((e.hasClassName("alternate")||e.hasClassName("not-alternate"))){if(e.hasClassName("extendedRow")){c++}else{if(c>=d){Element.toggle(e)}}}})}}function PaymentFormEventHandler(b,a){this.paymentFormHashCode=b;this.containerId=a;this.handleEvent=function(d){var c=document.getElementById(this.containerId);if(c){if(this.paymentFormHashCode==d.paymentFormHashCode){c.style.display="block"}else{c.style.display="none"}}}}function PaymentReportingEventHandler(a){this.allReportingFieldNames=a;this.reserveReportingFieldNames=new Array();this.chargeReportingFieldNames=new Array();this.handleEvent=function(e){if(e.transactionType=="RESERVE"){this.reserveReportingFieldNames=e.reportingFieldNames}else{if(e.transactionType=="CHARGE"){this.chargeReportingFieldNames=e.reportingFieldNames}}var c=0;for(var f=0;f<this.allReportingFieldNames.length;f++){var b=this.allReportingFieldNames[f];var g=(this.reserveReportingFieldNames.contains(b)||this.chargeReportingFieldNames.contains(b)?"block":"none");dojo.event.topic.publish("/payment/reporting/"+b,{display:g});if(g=="block"){c++}}var j=new Array("PaymentReportingContainer");for(var f=0;f<j.length;f++){var d=document.getElementById(j[f]);if(d){if(c==0){d.style.display="none"}else{d.style.display="block"}}}}}function PaymentReportingFieldEventHandler(a){this.containerId=a;this.handleEvent=function(c){var b=document.getElementById(this.containerId);if(b){if(b.style.display!=c.display){b.style.display=c.display}}}}function togglePaymentChargeComponents(){var a;a=document.getElementById("PaymentChargeOptionContainer");if(a){if(a.style.display=="none"){a.style.display="block"}else{a.style.display="none"}}}function loadScript(b){var a=new Array();a[0]=b;loadScripts(a)}function loadScripts(b){if(b.length>0){var d=document.getElementsByTagName("head")[0];if(d){for(var c=0;c<b.length;c++){var a=document.createElement("script");a.type="text/javascript";a.src=b[c];d.appendChild(a)}}}}var hotels={language:"en",refPointLatitude:0,refPointLongitude:0,baseUrl:"",elements:[],hotelsObj:function(q,j,r,n,m,t,s,d,c,i,g,o,b,k,l,p,f,a,e){this.id=q;this.brandCode=j;this.hotelCode=r;this.latitude=n;this.longitude=m;this.name=t;this.description=s;this.address=d;this.distance=c;this.distanceUnit=i;this.stars=g;this.image=o;this.imageIndex=b;this.imageButton=k;this.brandLogo=l;this.minPrice=p;this.currency=f;this.availabilityStatus=a;this.url=e},add:function(r,j,s,o,n,u,t,d,c,i,g,p,b,l,m,q,f,a,e){var k=hotels.elements.length;hotels.elements[k]=new hotels.hotelsObj(r,j,s,o,n,u,t,d,c,i,g,p,b,l,m,q,f,a,e)},get:function(a){return hotels.elements[a]},getId:function(a){return hotels.elements[a].id},getBrandCode:function(a){return hotels.elements[a].brandCode},getHotelCode:function(a){return hotels.elements[a].hotelCode},getLatitude:function(a){return hotels.elements[a].latitude},getLongitude:function(a){return hotels.elements[a].longitude},getName:function(a){return hotels.elements[a].name},getDescription:function(a){return hotels.elements[a].description},getAddress:function(a){return hotels.elements[a].address},getDistance:function(a){return hotels.elements[a].distance},getDistanceUnit:function(a){return hotels.elements[a].distanceUnit},getImage:function(a){return hotels.elements[a].image},getImageIndex:function(a){return hotels.elements[a].imageIndex},getImageButton:function(a){return hotels.elements[a].imageButton},getStars:function(a){return hotels.elements[a].stars},getMinPrice:function(a){return hotels.elements[a].minPrice},getCurrency:function(a){return hotels.elements[a].currency},getBrandLogo:function(a){return hotels.elements[a].brandLogo},getAvailabilityStatus:function(a){return hotels.elements[a].availabilityStatus},getUrl:function(a){return hotels.elements[a].url},getHotelCount:function(){return hotels.elements.length},remove:function(a){delete hotels.elements[a]},removeAll:function(){hotels.elements=[];refPointLatitude=0;refPointLongitude=0}};var messages={put:function(a,b){messages[a]=b},get:function(a){return messages[a]}};Array.prototype.indexOf=function(c){var b,a=-1;for(b=0;b<this.length;b++){if(this[b]===c){a=b;break}}return a};Array.prototype.lastIndexOf=function(c){this.reverse();var b,a=-1;for(b=0;b<this.length;b++){if(this[b]===c){a=(this.length-1-b);break}}this.reverse();return a};Array.prototype.contains=function(c){var b,a=false;for(b=0;b<this.length;b++){if(this[b]===c){a=true;break}}return a};function changeRoomCount(b){var f=getTapestryElementsById("RoomRateButton");var e=getTapestryElementsById("SelectRoomCount");var g=b.options.selectedIndex;for(var d=0;d<e.length;d++){var c=f[d];var a=getParentTableRow(c);if(e[d]!=b||g==0){e[d].options.selectedIndex=0;c.src="img/btn_buchen_hi.png";c.disabled="disabled";a.className=((d%2==0)?"":"alternate")}else{c.src="img/btn_buchen.png";c.disabled="";a.className="currentPrice"}}}function initRoomCount(){var a=document.getElementById("SelectRoomCount");if(a){a.options.selectedIndex=1;changeRoomCount(a)}}function getParentTableRow(a){while(a!=null&&a.nodeName&&a.nodeName.toUpperCase()!="TR"){a=a.parentNode}return a}function getTapestryElementsById(b){var d=new Array();var c=document.getElementById(b);var a=0;while(c!=null){d.push(c);c=document.getElementById(b+"_"+a);a++}return d}var pic=0;var pics=new Array();var imgXUrl="";var picLabelText="";var isPicturesInitialized=false;function initializePictures(){if(!isPicturesInitialized){var a;for(var b=0;b<pics.length;b++){a=document.getElementById("thumb_"+b);a.src=asImgXUrl(pics[b]["url"],imgXUrl,75,75);a.title=pics[b]["description"]}if(pics.length>0){setpic(0,256,0)}isPicturesInitialized=true}}function changepic(a,b){if(a=="+"){pic++;if(pic>=pics.length){pic=0}}if(a=="-"){pic--;if(pic<0){pic=pics.length-1}}setpic(pic,b)}function setpic(c,d){var a=pics[c]["description"];var f=asImgXUrl(pics[c]["url"],imgXUrl,d,0);var b=document.getElementById("hotelpic_slideLabel");if(a==""){a=picLabelText+" ("+(c+1)+")"}document.images.hotelpic.src=f;if(b.firstChild){b.firstChild.nodeValue=a}else{var e=document.createTextNode(a);b.appendChild(e)}pic=c}function asImgXUrl(e,d,c,b){var a=d+"?src="+e;if(c>0){a+="&width="+c}if(b>0){a+="&height="+b}return a}function selectWert(sObj){with(sObj){return options[selectedIndex].value}}function selectKey(sObj){with(sObj){return options[selectedIndex].text}}function showMore(){var a=document.getElementById("SearchRoomCountField");for(var b=0;b<a.length;b++){if(a[b].value=="3"){a[b].selected=true}else{a[b].selected=false}}dojo.widget.byId("AdvancedBookingSearchOverlay_0").show();document.getElementById("AdvancedBooking").style.display="block"}function Overlay_show(a){if(selectWert(document.getElementById("SearchRoomCountField"))=="3"){document.getElementById("AdvancedBooking").style.display="block";if(!a){if(dojo.widget.byId("AdvancedBookingSearchOverlay_0")){dojo.widget.byId("AdvancedBookingSearchOverlay_0").show()}}}else{document.getElementById("AdvancedBooking").style.display="none"}}var activex=((navigator.userAgent.indexOf("Win")!=-1)&&(navigator.userAgent.indexOf("MSIE")!=-1)&&(parseInt(navigator.appVersion)>=4));var CantDetect=((navigator.userAgent.indexOf("Safari")!=-1)||(navigator.userAgent.indexOf("Opera")!=-1));function oopsPopup(){if((navigator.language&&navigator.language.indexOf("ja")!=-1)||(navigator.systemLanguage&&navigator.systemLanguage.indexOf("ja")!=-1)||(navigator.userLanguage&&navigator.userLanguage.indexOf("ja")!=-1)){var e="http://download.skype.com/share/skypebuttons/oops/oops_ja.html"}else{var e="http://download.skype.com/share/skypebuttons/oops/oops.html"}var b="oops";var d=540,g=305;var f="no";w=screen.availWidth;h=screen.availHeight;var c=(w-d)/2,a=(h-g)/2;oopswindow=window.open(e,b,"width="+d+",height="+g+",scrollbars="+f+",screenx="+c+",screeny="+a+",top="+a+",left="+c);return false}if(typeof(detected)=="undefined"&&activex){document.write(['<script language="VBscript">',"Function isSkypeInstalled()","on error resume next",'Set oSkype = CreateObject("Skype.Detection")',"isSkypeInstalled = IsObject(oSkype)","Set oSkype = nothing","End Function","<\/script>"].join("\n"))}function skypeCheck(){if(CantDetect){return true}else{if(!activex){var a=navigator.mimeTypes["application/x-skype"];detected=true;if(typeof(a)=="object"){return true}else{return oopsPopup()}}else{if(isSkypeInstalled()){detected=true;return true}}}detected=true;return oopsPopup()}function loadDetection(){if(document.getElementById&&document.getElementsByTagName){if(window.addEventListener){window.addEventListener("load",addDetection,false)}else{if(window.attachEvent){window.attachEvent("onload",addDetection)}}}}function addDetection(){var c=document.getElementsByTagName("a");for(var b=0;b<c.length;b++){if(c[b].childNodes[0]&&c[b].childNodes[0].src){if((c[b].childNodes[0].src.indexOf("download.skype.com/share/skypebuttons")!=-1||c[b].childNodes[0].src.indexOf("mystatus.skype.com")!=-1)&&(typeof(c[b].onclick)=="undefined"||c[b].onclick==null)){c[b].onclick=function a(){return skypeCheck()}}}}}loadDetection();Calendar=function(d,c,f,a){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=f||null;this.onClose=a||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT.DEF_DATE_FORMAT;this.ttDateFormat=Calendar._TT.TT_DATE_FORMAT;this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof d=="number"?d:Calendar._FD;this.showsOtherMonths=false;this.dateStr=c;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined"){Calendar._SDN_len=3}var b=new Array();for(var e=8;e>0;){b[--e]=Calendar._DN[e].substr(0,Calendar._SDN_len)}Calendar._SDN=b;if(typeof Calendar._SMN_len=="undefined"){Calendar._SMN_len=3}b=new Array();for(var e=12;e>0;){b[--e]=Calendar._MN[e].substr(0,Calendar._SMN_len)}Calendar._SMN=b}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(e){var a=0,d=0;var c=/^div$/i.test(e.tagName);if(c&&e.scrollLeft){a=e.scrollLeft}if(c&&e.scrollTop){d=e.scrollTop}var f={x:e.offsetLeft-a,y:e.offsetTop-d};if(e.offsetParent){var b=this.getAbsolutePos(e.offsetParent);f.x+=b.x;f.y+=b.y}return f};Calendar.isRelated=function(c,a){var d=a.relatedTarget;if(!d){var b=a.type;if(b=="mouseover"){d=a.fromElement}else{if(b=="mouseout"){d=a.toElement}}}while(d){if(d==c){return true}d=d.parentNode}return false};Calendar.removeClass=function(e,d){if(!(e&&e.className)){return}var a=e.className.split(" ");var b=new Array();for(var c=a.length;c>0;){if(a[--c]!=d){b[b.length]=a[c]}}e.className=b.join(" ")};Calendar.addClass=function(b,a){Calendar.removeClass(b,a);b.className+=" "+a};Calendar.getElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.currentTarget;while(b.nodeType!=1||/^div$/i.test(b.tagName)){b=b.parentNode}return b};Calendar.getTargetElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.target;while(b.nodeType!=1){b=b.parentNode}return b};Calendar.stopEvent=function(a){a||(a=window.event);if(Calendar.is_ie){a.cancelBubble=true;a.returnValue=false}else{a.preventDefault();a.stopPropagation()}return false};Calendar.addEvent=function(a,c,b){if(a.attachEvent){a.attachEvent("on"+c,b)}else{if(a.addEventListener){a.addEventListener(c,b,true)}else{a["on"+c]=b}}};Calendar.removeEvent=function(a,c,b){if(a.detachEvent){a.detachEvent("on"+c,b)}else{if(a.removeEventListener){a.removeEventListener(c,b,true)}else{a["on"+c]=null}}};Calendar.createElement=function(c,b){var a=null;if(document.createElementNS){a=document.createElementNS("http://www.w3.org/1999/xhtml",c)}else{a=document.createElement(c)}if(typeof b!="undefined"){b.appendChild(a)}return a};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true)}}};Calendar.findMonth=function(a){if(typeof a.month!="undefined"){return a}else{if(typeof a.parentNode.month!="undefined"){return a.parentNode}}return null};Calendar.findYear=function(a){if(typeof a.year!="undefined"){return a}else{if(typeof a.parentNode.year!="undefined"){return a.parentNode}}return null};Calendar.showMonthsCombo=function(){var e=Calendar._C;if(!e){return false}var e=e;var f=e.activeDiv;var d=e.monthsCombo;if(e.hilitedMonth){Calendar.removeClass(e.hilitedMonth,"hilite")}if(e.activeMonth){Calendar.removeClass(e.activeMonth,"active")}var c=e.monthsCombo.getElementsByTagName("div")[e.date.getMonth()];Calendar.addClass(c,"active");e.activeMonth=c;var b=d.style;b.display="block";if(f.navtype<0){b.left=f.offsetLeft+"px"}else{var a=d.offsetWidth;if(typeof a=="undefined"){a=50}b.left=(f.offsetLeft+f.offsetWidth-a)+"px"}b.top=(f.offsetTop+f.offsetHeight)+"px"};Calendar.showYearsCombo=function(d){var a=Calendar._C;if(!a){return false}var a=a;var c=a.activeDiv;var f=a.yearsCombo;if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}if(a.activeYear){Calendar.removeClass(a.activeYear,"active")}a.activeYear=null;var b=a.date.getFullYear()+(d?1:-1);var k=f.firstChild;var j=false;for(var e=12;e>0;--e){if(b>=a.minYear&&b<=a.maxYear){k.innerHTML=b;k.year=b;k.style.display="block";j=true}else{k.style.display="none"}k=k.nextSibling;b+=d?a.yearStep:-a.yearStep}if(j){var l=f.style;l.display="block";if(c.navtype<0){l.left=c.offsetLeft+"px"}else{var g=f.offsetWidth;if(typeof g=="undefined"){g=50}l.left=(c.offsetLeft+c.offsetWidth-g)+"px"}l.top=(c.offsetTop+c.offsetHeight)+"px"}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false}if(cal.timeout){clearTimeout(cal.timeout)}var el=cal.activeDiv;if(!el){return false}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev)}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler()}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler()}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev)}};Calendar.tableMouseOver=function(o){var a=Calendar._C;if(!a){return}var c=a.activeDiv;var k=Calendar.getTargetElement(o);if(k==c||k.parentNode==c){Calendar.addClass(c,"hilite active");Calendar.addClass(c.parentNode,"rowhilite")}else{if(typeof c.navtype=="undefined"||(c.navtype!=50&&(c.navtype==0||Math.abs(c.navtype)>2))){Calendar.removeClass(c,"active")}Calendar.removeClass(c,"hilite");Calendar.removeClass(c.parentNode,"rowhilite")}o||(o=window.event);if(c.navtype==50&&k!=c){var n=Calendar.getAbsolutePos(c);var q=c.offsetWidth;var p=o.clientX;var r;var m=true;if(p>n.x+q){r=p-n.x-q;m=false}else{r=n.x-p}if(r<0){r=0}var f=c._range;var j=c._current;var g=Math.floor(r/10)%f.length;for(var e=f.length;--e>=0;){if(f[e]==j){break}}while(g-->0){if(m){if(--e<0){e=f.length-1}}else{if(++e>=f.length){e=0}}}var b=f[e];c.innerHTML=b;a.onUpdateTime()}var d=Calendar.findMonth(k);if(d){if(d.month!=a.date.getMonth()){if(a.hilitedMonth){Calendar.removeClass(a.hilitedMonth,"hilite")}Calendar.addClass(d,"hilite");a.hilitedMonth=d}else{if(a.hilitedMonth){Calendar.removeClass(a.hilitedMonth,"hilite")}}}else{if(a.hilitedMonth){Calendar.removeClass(a.hilitedMonth,"hilite")}var l=Calendar.findYear(k);if(l){if(l.year!=a.date.getFullYear()){if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}Calendar.addClass(l,"hilite");a.hilitedYear=l}else{if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}}}else{if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}}}return Calendar.stopEvent(o)};Calendar.tableMouseDown=function(a){if(Calendar.getTargetElement(a)==Calendar.getElement(a)){return Calendar.stopEvent(a)}};Calendar.calDragIt=function(b){var c=Calendar._C;if(!(c&&c.dragging)){return false}var e;var d;if(Calendar.is_ie){d=window.event.clientY+document.body.scrollTop;e=window.event.clientX+document.body.scrollLeft}else{e=b.pageX;d=b.pageY}c.hideShowCovered();var a=c.element.style;a.left=(e-c.xOffs)+"px";a.top=(d-c.yOffs)+"px";return Calendar.stopEvent(b)};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev)}cal.hideShowCovered()};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300){with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver)}else{addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver)}addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp)}}else{if(cal.isPopup){cal._dragStart(ev)}}if(el.navtype==-1||el.navtype==1){if(cal.timeout){clearTimeout(cal.timeout)}cal.timeout=setTimeout("Calendar.showMonthsCombo()",250)}else{if(el.navtype==-2||el.navtype==2){if(cal.timeout){clearTimeout(cal.timeout)}cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250)}else{cal.timeout=null}}return Calendar.stopEvent(ev)};Calendar.dayMouseDblClick=function(a){Calendar.cellClick(Calendar.getElement(a),a||window.event);if(Calendar.is_ie){document.selection.empty()}};Calendar.dayMouseOver=function(b){var a=Calendar.getElement(b);if(Calendar.isRelated(a,b)||Calendar._C||a.disabled){return false}if(a.ttip){if(a.ttip.substr(0,1)=="_"){a.ttip=a.caldate.print(a.calendar.ttDateFormat)+a.ttip.substr(1)}a.calendar.tooltips.innerHTML=a.ttip}if(a.navtype!=300){Calendar.addClass(a,"hilite");if(a.caldate){Calendar.addClass(a.parentNode,"rowhilite")}}return Calendar.stopEvent(b)};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled){return false}removeClass(el,"hilite");if(el.caldate){removeClass(el.parentNode,"rowhilite")}if(el.calendar){el.calendar.tooltips.innerHTML=_TT.SEL_DATE}return stopEvent(ev)}};Calendar.cellClick=function(e,p){var c=e.calendar;var j=false;var m=false;var f=null;if(typeof e.navtype=="undefined"){if(c.currentDateEl){Calendar.removeClass(c.currentDateEl,"selected");Calendar.addClass(e,"selected");j=(c.currentDateEl==e);if(!j){c.currentDateEl=e}}c.date.setDateOnly(e.caldate);f=c.date;var b=!(c.dateClicked=!e.otherMonth);if(!b&&!c.currentDateEl){c._toggleMultipleDate(new Date(f))}else{m=!e.disabled}if(b){c._init(c.firstDayOfWeek,f)}}else{if(e.navtype==200){Calendar.removeClass(e,"hilite");c.callCloseHandler();return}f=new Date(c.date);if(e.navtype==0){f.setDateOnly(new Date())}c.dateClicked=false;var o=f.getFullYear();var g=f.getMonth();function a(r){var s=f.getDate();var i=f.getMonthDays(r);if(s>i){f.setDate(i)}f.setMonth(r)}switch(e.navtype){case 400:Calendar.removeClass(e,"hilite");var q=Calendar._TT.ABOUT;if(typeof q!="undefined"){q+=c.showsTime?Calendar._TT.ABOUT_TIME:""}else{q='Help and about box text is not translated into this language.\nIf you know this language and you feel generous please update\nthe corresponding file in "lang" subdir to match calendar-en.js\nand send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\nThank you!\nhttp://dynarch.com/mishoo/calendar.epl\n'}alert(q);return;case -2:if(o>c.minYear){f.setFullYear(o-1)}break;case -1:if(g>0){a(g-1)}else{if(o-->c.minYear){f.setFullYear(o);a(11)}}break;case 1:if(g<11){a(g+1)}else{if(o<c.maxYear){f.setFullYear(o+1);a(0)}}break;case 2:if(o<c.maxYear){f.setFullYear(o+1)}break;case 100:c.setFirstDayOfWeek(e.fdow);return;case 50:var l=e._range;var n=e.innerHTML;for(var k=l.length;--k>=0;){if(l[k]==n){break}}if(p&&p.shiftKey){if(--k<0){k=l.length-1}}else{if(++k>=l.length){k=0}}var d=l[k];e.innerHTML=d;c.onUpdateTime();return;case 0:if((typeof c.getDateStatus=="function")&&c.getDateStatus(f,f.getFullYear(),f.getMonth(),f.getDate(),c)){return false}break}if(!f.equalsTo(c.date)){c.setDate(f);m=true}else{if(e.navtype==0){m=j=true}}}if(m){p&&c.callHandler()}if(j){Calendar.removeClass(e,"hilite");p&&c.callCloseHandler()}};Calendar.prototype.create=function(o){var n=null;if(!o){n=document.getElementsByTagName("body")[0];this.isPopup=true}else{n=o;this.isPopup=false}this.date=this.dateStr?new Date(this.dateStr):new Date();var r=Calendar.createElement("table");this.table=r;r.cellSpacing=0;r.cellPadding=0;r.calendar=this;Calendar.addEvent(r,"mousedown",Calendar.tableMouseDown);var a=Calendar.createElement("div");this.element=a;a.className="calendar";if(this.isPopup){a.style.position="absolute";a.style.display="none"}a.appendChild(r);var l=Calendar.createElement("thead",r);var p=null;var s=null;var b=this;var e=function(t,j,i){p=Calendar.createElement("td",s);p.colSpan=j;p.className="button";if(i!=0&&Math.abs(i)<=2){p.className+=" nav"}Calendar._add_evs(p);p.calendar=b;p.navtype=i;p.innerHTML="<div unselectable='on'>"+t+"</div>";return p};s=Calendar.createElement("tr",l);var c=6;(this.isPopup)&&--c;(this.weekNumbers)&&++c;e("?",1,400).ttip=Calendar._TT.INFO;this.title=e("",c,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT.DRAG_TO_MOVE;this.title.style.cursor="move";e("&#x00d7;",1,200).ttip=Calendar._TT.CLOSE}s=Calendar.createElement("tr",l);s.className="headrow";this._nav_py=e("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT.PREV_YEAR;this._nav_pm=e("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT.PREV_MONTH;this._nav_now=e(Calendar._TT.TODAY,this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT.GO_TODAY;this._nav_nm=e("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT.NEXT_MONTH;this._nav_ny=e("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT.NEXT_YEAR;s=Calendar.createElement("tr",l);s.className="daynames";if(this.weekNumbers){p=Calendar.createElement("td",s);p.className="name wn";p.innerHTML=Calendar._TT.WK}for(var k=7;k>0;--k){p=Calendar.createElement("td",s);if(!k){p.navtype=100;p.calendar=this;Calendar._add_evs(p)}}this.firstdayname=(this.weekNumbers)?s.firstChild.nextSibling:s.firstChild;this._displayWeekdays();var g=Calendar.createElement("tbody",r);this.tbody=g;for(k=6;k>0;--k){s=Calendar.createElement("tr",g);if(this.weekNumbers){p=Calendar.createElement("td",s)}for(var f=7;f>0;--f){p=Calendar.createElement("td",s);p.calendar=this;Calendar._add_evs(p)}}if(this.showsTime){s=Calendar.createElement("tr",g);s.className="time";p=Calendar.createElement("td",s);p.className="time";p.colSpan=2;p.innerHTML=Calendar._TT.TIME||"&nbsp;";p=Calendar.createElement("td",s);p.className="time";p.colSpan=this.weekNumbers?4:3;(function(){function u(G,I,H,J){var E=Calendar.createElement("span",p);E.className=G;E.innerHTML=I;E.calendar=b;E.ttip=Calendar._TT.TIME_PART;E.navtype=50;E._range=[];if(typeof H!="number"){E._range=H}else{for(var F=H;F<=J;++F){var D;if(F<10&&J>=10){D="0"+F}else{D=""+F}E._range[E._range.length]=D}}Calendar._add_evs(E);return E}var B=b.date.getHours();var i=b.date.getMinutes();var C=!b.time24;var j=(B>12);if(C&&j){B-=12}var z=u("hour",B,C?1:0,C?12:23);var v=Calendar.createElement("span",p);v.innerHTML=":";v.className="colon";var t=u("minute",i,0,59);var A=null;p=Calendar.createElement("td",s);p.className="time";p.colSpan=2;if(C){A=u("ampm",j?"pm":"am",["am","pm"])}else{p.innerHTML="&nbsp;"}b.onSetTime=function(){var E,D=this.date.getHours(),F=this.date.getMinutes();if(C){E=(D>=12);if(E){D-=12}if(D==0){D=12}A.innerHTML=E?"pm":"am"}z.innerHTML=(D<10)?("0"+D):D;t.innerHTML=(F<10)?("0"+F):F};b.onUpdateTime=function(){var E=this.date;var F=parseInt(z.innerHTML,10);if(C){if(/pm/i.test(A.innerHTML)&&F<12){F+=12}else{if(/am/i.test(A.innerHTML)&&F==12){F=0}}}var G=E.getDate();var D=E.getMonth();var H=E.getFullYear();E.setHours(F);E.setMinutes(parseInt(t.innerHTML,10));E.setFullYear(H);E.setMonth(D);E.setDate(G);this.dateClicked=false;this.callHandler()}})()}else{this.onSetTime=this.onUpdateTime=function(){}}var m=Calendar.createElement("tfoot",r);s=Calendar.createElement("tr",m);s.className="footrow";p=e(Calendar._TT.SEL_DATE,this.weekNumbers?8:7,300);p.className="ttip";if(this.isPopup){p.ttip=Calendar._TT.DRAG_TO_MOVE;p.style.cursor="move"}this.tooltips=p;a=Calendar.createElement("div",this.element);this.monthsCombo=a;a.className="combo";for(k=0;k<Calendar._MN.length;++k){var d=Calendar.createElement("div");d.className=Calendar.is_ie?"label-IEfix":"label";d.month=k;d.innerHTML=Calendar._SMN[k];a.appendChild(d)}a=Calendar.createElement("div",this.element);this.yearsCombo=a;a.className="combo";for(k=12;k>0;--k){var q=Calendar.createElement("div");q.className=Calendar.is_ie?"label-IEfix":"label";a.appendChild(q)}this._init(this.firstDayOfWeek,this.date);n.appendChild(this.element)};Calendar._keyEvent=function(l){var a=window._dynarch_popupCalendar;if(!a||a.multiple){return false}(Calendar.is_ie)&&(l=window.event);var j=(Calendar.is_ie||l.type=="keypress"),m=l.keyCode;if(l.ctrlKey){switch(m){case 37:j&&Calendar.cellClick(a._nav_pm);break;case 38:j&&Calendar.cellClick(a._nav_py);break;case 39:j&&Calendar.cellClick(a._nav_nm);break;case 40:j&&Calendar.cellClick(a._nav_ny);break;default:return false}}else{switch(m){case 32:Calendar.cellClick(a._nav_now);break;case 27:j&&a.callCloseHandler();break;case 37:case 38:case 39:case 40:if(j){var e,n,k,g,c,d;e=m==37||m==38;d=(m==37||m==39)?1:7;function b(){c=a.currentDateEl;var o=c.pos;n=o&15;k=o>>4;g=a.ar_days[k][n]}b();function f(){var o=new Date(a.date);o.setDate(o.getDate()-d);a.setDate(o)}function i(){var o=new Date(a.date);o.setDate(o.getDate()+d);a.setDate(o)}while(1){switch(m){case 37:if(--n>=0){g=a.ar_days[k][n]}else{n=6;m=38;continue}break;case 38:if(--k>=0){g=a.ar_days[k][n]}else{f();b()}break;case 39:if(++n<7){g=a.ar_days[k][n]}else{n=0;m=40;continue}break;case 40:if(++k<a.ar_days.length){g=a.ar_days[k][n]}else{i();b()}break}break}if(g){if(!g.disabled){Calendar.cellClick(g)}else{if(e){f()}else{i()}}}}break;case 13:if(j){Calendar.cellClick(a.currentDateEl,l)}break;default:return false}}return Calendar.stopEvent(l)};Calendar.prototype._init=function(o,B){var A=new Date(),s=A.getFullYear(),D=A.getMonth(),b=A.getDate();this.table.style.visibility="hidden";var k=B.getFullYear();if(k<this.minYear){k=this.minYear;B.setFullYear(k)}else{if(k>this.maxYear){k=this.maxYear;B.setFullYear(k)}}this.firstDayOfWeek=o;this.date=new Date(B);var C=B.getMonth();var F=B.getDate();var E=B.getMonthDays();B.setDate(1);var t=(B.getDay()-this.firstDayOfWeek)%7;if(t<0){t+=7}B.setDate(-t);B.setDate(B.getDate()+1);var e=this.tbody.firstChild;var m=Calendar._SMN[C];var q=this.ar_days=new Array();var p=Calendar._TT.WEEKEND;var d=this.multiple?(this.datesCells={}):null;for(var v=0;v<6;++v,e=e.nextSibling){var a=e.firstChild;if(this.weekNumbers){a.className="day wn";a.innerHTML=B.getWeekNumber();a=a.nextSibling}e.className="daysrow";var z=false,f,c=q[v]=[];for(var u=0;u<7;++u,a=a.nextSibling,B.setDate(f+1)){f=B.getDate();var g=B.getDay();a.className="day";a.pos=v<<4|u;c[u]=a;var n=(B.getMonth()==C);if(!n){if(this.showsOtherMonths){a.className+=" othermonth";a.otherMonth=true}else{a.className="emptycell";a.innerHTML="&nbsp;";a.disabled=true;continue}}else{a.otherMonth=false;z=true}a.disabled=false;a.innerHTML=this.getDateText?this.getDateText(B,f):f;if(d){d[B.print("%Y%m%d")]=a}if(this.getDateStatus){var r=this.getDateStatus(B,k,C,f,this);if(this.getDateToolTip){var l=this.getDateToolTip(B,k,C,f);if(l){a.title=l}}if(r===true){a.className+=" disabled";a.disabled=true}else{if(/disabled/i.test(r)){a.disabled=true}a.className+=" "+r}}if(!a.disabled){a.caldate=new Date(B);a.ttip="_";if(!this.multiple&&n&&f==F&&this.hiliteToday){a.className+=" selected";this.currentDateEl=a}if(B.getFullYear()==s&&B.getMonth()==D&&f==b){a.className+=" today";a.ttip+=Calendar._TT.PART_TODAY}if(p.indexOf(g.toString())!=-1){a.className+=a.otherMonth?" oweekend":" weekend"}}}if(!(z||this.showsOtherMonths)){e.className="emptyrow"}}this.title.innerHTML=Calendar._MN[C]+", "+k;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates()};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var b in this.multiple){var a=this.datesCells[b];var c=this.multiple[b];if(!c){continue}if(a){a.className+=" selected"}}}};Calendar.prototype._toggleMultipleDate=function(b){if(this.multiple){var c=b.print("%Y%m%d");var a=this.datesCells[c];if(a){var e=this.multiple[c];if(!e){Calendar.addClass(a,"selected");this.multiple[c]=b}else{Calendar.removeClass(a,"selected");delete this.multiple[c]}}}};Calendar.prototype.setDateToolTipHandler=function(a){this.getDateToolTip=a};Calendar.prototype.setDate=function(a){if(!a.equalsTo(this.date)){this._init(this.firstDayOfWeek,a)}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date)};Calendar.prototype.setFirstDayOfWeek=function(a){this._init(a,this.date);this._displayWeekdays()};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(a){this.getDateStatus=a};Calendar.prototype.setRange=function(b,c){this.minYear=b;this.maxYear=c};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat))}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this)}this.hideShowCovered()};Calendar.prototype.destroy=function(){var a=this.element.parentNode;a.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null};Calendar.prototype.reparent=function(b){var a=this.element;a.parentNode.removeChild(a);b.appendChild(a)};Calendar._checkCalendar=function(b){var c=window._dynarch_popupCalendar;if(!c){return false}var a=Calendar.is_ie?Calendar.getElement(b):Calendar.getTargetElement(b);for(;a!=null&&a!=c.element;a=a.parentNode){}if(a==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(b)}};Calendar.prototype.show=function(){var e=this.table.getElementsByTagName("tr");for(var d=e.length;d>0;){var f=e[--d];Calendar.removeClass(f,"rowhilite");var c=f.getElementsByTagName("td");for(var b=c.length;b>0;){var a=c[--b];Calendar.removeClass(a,"hilite");Calendar.removeClass(a,"active")}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar)}this.hideShowCovered()};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar)}this.element.style.display="none";this.hidden=true;this.hideShowCovered()};Calendar.prototype.showAt=function(a,c){var b=this.element.style;b.left=a+"px";b.top=c+"px";this.show()};Calendar.prototype.showAtElement=function(c,d){var a=this;var e=Calendar.getAbsolutePos(c);if(!d||typeof d!="string"){this.showAt(e.x,e.y+c.offsetHeight);return true}function b(j){if(j.x<0){j.x=0}if(j.y<0){j.y=0}var k=document.createElement("div");var i=k.style;i.position="absolute";i.right=i.bottom=i.width=i.height="0px";document.body.appendChild(k);var g=Calendar.getAbsolutePos(k);document.body.removeChild(k);if(Calendar.is_ie){g.y+=document.body.scrollTop;g.x+=document.body.scrollLeft}else{g.y+=window.scrollY;g.x+=window.scrollX}var f=j.x+j.width-g.x;if(f>0){j.x-=f}f=j.y+j.height-g.y;if(f>0){j.y-=f}}this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var f=a.element.offsetWidth;var i=a.element.offsetHeight;a.element.style.display="none";var g=d.substr(0,1);var j="l";if(d.length>1){j=d.substr(1,1)}switch(g){case"T":e.y-=i;break;case"B":e.y+=c.offsetHeight;break;case"C":e.y+=(c.offsetHeight-i)/2;break;case"t":e.y+=c.offsetHeight-i;break;case"b":break}switch(j){case"L":e.x-=f;break;case"R":e.x+=c.offsetWidth;break;case"C":e.x+=(c.offsetWidth-f)/2;break;case"l":e.x+=c.offsetWidth-f;break;case"r":break}e.width=f;e.height=i+40;a.monthsCombo.style.display="none";b(e);a.showAt(e.x,e.y)};if(Calendar.is_khtml){setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10)}else{Calendar.continuation_for_the_fucking_khtml_browser()}};Calendar.prototype.setDateFormat=function(a){this.dateFormat=a};Calendar.prototype.setTtDateFormat=function(a){this.ttDateFormat=a};Calendar.prototype.parseDate=function(b,a){if(!a){a=this.dateFormat}this.setDate(Date.parseDate(b,a))};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera){return}function b(k){var i=k.style.visibility;if(!i){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml){i=document.defaultView.getComputedStyle(k,"").getPropertyValue("visibility")}else{i=""}}else{if(k.currentStyle){i=k.currentStyle.visibility}else{i=""}}}return i}var t=new Array("applet","iframe","select");var c=this.element;var a=Calendar.getAbsolutePos(c);var f=a.x;var d=c.offsetWidth+f;var s=a.y;var r=c.offsetHeight+s;for(var j=t.length;j>0;){var g=document.getElementsByTagName(t[--j]);var e=null;for(var m=g.length;m>0;){e=g[--m];a=Calendar.getAbsolutePos(e);var q=a.x;var o=e.offsetWidth+q;var n=a.y;var l=e.offsetHeight+n;if(this.hidden||(q>d)||(o<f)||(n>r)||(l<s)){if(!e.__msh_save_visibility){e.__msh_save_visibility=b(e)}e.style.visibility=e.__msh_save_visibility}else{if(!e.__msh_save_visibility){e.__msh_save_visibility=b(e)}e.style.visibility="hidden"}}}};Calendar.prototype._displayWeekdays=function(){var b=this.firstDayOfWeek;var a=this.firstdayname;var d=Calendar._TT.WEEKEND;for(var c=0;c<7;++c){a.className="day name";var e=(c+b)%7;if(c){a.ttip=Calendar._TT.DAY_FIRST.replace("%s",Calendar._DN[e]);a.navtype=100;a.calendar=this;a.fdow=e;Calendar._add_evs(a)}if(d.indexOf(e.toString())!=-1){Calendar.addClass(a,"weekend")}a.innerHTML=Calendar._SDN[(c+b)%7];a=a.nextSibling}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none"};Calendar.prototype._dragStart=function(ev){if(this.dragging){return}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX}var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd)}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(n,c){var o=new Date();var p=0;var e=-1;var l=0;var r=n.split(/[\s\/\.-]+/);var q=c.match(/%./g);var k=0,g=0;var s=0;var f=0;for(k=0;k<r.length;++k){if(!r[k]){continue}switch(q[k]){case"%d":case"%e":l=parseInt(r[k],10);break;case"%m":e=parseInt(r[k],10)-1;break;case"%Y":case"%y":p=parseInt(r[k],10);(p<100)&&(p+=(p>29)?1900:2000);break;case"%b":case"%B":for(g=0;g<12;++g){if(Calendar._MN[g].substr(0,r[k].length).toLowerCase()==r[k].toLowerCase()){e=g;break}}break;case"%H":case"%I":case"%k":case"%l":s=parseInt(r[k],10);break;case"%P":case"%p":if(/pm/i.test(r[k])&&s<12){s+=12}else{if(/am/i.test(r[k])&&s>=12){s-=12}}break;case"%M":f=parseInt(r[k],10);break}}if(isNaN(p)){p=o.getFullYear()}if(isNaN(e)){e=o.getMonth()}if(isNaN(l)){l=o.getDate()}if(isNaN(s)){s=o.getHours()}if(isNaN(f)){f=o.getMinutes()}if(p!=0&&e!=-1&&l!=0){return new Date(p,e,l,s,f,0)}p=0;e=-1;l=0;for(k=0;k<r.length;++k){if(r[k].search(/[a-zA-Z]+/)!=-1){var u=-1;for(g=0;g<12;++g){if(Calendar._MN[g].substr(0,r[k].length).toLowerCase()==r[k].toLowerCase()){u=g;break}}if(u!=-1){if(e!=-1){l=e+1}e=u}}else{if(parseInt(r[k],10)<=12&&e==-1){e=r[k]-1}else{if(parseInt(r[k],10)>31&&p==0){p=parseInt(r[k],10);(p<100)&&(p+=(p>29)?1900:2000)}else{if(l==0){l=r[k]}}}}}if(p==0){p=o.getFullYear()}if(e!=-1&&l!=0){return new Date(p,e,l,s,f,0)}return o};Date.prototype.getMonthDays=function(b){var a=this.getFullYear();if(typeof b=="undefined"){b=this.getMonth()}if(((0==(a%4))&&((0!=(a%100))||(0==(a%400))))&&b==1){return 29}else{return Date._MD[b]}};Date.prototype.getDayOfYear=function(){var a=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var c=new Date(this.getFullYear(),0,0,0,0,0);var b=a-c;return Math.floor(b/Date.DAY)};Date.prototype.getWeekNumber=function(){var c=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var b=c.getDay();c.setDate(c.getDate()-(b+6)%7+3);var a=c.valueOf();c.setMonth(0);c.setDate(4);return Math.round((a-c.valueOf())/(7*86400000))+1};Date.prototype.equalsTo=function(a){return((this.getFullYear()==a.getFullYear())&&(this.getMonth()==a.getMonth())&&(this.getDate()==a.getDate())&&(this.getHours()==a.getHours())&&(this.getMinutes()==a.getMinutes()))};Date.prototype.setDateOnly=function(a){var b=new Date(a);this.setDate(1);this.setFullYear(b.getFullYear());this.setMonth(b.getMonth());this.setDate(b.getDate())};Date.prototype.print=function(n){var b=this.getMonth();var l=this.getDate();var o=this.getFullYear();var q=this.getWeekNumber();var r=this.getDay();var z={};var t=this.getHours();var c=(t>=12);var j=(c)?(t-12):t;var v=this.getDayOfYear();if(j==0){j=12}var e=this.getMinutes();var k=this.getSeconds();z["%a"]=Calendar._SDN[r];z["%A"]=Calendar._DN[r];z["%b"]=Calendar._SMN[b];z["%B"]=Calendar._MN[b];z["%C"]=1+Math.floor(o/100);z["%d"]=(l<10)?("0"+l):l;z["%e"]=l;z["%H"]=(t<10)?("0"+t):t;z["%I"]=(j<10)?("0"+j):j;z["%j"]=(v<100)?((v<10)?("00"+v):("0"+v)):v;z["%k"]=t;z["%l"]=j;z["%m"]=(b<9)?("0"+(1+b)):(1+b);z["%M"]=(e<10)?("0"+e):e;z["%n"]="\n";z["%p"]=c?"PM":"AM";z["%P"]=c?"pm":"am";z["%s"]=Math.floor(this.getTime()/1000);z["%S"]=(k<10)?("0"+k):k;z["%t"]="\t";z["%U"]=z["%W"]=z["%V"]=(q<10)?("0"+q):q;z["%u"]=r+1;z["%w"]=r;z["%y"]=(""+o).substr(2,2);z["%Y"]=o;z["%%"]="%";var u=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml){return n.replace(u,function(a){return z[a]||a})}var p=n.match(u);for(var g=0;g<p.length;g++){var f=z[p[g]];if(f){u=new RegExp(p[g],"g");n=n.replace(u,f)}}return n};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(b){var a=new Date(this);a.__msh_oldSetFullYear(b);if(a.getMonth()!=this.getMonth()){this.setDate(28)}this.__msh_oldSetFullYear(b)};window._dynarch_popupCalendar=null;Calendar.setup=function(g){function f(i,j){if(typeof g[i]=="undefined"){g[i]=j}}f("inputField",null);f("displayArea",null);f("button",null);f("eventName","click");f("ifFormat","%Y/%m/%d");f("daFormat","%Y/%m/%d");f("singleClick",true);f("disableFunc",null);f("dateStatusFunc",g.disableFunc);f("dateText",null);f("firstDay",null);f("align","Br");f("range",[1900,2999]);f("weekNumbers",true);f("flat",null);f("flatCallback",null);f("onSelect",null);f("onClose",null);f("onUpdate",null);f("date",null);f("showsTime",false);f("timeFormat","24");f("electric",true);f("step",2);f("position",null);f("cache",false);f("showOthers",false);f("multiple",null);var c=["inputField","displayArea","button"];for(var b in c){if(typeof g[c[b]]=="string"){g[c[b]]=document.getElementById(g[c[b]])}}if(!(g.flat||g.multiple||g.inputField||g.displayArea||g.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false}function a(j){var i=j.params;var k=(j.dateClicked||i.electric);if(k&&i.inputField){i.inputField.value=j.date.print(i.ifFormat);if(typeof i.inputField.onchange=="function"){i.inputField.onchange()}}if(k&&i.displayArea){i.displayArea.innerHTML=j.date.print(i.daFormat)}if(k&&typeof i.onUpdate=="function"){i.onUpdate(j)}if(k&&i.flat){if(typeof i.flatCallback=="function"){i.flatCallback(j)}}if(k&&i.singleClick&&j.dateClicked){j.callCloseHandler()}}if(g.flat!=null){if(typeof g.flat=="string"){g.flat=document.getElementById(g.flat)}if(!g.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false}var e=new Calendar(g.firstDay,g.date,g.onSelect||a);e.showsOtherMonths=g.showOthers;e.showsTime=g.showsTime;e.time24=(g.timeFormat=="24");e.params=g;e.weekNumbers=g.weekNumbers;e.setRange(g.range[0],g.range[1]);e.setDateStatusHandler(g.dateStatusFunc);e.getDateText=g.dateText;if(g.ifFormat){e.setDateFormat(g.ifFormat)}if(g.inputField&&typeof g.inputField.value=="string"){e.parseDate(g.inputField.value)}e.create(g.flat);e.show();return false}var d=g.button||g.displayArea||g.inputField;d["on"+g.eventName]=function(){var j=g.inputField||g.displayArea;var l=g.inputField?g.ifFormat:g.daFormat;var p=false;var n=window.calendar;if(j){g.date=Date.parseDate(j.value||j.innerHTML,l)}if(!(n&&g.cache)){window.calendar=n=new Calendar(g.firstDay,g.date,g.onSelect||a,g.onClose||function(i){i.hide()});n.showsTime=g.showsTime;n.time24=(g.timeFormat=="24");n.weekNumbers=g.weekNumbers;n.inputField=g.inputField.id;p=true}else{if(g.date){n.setDate(g.date)}n.hide()}if(g.multiple){n.multiple={};for(var k=g.multiple.length;--k>=0;){var o=g.multiple[k];var m=o.print("%Y%m%d");n.multiple[m]=o}}n.showsOtherMonths=g.showOthers;n.yearStep=g.step;n.setRange(g.range[0],g.range[1]);n.params=g;n.setDateStatusHandler(g.dateStatusFunc);n.getDateText=g.dateText;n.setDateFormat(l);if(p){n.create()}n.refresh();if(!g.position){n.showAtElement(g.button||g.displayArea||g.inputField,g.align)}else{n.showAt(g.position[0],g.position[1])}return false};return e};Date.dayDiff=function(c,a){if(c&&a){c=new Date(c.getFullYear(),c.getMonth(),c.getDate());a=new Date(a.getFullYear(),a.getMonth(),a.getDate());var b=a.getTime()-c.getTime();var d=Math.round(b/Date.DAY);return d}};CalendarInputField=function(k,g,a,i,f,c,e,b){this.field_id=k;this.start_date=g;this.end_date=a;this.display_date_format=i;this.hidden_field_id=f;this.transfer_date_format=c;this.offset=e;this.linked_cif=null;this.on_update=b;var j=document.getElementById(this.field_id);var d=this.getDate();if(j&&d){j.value=d.print(this.display_date_format)}};CalendarInputField.prototype.getDate=function(){var a=null;var c=document.getElementById(this.hidden_field_id);if(c){var b=c.value;if(b&&b.length>0){a=Date.parseDate(b,this.transfer_date_format)}}return a};CalendarInputField.prototype.setLinkedCif=function(a){this.linked_cif=a};CalendarInputField.prototype.validate=function(){var d=document.getElementById(this.field_id);if(d){var b;var c=d.value;if(c&&c.length>0){b=null;var a=new Date();if(b==null&&c.match(/^\d\d?[-\/\.]\d\d?$/)){c+="."+a.getFullYear()}if(b==null&&c.match(/^\d\d?[-\/\.]\d\d?[-\/\.]$/)){c+=a.getFullYear();b=Date.parseDate(c,"%d.%m.%Y")}if(b==null&&c.match(/^\d\d?[-\/\.]\d\d?[-\/\.]\d+$/)){b=Date.parseDate(c,"%d.%m.%Y")}if(b==null&&c.match(/^\d{4}-\d{2}-\d{2}$/)){b=Date.parseDate(c,"%Y-%m-%d")}if(b==null&&c.match(/^\w+, *\d\d?\.? *.+ +\d+$/)){b=Date.parseDate(c,"%a, %e. %B %Y")}if(b==null&&c.match(/^\d\d?\.? *.+ +\d+$/)){b=Date.parseDate(c,"%e. %B %Y")}if(b==null){b=Date.parseDate(c,"%d.%m.%Y")}}else{b=null}if(typeof b!="undefined"){this.update(b,true)}}};CalendarInputField.prototype.update=function(b,c){if(b){if(this.start_date){if(Date.dayDiff(this.start_date,b)<0){b=this.start_date}}if(this.end_date){if(Date.dayDiff(this.end_date,b)>0){b=this.end_date}}}CalendarInputField.updateField(this.field_id,b,this.display_date_format);CalendarInputField.updateField(this.hidden_field_id,b,this.transfer_date_format);if(c&&this.linked_cif){if(b){var a=this.linked_cif.getDate();if(this.offset>0){if(a==null||b.getTime()>=a.getTime()){var d=b.getTime();d+=(this.offset*Date.DAY);this.linked_cif.update(new Date(d),false)}}if(this.offset<0){if(a==null||b.getTime()<=a.getTime()){var d=b.getTime();d+=(this.offset*Date.DAY);this.linked_cif.update(new Date(d),false);this.day_di}}}else{this.linked_cif.update(null,false)}if(typeof this.on_update=="function"){this.on_update(this.getDayDiff())}}};CalendarInputField.prototype.isDisallowedDate=function(c,g,a,f){if(c==null||c.length==0){return false}var e=false;if(this.start_date){var b=new Date();b=new Date(b.getFullYear(),b.getMonth(),b.getDate());if(Date.dayDiff(b,c)<0){e=e||true}}if(this.end_date){if(Date.dayDiff(this.end_date,c)>0){e=e||true}}return e};CalendarInputField.prototype.getDayDiff=function(){var a=0;if(this.offset<0){a=Date.dayDiff(this.linked_cif.getDate(),this.getDate())}if(this.offset>0){a=Date.dayDiff(this.getDate(),this.linked_cif.getDate())}return a};CalendarInputField.updateField=function(d,a,c){var b=d;if(typeof d=="string"){b=document.getElementById(d)}if(b){if(a){b.value=a.print(c)}else{b.value=""}}};CalendarInputField.create=function(p,f,i,m,c,o,g,e,b){var d=new Date();d=new Date(d.getFullYear(),d.getMonth(),d.getDate());var j=null;if(o.length>0){j=new Date(d.getTime()+(o*Date.DAY))}var a=null;if(g.length>0){a=new Date(d.getTime()+(g*Date.DAY))}var l=[];if(j&&a){l[0]=j.getFullYear();l[1]=a.getFullYear()}var k=new CalendarInputField(p,j,a,m,f,c,e,b);var n=document.getElementById(p);if(n){n.onchange=function(){var q=calendar_input_fields.get(this.id);if(q){q.validate()}}}Calendar.setup({inputField:p,ifFormat:m,button:i,range:l,electric:false,date:j,onUpdate:function(s){var q=s.date;var r=calendar_input_fields.get(s.inputField);if(typeof r!="undefined"){r.update(q,true)}},dateStatusFunc:function(r,v,q,u,t){var s=calendar_input_fields.get(t.inputField);if(typeof s!="undefined"){return s.isDisallowedDate(r,v,q,u)}return false}});return k};var arrival_cif;var departure_cif;var on_update_func;var calendar_input_fields={elements:[],add:function(a){if(typeof a!="undefined"){calendar_input_fields.elements[a.field_id]=a}},get:function(a){return calendar_input_fields.elements[a]},remove:function(a){delete calendar_input_fields.elements[a]}};var Prototype={Version:"1.6.1",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,d=arguments.length;b<d;b++){var a=arguments[b];try{c=a();break}catch(f){}}return c}};var Class=(function(){function a(){}function b(){var g=null,f=$A(arguments);if(Object.isFunction(f[0])){g=f.shift()}function d(){this.initialize.apply(this,arguments)}Object.extend(d,Class.Methods);d.superclass=g;d.subclasses=[];if(g){a.prototype=g.prototype;d.prototype=new a;g.subclasses.push(d)}for(var e=0;e<f.length;e++){d.addMethods(f[e])}if(!d.prototype.initialize){d.prototype.initialize=Prototype.emptyFunction}d.prototype.constructor=d;return d}function c(l){var f=this.superclass&&this.superclass.prototype;var e=Object.keys(l);if(!Object.keys({toString:true}).length){if(l.toString!=Object.prototype.toString){e.push("toString")}if(l.valueOf!=Object.prototype.valueOf){e.push("valueOf")}}for(var d=0,g=e.length;d<g;d++){var k=e[d],j=l[k];if(f&&Object.isFunction(j)&&j.argumentNames().first()=="$super"){var m=j;j=(function(i){return function(){return f[i].apply(this,arguments)}})(k).wrap(m);j.valueOf=m.valueOf.bind(m);j.toString=m.toString.bind(m)}this.prototype[k]=j}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var d=Object.prototype.toString;function j(r,t){for(var s in t){r[s]=t[s]}return r}function m(r){try{if(e(r)){return"undefined"}if(r===null){return"null"}return r.inspect?r.inspect():String(r)}catch(s){if(s instanceof RangeError){return"..."}throw s}}function l(r){var t=typeof r;switch(t){case"undefined":case"function":case"unknown":return;case"boolean":return r.toString()}if(r===null){return"null"}if(r.toJSON){return r.toJSON()}if(i(r)){return}var s=[];for(var v in r){var u=l(r[v]);if(!e(u)){s.push(v.toJSON()+": "+u)}}return"{"+s.join(", ")+"}"}function c(r){return $H(r).toQueryString()}function f(r){return r&&r.toHTML?r.toHTML():String.interpret(r)}function p(r){var s=[];for(var t in r){s.push(t)}return s}function n(r){var s=[];for(var t in r){s.push(r[t])}return s}function k(r){return j({},r)}function i(r){return !!(r&&r.nodeType==1)}function g(r){return d.call(r)=="[object Array]"}function q(r){return r instanceof Hash}function b(r){return typeof r==="function"}function a(r){return d.call(r)=="[object String]"}function o(r){return d.call(r)=="[object Number]"}function e(r){return typeof r==="undefined"}j(Object,{extend:j,inspect:m,toJSON:l,toQueryString:c,toHTML:f,keys:p,values:n,clone:k,isElement:i,isArray:g,isHash:q,isFunction:b,isString:a,isNumber:o,isUndefined:e})})();Object.extend(Function.prototype,(function(){var l=Array.prototype.slice;function d(p,m){var o=p.length,n=m.length;while(n--){p[o+n]=m[n]}return p}function j(n,m){n=l.call(n,0);return d(n,m)}function g(){var m=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return m.length==1&&!m[0]?[]:m}function i(o){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var m=this,n=l.call(arguments,1);return function(){var p=j(n,arguments);return m.apply(o,p)}}function f(o){var m=this,n=l.call(arguments,1);return function(q){var p=d([q||window.event],n);return m.apply(o,p)}}function k(){if(!arguments.length){return this}var m=this,n=l.call(arguments,0);return function(){var o=j(n,arguments);return m.apply(this,o)}}function e(o){var m=this,n=l.call(arguments,1);o=o*1000;return window.setTimeout(function(){return m.apply(m,n)},o)}function a(){var m=d([0.01],arguments);return this.delay.apply(this,m)}function c(n){var m=this;return function(){var o=d([m.bind(this)],arguments);return n.apply(this,o)}}function b(){if(this._methodized){return this._methodized}var m=this;return this._methodized=function(){var n=d([this],arguments);return m.apply(null,n)}}return{argumentNames:g,bind:i,bindAsEventListener:f,curry:k,delay:e,defer:a,wrap:c,methodize:b}})());Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(d){if(a==null){return(d[1]+"")}var f=d[1]||"";if(f=="\\"){return d[2]}var b=a,g=d[3];var e=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;d=e.exec(g);if(d==null){return f}while(d!=null){var c=d[1].startsWith("[")?d[2].replace(/\\\\]/g,"]"):d[1];b=b[c];if(null==b||""==d[3]){break}g=g.substring("["==d[3]?d[1].length:d[0].length);d=e.exec(g)}return f+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(C,B){var A=0;try{this._each(function(E){C.call(B,E,A++)})}catch(D){if(D!=$break){throw D}}return this}function s(D,C,B){var A=-D,E=[],F=this.toArray();if(D<1){return F}while((A+=D)<F.length){E.push(F.slice(A,A+D))}return E.collect(C,B)}function b(C,B){C=C||Prototype.K;var A=true;this.each(function(E,D){A=A&&!!C.call(B,E,D);if(!A){throw $break}});return A}function j(C,B){C=C||Prototype.K;var A=false;this.each(function(E,D){if(A=!!C.call(B,E,D)){throw $break}});return A}function k(C,B){C=C||Prototype.K;var A=[];this.each(function(E,D){A.push(C.call(B,E,D))});return A}function u(C,B){var A;this.each(function(E,D){if(C.call(B,E,D)){A=E;throw $break}});return A}function i(C,B){var A=[];this.each(function(E,D){if(C.call(B,E,D)){A.push(E)}});return A}function g(D,C,B){C=C||Prototype.K;var A=[];if(Object.isString(D)){D=new RegExp(RegExp.escape(D))}this.each(function(F,E){if(D.match(F)){A.push(C.call(B,F,E))}});return A}function a(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B}function r(B,A){A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){while(C.length<B){C.push(A)}return C})}function m(A,C,B){this.each(function(E,D){A=C.call(B,A,E,D)});return A}function z(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})}function q(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E>=A){A=E}});return A}function o(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E<A){A=E}});return A}function e(D,B){D=D||Prototype.K;var C=[],A=[];this.each(function(F,E){(D.call(B,F,E)?C:A).push(F)});return[C,A]}function f(B){var A=[];this.each(function(C){A.push(C[B])});return A}function d(C,B){var A=[];this.each(function(E,D){if(!C.call(B,E,D)){A.push(E)}});return A}function n(B,A){return this.map(function(D,C){return{value:D,criteria:B.call(A,D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")}function p(){return this.map()}function t(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.pluck(D))})}function l(){return this.toArray().length}function v(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:s,all:b,every:b,any:j,some:j,collect:k,map:k,detect:u,findAll:i,select:i,filter:i,grep:g,include:a,member:a,inGroupsOf:r,inject:m,invoke:z,max:q,min:o,partition:e,pluck:f,reject:d,sortBy:n,toArray:p,entries:p,zip:t,size:l,inspect:v,find:u}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var t=Array.prototype,n=t.slice,p=t.forEach;function b(A){for(var z=0,B=this.length;z<B;z++){A(this[z])}}if(!p){p=b}function m(){this.length=0;return this}function d(){return this[0]}function g(){return this[this.length-1]}function j(){return this.select(function(z){return z!=null})}function v(){return this.inject([],function(A,z){if(Object.isArray(z)){return A.concat(z.flatten())}A.push(z);return A})}function i(){var z=n.call(arguments,0);return this.select(function(A){return !z.include(A)})}function f(z){return(z!==false?this:this.toArray())._reverse()}function l(z){return this.inject([],function(C,B,A){if(0==A||(z?C.last()!=B:!C.include(B))){C.push(B)}return C})}function q(z){return this.uniq().findAll(function(A){return z.detect(function(B){return A===B})})}function r(){return n.call(this,0)}function k(){return this.length}function u(){return"["+this.map(Object.inspect).join(", ")+"]"}function s(){var z=[];this.each(function(A){var B=Object.toJSON(A);if(!Object.isUndefined(B)){z.push(B)}});return"["+z.join(", ")+"]"}function a(B,z){z||(z=0);var A=this.length;if(z<0){z=A+z}for(;z<A;z++){if(this[z]===B){return z}}return -1}function o(A,z){z=isNaN(z)?this.length:(z<0?this.length+z:z)+1;var B=this.slice(0,z).reverse().indexOf(A);return(B<0)?B:z-B-1}function c(){var E=n.call(this,0),C;for(var A=0,B=arguments.length;A<B;A++){C=arguments[A];if(Object.isArray(C)&&!("callee" in C)){for(var z=0,D=C.length;z<D;z++){E.push(C[z])}}else{E.push(C)}}return E}Object.extend(t,Enumerable);if(!t._reverse){t._reverse=t.reverse}Object.extend(t,{_each:p,clear:m,first:d,last:g,compact:j,flatten:v,without:i,reverse:f,uniq:l,intersect:q,clone:r,toArray:r,size:k,inspect:u,toJSON:s});var e=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(e){t.concat=c}if(!t.indexOf){t.indexOf=a}if(!t.lastIndexOf){t.lastIndexOf=o}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function e(r){this._object=Object.isHash(r)?r.toObject():Object.clone(r)}function f(s){for(var r in this._object){var t=this._object[r],u=[r,t];u.key=r;u.value=t;s(u)}}function l(r,s){return this._object[r]=s}function c(r){if(this._object[r]!==Object.prototype[r]){return this._object[r]}}function o(r){var s=this._object[r];delete this._object[r];return s}function q(){return Object.clone(this._object)}function p(){return this.pluck("key")}function n(){return this.pluck("value")}function g(s){var r=this.detect(function(t){return t.value===s});return r&&r.key}function j(r){return this.clone().update(r)}function d(r){return new Hash(r).inject(this,function(s,t){s.set(t.key,t.value);return s})}function b(r,s){if(Object.isUndefined(s)){return r}return r+"="+encodeURIComponent(String.interpret(s))}function a(){return this.inject([],function(t,u){var s=encodeURIComponent(u.key),r=u.value;if(r&&typeof r=="object"){if(Object.isArray(r)){return t.concat(r.map(b.curry(s)))}}else{t.push(b(s,r))}return t}).join("&")}function m(){return"#<Hash:{"+this.map(function(r){return r.map(Object.inspect).join(": ")}).join(", ")+"}>"}function k(){return Object.toJSON(this.toObject())}function i(){return new Hash(this)}return{initialize:e,_each:f,set:l,get:c,unset:o,toObject:q,toTemplateReplacements:q,keys:p,values:n,index:g,merge:j,update:d,toQueryString:a,inspect:m,toJSON:k,clone:i}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function d(){return this.toPaddedString(2,16)}function e(){return this+1}function a(l,k){$R(0,this,true).each(l,k);return this}function b(m,l){var k=this.toString(l||10);return"0".times(m-k.length)+k}function f(){return isFinite(this)?this.toString():"null"}function j(){return Math.abs(this)}function i(){return Math.round(this)}function g(){return Math.ceil(this)}function c(){return Math.floor(this)}return{toColorPart:d,succ:e,times:a,toPaddedString:b,toJSON:f,abs:j,round:i,ceil:g,floor:c}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(f,d,e){this.start=f;this.end=d;this.exclusive=e}function c(d){var e=this.start;while(this.include(e)){d(e);e=e.succ()}}function a(d){if(d<this.start){return false}if(this.exclusive){return d<this.end}return d<=this.end}return{initialize:b,_each:c,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(d,b,c,a){this.each(function(f){if(Object.isFunction(f[d])){try{f[d].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var d=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){d._method=this.method;this.method="post"}this.parameters=d;if(d=Object.toQueryString(d)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+d}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){d+="&_="}}}try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||d):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var e={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){e["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){e.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,d=c.length;b<d;b+=2){e[c[b]]=c[b+1]}}else{$H(c).each(function(f){e[f.key]=f.value})}}for(var a in e){this.transport.setRequestHeader(a,e[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(d){this.dispatchException(d)}var f=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&f&&f.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(d){this.dispatchException(d)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var d=this.transport=c.transport,a=this.readyState=d.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(d.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=d.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var d=b.onComplete;b.onComplete=(function(e,f){this.updateContent(e.responseText);if(Object.isFunction(d)){d(e,f)}}).bind(this);$super(c,b)},updateContent:function(d){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){d=d.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=d;c.insert(b)}else{a.insertion(c,d)}}else{c.update(d)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,d=[],c=arguments.length;a<c;a++){d.push($(arguments[a]))}return d}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(f,a){var c=[];var e=document.evaluate(f,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,d=e.snapshotLength;b<d;b++){c.push(Element.extend(e.snapshotItem(b)))}return c}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(c){var b=(function(){var f=document.createElement("form");var e=document.createElement("input");var d=document.documentElement;e.setAttribute("name","test");f.appendChild(e);d.appendChild(f);var g=f.elements?(typeof f.elements.test=="undefined"):null;d.removeChild(f);f=e=null;return g})();var a=c.Element;c.Element=function(f,e){e=e||{};f=f.toLowerCase();var d=Element.cache;if(b&&e.name){f="<"+f+' name="'+e.name+'">';delete e.name;return Element.writeAttribute(document.createElement(f),e)}if(!d[f]){d[f]=Element.extend(document.createElement(f))}return Element.writeAttribute(d[f].cloneNode(false),e)};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var b=(function(){var e=document.createElement("select"),f=true;e.innerHTML='<option value="test">test</option>';if(e.options&&e.options[0]){f=e.options[0].nodeName.toUpperCase()!=="OPTION"}e=null;return f})();var a=(function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var i=typeof f.tBodies[0]=="undefined";f=null;return i}}catch(g){return true}})();var d=(function(){var f=document.createElement("script"),i=false;try{f.appendChild(document.createTextNode(""));i=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3}catch(g){i=true}f=null;return i})();function c(f,g){f=$(f);if(g&&g.toElement){g=g.toElement()}if(Object.isElement(g)){return f.update().insert(g)}g=Object.toHTML(g);var e=f.tagName.toUpperCase();if(e==="SCRIPT"&&d){f.text=g;return f}if(b||a){if(e in Element._insertionTranslations.tags){while(f.firstChild){f.removeChild(f.firstChild)}Element._getContentFromAnonymousElement(e,g.stripScripts()).each(function(i){f.appendChild(i)})}else{f.innerHTML=g.stripScripts()}}else{f.innerHTML=g.stripScripts()}g.evalScripts.bind(g).defer();return f}return c})(),replace:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}else{if(!Object.isElement(c)){c=Object.toHTML(c);var a=b.ownerDocument.createRange();a.selectNode(b);c.evalScripts.bind(c).defer();c=a.createContextualFragment(c.stripScripts())}}b.parentNode.replaceChild(c,b);return b},insert:function(c,e){c=$(c);if(Object.isString(e)||Object.isNumber(e)||Object.isElement(e)||(e&&(e.toElement||e.toHTML))){e={bottom:e}}var d,f,b,g;for(var a in e){d=e[a];a=a.toLowerCase();f=Element._insertionTranslations[a];if(d&&d.toElement){d=d.toElement()}if(Object.isElement(d)){f(c,d);continue}d=Object.toHTML(d);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();g=Element._getContentFromAnonymousElement(b,d.stripScripts());if(a=="top"||a=="after"){g.reverse()}g.each(f.curry(c));d.evalScripts.bind(d).defer()}return c},wrap:function(b,c,a){b=$(b);if(Object.isElement(c)){$(c).writeAttribute(a||{})}else{if(Object.isString(c)){c=new Element(c,a)}else{c=new Element("div",c)}}if(b.parentNode){b.parentNode.replaceChild(c,b)}c.appendChild(b);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(f){var e=f.first(),c=f.last();var d=(b[e]||"").toString();if(d){a+=" "+c+"="+d.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(b,d,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=Element.ancestors(b);return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},down:function(b,c,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b)}return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[a||0]},previous:function(b,d,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=Element.previousSiblings(b);return Object.isNumber(d)?c[d]:Selector.findElement(c,d,a)},next:function(c,d,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=Element.nextSiblings(c);return Object.isNumber(d)?a[d]:Selector.findElement(a,d,b)},select:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b,a)},adjacent:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b.parentNode,a).without(b)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b}do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!c.attributes||!c.attributes[a])?null:c.attributes[a].value}}return c.getAttribute(a)},writeAttribute:function(e,c,f){e=$(e);var b={},d=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(f)?true:f}for(var a in b){c=d.names[a]||a;f=b[a];if(d.values[a]){c=d.values[a](e,f)}if(f===false||f===null){e.removeAttribute(c)}else{if(f===true){e.setAttribute(c,c)}else{e.setAttribute(c,f)}}}return e},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!Element.hasClassName(a,b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(b)&&a!==b}while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var d=b.style[c];if(!d||d=="auto"){var a=document.defaultView.getComputedStyle(b,null);d=a?a[c]:null}if(c=="opacity"){return d?parseFloat(d):1}return d=="auto"?null:d},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var e=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var d in c){if(d=="opacity"){b.setOpacity(c[d])}else{e[(d=="float"||d=="cssFloat")?(Object.isUndefined(e.styleFloat)?"cssFloat":"styleFloat"):d]=c[d]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var g=Element.getStyle(c,"display");if(g!="none"&&g!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var f=b.visibility;var d=b.position;var a=b.display;b.visibility="hidden";if(d!="fixed"){b.position="absolute"}b.display="block";var i=c.clientWidth;var e=c.clientHeight;b.display=a;b.position=d;b.visibility=f;return{width:i,height:e}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(c,a)},positionedOffset:function(b){var a=0,d=0;do{a+=b.offsetTop||0;d+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName.toUpperCase()=="BODY"){break}var c=Element.getStyle(b,"position");if(c!=="static"){break}}}while(b);return Element._returnOffset(d,a)},absolutize:function(b){b=$(b);if(Element.getStyle(b,"position")=="absolute"){return b}var d=Element.positionedOffset(b);var f=d[1];var e=d[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=e-parseFloat(b.style.left||0);b._originalTop=f-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=f+"px";b.style.left=e+"px";b.style.width=c+"px";b.style.height=a+"px";return b},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative"){return a}a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(c,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(d){var a=0,c=0;var b=d;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body&&Element.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=d;do{if(!Prototype.Browser.Opera||(b.tagName&&(b.tagName.toUpperCase()=="BODY"))){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return Element._returnOffset(c,a)},clonePosition:function(b,d){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});d=$(d);var e=Element.viewportOffset(d);b=$(b);var f=[0,0];var c=null;if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);f=Element.viewportOffset(c)}if(c==document.body){f[0]-=document.body.offsetLeft;f[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(e[0]-f[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(e[1]-f[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=d.offsetWidth+"px"}if(a.setHeight){b.style.height=d.offsetHeight+"px"}return b}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(d,b,c){switch(c){case"left":case"top":case"right":case"bottom":if(d(b,"position")==="static"){return null}case"height":case"width":if(!Element.visible(b)){return null}var e=parseInt(d(b,c),10);if(e!==b["offset"+c.capitalize()]){return e+"px"}var a;if(c==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(e,function(f,g){var i=d(b,g);return i===null?f:f-parseInt(i,10)})+"px";default:return d(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,a,b){if(b==="title"){return a.title}return c(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(c,b){b=$(b);try{b.offsetParent}catch(f){return $(document.body)}var a=b.getStyle("position");if(a!=="static"){return c(b)}b.setStyle({position:"relative"});var d=c(b);b.setStyle({position:a});return d});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(f,c){c=$(c);try{c.offsetParent}catch(i){return Element._returnOffset(0,0)}var b=c.getStyle("position");if(b!=="static"){return f(c)}var d=c.getOffsetParent();if(d&&d.getStyle("position")==="fixed"){d.setStyle({zoom:1})}c.setStyle({position:"relative"});var g=f(c);c.setStyle({position:b});return g})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent}catch(c){return Element._returnOffset(0,0)}return b(a)});Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(b,e){function f(g){return g.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var d=b.getStyle("filter"),c=b.style;if(e==1||e===""){(d=f(d))?c.filter=d:c.removeAttribute("filter");return b}else{if(e<0.00001){e=0}}c.filter=f(d)+"alpha(opacity="+(e*100)+")";return b};Element._attributeTranslations=(function(){var b="className";var a="for";var c=document.createElement("div");c.setAttribute(b,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){b="class"}}c=null;c=document.createElement("label");c.setAttribute(a,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){a="htmlFor"}}c=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(d,e){return d.getAttribute(e)},_getAttr2:function(d,e){return d.getAttribute(e,2)},_getAttrNode:function(d,f){var e=d.getAttributeNode(f);return e?e.value:""},_getEv:(function(){var d=document.createElement("div");d.onclick=Prototype.emptyFunction;var g=d.getAttribute("onclick");var e;if(String(g).indexOf("{")>-1){e=function(f,i){i=f.getAttribute(i);if(!i){return null}i=i.toString();i=i.split("{")[1];i=i.split("}")[0];return i.strip()}}else{if(g===""){e=function(f,i){i=f.getAttribute(i);if(!i){return null}return i.strip()}}}d=null;return e})(),_flag:function(d,e){return $(d).hasAttribute(e)?e:null},style:function(d){return d.style.cssText.toLowerCase()},title:function(d){return d.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(e){var b=e.getElementsByTagName("*"),d=[];for(var c=0,f;f=b[c];c++){if(f.tagName!=="!"){d.push(f)}}return d}Element.Methods.down=function(c,d,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(d)?a(c)[d]:Element.select(c,d)[b||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var d=document.createTextNode(" ");a.appendChild(d);a.removeChild(d)}catch(c){}}}return a};Element.Methods.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(c,a)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){c.parentNode.replaceChild(e,c);return c}e=Object.toHTML(e);var d=c.parentNode,b=d.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var f=c.next();var a=Element._getContentFromAnonymousElement(b,e.stripScripts());d.removeChild(c);if(f){a.each(function(g){d.insertBefore(g,f)})}else{a.each(function(g){d.appendChild(g)})}}else{c.outerHTML=e.stripScripts()}e.evalScripts.bind(e).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(c,b){var d=new Element("div"),a=Element._insertionTranslations.tags[c];if(a){d.innerHTML=a[0]+b+a[1];a[2].times(function(){d=d.firstChild})}else{d.innerHTML=b}return $A(d.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,c){c=Element._attributeTranslations.has[c]||c;var b=$(a).getAttributeNode(c);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function c(g){if(typeof window.Element!="undefined"){var j=window.Element.prototype;if(j){var l="_"+(Math.random()+"").slice(2);var i=document.createElement(g);j[l]="x";var k=(i[l]!=="x");delete j[l];i=null;return k}}return false}function b(i,g){for(var k in g){var j=g[k];if(Object.isFunction(j)&&!(k in i)){i[k]=j.methodize()}}}var d=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(d){return function(i){if(i&&typeof i._extendedByPrototype=="undefined"){var g=i.tagName;if(g&&(/^(?:object|applet|embed)$/i.test(g))){b(i,Element.Methods);b(i,Element.Methods.Simulated);b(i,Element.Methods.ByTag[g.toUpperCase()])}}return i}}return Prototype.K}var a={},e=Element.Methods.ByTag;var f=Object.extend(function(j){if(!j||typeof j._extendedByPrototype!="undefined"||j.nodeType!=1||j==window){return j}var g=Object.clone(a),i=j.tagName.toUpperCase();if(e[i]){Object.extend(g,e[i])}b(j,g);j._extendedByPrototype=Prototype.emptyFunction;return j},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});f.refresh();return f})();Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var j=Prototype.BrowserFeatures,d=Element.Methods.ByTag;if(!c){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(Object.isArray(b)){b.each(g)}else{g(b)}}function g(l){l=l.toUpperCase();if(!Element.Methods.ByTag[l]){Element.Methods.ByTag[l]={}}Object.extend(Element.Methods.ByTag[l],c)}function a(n,m,l){l=l||false;for(var p in n){var o=n[p];if(!Object.isFunction(o)){continue}if(!l||!(p in m)){m[p]=o.methodize()}}}function e(o){var l;var n={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(n[o]){l="HTML"+n[o]+"Element"}if(window[l]){return window[l]}l="HTML"+o+"Element";if(window[l]){return window[l]}l="HTML"+o.capitalize()+"Element";if(window[l]){return window[l]}var m=document.createElement(o);var p=m.__proto__||m.constructor.prototype;m=null;return p}var i=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(j.ElementExtensions){a(Element.Methods,i);a(Element.Methods.Simulated,i,true)}if(j.SpecificElementExtensions){for(var k in Element.Methods.ByTag){var f=e(k);if(Object.isUndefined(f)){continue}a(d[k],f.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(b){var g=Prototype.Browser,e=document,c,d={};function a(){if(g.WebKit&&!e.evaluate){return document}if(g.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function f(i){if(!c){c=a()}d[i]="client"+i;b["get"+i]=function(){return c[d[i]]};return b["get"+i]()}b.getWidth=f.curry("Width");b.getHeight=f.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return}var a;if(b===window){a=0}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=[Element.Storage.UID++]}a=b._prototypeUID[0]}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,c){if(!(b=$(b))){return}if(arguments.length===2){Element.getStorage(b).update(a)}else{Element.getStorage(b).set(a,c)}return b},retrieve:function(c,b,a){if(!(c=$(c))){return}var e=Element.getStorage(c),d=e.get(b);if(Object.isUndefined(d)){e.set(b,a);d=a}return d},clone:function(c,a){if(!(c=$(c))){return}var e=c.cloneNode(a);e._prototypeUID=void 0;if(a){var d=Element.select(e,"*"),b=d.length;while(b--){d[b]._prototypeUID=void 0}}return Element.extend(e)}});var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var a=(function(){var e=false;if(document.evaluate&&window.XPathResult){var d=document.createElement("div");d.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var c=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var b=document.evaluate(c,d,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);e=(b.snapshotLength!==2);d=null}return e})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(b)){return false}if(a){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var j=this.expression,k=Selector.patterns,c=Selector.xpath,g,b,a=k.length,d;if(Selector._cache[j]){this.xpath=Selector._cache[j];return}this.matcher=[".//*"];while(j&&g!=j&&(/\S/).test(j)){g=j;for(var f=0;f<a;f++){d=k[f].name;if(b=j.match(k[f].re)){this.matcher.push(Object.isFunction(c[d])?c[d](b):new Template(c[d]).evaluate(b));j=j.replace(b[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var c=this.expression,b;switch(this.mode){case"selectorsAPI":if(a!==document){var d=a.id,f=$(a).identify();f=f.replace(/([\.:])/g,"\\$1");c="#"+f+" "+c}b=$A(a.querySelectorAll(c)).map(Element.extend);a.id=d;return b;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(l){this.tokens=[];var r=this.expression,a=Selector.patterns,f=Selector.assertions;var b,d,g,q=a.length,c;while(r&&b!==r&&(/\S/).test(r)){b=r;for(var k=0;k<q;k++){d=a[k].re;c=a[k].name;if(g=r.match(d)){if(f[c]){this.tokens.push([c,Object.clone(g)]);r=r.replace(g[0],"")}else{return this.findElements(document).include(l)}}}}var o=true,c,n;for(var k=0,j;j=this.tokens[k];k++){c=j[0],n=j[1];if(!Selector.assertions[c](l,n)){o=false;break}}return o},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var c=document.createElement("div"),a=document.createElement("span");c.id="prototype_test_id";a.className="Test";c.appendChild(a);var b=(c.querySelector("#prototype_test_id .test")!==null);c=a=null;return b})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return new Template("[@#{1}]").evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(Object.isFunction(b)){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(f){var k=f[6],c=Selector.patterns,l=Selector.xpath,a,n,j=c.length,b;var d=[];while(k&&a!=k&&(/\S/).test(k)){a=k;for(var g=0;g<j;g++){b=c[g].name;if(f=k.match(c[g].re)){n=Object.isFunction(l[b])?l[b](f):new Template(l[b]).evaluate(f);d.push("("+n.substring(1,n.length-1)+")");k=k.replace(f[0],"");break}}}return"[not("+d.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(g,e){var i,j=e[6],d;if(j=="even"){j="2n+0"}if(j=="odd"){j="2n+1"}if(i=j.match(/^(\d+)$/)){return"["+g+"= "+i[1]+"]"}if(i=j.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(i[1]=="-"){i[1]=-1}var f=i[1]?Number(i[1]):1;var c=i[2]?Number(i[2]):0;d="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(d).evaluate({fragment:g,a:f,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(b,c){var a=Element.readAttribute(b,c[1]);return a&&Selector.operators[c[2]](a,c[5]||c[6])}},handlers:{concat:function(d,c){for(var e=0,f;f=c[e];e++){d.push(f)}return d},mark:function(a){var d=Prototype.emptyFunction;for(var b=0,c;c=a[b];b++){c._countedByPrototype=d}return a},unmark:(function(){var a=(function(){var b=document.createElement("div"),e=false,d="_countedByPrototype",c="x";b[d]=c;e=(b.getAttribute(d)===c);b=null;return e})();return a?function(b){for(var c=0,d;d=b[c];c++){d.removeAttribute("_countedByPrototype")}return b}:function(b){for(var c=0,d;d=b[c];c++){d._countedByPrototype=void 0}return b}})(),index:function(a,d,g){a._countedByPrototype=Prototype.emptyFunction;if(d){for(var b=a.childNodes,e=b.length-1,c=1;e>=0;e--){var f=b[e];if(f.nodeType==1&&(!g||f._countedByPrototype)){f.nodeIndex=c++}}}else{for(var e=0,c=1,b=a.childNodes;f=b[e];e++){if(f.nodeType==1&&(!g||f._countedByPrototype)){f.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var d=[],e;for(var c=0,a=b.length;c<a;c++){if(typeof(e=b[c])._countedByPrototype=="undefined"){e._countedByPrototype=Prototype.emptyFunction;d.push(Element.extend(e))}}return Selector.handlers.unmark(d)},descendant:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,e.getElementsByTagName("*"))}return b},child:function(a){var e=Selector.handlers;for(var d=0,c=[],f;f=a[d];d++){for(var b=0,g;g=f.childNodes[b];b++){if(g.nodeType==1&&g.tagName!="!"){c.push(g)}}}return c},adjacent:function(a){for(var c=0,b=[],e;e=a[c];c++){var d=this.nextElementSibling(e);if(d){b.push(d)}}return b},laterSibling:function(a){var d=Selector.handlers;for(var c=0,b=[],e;e=a[c];c++){d.concat(b,Element.nextSiblings(e))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,j,c,b){var k=c.toUpperCase();var e=[],g=Selector.handlers;if(a){if(b){if(b=="descendant"){for(var f=0,d;d=a[f];f++){g.concat(e,d.getElementsByTagName(c))}return e}else{a=this[b](a)}if(c=="*"){return a}}for(var f=0,d;d=a[f];f++){if(d.tagName.toUpperCase()===k){e.push(d)}}return e}else{return j.getElementsByTagName(c)}},id:function(a,l,b,c){var k=$(b),g=Selector.handlers;if(l==document){if(!k){return[]}if(!a){return[k]}}else{if(!l.sourceIndex||l.sourceIndex<1){var a=l.getElementsByTagName("*");for(var e=0,d;d=a[e];e++){if(d.id===b){return[d]}}}}if(a){if(c){if(c=="child"){for(var f=0,d;d=a[f];f++){if(k.parentNode==d){return[k]}}}else{if(c=="descendant"){for(var f=0,d;d=a[f];f++){if(Element.descendantOf(k,d)){return[k]}}}else{if(c=="adjacent"){for(var f=0,d;d=a[f];f++){if(Selector.handlers.previousElementSibling(k)==d){return[k]}}}else{a=g[c](a)}}}}for(var f=0,d;d=a[f];f++){if(d==k){return[k]}}return[]}return(k&&Element.descendantOf(k,l))?[k]:[]},className:function(b,a,c,d){if(b&&d){b=this[d](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,f){if(!c){c=Selector.handlers.descendant([b])}var j=" "+f+" ";for(var e=0,d=[],g,a;g=c[e];e++){a=g.className;if(a.length==0){continue}if(a==f||(" "+a+" ").include(j)){d.push(g)}}return d},attrPresence:function(c,b,a,g){if(!c){c=b.getElementsByTagName("*")}if(c&&g){c=this[g](c)}var e=[];for(var d=0,f;f=c[d];d++){if(Element.hasAttribute(f,a)){e.push(f)}}return e},attr:function(a,k,j,l,c,b){if(!a){a=k.getElementsByTagName("*")}if(a&&b){a=this[b](a)}var m=Selector.operators[c],f=[];for(var e=0,d;d=a[e];e++){var g=Element.readAttribute(d,j);if(g===null){continue}if(m(g,l)){f.push(d)}}return f},pseudo:function(b,c,e,a,d){if(b&&d){b=this[d](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,e,a)}},pseudos:{"first-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.previousElementSibling(e)){continue}c.push(e)}return c},"last-child":function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(Selector.handlers.nextElementSibling(e)){continue}c.push(e)}return c},"only-child":function(b,g,a){var e=Selector.handlers;for(var d=0,c=[],f;f=b[d];d++){if(!e.previousElementSibling(f)&&!e.nextElementSibling(f)){c.push(f)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,d,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,d,a),d,a)},getIndices:function(d,c,e){if(d==0){return c>0?[c]:[]}return $R(1,e).inject([],function(a,b){if(0==(b-c)%d&&(b-c)/d>=0){a.push(b)}return a})},nth:function(c,s,u,r,e){if(c.length==0){return[]}if(s=="even"){s="2n+0"}if(s=="odd"){s="2n+1"}var q=Selector.handlers,p=[],d=[],g;q.mark(c);for(var o=0,f;f=c[o];o++){if(!f.parentNode._countedByPrototype){q.index(f.parentNode,r,e);d.push(f.parentNode)}}if(s.match(/^\d+$/)){s=Number(s);for(var o=0,f;f=c[o];o++){if(f.nodeIndex==s){p.push(f)}}}else{if(g=s.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(g[1]=="-"){g[1]=-1}var v=g[1]?Number(g[1]):1;var t=g[2]?Number(g[2]):0;var z=Selector.pseudos.getIndices(v,t,c.length);for(var o=0,f,k=z.length;f=c[o];o++){for(var n=0;n<k;n++){if(f.nodeIndex==z[n]){p.push(f)}}}}}q.unmark(c);q.unmark(d);return p},empty:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.tagName=="!"||e.firstChild){continue}c.push(e)}return c},not:function(a,d,k){var g=Selector.handlers,l,c;var j=new Selector(d).findElements(k);g.mark(j);for(var f=0,e=[],b;b=a[f];f++){if(!b._countedByPrototype){e.push(b)}}g.unmark(j);return e},enabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(!e.disabled&&(!e.type||e.type!=="hidden")){c.push(e)}}return c},disabled:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.disabled){c.push(e)}}return c},checked:function(b,f,a){for(var d=0,c=[],e;e=b[d];d++){if(e.checked){c.push(e)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b==a||b&&b.startsWith(a)},"$=":function(b,a){return b==a||b&&b.endsWith(a)},"*=":function(b,a){return b==a||b&&b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+(b||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){a.push(c[1].strip())});return a},matchElements:function(f,g){var e=$$(g),d=Selector.handlers;d.mark(e);for(var c=0,b=[],a;a=f[c];c++){if(a._countedByPrototype){b.push(a)}}d.unmark(e);return b},findElement:function(b,c,a){if(Object.isNumber(c)){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(e,g){g=Selector.split(g.join(","));var d=[],f=Selector.handlers;for(var c=0,b=g.length,a;c<b;c++){a=new Selector(g[c].strip());f.concat(d,a.findElements(e))}return(b>1)?f.unique(d):d}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(d,c){for(var e=0,f;f=c[e];e++){if(f.tagName!=="!"){d.push(f)}}return d}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(g,b){if(typeof b!="object"){b={hash:!!b}}else{if(Object.isUndefined(b.hash)){b.hash=true}}var c,f,a=false,e=b.submit;var d=g.inject({},function(i,j){if(!j.disabled&&j.name){c=j.name;f=$(j).getValue();if(f!=null&&j.type!="file"&&(j.type!="submit"||(!a&&e!==false&&(!e||c==e)&&(a=true)))){if(c in i){if(!Object.isArray(i[c])){i[c]=[i[c]]}i[c].push(f)}else{i[c]=f}}}return i});return b.hash?d:Object.toQueryString(d)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(e){var f=$(e).getElementsByTagName("*"),d,a=[],c=Form.Element.Serializers;for(var b=0;d=f[b];b++){a.push(d)}return a.inject([],function(g,i){if(c[i.tagName.toLowerCase()]){g.push(Element.extend(i))}return g})},getInputs:function(g,c,d){g=$(g);var a=g.getElementsByTagName("input");if(!c&&!d){return $A(a).map(Element.extend)}for(var e=0,j=[],f=a.length;e<f;e++){var b=a[e];if((c&&b.type!=c)||(d&&b.name!=d)){continue}j.push(Element.extend(b))}return j},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(d){return"hidden"!=d.type&&!d.disabled});var a=c.findAll(function(d){return d.hasAttribute("tabIndex")&&d.tabIndex>=0}).sortBy(function(d){return d.tabIndex}).first();return a?a:c.find(function(d){return/^(?:input|select|textarea)$/i.test(d.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var d=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(d){if(Object.isString(d)){d=d.toQueryParams()}Object.extend(a.parameters,d)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null}else{a.checked=!!b}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value}else{a.value=b}},select:function(c,f){if(Object.isUndefined(f)){return this[c.type=="select-one"?"selectOne":"selectMany"](c)}else{var b,d,g=!Object.isArray(f);for(var a=0,e=c.length;a<e;a++){b=c.options[a];d=this.optionValue(b);if(g){if(d==f){b.selected=true;return}}else{b.selected=f.include(d)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(d){var a,e=d.length;if(!e){return null}for(var c=0,a=[];c<e;c++){var b=d.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var z={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var e=document.documentElement;var A="onmouseenter" in e&&"onmouseleave" in e;var p;if(Prototype.Browser.IE){var i={0:1,1:4,2:2};p=function(C,B){return C.button===i[B]}}else{if(Prototype.Browser.WebKit){p=function(C,B){switch(B){case 0:return C.which==1&&!C.metaKey;case 1:return C.which==1&&C.metaKey;default:return false}}}else{p=function(C,B){return C.which?(C.which===B+1):(C.button===B)}}}function s(B){return p(B,0)}function r(B){return p(B,1)}function l(B){return p(B,2)}function c(D){D=z.extend(D);var C=D.target,B=D.type,E=D.currentTarget;if(E&&E.tagName){if(B==="load"||B==="error"||(B==="click"&&E.tagName.toLowerCase()==="input"&&E.type==="radio")){C=E}}if(C.nodeType==Node.TEXT_NODE){C=C.parentNode}return Element.extend(C)}function n(C,E){var B=z.element(C);if(!E){return B}var D=[B].concat(B.ancestors());return Selector.findElement(D,E,0)}function q(B){return{x:b(B),y:a(B)}}function b(D){var C=document.documentElement,B=document.body||{scrollLeft:0};return D.pageX||(D.clientX+(C.scrollLeft||B.scrollLeft)-(C.clientLeft||0))}function a(D){var C=document.documentElement,B=document.body||{scrollTop:0};return D.pageY||(D.clientY+(C.scrollTop||B.scrollTop)-(C.clientTop||0))}function o(B){z.extend(B);B.preventDefault();B.stopPropagation();B.stopped=true}z.Methods={isLeftClick:s,isMiddleClick:r,isRightClick:l,element:c,findElement:n,pointer:q,pointerX:b,pointerY:a,stop:o};var u=Object.keys(z.Methods).inject({},function(B,C){B[C]=z.Methods[C].methodize();return B});if(Prototype.Browser.IE){function g(C){var B;switch(C.type){case"mouseover":B=C.fromElement;break;case"mouseout":B=C.toElement;break;default:return null}return Element.extend(B)}Object.extend(u,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});z.extend=function(C,B){if(!C){return false}if(C._extendedByPrototype){return C}C._extendedByPrototype=Prototype.emptyFunction;var D=z.pointer(C);Object.extend(C,{target:C.srcElement||B,relatedTarget:g(C),pageX:D.x,pageY:D.y});return Object.extend(C,u)}}else{z.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(z.prototype,u);z.extend=Prototype.K}function m(F,E,G){var D=Element.retrieve(F,"prototype_event_registry");if(Object.isUndefined(D)){d.push(F);D=Element.retrieve(F,"prototype_event_registry",$H())}var B=D.get(E);if(Object.isUndefined(B)){B=[];D.set(E,B)}if(B.pluck("handler").include(G)){return false}var C;if(E.include(":")){C=function(H){if(Object.isUndefined(H.eventName)){return false}if(H.eventName!==E){return false}z.extend(H,F);G.call(F,H)}}else{if(!A&&(E==="mouseenter"||E==="mouseleave")){if(E==="mouseenter"||E==="mouseleave"){C=function(I){z.extend(I,F);var H=I.relatedTarget;while(H&&H!==F){try{H=H.parentNode}catch(J){H=F}}if(H===F){return}G.call(F,I)}}}else{C=function(H){z.extend(H,F);G.call(F,H)}}}C.handler=G;B.push(C);return C}function f(){for(var B=0,C=d.length;B<C;B++){z.stopObserving(d[B]);d[B]=null}}var d=[];if(Prototype.Browser.IE){window.attachEvent("onunload",f)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var k=Prototype.K;if(!A){k=function(C){var B={mouseenter:"mouseover",mouseleave:"mouseout"};return C in B?B[C]:C}}function t(E,D,F){E=$(E);var C=m(E,D,F);if(!C){return E}if(D.include(":")){if(E.addEventListener){E.addEventListener("dataavailable",C,false)}else{E.attachEvent("ondataavailable",C);E.attachEvent("onfilterchange",C)}}else{var B=k(D);if(E.addEventListener){E.addEventListener(B,C,false)}else{E.attachEvent("on"+B,C)}}return E}function j(G,E,H){G=$(G);var D=Element.retrieve(G,"prototype_event_registry");if(Object.isUndefined(D)){return G}if(E&&!H){var F=D.get(E);if(Object.isUndefined(F)){return G}F.each(function(I){Element.stopObserving(G,E,I.handler)});return G}else{if(!E){D.each(function(K){var I=K.key,J=K.value;J.each(function(L){Element.stopObserving(G,I,L.handler)})});return G}}var F=D.get(E);if(!F){return}var C=F.find(function(I){return I.handler===H});if(!C){return G}var B=k(E);if(E.include(":")){if(G.removeEventListener){G.removeEventListener("dataavailable",C,false)}else{G.detachEvent("ondataavailable",C);G.detachEvent("onfilterchange",C)}}else{if(G.removeEventListener){G.removeEventListener(B,C,false)}else{G.detachEvent("on"+B,C)}}D.set(E,F.without(C));return G}function v(E,D,C,B){E=$(E);if(Object.isUndefined(B)){B=true}if(E==document&&document.createEvent&&!E.dispatchEvent){E=document.documentElement}var F;if(document.createEvent){F=document.createEvent("HTMLEvents");F.initEvent("dataavailable",true,true)}else{F=document.createEventObject();F.eventType=B?"ondataavailable":"onfilterchange"}F.eventName=D;F.memo=C||{};if(document.createEvent){E.dispatchEvent(F)}else{E.fireEvent(F.eventType,F)}return z.extend(F)}Object.extend(z,z.Methods);Object.extend(z,{fire:v,observe:t,stopObserving:j});Element.addMethods({fire:v,observe:t,stopObserving:j});Object.extend(document,{fire:v.methodize(),observe:t.methodize(),stopObserving:j.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,z)}else{window.Event=z}})();(function(){var d;function a(){if(document.loaded){return}if(d){window.clearTimeout(d)}document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){d=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",c);if(window==top){d=b.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,d){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=d+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,e){e=e.toString().strip();var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);return d?document._getElementsByXPath(".//*"+d,c):[]}:function(e,f){f=f.toString().strip();var g=[],j=(/\s/.test(f)?$w(f):null);if(!j&&!f){return g}var c=$(e).getElementsByTagName("*");f=" "+f+" ";for(var d=0,l,k;l=c[d];d++){if(l.className&&(k=" "+l.className+" ")&&(k.include(f)||(j&&j.all(function(i){return !i.toString().blank()&&k.include(" "+i+" ")})))){g.push(Element.extend(l))}}return g};return function(d,c){return $(c||document.body).getElementsByClassName(d)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore(new Element("span",{style:b}).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(b,c){var e;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){e=b}else{e=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var d=a.delay;$A(e).each(function(g,f){new c(g,Object.extend(a,{delay:f*a.speed+d}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c,a){b=$(b);c=(c||"appear").toLowerCase();return Effect[Effect.PAIRS[c][b.visible()?1:0]](b,Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},a||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=Object.isString(b.options.queue)?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(d){return d.state=="idle"}).each(function(d){d.startOn+=b.finishOn;d.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false){a.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function b(d,c){if(d.options[c+"Internal"]){d.options[c+"Internal"](d)}if(d.options[c]){d.options[c](d)}}return function(c){if(this.state==="idle"){this.state="running";b(this,"beforeSetup");if(this.setup){this.setup()}b(this,"afterSetup")}if(this.state==="running"){c=(this.options.transition(c)*this.fromToDelta)+this.options.from;this.position=c;b(this,"beforeUpdate");if(this.update){this.update(c)}b(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=(b*this.totalFrames).round();if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,f,e){c=Object.isString(c)?$(c):c;var b=$A(arguments),d=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(d)?d.bind(c):Object.isFunction(c[d])?c[d].bind(c):function(g){c[d]=g};this.start(Object.extend({from:f,to:e},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,e){var f={};if(this.options.scaleX){f.width=e.round()+"px"}if(this.options.scaleY){f.height=a.round()+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px"}if(this.options.scaleX){f.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){f.top=-c+"px"}if(this.options.scaleX){f.left=-b+"px"}}}this.element.setStyle(f)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,d){return b+((this._base[d]+(this._delta[d]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(c){var b=arguments[1]||{},a=document.viewport.getScrollOffsets(),d=$(c).cumulativeOffset();if(b.offset){d[1]+=b.offset}return new Effect.Tween(null,a.top,d[1],b,function(e){scrollTo(a.left,e.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(d){if(d.options.to!=0){return}d.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(d){d.element.makePositioned().makeClipping()},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(d){d=$(d);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var e=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:d.getStyle("top"),left:d.getStyle("left")};return new Effect.Move(d,{x:e,y:0,duration:c,afterFinishInternal:function(f){new Effect.Move(f.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(g){new Effect.Move(g.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(i){new Effect.Move(i.element,{x:-e*2,y:0,duration:c*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:e*2,y:0,duration:c*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-e,y:0,duration:c,afterFinishInternal:function(l){l.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makePositioned();d.element.down().makePositioned();if(window.opera){d.element.setStyle({top:""})}d.element.makeClipping().show()},afterUpdateInternal:function(d){d.element.down().setStyle({bottom:(d.dims[0]-d.element.clientHeight)+"px"})},afterFinishInternal:function(d){d.element.hide().undoClipping().undoPositioned();d.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var i,f;var e,d;switch(b.direction){case"top-left":i=f=e=d=0;break;case"top-right":i=g.width;f=d=0;e=-g.width;break;case"bottom-left":i=e=0;f=g.height;d=-g.height;break;case"bottom-right":i=g.width;f=g.height;e=-g.width;d=-g.height;break;case"center":i=g.width/2;f=g.height/2;e=-g.width/2;d=-g.height/2;break}return new Effect.Move(c,{x:i,y:f,duration:0.01,beforeSetup:function(j){j.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(j){new Effect.Parallel([new Effect.Opacity(j.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(j.element,{x:e,y:d,sync:true,transition:b.moveTransition}),new Effect.Scale(j.element,100,{scaleMode:{originalHeight:g.height,originalWidth:g.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(k){k.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(k){k.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var f=c.getDimensions();var e,d;switch(b.direction){case"top-left":e=d=0;break;case"top-right":e=f.width;d=0;break;case"bottom-left":e=0;d=f.height;break;case"bottom-right":e=f.width;d=f.height;break;case"center":e=f.width/2;d=f.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:e,y:d,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(g){g.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(g){g.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{},a=c.getInlineOpacity(),e=b.transition||Effect.Transitions.linear,d=function(f){return 1-e((-Math.cos((f*(b.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:a})}},b),{transition:d}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var b=this.element.getStyles();this.style=this.style.reject(function(d){return d.value==b[d.key]});a.afterFinishInternal=function(d){d.element.addClassName(d.options.style);d.transforms.each(function(e){d.element.style[e.style]=""})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(g){var f=g[0],e=g[1],d=null;if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();d="color"}else{if(f=="opacity"){e=parseFloat(e);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(e)){var c=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(c[1]);d=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(f);return{style:f.camelize(),originalValue:d=="color"?a(b):parseFloat(b||0),targetValue:d=="color"?a(e):e,unit:d}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var d={},b,c=this.transforms.length;while(c--){d[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():(b.originalValue+(b.targetValue-b.originalValue)*a).toFixed(3)+(b.unit===null?"":b.unit)}this.element.setStyle(d,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var d=a.get("ids"),c=a.get("effect"),b=a.get("options");var e=[$(d)||$$(d)].flatten();return e.map(function(f){return new c(f,Object.extend({sync:true},b))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var b,a=$H();if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(b[c]){a.set(c,b[c])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=a[d];return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=a[e];return d});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(c,e,b){c=$(c);var d=e.dasherize().camelize(),a=d.charAt(0).toUpperCase()+d.substring(1);new Effect[a](c,b);return c},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(b,c,a){b=$(b);this.element=b;this.update=$(c);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions){this.setOptions(a)}else{this.options=a||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(d,f,e){if(!f.style.position||f.style.position=="absolute"){f.style.position="absolute";Position.clone(d,f,{setHeight:false,offsetTop:d.offsetHeight})}f.style.width=e+"px";Effect.Appear(f,{duration:0.15})};this.options.onHide=this.options.onHide||function(d,e){new Effect.Fade(e,{duration:0.15})};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update,this.options.width)}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(a);return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(b){var a=Event.findElement(b,"LI");if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;this.render()}Event.stop(b)},onClick:function(b){var a=Event.findElement(b,"LI");this.index=a.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(g){if(this.options.updateElement){this.options.updateElement(g);return}var e="";if(this.options.select){var a=$(g).select("."+this.options.select)||[];if(a.length>0){e=Element.collectTextNodes(a[0],this.options.select)}}else{e=Element.collectTextNodesIgnoreClass(g,"informal")}var d=this.getTokenBounds();if(d[0]!=-1){var f=this.element.value.substr(0,d[0]);var b=this.element.value.substr(d[0]).match(/^\s+/);if(b){f+=b[0]}this.element.value=f+e+this.element.value.substr(d[1])}else{this.element.value=e}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){var c=new Function("p1","p2",this.options.afterUpdateElement+"(p1,p2);");c(this.element,g)}},updateChoices:function(c){if(!this.changed&&this.hasFocus){this.update.innerHTML=c;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds}var e=this.element.value;if(e.strip().empty()){return[-1,0]}var f=arguments.callee.getFirstDifferencePos(e,this.oldElementValue);var i=(f==this.oldElementValue.length?1:0);var d=-1,c=e.length;var g;for(var b=0,a=this.options.tokens.length;b<a;++b){g=e.lastIndexOf(this.options.tokens[b],f+i-1);if(g>d){d=g}g=e.indexOf(this.options.tokens[b],f+i);if(-1!=g&&g<c){c=g}}return(this.tokenBounds=[d+1,c])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(c,a){var d=Math.min(c.length,a.length);for(var b=0;b<d;++b){if(c[b]!=a[b]){return b}}return d};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(c,d,b,a){this.baseInitialize(c,d,a);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=b},getUpdatedChoices:function(){this.startIndicator();var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(b,d,c,a){this.baseInitialize(b,d,a);this.options.array=c},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(b){var d=[];var c=[];var j=b.getToken();var g=0;for(var e=0;e<b.options.array.length&&d.length<b.options.choices;e++){var f=b.options.array[e];var k=b.options.ignoreCase?f.toLowerCase().indexOf(j.toLowerCase()):f.indexOf(j);while(k!=-1){if(k==0&&f.length!=j.length){d.push("<li><strong>"+f.substr(0,j.length)+"</strong>"+f.substr(j.length)+"</li>");break}else{if(j.length>=b.options.partialChars&&b.options.partialSearch&&k!=-1){if(b.options.fullSearch||/\s/.test(f.substr(k-1,1))){c.push("<li>"+f.substr(0,k)+"<strong>"+f.substr(k,j.length)+"</strong>"+f.substr(k+j.length)+"</li>");break}}}k=b.options.ignoreCase?f.toLowerCase().indexOf(j.toLowerCase(),k+1):f.indexOf(j,k+1)}}if(c.length){d=d.concat(c.slice(0,b.options.choices-d.length))}return"<ul>"+d.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(c,b,a){this.url=b;this.element=c=$(c);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(a);Object.extend(this.options,a||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=""}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}if(!this.options.externalControl){this.options.externalControlOnly=false}this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(a){if(!this._editing||a.ctrlKey||a.altKey||a.shiftKey){return}if(Event.KEY_ESC==a.keyCode){this.handleFormCancellation(a)}else{if(Event.KEY_RETURN==a.keyCode){this.handleFormSubmission(a)}}},createControl:function(g,c,b){var e=this.options[g+"Control"];var f=this.options[g+"Text"];if("button"==e){var a=document.createElement("input");a.type="submit";a.value=f;a.className="editor_"+g+"_button";if("cancel"==g){a.onclick=this._boundCancelHandler}this._form.appendChild(a);this._controls[g]=a}else{if("link"==e){var d=document.createElement("a");d.href="#";d.appendChild(document.createTextNode(f));d.onclick="cancel"==g?this._boundCancelHandler:this._boundSubmitHandler;d.className="editor_"+g+"_link";if(b){d.className+=" "+b}this._form.appendChild(d);this._controls[g]=d}}},createEditField:function(){var c=(this.options.loadTextURL?this.options.loadingText:this.getText());var b;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){b=document.createElement("input");b.type="text";var a=this.options.size||this.options.cols||0;if(0<a){b.size=a}}else{b=document.createElement("textarea");b.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);b.cols=this.options.cols||40}b.name=this.options.paramName;b.value=c;b.className="editor_field";if(this.options.submitOnBlur){b.onblur=this._boundSubmitHandler}this._controls.editor=b;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var b=this;function a(d,e){var c=b.options["text"+d+"Controls"];if(!c||e===false){return}b._form.appendChild(document.createTextNode(c))}this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"))}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form)}a("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);a("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");a("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML}this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(a){if(this._saving||this._editing){return}this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl){this.options.externalControl.hide()}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField()}if(a){Event.stop(a)}},enterHover:function(a){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();if(a){Event.stop(a)}},handleFormSubmission:function(d){var b=this._form;var c=$F(this._controls.editor);this.prepareSubmission();var f=this.options.callback(b,c)||"";if(Object.isString(f)){f=f.toQueryParams()}f.editorId=this.element.id;if(this.options.htmlResponse){var a=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(a,{parameters:f,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,a)}else{var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:f,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,a)}if(d){Event.stop(d)}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl){this.options.externalControl.show()}this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(a){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(c){this._form.removeClassName(this.options.loadingClassName);var b=c.responseText;if(this.options.stripLoadedTextTags){b=b.stripTags()}this._controls.editor.value=b;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,a)},postProcessEditField:function(){var a=this.options.fieldPostCreation;if(a){$(this._controls.editor)["focus"==a?"focus":"activate"]()}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var a;$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);this._listeners[b.key]=a;if(!this.options.externalControlOnly){this.element.observe(b.key,a)}if(this.options.externalControl){this.options.externalControl.observe(b.key,a)}}.bind(this))},removeForm:function(){if(!this._form){return}this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(b,a){if("function"==typeof this.options[b]){this.options[b](this,a)}},unregisterListeners:function(){$H(this._listeners).each(function(a){if(!this.options.externalControlOnly){this.element.stopObserving(a.key,a.value)}if(this.options.externalControl){this.options.externalControl.stopObserving(a.key,a.value)}}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,c,b,a){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(c,b,a)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];if(this.options.loadCollectionURL){this.loadCollection()}else{this.checkForExternalText()}this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js)){throw ("Server returned an invalid collection representation.")}this._collection=eval(js);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options)},showLoadingText:function(b){this._controls.editor.disabled=true;var a=this._controls.editor.firstChild;if(!a){a=document.createElement("option");a.value="";this._controls.editor.appendChild(a);a.selected=true}a.update((b||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText()}else{this.buildOptionList()}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){this._text=b.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,a)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(d){return 2===d.length?d:[d,d].flatten()});var b=("value" in this.options)?this.options.value:this._text;var a=this._collection.any(function(d){return d[0]==b}.bind(this));this._controls.editor.update("");var c;this._collection.each(function(e,d){c=document.createElement("option");c.value=e[0];c.selected=a?e[0]==b:0==d;c.appendChild(document.createTextNode(e[1]));this._controls.editor.appendChild(c)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){if(!a){return}function b(c,d){if(c in a||d===undefined){return}a[c]=d}b("cancelControl",(a.cancelLink?"link":(a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined)));b("okControl",(a.okLink?"link":(a.okButton?"button":a.okLink==a.okButton==false?false:undefined)));b("highlightColor",a.highlightcolor);b("highlightEndColor",a.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)},onComplete:function(b,a){new Effect.Highlight(a,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;if(a._effect){a._effect.cancel()}},onFailure:function(b,a){alert("Error communication with the server: "+b.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(b,a,c){this.delay=a||0.5;this.element=$(b);this.callback=c;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(a){if(this.lastValue==$F(this.element)){return}if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});var Tooltip=Class.create();Tooltip.prototype={initialize:function(d,c){var b=Object.extend({default_css:false,margin:"0px",padding:"5px",backgroundColor:"#d6d6fc",min_distance_x:15,min_distance_y:15,delta_x:0,delta_y:0,zindex:1000},arguments[2]||{});this.element=$(d);this.options=b;if($(c)){this.tool_tip=$(c);var a=$$("body")[0];this.tool_tip=$(a.appendChild(this.tool_tip.remove()))}else{this.tool_tip=$(document.createElement("div"));document.body.appendChild(this.tool_tip);this.tool_tip.addClassName("tooltip");this.tool_tip.appendChild(document.createTextNode(c))}this.tool_tip.hide();this.eventMouseOver=this.showTooltip.bindAsEventListener(this);this.eventMouseOut=this.hideTooltip.bindAsEventListener(this);this.eventMouseMove=this.moveTooltip.bindAsEventListener(this);this.registerEvents()},destroy:function(){Event.stopObserving(this.element,"mouseover",this.eventMouseOver);Event.stopObserving(this.element,"mouseout",this.eventMouseOut);Event.stopObserving(this.element,"mousemove",this.eventMouseMove)},registerEvents:function(){Event.observe(this.element,"mouseover",this.eventMouseOver);Event.observe(this.element,"mouseout",this.eventMouseOut);Event.observe(this.element,"mousemove",this.eventMouseMove)},moveTooltip:function(e){Event.stop(e);var b=Event.pointerX(e);var a=Event.pointerY(e);var d=Element.getDimensions(this.tool_tip);var c=d.width;var f=d.height;if((c+b)>=(this.getWindowWidth()-this.options.min_distance_x)){b=b-c;b=b-this.options.min_distance_x}else{b=b+this.options.min_distance_x}if((f+a)>=(this.getWindowHeight()-this.options.min_distance_y)){a=a-f;a=a-this.options.min_distance_y}else{a=a+this.options.min_distance_y}this.setStyles(b,a)},showTooltip:function(a){Event.stop(a);this.moveTooltip(a);this.tool_tip.show()},setStyles:function(a,b){Element.setStyle(this.tool_tip,{position:"absolute",top:b+this.options.delta_y+"px",left:a+this.options.delta_x+"px",zindex:this.options.zindex});if(this.options.default_css){Element.setStyle(this.tool_tip,{margin:this.options.margin,padding:this.options.padding,backgroundColor:this.options.backgroundColor,zindex:this.options.zindex})}},hideTooltip:function(a){new Element.hide(this.tool_tip)},getWindowHeight:function(){return document.viewport.getHeight()},getWindowWidth:function(){return document.viewport.getWidth()}};var SlideShow=Class.create();SlideShow.prototype={initialize:function(a,c,b,d){this.timeout=c;this.interval=b;this.transition=d;this.container=$(a);this.images=Element.select(this.container,"img");this.images.each(function(e){e.setStyle({position:"absolute",left:"0px",top:"0px"})});this.currentIndex=0;slideshow=this;if(this.images.size()>0){if(this.images.size()>1){this.executer=new PeriodicalExecuter(this.nextImage,c+b)}}},nextImage:function(){var a=(slideshow.currentIndex==(slideshow.images.size()-1)?0:slideshow.currentIndex+1);var c=slideshow.images[slideshow.currentIndex];var b=slideshow.images[a];switch(slideshow.transition){case"appear":new Effect.Appear(b,{duration:2,from:0,to:1});new Effect.Appear(c,{duration:2,from:1,to:0,afterFinish:slideshow.removeImage});break}slideshow.currentIndex=a},removeImage:function(){}};var GoogleMapsVisible=false;var map=null;var markersArray=[];function initHotelMap(){var b=new google.maps.LatLng(hotels.getLatitude(0),hotels.getLongitude(0));var a={center:b,zoom:14,panControl:true,zoomControl:true,mapTypeControl:true,scaleControl:true,streetViewControl:true,overviewMapControl:true,overviewMapControlOptions:{opened:true},mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map($("Map"),a);addMarker(b);map.controls[google.maps.ControlPosition.TOP_RIGHT].push(FullScreenControl(0))}function showHotelMap(){if(map==null){initHotelMap()}}function initCityMap(){var b=new google.maps.LatLng(hotels.refPointLatitude,hotels.refPointLongitude);var a={center:b,zoom:14,panControl:true,zoomControl:true,mapTypeControl:true,scaleControl:true,streetViewControl:true,overviewMapControl:true,overviewMapControlOptions:{opened:true},mapTypeId:google.maps.MapTypeId.ROADMAP};map=new google.maps.Map($("Map"),a);addMarker(b);addHotelMarkerList();renderHotelInfo(0);map.controls[google.maps.ControlPosition.TOP_RIGHT].push(CloseMapControl("GoogleMapsCityMap",0));map.controls[google.maps.ControlPosition.TOP_RIGHT].push(FullScreenControl(0))}function showCityMap(){$("GoogleMapsCityMap").show();if(map==null){initCityMap()}var a=getBounds(hotels);if(a!=null){map.setCenter(a.getCenter());map.fitBounds(a)}else{var b=new google.maps.LatLng(hotels.refPointLatitude,hotels.refPointLongitude);map.setCenter(b);map.setZoom(11)}}function updateCityMap(){deleteOverlays();var a=new google.maps.LatLng(hotels.refPointLatitude,hotels.refPointLongitude);addMarker(a);addHotelMarkerList();renderHotelInfo(0);if($("GoogleMapsCityMap").visible()){showCityMap()}}function renderHotelInfo(i){if(hotels.elements.length>0){var f=hotels.getImage(i);var d=hotels.getImageIndex(i);var b=hotels.getImageButton(i);var c=hotels.getName(i);var e=hotels.getStars(i);var l=hotels.getAddress(i);var m=hotels.getDescription(i);var g=hotels.getMinPrice(i);var j=hotels.getCurrency(i);var k=(g.length>0&&j.length>0?messages.get("IBE.global.text.PriceFrom")+" "+g+" "+j:"");var a=hotels.baseUrl;a=a.replace(/HOTEL_CODE/g,hotels.getHotelCode(i));document.getElementById("MapHotelImage").innerHTML='<img src="'+f+'"/>';document.getElementById("MapHotelNumber").innerHTML='<img src="'+d+'"/>';document.getElementById("MapHotelName").innerHTML=c+'<img src="images/icn_'+e+'star.gif"/>';document.getElementById("MapHotelAddress").innerHTML=l;document.getElementById("MapHotelDesc").innerHTML=m;document.getElementById("MapHotelPrice").innerHTML=k;document.getElementById("MapHotelBook").innerHTML='<a href="'+a+'"><img src="'+b+'"/></a>'}}function getBounds(b){var d=null;if(b.elements.length>0){var g=maxLat=b.refPointLatitude;var a=maxLon=b.refPointLongitude;for(var c=0;c<b.elements.length;c++){var e=b.getLatitude(c);var f=b.getLongitude(c);g=Math.min(g,e);a=Math.min(a,f);maxLat=Math.max(maxLat,e);maxLon=Math.max(maxLon,f)}d=new google.maps.LatLngBounds(new google.maps.LatLng(g,a),new google.maps.LatLng(maxLat,maxLon))}return d}function createHotelNumberIconImage(d){var c=hotels.getId(d);var b=hotels.getImageIndex(d);var f="";var a="";var e="";if(c<=99){b=b.replace(/number3/g,"number1");f=b;a=new google.maps.Size(20,22);e=new google.maps.Point(10,11)}else{b=b.replace(/number4/g,"number2");f=b;a=new google.maps.Size(28,22);e=new google.maps.Point(14,11)}var g=new google.maps.MarkerImage(f,a,new google.maps.Point(0,0),e);return g}function createHotelNumberIconShadow(c){var b=hotels.getId(c);var e="";var a="";var d="";if(b<=99){e="img/google/shadow-99.png";a=new google.maps.Size(32,22);d=new google.maps.Point(10,11)}else{e="img/google/shadow-999.png";a=new google.maps.Size(40,22);d=new google.maps.Point(14,11)}var f=new google.maps.MarkerImage(e,a,new google.maps.Point(0,0),d);return f}function createHotelStarsIcon(a){var b=new google.maps.Icon();b.shadow="images/haus-shadow.png";b.iconSize=new google.maps.Size(20,24);b.shadowSize=new google.maps.Size(33,24);b.iconAnchor=new google.maps.Point(10,12);b.infoWindowAnchor=new google.maps.Point(10,12);if(a==0){b.image="images/haus.gif"}else{b.image="images/haus"+a+".gif"}return b}function FullScreenControl(a){var c=document.createElement("DIV");var e="FullScreenButtonIconToggleOff";var d=false;c.id="FullScreenButton";c.index=a;var b=document.createElement("DIV");b.id=e;c.appendChild(b);google.maps.event.addDomListener(c,"click",function(){var f=$("Map").parentNode.id;if(d){b.id=e;toggleFullScreen(f,d);d=false}else{b.id="FullScreenButtonIconToggleOn";toggleFullScreen(f,d);d=true}});return c}function CloseMapControl(d,a){var c=document.createElement("DIV");c.id="CloseGoogleMapsButton";c.index=a;var b=document.createElement("DIV");c.appendChild(b);google.maps.event.addDomListener(c,"click",function(){GoogleMapsVisible=false;$(d).hide();cleanRestore(d)});return c}function cleanRestore(a){if($("GoogleMapsContainer").childElements().size()==0){$("GoogleMapsContainer").insert($(a))}$("content").removeClassName("hideAll");$("Map").removeClassName("fullHotelMap");$("Map").removeClassName("fullCityMap");$("Map").style.height=""}function toggleFullScreen(b,a){if(a){if(b=="GoogleMapsHotelMap"){$("Map").removeClassName("fullHotelMap")}if(b=="GoogleMapsCityMap"){$("Map").removeClassName("fullCityMap")}$("Map").style.height="";$("GoogleMapsContainer").insert($(b));$("content").removeClassName("hideAll")}else{$("content").addClassName("hideAll");$("main").insertBefore($(b),$("content"));if(b=="GoogleMapsHotelMap"){$("Map").addClassName("fullHotelMap")}if(b=="GoogleMapsCityMap"){$("Map").addClassName("fullCityMap")}$("Map").style.height=getAutoHeight()}}function getAutoHeight(){var a;if(typeof window.innerWidth!="undefined"){a=window.innerHeight}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){a=document.documentElement.clientHeight}else{a=document.getElementsByTagName("body")[0].clientHeight}}halfviewportheight=(a/1.5)+"px";return halfviewportheight}function addMarker(a){marker=new google.maps.Marker({position:a,map:map});markersArray.push(marker)}function addHotelMarkerList(){for(var c=0;c<hotels.elements.length;c++){if(hotels.getLatitude(c)!=0&&hotels.getLongitude(c)!=0){var b=new google.maps.LatLng(hotels.getLatitude(c),hotels.getLongitude(c));var a=hotels.baseUrl;a=a.replace(/HOTEL_CODE/g,hotels.getHotelCode(c));addHotelMarker(b,c,a)}}}function addHotelMarker(b,e,d){var f=createHotelNumberIconImage(e);var c=createHotelNumberIconShadow(e);var a=new google.maps.Marker({position:b,map:map,icon:f,shadow:c});markersArray.push(a);google.maps.event.addListener(a,"mouseover",function(){renderHotelInfo(e)});google.maps.event.addListener(a,"click",function(){window.location.href=d})}function clearOverlays(){if(markersArray){for(var a=0;a<markersArray.length;a++){markersArray[a].setMap(null)}}}function showOverlays(){if(markersArray){for(var a=0;a<markersArray.length;a++){markersArray[a].setMap(map)}}}function deleteOverlays(){if(markersArray){for(var a=0;a<markersArray.length;a++){markersArray[a].setMap(null)}markersArray.length=0}}if(typeof(Control)=="undefined"){Control={}}var $proc=function(a){return typeof(a)=="function"?a:function(){return a}};var $value=function(a){return typeof(a)=="function"?a():a};Object.Event={extend:function(a){a._objectEventSetup=function(b){this._observers=this._observers||{};this._observers[b]=this._observers[b]||[]};a.observe=function(d,b){if(typeof(d)=="string"&&typeof(b)!="undefined"){this._objectEventSetup(d);if(!this._observers[d].include(b)){this._observers[d].push(b)}}else{for(var c in d){this.observe(c,d[c])}}};a.stopObserving=function(c,b){this._objectEventSetup(c);if(c&&b){this._observers[c]=this._observers[c].without(b)}else{if(c){this._observers[c]=[]}else{this._observers={}}}};a.observeOnce=function(d,c){var b=function(){c.apply(this,arguments);this.stopObserving(d,b)}.bind(this);this._objectEventSetup(d);this._observers[d].push(b)};a.notify=function(g){this._objectEventSetup(g);var d=[];var b=$A(arguments).slice(1);try{for(var c=0;c<this._observers[g].length;++c){d.push(this._observers[g][c].apply(this._observers[g][c],b)||null)}}catch(f){if(f==$break){return false}else{throw f}}return d};if(a.prototype){a.prototype._objectEventSetup=a._objectEventSetup;a.prototype.observe=a.observe;a.prototype.stopObserving=a.stopObserving;a.prototype.observeOnce=a.observeOnce;a.prototype.notify=function(g){if(a.notify){var b=$A(arguments).slice(1);b.unshift(this);b.unshift(g);a.notify.apply(a,b)}this._objectEventSetup(g);var b=$A(arguments).slice(1);var d=[];try{if(this.options&&this.options[g]&&typeof(this.options[g])=="function"){d.push(this.options[g].apply(this,b)||null)}for(var c=0;c<this._observers[g].length;++c){d.push(this._observers[g][c].apply(this._observers[g][c],b)||null)}}catch(f){if(f==$break){return false}else{throw f}}return d}}}};Element.addMethods({observeOnce:function(c,d,b){var a=function(){b.apply(this,arguments);Element.stopObserving(c,d,a)};Element.observe(c,d,a)}});(function(){function a(d){var e,c,b;if(d.wheelDelta){e=d.wheelDelta/120}else{if(d.detail){e=-d.detail/3}}if(!e){return}c=Event.extend(d).target;c=Element.extend(c.nodeType===Node.TEXT_NODE?c.parentNode:c);b=c.fire("mouse:wheel",{delta:e});if(b.stopped){Event.stop(d);return false}}document.observe("mousewheel",a);document.observe("DOMMouseScroll",a)})();var IframeShim=Class.create({initialize:function(){this.element=new Element("iframe",{style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none",src:"javascript:void(0);",frameborder:0});$(document.body).insert(this.element)},hide:function(){this.element.hide();return this},show:function(){this.element.show();return this},positionUnder:function(a){var a=$(a);var c=a.cumulativeOffset();var b=a.getDimensions();this.element.setStyle({left:c[0]+"px",top:c[1]+"px",width:b.width+"px",height:b.height+"px",zIndex:a.getStyle("zIndex")-1}).show();return this},setBounds:function(a){for(prop in a){a[prop]+="px"}this.element.setStyle(a);return this},destroy:function(){if(this.element){this.element.remove()}return this}});if(typeof(Prototype)=="undefined"){throw"Control.ProgressBar requires Prototype to be loaded."}if(typeof(Object.Event)=="undefined"){throw"Control.ProgressBar requires Object.Event to be loaded."}Control.ProgressBar=Class.create({initialize:function(a,b){this.progress=0;this.executer=false;this.active=false;this.poller=false;this.container=$(a);this.containerWidth=this.container.getDimensions().width-(parseInt(this.container.getStyle("border-right-width").replace(/px/,""),10)+parseInt(this.container.getStyle("border-left-width").replace(/px/,""),10));this.progressContainer=$(document.createElement("div"));this.progressContainer.setStyle({width:this.containerWidth+"px",height:"100%",position:"absolute",top:"0px",right:"0px"});this.container.appendChild(this.progressContainer);this.options={afterChange:Prototype.emptyFunction,interval:0.25,step:1,classNames:{active:"progress_bar_active",inactive:"progress_bar_inactive"}};Object.extend(this.options,b||{});this.container.addClassName(this.options.classNames.inactive);this.active=false},setProgress:function(a){this.progress=a;this.draw();if(this.progress>=100){this.stop(false)}this.notify("afterChange",this.progress,this.active)},poll:function(c,b,a){a=a||{};var d=a.onSuccess||Prototype.emptyFunction;a.onSuccess=d.wrap(function(e,f){this.setProgress(parseInt(f.responseText,10));if(!this.active){this.poller.stop()}e(f)}).bind(this);this.active=true;this.poller=new PeriodicalExecuter(function(){var e=new Ajax.Request(c,a)}.bind(this),b||3)},start:function(){this.active=true;this.container.removeClassName(this.options.classNames.inactive);this.container.addClassName(this.options.classNames.active);this.executer=new PeriodicalExecuter(this.step.bind(this,this.options.step),this.options.interval)},stop:function(a){this.active=false;if(this.executer){this.executer.stop()}this.container.removeClassName(this.options.classNames.active);this.container.addClassName(this.options.classNames.inactive);if(typeof a==="undefined"||a===true){this.reset()}},step:function(a){this.active=true;this.setProgress(Math.min(100,this.progress+a))},reset:function(){this.active=false;this.setProgress(0)},draw:function(){this.progressContainer.setStyle({width:(this.containerWidth-Math.floor((parseInt(this.progress,10)/100)*this.containerWidth))+"px"})},notify:function(a){if(this.options[a]){return[this.options[a].apply(this.options[a],$A(arguments).slice(1))]}}});Object.Event.extend(Control.ProgressBar);if(typeof(Draggable)!="undefined"){Draggable.prototype.draw=function(k){var j=Position.cumulativeOffset(this.element);if(this.options.ghosting){var a=Position.realOffset(this.element);j[0]+=a[0]-Position.deltaX;j[1]+=a[1]-Position.deltaY}var i=this.currentDelta();j[0]-=i[0];j[1]-=i[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){j[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;j[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var c=[0,1].map(function(d){return(k[d]-j[d]-this.offset[d])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){c=this.options.snap(c[0],c[1],this)}else{if(this.options.snap instanceof Array){c=c.map(function(d,n){return Math.round(d/this.options.snap[n])*this.options.snap[n]}.bind(this))}else{c=c.map(function(d){return Math.round(d/this.options.snap)*this.options.snap}.bind(this))}}}if(this.options.onDraw){this.options.onDraw.bind(this)(c)}else{var b=this.element.style;if(this.options.constrainToViewport){var m=document.viewport.getDimensions();var f=this.element.getDimensions();var g=parseInt(this.element.getStyle("margin-top"));var l=parseInt(this.element.getStyle("margin-left"));var e=[[0-l,0-g],[(m.width-f.width)-l,(m.height-f.height)-g]];if((!this.options.constraint)||(this.options.constraint=="horizontal")){if((c[0]>=e[0][0])&&(c[0]<=e[1][0])){this.element.style.left=c[0]+"px"}else{this.element.style.left=((c[0]<e[0][0])?e[0][0]:e[1][0])+"px"}}if((!this.options.constraint)||(this.options.constraint=="vertical")){if((c[1]>=e[0][1])&&(c[1]<=e[1][1])){this.element.style.top=c[1]+"px"}else{this.element.style.top=((c[1]<=e[0][1])?e[0][1]:e[1][1])+"px"}}}else{if((!this.options.constraint)||(this.options.constraint=="horizontal")){b.left=c[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){b.top=c[1]+"px"}}if(b.visibility=="hidden"){b.visibility=""}}}}if(typeof(Prototype)=="undefined"){throw"Control.Window requires Prototype to be loaded."}if(typeof(IframeShim)=="undefined"){throw"Control.Window requires IframeShim to be loaded."}if(typeof(Object.Event)=="undefined"){throw"Control.Window requires Object.Event to be loaded."}Control.Window=Class.create({initialize:function(b,c){Control.Window.windows.push(this);this.container=false;this.isOpen=false;this.href=false;this.sourceContainer=false;this.ajaxRequest=false;this.remoteContentLoaded=false;this.numberInSequence=Control.Window.windows.length+1;this.indicator=false;this.effects={fade:false,appear:false};this.indicatorEffects={fade:false,appear:false};this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,method:"post",parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},c||{});this.indicator=this.options.indicator?$(this.options.indicator):false;if(b){if(typeof(b)=="string"&&b.match(Control.Window.uriRegex)){this.href=b}else{this.container=$(b);this.createDefaultContainer(b);if(this.container&&((this.container.readAttribute("href")&&this.container.readAttribute("href")!="")||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true){this.sourceContainer=$(this.options.hover)}else{this.sourceContainer=this.container;this.href=this.container.readAttribute("href");var a=this.href.match(/^#(.+)$/);if(a&&a[1]){this.container=$(a[1]);this.href=false}else{this.container=false}}this.sourceContainerOpenHandler=function(e){this.open(e);e.stop();return false}.bindAsEventListener(this);this.sourceContainerCloseHandler=function(e){this.close(e)}.bindAsEventListener(this);this.sourceContainerMouseMoveHandler=function(e){this.position(e)}.bindAsEventListener(this);if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.observe("click",this.sourceContainerOpenHandler)}}}}this.createDefaultContainer(b);if(this.options.insertRemoteContentAt===false){this.options.insertRemoteContentAt=this.container}var d={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};if(this.options.width){d.width=$value(this.options.width)+"px"}if(this.options.height){d.height=$value(this.options.height)+"px"}this.container.setStyle(d);if(this.options.className){this.container.addClassName(this.options.className)}this.positionHandler=this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);this.container.observe("mousedown",this.bringToFrontHandler);this.container.hide();this.closeHandler=this.close.bindAsEventListener(this);if(this.options.iframeshim){this.iFrameShim=new IframeShim();this.iFrameShim.hide()}this.applyResizable();this.applyDraggable();Event.observe(window,"resize",this.outOfBoundsPositionHandler);this.notify("afterInitialize")},open:function(c){if(this.isOpen){this.bringToFront();return false}if(this.notify("beforeOpen")===false){return false}if(this.options.closeOnClick){if(this.options.closeOnClick===true){this.closeOnClickContainer=$(document.body)}else{if(this.options.closeOnClick=="container"){this.closeOnClickContainer=this.container}else{if(this.options.closeOnClick=="overlay"){Control.Overlay.load();this.closeOnClickContainer=Control.Overlay.container}else{this.closeOnClickContainer=$(this.options.closeOnClick)}}}this.closeOnClickContainer.observe("click",this.closeHandler)}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var a=new Element("img");a.observe("load",function(d){this.getRemoteContentInsertionTarget().insert(d);this.position();if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this,a));a.writeAttribute("src",this.href)}else{if(!this.ajaxRequest){if(this.options.indicator){this.showIndicator()}this.ajaxRequest=new Ajax.Request(this.href,{method:this.options.method,parameters:this.options.parameters,onComplete:function(d){this.notify("onComplete",d);this.ajaxRequest=false}.bind(this),onSuccess:function(d){this.getRemoteContentInsertionTarget().insert(d.responseText);this.notify("onSuccess",d);if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this),onFailure:function(d){this.notify("onFailure",d);if(this.options.indicator){this.hideIndicator()}}.bind(this),onException:function(d,f){this.notify("onException",d,f);if(this.options.indicator){this.hideIndicator()}}.bind(this)})}}return true}else{if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.options.indicator){this.showIndicator()}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var b=this.container.down("iframe");b.onload=function(){this.notify("onRemoteContentLoaded");if(this.options.indicator){this.hideIndicator()}b.onload=null}.bind(this)}}this.finishOpen(c);return true},close:function(a){if(!this.isOpen||this.notify("beforeClose",a)===false){return false}if(this.options.closeOnClick){this.closeOnClickContainer.stopObserving("click",this.closeHandler)}if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.iFrameShim.hide()}this.isOpen=false;this.notify("afterClose")}.bind(this)})}else{this.container.hide();if(this.iFrameShim){this.iFrameShim.hide()}}if(this.ajaxRequest){this.ajaxRequest.transport.abort()}if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.stopObserving(window,"resize",this.positionHandler)}if(!this.options.draggable&&this.options.position=="center"){Event.stopObserving(window,"scroll",this.positionHandler)}if(this.options.indicator){this.hideIndicator()}if(!this.options.fade){this.isOpen=false;this.notify("afterClose")}return true},position:function(d){if(this.options.position=="mouse"){var g=[Event.pointerX(d),Event.pointerY(d)];this.container.setStyle({top:g[1]+$value(this.options.offsetTop)+"px",left:g[0]+$value(this.options.offsetLeft)+"px"});return}var i=this.container.getDimensions();var c=document.viewport.getDimensions();Position.prepare();var b=(Position.deltaX+Math.floor((c.width-i.width)/2));var a=(Position.deltaY+((c.height>i.height)?Math.floor((c.height-i.height)/2):0));if(this.options.position=="center"){this.container.setStyle({top:(i.height<=c.height)?((a!=null&&a>0)?a:0)+"px":0,left:(i.width<=c.width)?((b!=null&&b>0)?b:0)+"px":0})}else{if(this.options.position=="relative"){var g=this.sourceContainer.cumulativeOffset();var f=g[1]+$value(this.options.offsetTop);var e=g[0]+$value(this.options.offsetLeft);this.container.setStyle({top:(i.height<=c.height)?(this.options.constrainToViewport?Math.max(0,Math.min(c.height-(i.height),f)):f)+"px":0,left:(i.width<=c.width)?(this.options.constrainToViewport?Math.max(0,Math.min(c.width-(i.width),e)):e)+"px":0})}else{if(this.options.position.length){var f=$value(this.options.position[1])+$value(this.options.offsetTop);var e=$value(this.options.position[0])+$value(this.options.offsetLeft);this.container.setStyle({top:(i.height<=c.height)?(this.options.constrainToViewport?Math.max(0,Math.min(c.height-(i.height),f)):f)+"px":0,left:(i.width<=c.width)?(this.options.constrainToViewport?Math.max(0,Math.min(c.width-(i.width),e)):e)+"px":0})}}}if(this.iFrameShim){this.updateIFrameShimZIndex()}},ensureInBounds:function(){if(!this.isOpen){return}var a=document.viewport.getDimensions();var c=this.container.cumulativeOffset();var b=this.container.getDimensions();if(c.left+b.width>a.width){this.container.setStyle({left:(Math.max(0,a.width-b.width))+"px"})}if(c.top+b.height>a.height){this.container.setStyle({top:(Math.max(0,a.height-b.height))+"px"})}},bringToFront:function(){Control.Window.bringToFront(this);this.notify("bringToFront")},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);if(this.draggable){Draggables.removeObserver(this.container);this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.draggable.destroy()}if(this.resizable){Resizables.removeObserver(this.container);this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.resizable.destroy()}if(this.container&&!this.sourceContainer){this.container.remove()}if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler)}}if(this.iFrameShim){this.iFrameShim.destroy()}Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);Control.Window.windows=Control.Window.windows.without(this);this.notify("afterDestroy")},applyResizable:function(){if(this.options.resizable){if(typeof(Resizable)=="undefined"){throw"Control.Window requires resizable.js to be loaded."}var a=null;if(this.options.resizable===true){a=new Element("div",{className:"resizable_handle"});this.container.insert(a)}else{a=$(this.options.resziable)}this.resizable=new Resizable(this.container,{handle:a,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(b){return(document.viewport.getDimensions().height-parseInt(b.style.top||0))-(b.getHeight()-parseInt(b.style.height||0))}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(b){return(document.viewport.getDimensions().width-parseInt(b.style.left||0))-(b.getWidth()-parseInt(b.style.width||0))}:this.options.maxWidth});this.resizable.handle.observe("mousedown",this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onResize")}.bind(this)))}},applyDraggable:function(){if(this.options.draggable){if(typeof(Draggables)=="undefined"){throw"Control.Window requires dragdrop.js to be loaded."}var a=null;if(this.options.draggable===true){a=new Element("div",{className:"draggable_handle"});this.container.insert(a)}else{a=$(this.options.draggable)}this.draggable=new Draggable(this.container,{handle:a,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;document.onselectstart=function(){return false}}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart}.bind(this)});this.draggable.handle.observe("mousedown",this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onDrag")}.bind(this)))}},createDefaultContainer:function(a){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});$(document.body).insert(this.container);if(typeof(a)=="string"&&$(a)==null&&!a.match(/^#(.+)$/)&&!a.match(Control.Window.uriRegex)){this.container.update(a)}}},finishOpen:function(a){this.bringToFront();if(this.options.fade){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(this.effects.fade){this.effects.fade.cancel()}this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.isOpen=true;this.notify("afterOpen")}.bind(this)})}else{this.container.show()}this.position(a);if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.observe(window,"resize",this.positionHandler,false)}if(!this.options.draggable&&this.options.position=="center"){Event.observe(window,"scroll",this.positionHandler,false)}if(!this.options.fade){this.isOpen=true;this.notify("afterOpen")}return true},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2})}else{this.indicator.show()}}.bind(this),Control.Window.indicatorTimeout)},hideIndicator:function(){if(this.showIndicatorTimeout){window.clearTimeout(this.showIndicatorTimeout)}this.indicator.hide()},getRemoteContentInsertionTarget:function(){return typeof(this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)},updateIFrameShimZIndex:function(){if(this.iFrameShim){this.iFrameShim.positionUnder(this.container)}}});Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(a){Control.Window.windows=Control.Window.windows.without(a);Control.Window.windows.push(a);Control.Window.windows.each(function(c,d){var b=Control.Window.baseZIndex+d;c.container.setStyle({zIndex:b});if(c.isOpen){if(c.iFrameShim){c.updateIFrameShimZIndex()}}if(c.options.draggable){c.draggable.options.zindex=b}})},open:function(b,c){var a=new Control.Window(b,c);a.open();return a},initialZIndexForWindow:function(a){return Control.Window.baseZIndex+(Control.Window.windows.length-1)}});Object.Event.extend(Control.Window);Control.Window.LayoutUpdateObserver=Class.create({initialize:function(a,b){this.w=a;this.element=$(a.container);this.observer=b},onStart:Prototype.emptyFunction,onEnd:function(b,a){if(a.element==this.element&&this.iFrameShim){this.w.updateIFrameShimZIndex()}},onResize:function(b,a){if(a.element==this.element){this.observer(this.element)}},onDrag:function(b,a){if(a.element==this.element){this.observer(this.element)}}});Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded){return false}Control.Overlay.loaded=true;Control.Overlay.container=new Element("div",{id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window,"scroll",Control.Overlay.positionOverlay);Event.observe(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)}else{Control.Overlay.container.setStyle(Control.Overlay.styles)}Control.Overlay.iFrameShim=new IframeShim();Control.Overlay.iFrameShim.hide();Event.observe(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.container.hide();return true},unload:function(){if(!Control.Overlay.loaded){return false}Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.iFrameShim.destroy();Control.Overlay.container.remove();Control.Overlay.loaded=false;return true},show:function(a,b){if(Control.Overlay.notify("beforeShow")===false){return false}Control.Overlay.lastOpacity=a;Control.Overlay.positionIFrameShim();Control.Overlay.iFrameShim.show();if(b){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(Control.Overlay.effects.fade){Control.Overlay.effects.fade.cancel()}Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")},from:0,to:Control.Overlay.lastOpacity,duration:(b===true?0.75:b)/2})}else{Control.Overlay.container.setStyle({opacity:a||1});Control.Overlay.container.show();Control.Overlay.notify("afterShow")}return true},hide:function(a){if(Control.Overlay.notify("beforeHide")===false){return false}if(Control.Overlay.effects.appear){Control.Overlay.effects.appear.cancel()}Control.Overlay.iFrameShim.hide();if(a){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")},from:Control.Overlay.lastOpacity,to:0,duration:(a===true?0.75:a)/2})}else{Control.Overlay.container.hide();Control.Overlay.notify("afterHide")}return true},positionIFrameShim:function(){if(Control.Overlay.container.visible()){Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)}},positionOverlay:function(){Control.Overlay.container.setStyle({width:document.body.clientWidth+"px",height:document.body.clientHeight+"px"})}};Object.Event.extend(Control.Overlay);Control.ToolTip=Class.create(Control.Window,{initialize:function($super,a,c,b){$super(c,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),b||{}),{position:"mouse",hover:a}))}});Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});Control.Modal=Class.create(Control.Window,{initialize:function($super,a,b){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();$super(a,Object.extend(Object.clone(Control.Modal.defaultOptions),b||{}))}});Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:"overlay"},current:false,open:function(a,b){var c=new Control.Modal(a,b);c.open();return c},close:function(){if(Control.Modal.current){Control.Modal.current.close()}},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();this.overlayFinishedOpening=false;this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;this.open()}.bind(this));Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);throw $break}else{Control.Window.windows.without(this).invoke("close")}},afterOpen:function(){Control.Modal.current=this},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);Control.Modal.current=false;this.overlayFinishedOpening=false}}});Control.LightBox=Class.create(Control.Window,{initialize:function($super,a,b){this.allImagesLoaded=false;if(b.modal){var b=Object.extend(Object.clone(Control.LightBox.defaultOptions),b||{});b=Object.extend(Object.clone(Control.Modal.defaultOptions),b);b=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(b);$super(a,b)}else{$super(a,Object.extend(Object.clone(Control.LightBox.defaultOptions),b||{}))}this.hasRemoteContent=this.href&&!this.options.iframe;if(this.hasRemoteContent){this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this))}else{this.applyImageObservers()}this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))},applyImageObservers:function(){var a=this.getImages();this.numberImagesToLoad=a.length;this.numberofImagesLoaded=0;a.each(function(b){b.observe("load",function(c){++this.numberofImagesLoaded;if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;this.onAllImagesLoaded()}}.bind(this,b));b.hide()}.bind(this))},onAllImagesLoaded:function(){this.getImages().each(function(a){this.showImage(a)}.bind(this));if(this.hasRemoteContent){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}else{this.open()}},getImages:function(){return this.container.select(Control.LightBox.imageSelector)},showImage:function(a){a.show()}});Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded){throw $break}},onRemoteContentLoaded:function(){this.applyImageObservers();if(!this.allImagesLoaded){throw $break}}}});
