var EzRez={revision:'$Revision: 44458 $',REQUIRED_PROTOTYPE:'1.6.0',REQUIRED_SCRIPTACULOUS:'1.8.1',load:function(){function convertVersionString(versionString){var r=versionString.split('.');return parseInt(r[0],10)*100000+parseInt(r[1],10)*1000+parseInt(r[2],10);}
if(Prototype===undefined){throw("ezrez.js requires the Prototype JavaScript framework >= "+EzRez.REQUIRED_PROTOTYPE);}
if(convertVersionString(Prototype.Version)<convertVersionString(EzRez.REQUIRED_PROTOTYPE)){throw("ezrez.js requires the Prototype JavaScript framework >= "+EzRez.REQUIRED_PROTOTYPE);}
if(Scriptaculous===undefined){throw("ezrez.js requires the Prototype JavaScript framework >= "+EzRez.REQUIRED_SCRIPTACULOUS);}
if(convertVersionString(Scriptaculous.Version)<convertVersionString(EzRez.REQUIRED_SCRIPTACULOUS)){throw("ezrez.js requires the Prototype JavaScript framework >= "+EzRez.REQUIRED_SCRIPTACULOUS);}
var script=$A(document.getElementsByTagName("script")).find(function(s){return s.src&&(s.src.include('/js/packages/js/ezrez-')||s.src.include('/js/ezrez/js/ezrez.js'));});this.path=(script)?script.src.replace(/\/js\/packages\/js\/ezrez-[^\/]*\.js$/,'/js').replace('/js/ezrez/js/ezrez.js','/js'):'';var matches='$Revision: 44458 $'.match(/^\$Revision: (\d+) \$$/);this.revision=matches[1];}};EzRez.load();Array.prototype.intersect2=function(other){var arr=this,result=[];other.each(function(item){if(arr.indexOf(item)!==-1&&result.indexOf(item)==-1)
result.push(item);});return result;};Object.extend(Event,{KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123});Date.parseGMT=function(datestring){if(!datestring){return new Date();}
var matches=datestring.match(/(^\d{4})[-\/](\d{1,2})[-\/](\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2}) GMT$/);if(!matches){return null;}
if(!Object.isArray(matches)&&matches.length<8){return null;}
matches.shift();matches=matches.collect(function(match){return parseInt(match,10);});return Date.UTC(matches[0],matches[1]-1,matches[2]-1,matches[3],matches[4],matches[5]);};Date.parseJSON=function(datestring){if(!datestring){return new Date();}
var matches=datestring.match(/(^\d{4})[-\/](\d{1,2})[-\/](\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2}) GMT$/);if(!matches){return null;}
if(!Object.isArray(matches)&&matches.length<8){return null;}
matches.shift();matches=matches.collect(function(match){return parseInt(match,10);});return new Date(matches[0],matches[1]-1,matches[2],matches[3],matches[4],matches[5]).getTime();};Date.prototype.diffInDays=function(date2){var diff=(date2.getTime()-this.getTime())/(1000*60*60*24);return Math.ceil(diff);};Date.prototype.isBefore=function(d){return this.getTime()<d.getTime();};Date.prototype.isAfter=function(d){return this.getTime()>d.getTime();};Date.prototype.format=function(mask,utc){var token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};var dateFormat=function(date,mask,utc){var dF=dateFormat;if(arguments.length==1&&(typeof date=="string"||date instanceof String)&&!/\d/.test(date)){mask=date;date=undefined;}
date=date?new Date(date):new Date();if(isNaN(date))throw new SyntaxError("invalid date");mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true;}
var _=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});};dateFormat.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};return dateFormat(this,mask,utc);};Math.roundToDecimal=function(number,decimal){if(!Object.isNumber(number)||!Object.isNumber(decimal)||decimal<1){return number;}
decimal=Math.round(decimal);return Math.round(number*Math.pow(10,decimal))/Math.pow(10,decimal);};try{document.execCommand("BackgroundImageCache",false,true);}catch(err){}
if(EzRez===undefined){throw('ezrez-util.js requires ezrez.js');}
EzRez.Util={};EzRez.Util.MockFBConsole=function(){this.debug=function(){};this.log=function(){};this.info=function(){};this.warn=function(){};this.error=function(){};this.assert=function(){};this.dir=function(){};this.dirxml=function(){};this.group=function(){};this.groupEnd=function(){};this.time=function(){};this.timeEnd=function(){};this.count=function(){};this.trace=function(){};this.profile=function(){};this.profileEnd=function(){};};try{console.info('console.info test');console.dir({test:'console.dir test'});}catch(e){window.console=new EzRez.Util.MockFBConsole();}
EzRez.Util.Debug=new function(){var _disabled_buffer=[];var _log4js=log4javascript.getLogger();var _popUpAppender=new log4javascript.PopUpAppender();_popUpAppender.setFocusPopUp(false);_popUpAppender.setComplainAboutPopUpBlocking(false);_popUpAppender.setUseOldPopUp(true);_popUpAppender.setReopenWhenClosed(false);_log4js.addAppender(_popUpAppender);log4javascript.setEnabled(false);var _buffer=function(level,message,exception){if(log4javascript.isEnabled()){return;}
_disabled_buffer.push({lvl:level,msg:message,ex:exception});};this.trace=function(message,exception){_buffer('trace',message,exception);_log4js.trace(message,exception);};this.debug=function(message,exception){_buffer('trace',message,exception);_log4js.debug(message,exception);};this.info=function(message,exception){_buffer('info',message,exception);_log4js.info(message,exception);};this.warn=function(message,exception){_buffer('warn',message,exception);_log4js.warn(message,exception);};this.error=function(message,exception){_buffer('error',message,exception);_log4js.error(message,exception);};this.fatal=function(message,exception){_buffer('fatal',message,exception);_log4js.fatal(message,exception);};this.setEnabled=function(enabled){log4javascript.setEnabled(enabled);if(enabled&&_disabled_buffer.length>0){_disabled_buffer.each(function(log){this[log.lvl](log.msg,log.ex);},this);_disabled_buffer=[];}};this.openPopup=function(){_popUpAppender.setReopenWhenClosed(true);_log4js.debug('Debugging enabled.');_popUpAppender.setReopenWhenClosed(false);};this.closePopup=function(){_popUpAppender.close();};};EzRez.Util.Env=new function(){var _versionSearchString='';var _dataBrowser=[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}];var _dataOS=[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}];var _searchString=function(data){var dataString=false;var dataProp=false;for(var i=0;i<data.length;i++){dataString=data[i].string;dataProp=data[i].prop;_versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1){return data[i].identity;}}else if(dataProp){return data[i].identity;}}};var _searchVersion=function(dataString){var index=dataString.indexOf(_versionSearchString);if(index==-1){return;}
return parseFloat(dataString.substring(index+_versionSearchString.length+1));};var _browser=_searchString(_dataBrowser)||"An unknown browser";var _version=_searchVersion(navigator.userAgent)||_searchVersion(navigator.appVersion)||"an unknown version";var _OS=_searchString(_dataOS)||"an unknown OS";this.toString=function(){return _browser+' '+_version+' '+_OS;};this.getBrowser=function(){return _browser;};this.getVersion=function(){return _version;};this.getOS=function(){return _OS;};this.isIE6=function(){var browserVersion=_browser+_version;return browserVersion.include("Explorer6");};};EzRez.Util.RemoteLog=function(message,cfg){var config=$H({type:'information',file:'clientapp_javascript',complete:function(){}}).merge(cfg).toObject();var _url='/js_logger.cfm';var _type=config.type;var _file=config.file;var _complete=config.complete;var _status=false;var _params;var _tpl=new Template('<log>'+'<message>#{msg}</message>'+'<environment>#{env}</environment>'
+'<location>#{loc}</location>'+'</log>');var _makeParams=function(message){var log={msg:message,env:navigator.userAgent,loc:location.href};_params={log_content:_tpl.evaluate(log),log_type:_type,log_file:_file};};this.getPost=function(){return _params;};this.getStatus=function(){return _status;};this.post=function(message){_makeParams(message);var ajax=new Ajax.Request(_url,{method:'post',parameters:_params,onSuccess:function(transport){_status=(transport.responseText.strip()=='1');_complete(_status);},onException:function(transport,exception){_status=false;_complete(_status);throw exception;},onFailure:function(){_status=false;_complete(_status);}});};this.post(message);};EzRez.Util.Exception=function(cfg,e){var config=$H({name:'EzrezException',message:'',remotelog:true}).merge(cfg).toObject();var _tostring=config.name+': "'+config.message+'"';var _remotelog=config.remotelog;var _log;this.name=config.name;this.message=config.message;this.toString=function(){return _tostring;};EzRez.Util.Debug.error(_tostring,e);if(_remotelog){_log=new EzRez.Util.RemoteLog(_tostring,{type:'error'});}};EzRez.Util.Profiler=new function(){var _now=new Date();var _start=_now.getTime();var _divid='profiler_report';var _spans=$H();var _toHTML=function(){var html='<ul>';var tpl=new Template('<li class="profiler_span">'
+'<div class="span_details">(#{index}) #{name}: #{start}, #{end}, #{dur}</div>'
+'<div class="span_bar" style="left:#{left}px; width: #{width}px;"> </div>'+'</li>');_spans.each(function(span){span.value.left=span.value.start/50;span.value.width=span.value.dur/50;html+=tpl.evaluate(span.value);});html+='</ul>';return html;};var _toXML=function(){var xml='<profile_report>';var tpl=new Template('<span>'+'<index>#{index}</index>'+'<name>#{name}</name>'+'<start>#{start}</start>'
+'<end>#{end}</end>'+'<duration>#{dur}</duration>'+'</span>');_spans.each(function(span){xml+=tpl.evaluate(span.value);});xml+='</profile_report>';return xml;};var _toJSON=function(){return _spans.toJSON();};var _getDiff=function(){var ctime=new Date();return ctime.getTime()-_start;};var _logReport=function(){var report_str=_toJSON();var log=new EzRez.Util.RemoteLog(report_str,{file:'js_profile'});};var _renderReport=function(){if($(_divid)){return;}
_toHTML();var report_str='<h3>Profiler Report</h3>'+_toHTML();report_str+="<a class='log' href='#'>(Log)</a>";var div=new Element('div',{'id':_divid,'style':'display: none;'}).update(report_str);document.body.appendChild(div);};var _onF2=function(evt){if(evt.keyCode!=Event.KEY_F2){return;}
_renderReport(_divid);$$('#'+_divid+' a.log')[0].observe('click',function(evt){_logReport();Event.stop(evt);return false;});$(_divid).toggle();};var _stop=function(name){var span=_spans.get(name);if(!span){span={index:_spans.size()+1,name:name,start:0};}
span.stop=function(){};span.end=_getDiff();span.dur=span.end-span.start;_spans.set(name,span);EzRez.Util.Debug.info('#{index}) #{name}: #{start}, #{end}, #{dur}'.interpolate(span));return span;};this.getStartTime=function(){return _start;};this.start=function(name){var span={index:_spans.size()+1,name:name,start:_getDiff(),end:null,dur:null};span.stop=function(){_stop(name);};_spans.set(name,span);return span;};this.stop=function(name){return _stop(name);};this.report=function(){_renderReport();};this.logReport=function(){_logReport();};this.clearAll=function(){_spans=$H();};this.getSpan=function(name){return _spans.get(name);};this.getSpans=function(){return _spans;};this.toHTML=function(){return _toHTML();};this.toXML=function(){return _toXML();};this.toJSON=function(){return _toJSON();};document.observe('keydown',_onF2);};EzRez.Util.Cookie=new function(){var _cookie_txt='';this.create=function(name,value,hours){var expires="";var encoded=encodeURIComponent(value);var date=new Date();if(hours){date.setTime(date.getTime()+(hours*60*60*1000));expires="; expires="+date.toGMTString();}
_cookie_txt=name+"="+encoded+expires+"; path=/";document.cookie=_cookie_txt;};this.read=function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');var c;for(var i=0;i<ca.length;i++){c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)==0)return decodeURIComponent(c.substring(nameEQ.length,c.length));}
return null;};this.erase=function(name){this.create(name,"",-1);};this.eraseAll=function(){var ca=document.cookie.split(';');ca.each(function(c){var name=c.strip().split('=')[0];this.erase(name);}.bind(this));};this.getCookieText=function(){return _cookie_txt;};};EzRez.Util.Indexer=function(cfg){var config=$H({index_data:null,id_property:'',property_list:'all'}).merge(cfg).toObject();var _indexes=$H();var _index_data=config.index_data;var _id_property=config.id_property;var _property_list=config.property_list;config.index_data=null;var _createIndexes=function(){var data_item;if(_property_list==='all'){data_item=_index_data.first();var property;for(property in data_item){if(data_item[property]&&property!==_id_property){_indexes.set(property,$H());}}
return;}
_property_list.each(function(property){_indexes.set(property,$H());});};var _buildIndex=function(index,look_up,id){if(Object.isArray(look_up)){look_up.each(function(look_up_item){_buildIndex(index,look_up_item,id);});return;}
var matches=index.get(look_up);if(!matches){index.set(look_up,[id]);}else{matches.push(id);}};var _buildIndexes=function(){_index_data.each(function(data_item,data_index){data_item.master_index=data_index;_indexes.each(function(index){if(data_item[index.key]){_buildIndex(index.value,data_item[index.key],data_item);}});});};var _unload=function(){_indexes=null;_index_data=null;};this.filter=function(index_name,index_lookup){var index=_indexes.get(index_name);if(!index){return[];}
var values=index.get(index_lookup);if(!values){return[];}
return values.pluck(_id_property);};this.filterUnion=function(index_name,index_lookups){var index=_indexes.get(index_name);var results=[];var temp;if(!index){return results;}
index_lookups.each(function(lookup){temp=index.get(lookup);if(temp){results=results.concat(temp);}});results=results.sortBy(function(data_item){return data_item.master_index;});return results.pluck(_id_property);};this.filterIntersect=function(index_name,index_lookups){var index=_indexes.get(index_name);var results=null;var temp=null;if(!index){return results;}
index_lookups.each(function(lookup){temp=index.get(lookup);if(!temp){return;}
if(!results){results=temp;return;}
if([results.length,temp.length].include(0)){results=[];throw $break;}
results=results.intersect2(temp);});if(!results){return[];}
return results.pluck(_id_property);};this.getIndex=function(index_name){return _indexes.get(index_name);};this.getIndexes=function(){return _indexes;};this.deleteIndexes=function(){_indexes=$H();};this.deleteIndex=function(index_name){_indexes.unset(index_name);};this.unload=function(){_unload();};Event.observe(window,'unload',_unload);_createIndexes();_buildIndexes();};EzRez.Util.Omniture=new function(){this.transmit=function(){try{if(!s){return;}
var s_code=s.t();if(s_code){document.write(s_code);}}catch(e){}};};EzRez.Util.Locales=new function(){var _dateLocales=$H();this.setDateLocale=function(locale,info){_dateLocales.set(locale,info);};this.get=function(locale){return _dateLocales.get(locale);};};EzRez.Util.WebAnalytics={};(function(){var _beacons=$H();EzRez.Util.WebAnalytics.createWebBeacon=function(name,adapter){if(_beacons.get(name)){return _beacons.get(name);}
_beacons.set(name,new EzRez.Util.WebAnalytics.WebBeacon(name,adapter));};EzRez.Util.WebAnalytics.getWebBeacon=function(name){return _beacons.get(name);};EzRez.Util.WebAnalytics.transmitWebBeacons=function(){_beacons.each(function(item){item.value.transmit();});};})();EzRez.Util.WebAnalytics.WebBeacon=function(name,adapter){var _fields=$H();var _adapter=adapter;var _name=name;this.getName=function(){return _name;};this.setField=function(name,value){_fields.set(name,value);};this.getField=function(name){return _fields.get(name);};this.getFields=function(){return _fields;};this.getAdapter=function(){return _adapter;};this.transmit=function(){console.info(_name+'WebAnalytics Fields:');console.dir(_fields.toObject());if(!_adapter){return;}
if(_fields.size()===0){return;}
_adapter(_fields);};};EzRez.Util.WebAnalytics.Adapters={};EzRez.Util.WebAnalytics.Adapters.Omniture=function(data){try{if(!s){return;}
data.each(function(item){s[item.key]=item.value;});var s_code=s.t();if(s_code){document.write(s_code);}}catch(e){throw new EzRez.Util.Exception({name:'EzRez.Util.WebAnalytics.Adapters.Omniture',message:'Omniture s code has not been loaded.'},e);}};if(EzRez===undefined){throw('ezrez-ui.js requires ezrez.js');}
if(EzRez.Util===undefined){throw('ezrez-ui.js requires ezrez-util.js');}
EzRez.UI={};EzRez.UI.Spinner=function(spinner_id,cfg){var config=$H({hide_id:null,hide_sibling:true}).merge(cfg).toObject();var _hide_id=config.hide_id;var _hide_sibling=config.hide_sibling;var _elm=null;;var _init=function(){_elm=$(spinner_id);if(!_elm){throw({name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this control to operate.'});}
return true;};this.show=function(){if(!_init()){return;}
_elm.show();if(_hide_sibling){var sib=_elm.next();if(sib!=undefined){_elm.next().hide();}}
if($(_hide_id)){$(_hide_id).hide();}};this.hide=function(){if(!_init()){return;}
_elm.hide();if(_hide_sibling){var sib=_elm.next();if(sib!=undefined){_elm.next().show();}}
if($(_hide_id)){$(_hide_id).show();}};this.setMessage=function(msg){if(!_init()){return;}
_elm.down('p.message').update(msg);};this.getMessage=function(){if(_elm===null){return'';}
return _elm.down('p.message').innerHTML;};this.getElement=function(){return _elm;};};EzRez.UI.TabLinks=function(cfg){var rand=Math.floor(new Date().getTime()+1000*Math.random());var config=$H({name:'TabLinks_'+rand,default_tab:null,use_cookies:true,link_active_css:null,no_hide_classname:null,onshow:function(evt,tab){}}).merge(cfg).toObject();var _name=config.name;var _default_tab=config.default_tab;var _use_cookies=config.use_cookies;var _onshow=config.onshow;var _link_active_css=config.link_active_css;var _no_hide_classname=config.no_hide_classname;var _tabs=new Array();var _links=new Array();var _deactivateLinks=function(){if(_link_active_css===null){return;};_links.each(function(link){link.anchor.removeClassName(_link_active_css);});};var _activateLink=function(link){if(_link_active_css===null){return;};if(typeof(link)=='string'){link=$(link);}
link.addClassName(_link_active_css);};this.showTab=function(tab,evt){if(typeof(tab)=='string'){tab=$(tab);}
this.hideTabs();if(!tab){return;}
tab.show();_deactivateLinks();var active=_links.findAll(function(link){return(link.tab==tab);});active.each(function(link){_activateLink(link.anchor);if(_use_cookies){EzRez.Util.Cookie.create(_name,link.tab.identify());}}.bind(this));_onshow(evt,tab);};this.showLastViewedTab=function(){var tab=EzRez.Util.Cookie.read(_name);if(tab){this.showTab(tab);}else if(_default_tab!=null){this.showTab(_default_tab);}};this.hideTabs=function(){_tabs.each(function(id){var tab=$(id);if(!tab){return;}
if(tab.hasClassName(_no_hide_classname)){return;}
tab.hide();});};this.clearCookies=function(){EzRez.Util.Cookie.erase(_name);};this.createTabLink=function(tab,anchor){if(typeof(anchor)=='string'){anchor=$(anchor);}
if(typeof(tab)=='string'){tab=$(tab);}
anchor.observe('click',function(evt){this.showTab(tab,evt);Event.stop(evt);return false;}.bindAsEventListener(this));_tabs.push(tab);_links.push({anchor:anchor,tab:tab});};this.addLinks=function(links){links.each(function(link){var id=link.href.split('#')[1];var tab=$(id);if(tab===null){return;};this.createTabLink(tab,link);}.bind(this));};this.getLinks=function(){return _links;};this.getTabs=function(){return _tabs;};};EzRez.UI.PhotoSwitcher=function(target_img,photo_ul){photo_ul.childElements().each(function(child){var img=child.select('img.thumb')[0];img.observe('click',function(evt){var thumb=Event.element(evt);var medium=thumb.parentNode.select('img.medium')[0];target_img.src=medium.src;});});};EzRez.UI.Pagination=function(cfg){var config=$H({per_page:10,elements:[],active_element_classname:'',container_css:null,show_start:function(){},show_complete:function(){},listener_timeout:100}).merge(cfg).toObject();var _per_page=Object.isString(config.per_page)?parseInt(config.per_page):config.per_page;var _elements=config.elements;var _pages=[];var _page_number=1;var _overflow=false;var _container_css=config.container_css;var _prev_classname='previous';var _next_classname='next';var _page_classname='page';var _inactive_classname='inactive';var _active_element_classname=config.active_element_classname;var _valid=false;var _show_start=config.show_start;var _show_complete=config.show_complete;var _listener_timeout=config.listener_timeout;var _clicks=1;var _validateDOM=function(){if(!_container_css){return false;}
if($$(_container_css+' a').size()===0){return false;}
return true;};var _getPage=function(page_number){if(_pages.length===0){return[];}
if(!_pages[page_number-1]){_overflow=true;return _pages[0].compact();}
return _pages[page_number-1].compact();};var _adjustPagination=function(){if(!_valid){return;}
var prev_page=_page_number;var next_page=_page_number;var prev_invoke=new Element('a').addClassName;var next_invoke=new Element('a').addClassName;$$(_container_css+' a.'+_page_classname).invoke('removeClassName',_inactive_classname);$$(_container_css+' a.'+_page_classname+'[rel="'+_page_number+'"]').invoke('addClassName',_inactive_classname);if(_page_number>1){prev_page=_page_number-1;prev_invoke=new Element('a').removeClassName;}
if(_page_number<_pages.size()){next_page=_page_number+1;next_invoke=new Element('a').removeClassName;}
$$(_container_css+' a.'+_prev_classname).each(function(prev){prev.writeAttribute('rel',prev_page);prev_invoke.apply(prev,[_inactive_classname]);});$$(_container_css+' a.'+_next_classname).each(function(next){next.writeAttribute('rel',next_page);next_invoke.apply(next,[_inactive_classname]);});};var _hidePage=function(page){if(!page){page=_getPage(_page_number);}
page.each(function(element){if(!Object.isElement(element)){element=$(element);}
if(!element){return;}
element.removeClassName(_active_element_classname);element.hide();});};var _showPage=function(page_number,hide_page){_show_start();_hidePage(hide_page);page_number=(isNaN(page_number))?_page_number:page_number;page_number=(_overflow)?_page_number:page_number;_page_number=page_number;var page=_getPage(_page_number);page.each(function(element){if(!Object.isElement(element)){element=$(element);}
if(!element){return;}
element.addClassName(_active_element_classname);element.show();});_adjustPagination();_show_complete(page);};var _sortBy=function(iterator,ascending){var sorter=new EzRez.UI.Sorter({elements:_elements});_elements=sorter.sortBy(iterator,ascending);};var _makePages=function(cfg){var config=$H({data:null,sortby:null,ascending:true}).merge(cfg).toObject();if(config.data){_elements=config.data;}
if(config.sortby){_sortBy(config.sortby,config.ascending);}
var hide_page=_getPage(_page_number);_pages=_elements.eachSlice(_per_page);var size=_pages.size();if(_valid){$$(_container_css).each(function(container){var page_links=container.select('a.'+_page_classname);page_links.slice(0,size-1).invoke('show');page_links.slice(size,page_links.length).invoke('hide');});}
_showPage(1,hide_page);};var _removeListeners=function(){if(!_valid){return;}
$$(_container_css+' a').invoke('stopObserving','click',_clickListener);};var _unload=function(){_pages=null;_elements=null;_removeListeners();};var _clickListener=function(evt){EzRez.Util.Profiler.start('Pagination Click '+_clicks);var anchor=evt.target;var page_number=parseInt(anchor.readAttribute('rel'));_show_start();var listener=function(){_hidePage();page_number=(isNaN(page_number))?_page_number:page_number;page_number=(_overflow)?_page_number:page_number;_page_number=page_number;var page=_getPage(_page_number);var s2=EzRez.Util.Profiler.start('_showPage Show Elements');page.each(function(element){if(!Object.isElement(element)){element=$(element);}
if(!element){return;}
element.addClassName(_active_element_classname);element.show();});s2.stop();var s3=EzRez.Util.Profiler.start('_showPage Adjust Pagination');_adjustPagination();s3.stop();var s4=EzRez.Util.Profiler.start('_showPage Show Complete');_show_complete(page);s4.stop();EzRez.Util.Profiler.stop('Pagination Click '+_clicks);};if(_listener_timeout>0){setTimeout(listener,_listener_timeout);}else{listener();}
_clicks++;Event.stop(evt);return false;};this.makePages=function(cfg){_makePages(cfg);};this.showPage=function(page_number){_showPage(page_number);};this.hidePage=function(){_hidePage();};this.showPageByIndex=function(index){var page=Math.ceil((index+1)/_per_page);this.showPage(page);};this.sortBy=function(iterator,ascending){_sortBy(iterator,ascending);_makePages();};this.getPage=function(page_number){return _getPage(page_number);};this.getPages=function(){return _pages;};this.getElements=function(){return _elements;};this.getPageNumber=function(){return _page_number;};this.getCurrentPage=function(){return _getPage(_page_number);};this.unload=function(){_unload();};this.applyListeners=function(){if(!_valid){return;}
$$(_container_css+' a').invoke('observe','click',_clickListener);Event.observe(window,'unload',_unload);};this.removeListeners=function(){_removeListeners();};_valid=_validateDOM();this.makePages();this.applyListeners();};EzRez.UI.LightView=function(cfg){var config=$H({class_name:null,rel:null,options:{topclose:false,width:400,height:400},'lightview:opened':null,'lightview:hidden':null}).merge(cfg).toObject();var _class_name=config.class_name;var _rel=config.rel;var _options=config.options;var _lv_opened=config['lightview:opened'];var _lv_hidden=config['lightview:hidden'];var _show_opts={};var _show=function(elm_id,controller){if(!Lightview){throw new EzRez.Util.Exception({message:'EzRez.UI.LightView requires lightview.js.'});}
if(!$('lightview')){throw new EzRez.Util.Exception({message:'Lightview element is missing.'});}
if(!$(elm_id)){throw new EzRez.Util.Exception({message:'Missing anchor element for EzRez.UI.LightView.'});}
var lv=$('lightview');var elm=$(elm_id);var title=elm.readAttribute('title')||'::';title=title.split('::');if(!Lightview.started){Lightview.start();}
if(_class_name){var lv_style;var lv_class_child;if(!$('lightview_style')){lv_style=new Element('div',{'id':'lightview_style','style':'display:none;'});lv.insert(lv_style,{position:'after'});}else{lv_style=$('lightview_style');}
if(lv_style.select(_class_name).size()==0){lv_class_child=new Element('div',{'class':_class_name});lv_style.insert(lv_class_child);}else{lv_class_child=lv_style.select(_class_name)[0];}
var h_style=lv_class_child.getStyle('height');var w_style=lv_class_child.getStyle('width');if(h_style!==undefined){var h=parseInt(h_style.replace('px',''));if(!isNaN(h)){_options.height=h;}}
if(w_style!==undefined){var w=parseInt(w_style.replace('px',''));if(!isNaN(w)){_options.width=w;}}}
var _open=function(evt){if(_lv_opened!==null){_lv_opened(evt,controller);}};var _hide=function(evt){if(_lv_hidden!==null){_lv_hidden(evt,controller);document.stopObserving('lightview:hidden',_hide);}
if(_lv_opened!==null){document.stopObserving('lightview:opened',_open);}};if(_lv_opened!==null){document.observe('lightview:opened',_open);}
if(_lv_opened!==null||_lv_hidden!=null){document.observe('lightview:hidden',_hide);}
_show_opts={href:elm.href,rel:_rel,title:title[0],caption:title[1],options:_options};Lightview.show(_show_opts);};var _hide=function(){Lightview.hide();};this.getShowOptions=function(){return _show_opts;};this.setEventsListeners=function(events){var config=$H({'lightview:opened':null,'lightview:hidden':null}).merge(events).toObject();_lv_opened=config['lightview:opened'];_lv_hidden=config['lightview:hidden'];};this.show=function(elm_id){_show(elm_id);};this.hide=function(){_hide();};this.domAction=function(evt,controller){_show(evt.target,controller);Event.stop(evt);return false;};};EzRez.UI.DualSliderFilter=function(cfg){var _config=$H({id:null,ticks:null,update:function(){}}).merge(cfg).toObject();if(!(_config.ticks||_config.id)){throw('Missing parameters for EzRez.UI.DualSliderFilter.');}
var _dualSlider=null;var _that=this;var _elms=new EzRez.UI.DOMCache({rootNode:'#'+_config.id,nodes:{slider:function(rootNode){return rootNode.down('div.filterSlider');},highlight:function(rootNode){return rootNode.down('span.highlight');},minValue:function(rootNode){return rootNode.down('div.filterValues span.min');},maxValue:function(rootNode){return rootNode.down('div.filterValues span.max');},minThumb:function(rootNode){return rootNode.down('div.thumbMin');},maxThumb:function(rootNode){return rootNode.down('div.thumbMax');},inputMinValue:function(rootNode){return rootNode.down('input.min');},inputMaxValue:function(rootNode){return rootNode.down('input.max');}}});if(!_elms.cache()){throw('Invalid DOM nodes ('+_elms.getInvalidNodes().join(',')+') for '+_config.id+' EzRez.UI.DualSliderFilter.');}
var _range=_elms.slider.getWidth()-_elms.minThumb.getWidth();var _pixelsPerTick=_range/_config.ticks.length;try{_dualSlider=YAHOO.widget.Slider.getHorizDualSlider(_elms.slider,_elms.minThumb,_elms.maxThumb,_range);_dualSlider.animate=false;}catch(e){throw('EzRez.UI.DualSliderFilter requires YAHOO.widget.Slider.');}
_dualSlider.animate=false;var _fireUpdateEvent=function(min,max){if(!_elms.rootNode){return;}
_elms.rootNode.fire('DualSliderFilter:update',{min:min,max:max,instance:_that});};var _getMinIndexValue=function(){var minPixelVal=_dualSlider.minVal;var minIndexVal=Math.floor(minPixelVal/_pixelsPerTick-1);if(minIndexVal<0){return 0;}
return minIndexVal;};var _getMaxIndexValue=function(){var maxPixelVal=_dualSlider.maxVal;var maxIndexVal=Math.ceil(maxPixelVal/_pixelsPerTick-1);if(maxIndexVal>_config.ticks.length-1){return _config.ticks.length-1;}
return maxIndexVal;};var _updateSlider=function(){var minPixelVal=_dualSlider.minVal;var maxPixelVal=_dualSlider.maxVal;if(minPixelVal>=0&&minPixelVal<=_range){_elms.highlight.setStyle({left:(minPixelVal+4)+'px'});}
if(maxPixelVal>=0&&maxPixelVal<=_range){_elms.highlight.setStyle({width:(maxPixelVal-minPixelVal)+'px'});}
var minIndexVal=_getMinIndexValue();var maxIndexVal=_getMaxIndexValue();if(_config.ticks[minIndexVal]!==undefined){_elms.minValue.innerHTML=_config.ticks[minIndexVal]._label;_elms.inputMinValue.value=_config.ticks[minIndexVal]._value;}
if(_config.ticks[maxIndexVal]!==undefined){_elms.maxValue.innerHTML=_config.ticks[maxIndexVal]._label;_elms.inputMaxValue.value=_config.ticks[maxIndexVal]._value;}};var _getSliderValues=function(){var minIndexVal=_getMinIndexValue();var maxIndexVal=_getMaxIndexValue();var minTick=_config.ticks[0];var maxTick=_config.ticks[_config.ticks.length-1];if(_config.ticks[minIndexVal]){minTick=_config.ticks[minIndexVal];}
if(_config.ticks[maxIndexVal]){maxTick=_config.ticks[maxIndexVal];}
return{min:{label:minTick._label,value:minTick._value},max:{label:maxTick._label,value:maxTick._value}};};var _updateListener=function(){var values=_getSliderValues();_config.update(values.min,values.max);_fireUpdateEvent(values.min,values.max);};this.getSliderValues=function(){return _getSliderValues();};this.update=function(){_updateListener();};this.reset=function(){_dualSlider.setValues(0,_range,true,true,false);};this.applyListeners=function(){_dualSlider.subscribe('change',_updateSlider);_dualSlider.subscribe('ready',_updateSlider);_dualSlider.subscribe('slideEnd',_updateListener,this,true);};this.removeListeners=function(){_dualSlider.unsubscribe('change',_updateSlider);_dualSlider.unsubscribe('ready',_updateSlider);_dualSlider.unsubscribe('slideEnd',_updateListener);};this.getDualSlider=function(){return _dualSlider;};};EzRez.UI.CheckboxFilter=function(cfg){var config=$H({update:null,form_id:null,checkbox_name:null,checked_by_default:true,show_all_id:null}).merge(cfg).toObject();var _update=config.update;var _form_id=config.form_id;var _checkbox_name=config.checkbox_name;var _checked_by_default=config.checked_by_default;var _show_all_id=config.show_all_id;var _updateCount=0;var _isValid=false;var _valid=function(){if(!$(_form_id)){throw new EzRez.Util.Exception({message:'Missing '+_form_id+' form element for EzRez.UI.CheckboxFilter.'});}
if($(_form_id).getInputs('checkbox',_checkbox_name).size()===0){throw new EzRez.Util.Exception({message:'Missing '+_checkbox_name+' checkbox elements for EzRez.UI.CheckboxFilter.'});}
return true;};var _getCheckedValues=function(){var checked=$$('#'+_form_id+' input[name="'+_checkbox_name+'"]:checked');return checked.pluck('value');};var _updater=function(){if(_update===null){return;}
_update(_getCheckedValues(),_checkbox_name);_updateCount++;};var _checkboxListener=function(){if($(_show_all_id)){$(_show_all_id).checked=false;}
_updater();};var _showAllListener=function(){$(_form_id).getInputs('checkbox',_checkbox_name).each(function(item){item.checked=_checked_by_default;});_updater();};this.update=function(){_updater();};this.getCheckboxName=function(){return _checkbox_name;};this.getCheckedValues=function(){return _getCheckedValues();};this.reset=function(){$(_form_id).getInputs('checkbox',_checkbox_name).each(function(item){item.checked=_checked_by_default;});if($(_show_all_id)){$(_show_all_id).checked=!_checked_by_default;}};this.applyListeners=function(){if(!_isValid){return;}
$(_form_id).getInputs('checkbox',_checkbox_name).each(function(item){item.observe('click',_checkboxListener);});if($(_show_all_id)){$(_show_all_id).observe('click',_showAllListener);}};this.removeListeners=function(){if(!_isValid){return;}
$(_form_id).getInputs('checkbox',_checkbox_name).each(function(item){item.stopObserving('click',_checkboxListener);});if($(_show_all_id)){$(_show_all_id).stopObserving('click',_showAllListener);}};_isValid=_valid();};EzRez.UI.IconFilter=function(cfg){var config=$H({update:null,form_id:null,active_classname:'active',hover_classname:'hover',checkbox_name:null,checked_by_default:true,show_all_id:null}).merge(cfg).toObject();var _update=config.update;var _form_id=config.form_id;var _checkbox_name=config.checkbox_name;var _checked_by_default=config.checked_by_default;var _show_all_id=config.show_all_id;var _active_classname=config.active_classname;var _hover_classname=config.hover_classname;if($(_form_id)===null){throw('Missing '+_form_id+' form element for EzRez.UI.IconFilter.');}
if($(_form_id).getInputs('checkbox',_checkbox_name).size()===0){throw('Missing '+_checkbox_name+' checkbox elements for EzRez.UI.IconFilter.');}
if($(_form_id).select('li').size()===0){throw('Missing li elements for EzRez.UI.IconFilter.');}
var _getCheckedValues=function(){var checked=$$('#'+_form_id+' input[name="'+_checkbox_name+'"]:checked');return checked.pluck('value');};var _updater=function(){if(_update===null){return;}
_update(_getCheckedValues(),_checkbox_name);};var _liClickListener=function(evt){var item=evt.target;var checkbox=item.down('input');checkbox.checked=!checkbox.checked;item.toggleClassName(_active_classname);if(item.hasClassName(_active_classname)){item.addClassName(_hover_classname);}else{item.removeClassName(_hover_classname);}
if($(_show_all_id)){$(_show_all_id).checked=false;}
_updater();};var _liMouseoverListener=function(evt){evt.target.addClassName(_hover_classname);};var _liMouseoutListener=function(evt){var item=evt.target;if(item.hasClassName(_active_classname)){return;}
item.removeClassName(_hover_classname);};var _showAllListener=function(){$(_form_id).getInputs('checkbox',_checkbox_name).each(function(item){item.checked=_checked_by_default;});_updater();};this.update=function(){_updater();};this.getCheckboxName=function(){return _checkbox_name;};this.getCheckedValues=function(){return _getCheckedValues();};this.reset=function(){$(_form_id).select('li').each(function(item){item.removeClassName(_active_classname);item.removeClassName(_hover_classname);});$(_form_id).getInputs('checkbox',_checkbox_name).each(function(item){item.checked=_checked_by_default;});if($(_show_all_id)){$(_show_all_id).checked=!_checked_by_default;}};this.applyListeners=function(){$(_form_id).select('li').each(function(item){item.observe('click',_liClickListener);item.observe('mouseover',_liMouseoverListener);item.observe('mouseout',_liMouseoutListener);});if($(_show_all_id)){$(_show_all_id).observe('click',_showAllListener);}};this.removeListeners=function(){$(_form_id).select('li').each(function(item){item.stopObserving('click',_liClickListener);item.stopObserving('mouseover',_liMouseoverListener);item.stopObserving('mouseout',_liMouseoutListener);});if($(_show_all_id)){$(_show_all_id).stopObserving('click',_showAllListener);}};};EzRez.UI.WaitingOverlay=function(cfg){var config=$H({name:null,header:'',body:''}).merge(cfg).toObject();var _name='#'+config.name;var _header=config.header;var _body=config.body;var _show_count=1;var _hide_count=1;var _waiting=new YAHOO.widget.Panel(config.name,{width:"240px",close:false,draggable:false,zindex:4,modal:true,visible:false,underlay:'none'});var _isRendered=false;var _isVisible=false;var _center=function(){var offset=document.viewport.getScrollOffsets();var x=350;var y=offset.top+350;var wait_elm=$$(_name+'_c.yui-panel-container')[0];var style='';if(!wait_elm){return;}
if(!_waiting.style_top){style=wait_elm.getStyle('top');if(style){_waiting.style_top=parseInt(style.replace('px',''));}}
if(!_waiting.style_left){style=wait_elm.getStyle('left');if(style){_waiting.style_left=parseInt(style.replace('px',''));}}
if(!isNaN(_waiting.style_top)){y=offset.top+_waiting.style_top;}
if(!isNaN(_waiting.style_left)){x=_waiting.style_left;}
_waiting.moveTo(x,y);};var _render=function(){if(_isRendered){return;};_waiting.setHeader(_header);_waiting.setBody(_body);_isRendered=_waiting.render(document.body);};this.setContent=function(header,body){_header=header;_body=body;_isRendered=false;};this.hide=function(){if(_isVisible){_waiting.hide();_isVisible=false;}
_hide_count++;};this.show=function(){if(_isVisible){return;}
_render();if(!_isVisible){_center();_waiting.show();_isVisible=true;}
_show_count++;};this.getPanel=function(){return _waiting;};};EzRez.UI.Dialog=function(cfg){var _config=$H({name:null,position:'center',headerSelector:'div.header',bodySelector:'div.body',headerContent:null,bodyContent:null,className:''}).merge(cfg).toObject();var _show_count=1;var _hide_count=1;var _dialog=null;var _container=null;var _valid=false;var _overlapping=$$("select","embed","object");var _applyListeners;var _removeListeners;var _init=function(){if(_valid){return true;}
_dialog=$(_config.name);_dialog.addClassName(_config.className);_container=_dialog.down('div.container');_valid=(_dialog);if(!_valid){throw new EzRez.Util.Exception({message:'Missing #'+_config.name+' element for EzRez.UI.Dialog.'});}
if(_config.headerContent){_container.down(_config.headerSelector).update(_config.headerContent);}
if(_config.bodyContent){_container.down(_config.bodySelector).update(_config.bodyContent);}
return _valid;};var _position=function(position){if(!_init()){return;}
var dimensions={viewport:Object.extend(document.viewport.getScrollOffsets(),document.viewport.getDimensions()),body:$(document.body).getDimensions(),container:_container.getDimensions()};dimensions.container.top=Math.floor(dimensions.viewport.top+dimensions.viewport.height/2-dimensions.container.height/2);dimensions.container.left=Math.floor(dimensions.viewport.left+dimensions.viewport.width/2-dimensions.container.width/2);_dialog.setStyle({height:dimensions.body.height+'px',width:dimensions.viewport.width+'px'});var positions={center:function(){_container.addClassName('center');_container.setStyle({top:dimensions.container.top+'px',left:dimensions.container.left+'px'});},topleft:function(){_container.addClassName('topleft');},topright:function(){_container.addClassName('topright');}};_container.removeClassName('center');_container.removeClassName('topleft');_container.removeClassName('topright');var pos=positions[position];if(!pos){pos=positions.center;}
pos();};var _windowResizeListener=function(){_position(_config.position);};_applyListeners=function(){Event.observe(window,'resize',_windowResizeListener);};_removeListeners=function(){Event.stopObserving(window,'resize',_windowResizeListener);};this.show=function(){if(!_init()){return;}
_dialog.show();_position(_config.position);_overlapping.invoke('setStyle','visibility: hidden');_applyListeners();_show_count++;};this.hide=function(){if(!_init()){return;}
_overlapping.invoke('setStyle','visibility: visible');_dialog.hide();_removeListeners();_hide_count++;};this.applyListeners=function(){_applyListeners();};this.removeListeners=function(){_removeListeners();};};(function(){var _isOpened=false;var _elms={lightbox:null};var _valid=false;var _initialized=false;EzRez.UI.LightBox=function(cfg){var _config=$H({className:'',type:'iframe',opened:function(){},hidden:function(){}}).merge(cfg).toObject();var _show_count=1;var _hide_count=1;var _applyListeners;var _removeListeners;var _css={};var _frame=null;var _getElements=function(){if(_valid){return;}
var lightbox=$('lightbox');_elms={lightbox:lightbox,container:lightbox.down('div.container'),loading:lightbox.down('div.loading'),effect:lightbox.down('div.container div.effect_container'),header:lightbox.down('div.container div.header'),title:lightbox.down('div.container div.header h3.title'),caption:lightbox.down('div.container div.header p.caption'),main:lightbox.down('div.container div.main'),content:lightbox.down('div.container div.main div.content'),footer:lightbox.down('div.container div.footer'),close:lightbox.down('div.container div.header a.close_button'),overlapping:$$('select','embed','object')};};var _init=function(){if(_initialized){return _valid;}
if(_valid){return true;}
_getElements();var elms=Object.values(_elms);_valid=!(elms.include(null)||elms.include(undefined));return _valid;};var _centerContainer=function(){if(!_css.container){_css.container=_elms.container.getDimensions();}
if(!_css.main){_css.main=_elms.main.getDimensions();}
if(!_css.loading){_css.loading=_elms.loading.getDimensions();}
if(!_css.hspace){_css.hspace=2*parseInt(_elms.main.getStyle('padding-left').replace('px',''));}
if(!_css.vspace){_css.vspace=_elms.header.getHeight()+_elms.footer.getHeight();}
var dimensions={container:{style:'top:#{top}px; left:#{left}px; width:#{width}px; height:#{height}px;'},main:{style:''}};dimensions.viewport=Object.extend(document.viewport.getScrollOffsets(),document.viewport.getDimensions());dimensions.viewport.margin=10;dimensions.container.height=_css.main.height+_css.vspace;dimensions.container.width=_css.main.width;if(dimensions.container.height>dimensions.viewport.height){dimensions.container.height=dimensions.viewport.height;}
dimensions.container.top=Math.floor(dimensions.viewport.top+dimensions.viewport.height/2-dimensions.container.height/2);dimensions.container.left=Math.floor(dimensions.viewport.left+dimensions.viewport.width/2-dimensions.container.width/2);if(dimensions.viewport.width-dimensions.container.width<2*dimensions.viewport.margin){dimensions.container.width=dimensions.viewport.width-2*dimensions.viewport.margin;dimensions.container.left=dimensions.viewport.margin;dimensions.main.width=dimensions.container.width-_css.hspace;dimensions.main.style+='width:#{width}px !important;';}
if(dimensions.viewport.height-dimensions.container.height<2*dimensions.viewport.margin){dimensions.container.height=dimensions.viewport.height-2*dimensions.viewport.margin;dimensions.container.top+=dimensions.viewport.margin;dimensions.main.height=dimensions.container.height-_css.vspace;dimensions.main.style+='height:#{height}px !important;';}
if(dimensions.container.top<dimensions.viewport.margin){dimensions.container.top=dimensions.viewport.margin;}
if(dimensions.container.left<dimensions.viewport.margin){dimensions.container.left=dimensions.viewport.margin;}
_elms.container.writeAttribute('style',dimensions.container.style.interpolate(dimensions.container));_elms.main.writeAttribute('style',dimensions.main.style.interpolate(dimensions.main));_elms.loading.setStyle({top:Math.floor(dimensions.viewport.top+dimensions.viewport.height/2-_css.loading.height/2)+'px',left:Math.floor(dimensions.viewport.left+dimensions.viewport.width/2-_css.loading.width/2)+'px'});};var _sizeOverlay=function(){if(!_valid){return;}
var w=document.viewport.getWidth();var h=$(document.body).getHeight();_elms.lightbox.setStyle({height:h+'px',width:w+'px'});};var _showContent=function(anchor){var content;var title=anchor.getAttribute('title')||'::';title=title.split('::');if(title.length>=1){_elms.title.innerHTML=title[0];}
if(title.length>=2){_elms.caption.innerHTML=title[1];}
switch(_config.type){case'iframe':content=new Element('iframe',{'class':'frame',src:$(anchor).href,frameBorder:0,hspace:0,scrolling:'auto'});_frame=content;break;case'inline':var href=anchor.href.split('#');if(href.length>=2){var inline=$(href[1]);content=new Element('div',{'class':'inline'}).update(inline.innerHTML);}
break;case'flash':var tpl="<object class='flash' pluginspage='http://www.adobe.com/go/getflashplayer' wmode='transparent' quality='high' type='application/x-shockwave-flash' data='#{src}'>"
+"<param value='#{src}' name='movie'/>"+"<param value='true' name='allowFullScreen'/>"
+"</object>";content=tpl.interpolate({src:anchor.href});break;}
if(!content){return;}
setTimeout(function(){_elms.content.insert(content);_config.opened();},500);};var _onAfterHide=function(){if(!_valid){return;}
if(_frame){_frame=null;}
_elms.content.innerHTML='';_elms.loading.show();_removeListeners();setTimeout(_config.hidden,100);_isOpened=false;_hide_count++;};var _hide=function(){if(!_valid){return;}
_elms.overlapping.invoke('setStyle','visibility: visible');_elms.lightbox.hide();_elms.main.removeClassName(_config.className);if(_frame){_frame.src="javascript:false";setTimeout(_onAfterHide,10);}else{_onAfterHide();}};var _show=function(anchor){if(!_valid){return;}
if(_isOpened){_hide();};_sizeOverlay();_elms.overlapping.invoke('setStyle','visibility: hidden');_elms.lightbox.show();_elms.main.addClassName(_config.className);_centerContainer();_elms.container.hide();Effect.Appear(_elms.container,{duration:0.5});_showContent(anchor);_applyListeners();_isOpened=true;_show_count++;};var _closeClickListener=function(evt){setTimeout(_hide,100);Event.stop(evt);return false;};var _windowResizeListener=function(evt){_centerContainer();_sizeOverlay();};_applyListeners=function(){if(!_valid){return;}
_elms.close.observe('click',_closeClickListener);Event.observe(window,'resize',_windowResizeListener);};_removeListeners=function(){if(!_valid){return;}
_elms.close.stopObserving('click',_closeClickListener);Event.stopObserving(window,'resize',_windowResizeListener);};this.show=function(anchor){_show(anchor);};this.hide=function(){_hide();};this.applyListeners=function(){_applyListeners();};this.removeListeners=function(){_removeListeners();};_init();};})();EzRez.UI.Expander=function(cfg){var config=$H({outer_classnames:['outer_container'],inner_classname:'inner_container'}).merge(cfg).toObject();var _div_show_classname='div.show_more';var _a_open_classname='a.open';var _a_close_classname='a.close';var _p_first_classname='first';var _p_last_classname='last';var _opened_classname='opened';var _inner_classname=config.inner_classname;var _outer_classnames=config.outer_classnames;if(_outer_classnames.size()===0){throw('EzRez.UI.ShowMore missing required classnames');}
if($$(_outer_classnames[0]).size()===0){throw('EzRez.UI.ShowMore missing required classnames');}
if($$(_outer_classnames[0]+' '+_inner_classname).size()===0){throw('EzRez.UI.ShowMore missing required classnames');}
var _open=function(elm_id){var elm=$(elm_id);_outer_classnames.each(function(classname){var container=elm.up(classname);if(container!==undefined){container.addClassName(_opened_classname);}});elm.hide();elm.adjacent(_a_close_classname).each(function(sib){sib.show();});};var _close=function(elm_id){var elm=$(elm_id);_outer_classnames.each(function(classname){var container=elm.up(classname);if(container!==undefined){container.removeClassName(_opened_classname);}});elm.hide();elm.adjacent(_a_open_classname).each(function(sib){sib.show();});};var _openListener=function(evt){_open(evt.target);Event.stop(evt);return false;};var _closeListener=function(evt){_close(evt.target);Event.stop(evt);return false;};this.open=function(elm_id){_open(elm_id);};this.close=function(elm_id){_close(elm_id);};this.applyListeners=function(){var open_selector=_outer_classnames.reverse(false).concat([_div_show_classname,_a_open_classname]).join(' ');var close_selector=_outer_classnames.reverse(false).concat([_div_show_classname,_a_close_classname]).join(' ');EzRez.Util.Profiler.start('EzRez.UI.Expander applyListeners '+open_selector);$$(open_selector).each(function(anchor){anchor.observe('click',_openListener);});EzRez.Util.Profiler.stop('EzRez.UI.Expander applyListeners '+open_selector);EzRez.Util.Profiler.start('EzRez.UI.Expander applyListeners '+close_selector);$$(close_selector).each(function(anchor){anchor.observe('click',_closeListener);});EzRez.Util.Profiler.stop('EzRez.UI.Expander applyListeners '+close_selector);};this.removeListeners=function(){var open_selector=_outer_classnames.reverse(false).concat([_div_show_classname,_a_open_classname]).join(' ');var close_selector=_outer_classnames.reverse(false).concat([_div_show_classname,_a_close_classname]).join(' ');$$(open_selector).each(function(anchor){anchor.stopObserving('click',_openListener);});$$(close_selector).each(function(anchor){anchor.stopObserving('click',_closeListener);});};this.hideUnnecessaryLinks=function(containers){containers=(!containers||containers.length===0)?$$(_outer_classnames.last()+' '+_outer_classnames.first()):containers;containers.each(function(container){var child=container.down(_inner_classname);if(!child){return;}
var paragraphs=child.select('p');var visible=paragraphs.findAll(function(p){var empty=(p.innerHTML.strip().length==0);if(empty){p.hide();return false;}
return p.visible();});var first=visible.first();if(first){first.addClassName(_p_first_classname);}
var last=visible.last();if(last){last.addClassName(_p_last_classname);}
var show_link=container.down(_div_show_classname+' a');if(child.getHeight()<=container.getHeight()){show_link.hide();}else{show_link.show();}});};};EzRez.UI.Sorter=function(cfg){var config=$H({elements:null}).merge(cfg).toObject();var _elements=config.elements;var _unload=function(){_elements=null;};this.sortBy=function(iterator,ascending){ascending=(ascending===undefined)?true:ascending;_elements=_elements.sortBy(function(element){if(Object.isElement(element)){element=element.identify();}
return iterator(element);});if(!ascending){_elements.reverse();}
var last=_elements.first();if(!Object.isElement(last)){last=$(last);}
_elements.slice(1,_elements.length).each(function(element){if(!Object.isElement(element)){element=$(element);}
last.insert({after:element});last=element;});last=null;return _elements;};this.setElements=function(elements){_elements=elements;};this.getElements=function(){return _elements;};this.unload=function(){_unload();};};EzRez.UI.MultiAutoComplete=function(cfg){var config=$H({name:null,maxInputs:0}).merge(cfg).toObject();var _name=config.name;if(!$(_name)||!$(_name+'_auto')){throw new EzRez.Util.Exception({message:'Missing element for EzRez.UI.AutoComplete.'});}
var _fblist=new FacebookList(_name,_name+'_auto',{maxInputs:config.maxInputs,startinput:false,extrainputs:false});this.loadAirportsFromSelect=function(select_elm){if(!select_elm){select_elm=$(_name+'_select');}
if(!select_elm){throw new EzRez.Util.Exception({message:'Missing SELECT input for EzRez.UI.AutoComplete.'});}
var airports=[];select_elm.select('option').each(function(option){var airport={caption:option.innerHTML,value:option.value,selected:false};if(option.readAttribute('selected')){_fblist.add(airport);airport.selected=true;}
_fblist.autoFeed(airport);airports.push(airport);});return airports;};function processAirportItem(item){if(item.selected){_fblist.add(item);}
_fblist.autoFeed(item);}
this.loadAirportsFromArray=function(airports){var _tmpArray=airports.concat([]);var slice=function(){var item=_tmpArray.shift();processAirportItem(item);if(_tmpArray.length>0){setTimeout(slice,100);}};setTimeout(slice,100);};this.getFacebookList=function(){return _fblist;};this.update=function(){_fblist.update();};this.getValues=function(){_fblist.update();return $F(_name);};};EzRez.UI.DOMCache=function(cfg){var _config=$H({rootNode:'',nodes:{}}).merge(cfg).toObject();var _nodes=$H();var _isValidHmtl=false;var _rootNode=null;var _invalidNodes=[];var _that=this;var _add=function(name,selector){_nodes.set(name,{name:name,selector:selector});};var _init=function(){$H(_config.nodes).each(function(node){_add(node.key,node.value);});};var _cacheNode=function(node){try{var elm=Object.isElement(node.selector)?node.selector:node.selector(_rootNode);if(!elm){_invalidNodes.push(node.name);_isValidHmtl=false;}
node.elm=elm;_that[node.name]=node.elm;}catch(e){_invalidNodes.push(node.name);_isValidHmtl=false;}
return node;};var _cacheNodes=function(){try{_rootNode=$$(_config.rootNode).first();_that["rootNode"]=_rootNode;_isValidHmtl=Object.isElement(_rootNode);_nodes.each(function(node){_cacheNode(node.value);});return _isValidHmtl;}catch(e){_invalidNodes.push('rootNode: '+_config.rootNode);_isValidHmtl=false;return false;}};this.rootNode=_rootNode;this.add=function(name,selector){_add(name,selector);};this.get=function(name){return _nodes.get(name).elm;};this.refresh=function(name){var node=_nodes.get(name);_cacheNode(node);return node.elm;};this.cache=function(){return _cacheNodes();};this.clearAll=function(){_rootNode=null;_nodes.each(function(node){node.value.elm=null;});};this.isValidHtml=function(){return _isValidHmtl;};this.getInvalidNodes=function(){return _invalidNodes;};_init();};(function(){var _localeCodes=['af-ZA','ar-AE','ar-BH','ar-DZ','ar-EG','ar-IQ','ar-JO','ar-KW','ar-LB','ar-LY','ar-MA','ar-OM','ar-QA','ar-SA','ar-SY','ar-TN','ar-YE','az-Cyrl-AZ','az-Latn-AZ','be-BY','bg-BG','bs-Latn-BA','ca-ES','cs-CZ','cy-GB','da-DK','de-AT','de-CH','de-DE','de-LI','de-LU','dv-MV','el-GR','en-029','en-AU','en-BZ','en-CA','en-GB','en-IE','en-JM','en-NZ','en-PH','en-TT','en-US','en-ZA','en-ZW','es-AR','es-BO','es-CL','es-CO','es-CR','es-DO','es-EC','es-ES','es-GT','es-HN','es-MX','es-NI','es-PA','es-PE','es-PR','es-PY','es-SV','es-UY','es-VE','et-EE','eu-ES','fa-IR','fi-FI','fo-FO','fr-BE','fr-CA','fr-CH','fr-FR','fr-LU','fr-MC','gl-ES','gu-IN','he-IL','hi-IN','hr-BA','hr-HR','hu-HU','hy-AM','id-ID','is-IS','it-CH','it-IT','ja-JP','ka-GE','kk-KZ','kn-IN','kok-IN','ko-KR','ky-KG','lt-LT','lv-LV','mi-NZ','mk-MK','mn-MN','mr-IN','ms-BN','ms-MY','mt-MT','nb-NO','nl-BE','nl-NL','nn-NO','ns-ZA','pa-IN','pl-PL','pt-BR','pt-PT','quz-BO','quz-EC','quz-PE','ro-RO','ru-RU','sa-IN','se-FI','se-NO','se-SE','sk-SK','sl-SI','sma-NO','sma-SE','smj-NO','smj-SE','smn-FI','sms-FI','sq-AL','sr-Cyrl-BA','sr-Cyrl-CS','sr-Latn-BA','sr-Latn-CS','sv-FI','sv-SE','sw-KE','syr-SY','ta-IN','te-IN','th-TH','tn-ZA','tr-TR','tt-RU','uk-UA','ur-PK','uz-Cyrl-UZ','uz-Latn-UZ','vi-VN','xh-ZA','zh-CN','zh-HK','zh-MO','zh-SG','zh-TW','zu-ZA'];var _locales=$H();var _yuiDateFormat='mm/dd/yyyy';var _yuiPageDateFormat='mm/yyyy';var _scriptPath=EzRez.path+'/ezrez/js/locales/date/';var _isValidDateString=function(dateString,format){try{var date=null;if(dateString.blank()){return false;}
if(format){date=Date.parseExact(dateString,format.replace(/m/g,'M'));}else{date=Date.parse(dateString);}
return(date);}catch(e){return false;}};EzRez.UI.Calendar=function(cfg){var _config=$H({name:'CalendarFormInput',dateFormat:'mm/dd/yy',pages:2,advanceOnSelect:true,locale:'en-US',minDate:null,maxDate:null}).merge(cfg).toObject();var _calendar;var _isInitialized=false;var _elms={container:null};var _blackoutDates='';var _blackoutDays=[];var _isCalendarShown=false;var _vpWidth=document.viewport.getWidth();var _elDims=-1;if(Object.isString(_config.minDate)){_config.minDate=Date.parse(_config.minDate);}
if(Object.isString(_config.maxDate)){_config.maxDate=Date.parse(_config.maxDate);}
var _toDateObj=function(date,format){try{if(Object.isString(date)){if(format){date=Date.parseExact(date,format.replace(/m/g,'M'));}else{date=Date.parse(date);}}else if(Object.isArray(date)){date=Date.parse(date[1]+'/'+date[2]+'/'+date[0]);}}catch(e){date=null;}
return date;};var _toYuiDateFormat=function(date){var dateObj=_toDateObj(date,_config.dateFormat);if(!dateObj)return date;return dateObj.format(_yuiDateFormat);};var _toDateFormat=function(date){var dateObj=_toDateObj(date,_config.dateFormat);if(!dateObj)return date;return dateObj.format(_config.dateFormat);};var _getValidDate=function(date,minDate,maxDate){date=_toDateObj(date,_config.dateFormat);minDate=_toDateObj(minDate,_config.dateFormat);maxDate=_toDateObj(maxDate,_config.dateFormat);var default_date=[date,minDate,maxDate].compact().first();if(!date){return default_date;}
if(!minDate&&!maxDate){return date;}
if(maxDate&&!minDate){return date.isBefore(maxDate)?date:maxDate;}
if(minDate&&!maxDate){return date.isAfter(minDate)?date:minDate;}
if(date.between(minDate,maxDate)){return date;}
if(date.isAfter(maxDate)){return maxDate;}
if(date.isBefore(minDate)){return minDate;}};var _setProperty=function(name,value,silent){_calendar.cfg.setProperty(name,value,silent);};var _getProperty=function(name){return _calendar.cfg.getProperty(name);};var _setLocale=function(locale){if(!_localeCodes.include(locale)){_setLocale('en-US');return;}
_config.locale=locale;var script=_scriptPath+locale+'.js';var objTransaction=YAHOO.util.Get.script(script,{onSuccess:function(){var dateLocale=EzRez.Util.Locales.get(locale);if(!dateLocale||dateLocale.name!==locale){return;}
_setProperty("MONTHS_SHORT",dateLocale.abbreviatedMonthNames);_setProperty("MONTHS_LONG",dateLocale.monthNames);_setProperty("WEEKDAYS_1CHAR",dateLocale.firstLetterDayNames);_setProperty("WEEKDAYS_SHORT",dateLocale.shortestDayNames);_setProperty("WEEKDAYS_MEDIUM",dateLocale.abbreviatedDayNames);_setProperty("WEEKDAYS_LONG",dateLocale.dayNames);_setProperty("START_WEEKDAY",dateLocale.firstDayOfWeek);_calendar.render();}});};var _init=function(){_elms.container=$(_config.name);_calendar=new YAHOO.widget.CalendarGroup(_config.name,{'pages':_config.pages});_setProperty("hide_blank_weeks",true);if(_config.minDate){_setProperty('mindate',_config.minDate);}
if(_config.maxDate){_setProperty('maxdate',_config.maxDate);}
_setLocale(_config.locale);_isInitialized=true;};var _setBlackoutDates=function(dates){_blackoutDates=dates;};var _setBlackoutDaysOfTheWeek=function(days){_blackoutDays=days;};var _setEvent=function(event,listener){if(!_calendar[event]){return;}
_calendar[event].subscribe(listener,this,true);};var _removeEvent=function(event,listener){if(!_calendar[event]){return;}
_calendar[event].unsubscribe(listener,this,true);};var _isDateVisible=function(targetDate){var _c1=_calendar.getCalendarPage(_getValidDate(targetDate));if(_c1){return true;}
return false;};var _setSelectedDate=function(selectedDate){if(Object.isString(selectedDate)&&selectedDate.include(',')){var dates=selectedDate.split(',').map(function(date){date=_getValidDate(date,_getProperty('mindate'),_getProperty('maxdate'));if(date){date=date.format(_yuiDateFormat);}
return date;}).compact();if(_config.advanceOnSelect||!_isDateVisible(dates.first())){_setProperty('pagedate',dates.first());}
_setProperty('selected',dates.join(','));return;}
selectedDate=_getValidDate(selectedDate,null,null);if(_config.advanceOnSelect){var minDate=_getProperty('mindate');if(!selectedDate&&minDate){_setProperty('pagedate',minDate);return;}
if(!selectedDate&&!minDate){_setProperty('pagedate',new Date());return;}}
selectedDate=_getValidDate(selectedDate,_getProperty('mindate'),_getProperty('maxdate'));_setProperty('selected',_toYuiDateFormat(selectedDate));if(_config.advanceOnSelect||!_isDateVisible(selectedDate)){_setProperty('pagedate',selectedDate);}};var _getSelectedDates=function(){var dates=_calendar.getSelectedDates();return dates.map(function(date){return _toDateFormat(date,_config.dateFormat);}).join(',');};var _addRenderers=function(){_calendar.removeRenderers();_calendar.addRenderer(_blackoutDates,_calendar.renderOutOfBoundsDate);_blackoutDays.each(function(dayNo){_calendar.addWeekdayRenderer(dayNo,_calendar.renderOutOfBoundsDate);});};var _showCalendar=function(){_addRenderers();_calendar.render();_calendar.show();_isCalendarShown=true;};var _hideCalendar=function(){_calendar.hide();_isCalendarShown=false;};var _positionCalendar=function(element,position){var dims=Object.extend(element.cumulativeOffset(),element.getDimensions());var positions={right:{top:dims.top+'px',left:dims.left+dims.width+'px'},bottom:{top:dims.top+dims.height+'px',left:dims.left+'px'},fixed:{}};var style=positions[position];if(!style){style=positions['right'];}
_elms.container.setStyle(style);_showCalendar();};var _onWindowResize=function(){_vpWidth=document.viewport.getWidth();};var _shiftCalendarIntoViewPort=function(){var _os=_elms.container.cumulativeOffset();if(_elDims<0){_elDims=_elms.container.getDimensions();}
var _offset=(_os.left+_elDims.width)-_vpWidth;if(_offset>0){var _off=(_os.left-_offset)+"px";_elms.container.setStyle({left:_off});}};this.shiftCalendarIntoViewPort=function(){_shiftCalendarIntoViewPort();};this.show=function(){_showCalendar();};this.hide=function(){_hideCalendar();};this.position=function(element,position){_positionCalendar(element,position);};this.setBlackoutDates=function(dates){_setBlackoutDates(dates);};this.setBlackoutDaysOfTheWeek=function(days){return _setBlackoutDaysOfTheWeek(days);};this.setLocale=function(locale){_setLocale(locale);};this.setProperty=function(name,value,silent){_setProperty(name,value,silent);};this.setEvent=function(event,listener){_setEvent(event,listener);};this.getProperty=function(name){return _getProperty(name);};this.removeEvent=function(event,listener){_removeEvent(event,listener);};this.observe=function(event,listener){_setEvent(event,listener);};this.stopObserving=function(event,listener){_removeEvent(event,listener);};this.setSelectedDate=function(selected){_setSelectedDate(selected);};this.getSelectedDates=function(){return _getSelectedDates();};this.getValidDate=function(date){return _getValidDate(date,_config.minDate,_config.maxDate);};this.setDateFormat=function(format){_config.dateFormat=format;};this.getYuiCalendar=function(){return _calendar;};this.getConfig=function(){return _config;};this.getElements=function(){return _elms;};this.getContainerId=function(){return _calendar.containerId;};_init();Event.observe(window,'resize',_onWindowResize);};EzRez.UI.CalendarFormInput=function(cfg){EzRez.UI.Calendar.apply(this,arguments);var _super={show:this.show,setSelectedDate:this.setSelectedDate,getSelectedDates:this.getSelectedDates,position:this.position,setProperty:this.setProperty,getProperty:this.getProperty,getValidDate:this.getValidDate,positionWithinViewport:this.shiftCalendarIntoViewPort,getElements:this.getElements};var config=$H({inputs:[],position:'right',disableInputMinDate:false}).merge(cfg).toObject();var _config=this.getConfig();_config.inputs=config.inputs;_config.position=config.position;var _calendar=this.getYuiCalendar();var _currentInput;var _inputs=[];var _inputIds=[];var _isCalendarShown=false;var _documentClickListener;var _isInitialized=false;var _init=function(){_inputs=[];_config.inputs.uniq().each(function(selector){var inputElm=$$(selector).first();if(!inputElm){return;}
_inputs.push(inputElm);_inputIds.push(inputElm.identify());});_isInitialized=true;};var _showCalendar=function(input){_currentInput=input.identify();var index=_inputIds.indexOf(_currentInput);var prev=_inputs[index-1];_calendar.deselectAll();if(_config.minDate){_super.setProperty('mindate',_config.minDate);}
if(_config.maxDate){_super.setProperty('maxdate',_config.maxDate);}
if(prev&&index>0&&!_config.disableInputMinDate){var prevValue=_inputs.slice(0,index).invoke('getValue').reverse().find(function(value){return value.match(/[0-9]{2,4}\/[0-9]{2,4}\/[0-9]{2,4}/)!==null;});if(_isValidDateString(prevValue,_config.dateFormat)){_super.setProperty('mindate',_super.getValidDate(prevValue));}}
_super.setSelectedDate(input.getValue());_super.position(input,_config.position);_super.positionWithinViewport();if(!_isCalendarShown){document.observe('click',_documentClickListener);}
_isCalendarShown=true;};var _hideCalendar=function(){_calendar.hide();};var _updateInput=function(input){if(!input){throw new EzRez.Util.Exception({message:'Missing input for EzRez.UI.CalendarFormInput.'});}
input.setValue(_super.getSelectedDates());};var _addInput=function(id){if(!_isInitialized){_config.inputs.push(id);return;}
if(_inputIds.include(id)){return;}
var input=$(id);if(!input){return;}
_inputs.push(input);_inputIds.push(id);input.observe('click',_inputClickListener);};var _clearInputs=function(){_inputs.each(function(input){input.stopObserving('click',_inputClickListener);});_inputs=[];_inputIds=[];};_documentClickListener=function(evt){console.info('_documentClickListener');var elm=$(evt.target);if(_inputs.include(elm)){return;}
if(elm.descendantOf(_super.getElements().container)){return;}
_hideCalendar();};var _calendarSelectListener=function(){_hideCalendar();_updateInput($(_currentInput));};var _calendarHideListener=function(){_isCalendarShown=false;document.stopObserving('click',_documentClickListener);console.info('_hideCalendar');};var _inputClickListener=function(evt){var input=$(evt.target);_showCalendar(input);};this.show=function(input){if(!Object.isElement(input)){input=$(input);}
_showCalendar(input);};this.addInput=function(id){_addInput(id);};this.clearInputs=function(){_clearInputs();};this.setPosition=function(position){_config.position=position;};this.positionWithinViewport=function(){_config.shiftCalendarIntoViewPort();};this.applyListeners=function(){_inputs.each(function(input){input.observe('click',_inputClickListener);});_calendar.selectEvent.subscribe(_calendarSelectListener,this,true);_calendar.hideEvent.subscribe(_calendarHideListener,this,true);};this.removeListeners=function(){_inputs.each(function(input){input.stopObserving('click',_inputClickListener);});};_init();};EzRez.UI.Calendar.getLocales=function(complete){var errors=0;_localeCodes.each(function(code){var script=_scriptPath+code+'.js';var objTransaction=YAHOO.util.Get.script(script,{onSuccess:function(){var info=EzRez.Util.Locales.get(code);if(!info||info.name!==code){errors++;}else{_locales.set(code,info);}
if(_locales.size()===_localeCodes.length-errors){complete(_locales);}}});});};EzRez.UI.FormValidator=function(cfg){var _config=Object.extend({formName:''},cfg);var _form;var _rules=[];var _results=[];var _initialize=function(){_form=$(document.body).down('form[name="'+_config.formName+'"]');};var _clearResults=function(){_results.each(function(result){result.inputs.each(function(input){input.removeClassName('invalid');});});_results=[];};var _validate=function(form){var success=[];_clearResults();_rules.each(function(rule){var inputs=rule.inputNames.collect(function(name){return form[name];});var validatorSuccess=rule.validator(inputs);if(!validatorSuccess){_results.push({inputs:inputs,message:rule.message});}
success.push(validatorSuccess);});return success.compact().all();};var _alertAndFocus=function(){if(!_results.first().message){return;}
alert(_results.first().message);try{_results.first().inputs.first().focus();}catch(e){}};var _submitListener=function(evt){var form=$(evt.target);if(!_validate(form)){Event.stop(evt);_alertAndFocus();}};this.getResults=function(){return _results;};this.highLightInvalidFields=function(message){_results.each(function(result){result.inputs.each(function(input){input.addClassName('invalid');});});};this.validate=function(){if(!_validate(_form)){_alertAndFocus();return false;}
return true;};this.validateAndSubmit=function(){if(!_validate(_form)){_alertAndFocus();return;}
_form.submit();};this.addRule=function(options){var opts=Object.extend({inputNames:[],message:'',validator:function(inputs){}},options);_rules.push(opts);};this.applyListeners=function(){_form.observe("submit",_submitListener);};_initialize();};EzRez.UI.FormValidator.Validators={};EzRez.UI.FormValidator.Validators.hasValue=function(inputs){var results=inputs.collect(function(textObj){var value=textObj.getValue();if(value==null||value.blank()){return false;}else{return true;}});return results.compact().all();};EzRez.UI.FormValidator.Validators.isValidDOBPullDownsYMD=function(inputs){if(!EzRez.UI.FormValidator.Validators.hasValue(inputs)){return false;}
var yearValue=inputs[0].value;var monthValue=inputs[1].value;var dayValue=inputs[2].value;var today=new Date();var dob=new Date(today.getTime());dob.setFullYear(yearValue,monthValue-1,dayValue);return(dob<=today);};})();if(EzRez===undefined){throw('ezrez-app.js requires ezrez.js');}
if(EzRez.Util===undefined){throw('ezrez-app.js requires ezrez-util.js');}
if(EzRez.UI===undefined){throw('ezrez-app.js requires ezrez-ui.js');}
EzRez.App={};EzRez.App.Messenger=new function(){var _data=$H();this.begin=function(name,cfg){var config=$H({onEnd:null,keep:false}).merge(cfg).toObject();EzRez.Util.Profiler.start('Message '+name+'.');_data.set(name,{data:new Array(),ended:false,onEnd:config.onEnd,keep:config.keep});};this.write=function(name,value){var msg=_data.get(name);if(msg===undefined){return;}
if(msg.ended){return;}
msg.data.push(value);_data.set(name,msg);};var _read=function(name,keep){var msg=_data.get(name);if(keep===undefined){keep=false;}
if(msg===undefined){return;}
if(!msg.ended){return;}
if(!keep&&!msg.keep){_data.unset(name);}
return msg.data;};this.read=function(name,keep){return _read(name,keep);};this.end=function(name){var msg=_data.get(name);msg.ended=true;if(msg.onEnd!=null){var data=_read(name,msg.keep);msg.onEnd(data);}
EzRez.Util.Profiler.stop('Message '+name+'.');};};EzRez.App.Page=function(cfg){var config=$H({create:function(){},loading:function(){},complete:function(){},validate:function(){return true;},error:function(){},exception:function(){},parent:null}).merge(cfg).toObject();var _parent=config.parent;var _create=config.create;var _loading=config.loading;var _complete=config.complete;var _validate=config.validate;var _error=config.error;var _exception=config.exception;this.create=function(){return _create;};this.loading=function(){return _loading;};this.complete=function(){return _complete;};this.validate=function(){return _validate;};this.error=function(){return _error;};this.exception=function(){return _exception;};this.updater=function(target,src,params){var config=$H({asynchronous:true,evalScripts:true,method:'get',parameters:null}).merge(params).toObject();new Ajax.Updater(target,src,{asynchronous:config.asynchronous,evalScripts:config.evalScripts,method:config.method,parameters:config.parameters,onCreate:function(request){_create(request);if(_parent!=null){_parent.loading(request);}},onLoading:function(request){_loading(request);if(_parent!=null){_parent.loading(request);}},onComplete:function(request){_complete(request);if(_parent!=null){_parent.complete(request);_parent.applyPageBehaviors();}},onError:function(request){_error(request);if(_parent!=null){_parent.error(request);}},onException:function(request,exception){_exception(request,exception);if(_parent!=null){_parent.exception(request,exception);}}});};};(function(){var _pages;EzRez.App.Widget=function(cfg){var config=$H({loading:function(){},complete:function(){},error:function(){},exception:function(){}}).merge(cfg).toObject();_pages=$H();this.loading=config.loading;this.complete=config.complete;this.error=config.error;this.exception=config.exception;};EzRez.App.Widget.prototype={updateElementID:null,complete:null,loading:null,error:null,createPage:function(name,cfg){cfg.parent=this;var page=new EzRez.App.Page(cfg);_pages.set(name,page);},getPage:function(page){return _pages.get(page);},getPages:function(){return _pages;},onPageComplete:function(page){_pages.get(page).complete()();},updatePage:function(page,src,params){_pages.get(page).updater(this.updateElementID,src,params);},applyPageBehaviors:function(){_pages.each(function(page_entry){var page_name=page_entry.key;var page=page_entry.value;var link_selector='a.GoTo_'+page_name.strip();var form_selector='form.GoTo_'+page_name.strip();$$(link_selector).each(function(link){page.action_elm=link;link.observe('click',function(evt){if(!page.validate()()){Event.stop(evt);return false;}
page.updater(this.updateElementID,link.href);Event.stop(evt);return false;}.bindAsEventListener(this));}.bind(this));$$(form_selector).each(function(frm){page.action_elm=frm;frm.observe('submit',function(evt){if(!page.validate()()){Event.stop(evt);return false;}
page.updater(this.updateElementID,frm.action,{method:frm.method,parameters:frm.serialize()});Event.stop(evt);return false;}.bindAsEventListener(this));}.bind(this));}.bind(this));}};})();EzRez.App.DOMController=function(actions){var _actions=$H(actions);var _listeners=$H();var _that=this;var _exceptions=new Array();var _applycount=0;var _element=null;var _parseActionSignature=function(selector_event_string){var signature_array=selector_event_string.split(',');var selector=signature_array[0];var event=signature_array[1];if(Object.isString(selector)){selector=selector.strip();}
if(Object.isString(event)){event=event.strip();}
return{selector:selector,event:event};};var _getListenerID=function(selector,event){return selector+'_'+event;};var _applyListeners=function(selector,event,action){if(selector==='before'||selector=='after'){return;}
var elements;var listenerID=_getListenerID(selector,event);var listener=_listeners.get(listenerID);if(!listener){listener=function(evt){var name=event+': '+selector;var span=EzRez.Util.Profiler.start(name);var rtn=action(evt,_that);span.stop();return rtn;};_listeners.set(listenerID,listener);}
if(selector==='window'){Event.observe(window,event,listener);return;}
if(selector==='document'){document.observe(event,listener);return;}
elements=(_element===null)?$$(selector):_element.select(selector);elements.each(function(elm){elm.observe(event,listener);});};var _removeListeners=function(selector,event){if(selector==='before'||selector=='after'){return;}
var listenerID;var listener;var elements;if(selector==='window'){listenerID=_getListenerID(selector,event);listener=_listeners.get(listenerID);Event.stopObserving(window,event,listener);return;}
if(selector==='document'){listenerID=_getListenerID(selector,event);listener=_listeners.get(listenerID);document.stopObserving(event,listener);return;}
elements=(_element===null)?$$(selector):_element.select(selector);elements.each(function(elm){var listenerID=_getListenerID(selector,event);var listener=_listeners.get(listenerID);elm.stopObserving(event,listener);});};var _unload=function(){_listeners=null;_actions=null;};this.unload=function(){_unload();};this.setActions=function(actions){_actions=$H(actions);this.applyActions();};this.addAction=function(selector_event_string,action){_actions.set(selector_event_string,action);};this.applyAction=function(selector_event_string,element){_element=($(element))?$(element):null;var signature=_parseActionSignature(selector_event_string);var action=_actions.get(selector_event_string);if(action===undefined){return;}
_applyListeners(signature.selector,signature.event,action);};this.applyActions=function(element){_element=($(element))?$(element):null;EzRez.Util.Profiler.start('ApplyListeners '+' '+_applycount);var before=_actions.get('before');var after=_actions.get('after');EzRez.Util.Profiler.start('    ApplyListeners '+' '+_applycount+' Before');if(before!=undefined){try{before(_that);}catch(e){_exceptions.push(e);}}
EzRez.Util.Profiler.stop('    ApplyListeners '+' '+_applycount+' Before');EzRez.Util.Profiler.start('    ApplyListeners '+' '+_applycount+' Each');_actions.each(function(action){try{var signature=_parseActionSignature(action.key);EzRez.Util.Profiler.start('        ApplyListeners '+' '+_applycount+' '+action.key);_applyListeners(signature.selector,signature.event,action.value);EzRez.Util.Profiler.stop('        ApplyListeners '+' '+_applycount+' '+action.key);}catch(e){_exceptions.push(e);}});EzRez.Util.Profiler.stop('    ApplyListeners '+' '+_applycount+' Each');EzRez.Util.Profiler.start('    ApplyListeners '+' '+_applycount+' After');if(after!=undefined){try{after(_that);}catch(e){_exceptions.push(e);}}
EzRez.Util.Profiler.stop('    ApplyListeners '+' '+_applycount+' After');if(_exceptions.size()>0){_exceptions.each(function(e){throw(e);});}
EzRez.Util.Profiler.stop('ApplyListeners '+' '+_applycount);_applycount++;};this.removeAction=function(selector_event_string,element){_element=($(element))?$(element):null;var action=_actions.get(selector_event_string);var signature=_parseActionSignature(selector_event_string);if(action===undefined){return;}
_removeListeners(signature.selector,signature.event,action);};this.removeActions=function(element){_element=($(element))?$(element):null;_actions.each(function(action){var signature=_parseActionSignature(action.key);_removeListeners(signature.selector,signature.event,action.value);});};this.getAction=function(selector_event_string){return _actions.get(selector_event_string);};this.extend=function(actions){var child=new EzRez.App.DOMController(_actions.merge(actions));child.uber=function(selector_event_string){return _actions.get(selector_event_string);};return child;};this.uber=function(selector_event_string){return _actions.get(selector_event_string);};this.get=function(){return this;};Event.observe(window,'unload',_unload);};EzRez.App.UIComponent=function(cfg){var config=$H({initialize:function(){},applyListeners:function(){},removeListeners:function(){},unload:function(){}}).merge(cfg).toObject();var _component=null;var _isInitialized=false;var _areListenersApplied=false;this.initialize=function(params){if(_isInitialized){return;}
_component=config.initialize(params);_isInitialized=true;};this.applyListeners=function(){if(_areListenersApplied){return;}
config.applyListeners(_component);_areListenersApplied=true;};this.removeListeners=function(){if(!_areListenersApplied){return;}
config.removeListeners(_component);_areListenersApplied=false;};this.unload=function(){config.unload(_component);};this.get=function(){return _component;};this.isInitialized=function(){return _isInitialized;};this.areListenersApplied=function(){return _areListenersApplied;};};EzRez.App.Application=function(){var _domControllers=$H();var _uiComponents=$H();var _domLoaders=[];var _windowLoaders=[];var _domloaded=false;var _windowloaded=false;var _loaded=[];var _dependencies=$H();var _exceptions=[];var _load=function(resource,onload){if(onload&&!_domloaded){_domLoaders.push(resource);}else{resource();_exceptions.each(function(e){throw e;});_exceptions=[];}};this.createDOMController=function(name,actions){var controller=new EzRez.App.DOMController(actions);_domControllers.set(name,controller);controller.requires=function(dependencies){this.requires(name,dependencies);}.bind(this);return controller;};this.createAJAXConroller=function(name,actions){};this.createUIComponent=function(name,actions){var component=new EzRez.App.UIComponent(actions);_uiComponents.set(name,component);component.requires=function(dependencies){this.requires(name,dependencies);}.bind(this);return component;};this.loadDOMController=function(name,params,onload){onload=(onload===undefined)?true:onload;var controller=_domControllers.get(name);if(!controller){return}
var resource=function(){try{if(_loaded.include(name))return;var span=EzRez.Util.Profiler.start('Loaded '+name+' DOMController');controller.applyActions();_loaded.push(name);span.stop();}catch(e){_exceptions.push(e);}};_load(resource,onload);};this.loadUIComponent=function(name,params,onload){onload=(onload===undefined)?true:onload;var component=_uiComponents.get(name);if(!component){return;}
var resource=function(){try{if(_loaded.include(name))return;var span=EzRez.Util.Profiler.start('Loaded '+name+' UIComponent');component.initialize(params);component.applyListeners();_loaded.push(name);span.stop();}catch(e){_exceptions.push(e);}};_load(resource,onload);};this.loadAJAXConroller=function(name,params,onload){};this.getUIComponent=function(name){return _uiComponents.get(name);};this.getDOMController=function(name){return _domControllers.get(name);};this.getAJAXConroller=function(name){};this.use=function(name){var component=_uiComponents.get(name);if(!component)return null;return component.get();};this.getClientScript=function(cfg){var _config=Object.extend({dsn:'',cobrand:'',file:'',onSuccess:function(){},onFailure:function(){}},cfg);var url='/images_w/#{dsn}/nav/#{cobrand}/clientjs/#{file}.js'.interpolate({dsn:_config.dsn,cobrand:_config.cobrand,file:_config.file});YAHOO.util.Get.script(url,{onSuccess:function(response){EzRez.Util.Debug.info("Loaded "+url+".");_config.onSuccess(response);},onFailure:function(response){EzRez.Util.Debug.error("Failed to load "+url+".");_config.onFailure(response);},scope:window});};this.requires=function(name,dependencies){var resource_dependencies=_dependencies.get(name);if(resource_dependencies){resource_dependencies=resource_dependencies.concat(dependencies).uniq();_dependencies.set(name,resource_dependencies);return;}
_dependencies.set(name,dependencies);};this.load=function(name,params,onload){onload=(onload===undefined)?true:onload;var resource_dependencies=_dependencies.get(name);if(resource_dependencies){resource_dependencies.each(function(resource){this.load(resource,{},onload);}.bind(this));}
this.loadDOMController(name,params,onload);this.loadUIComponent(name,params,onload);this.loadAJAXConroller(name,params,onload);};this.domload=function(resource){_load(resource,true);};this.isDOMLoaded=function(){return _domloaded;};this.isWindowLoaded=function(){return _windowloaded;};this.Message=EzRez.App.Messenger;this.Temp=$H();this.Profile=EzRez.Util.Profiler;this.Debug=EzRez.Util.Debug;this.Cookie=EzRez.Util.Cookie;this.Env=EzRez.Util.Env;this.Omniture=EzRez.Util.Omniture;this.WebAnalytics=EzRez.Util.WebAnalytics;this.SysConf=new EzRez.WebApi.SysConf({});this.WebContext=new EzRez.WebApi.WebContext({});this.TravelerProfile=new EzRez.WebApi.TravelerProfile({});this.Search=new EzRez.WebApi.Search({});this.Availability=new EzRez.WebApi.Availability({});this.Itinerary=new EzRez.WebApi.Itinerary({});this.Booking=new EzRez.WebApi.Booking({});this.Agent=new EzRez.WebApi.Agent({});document.observe('dom:loaded',function(){EzRez.Util.Profiler.stop('dom:load');_domloaded=true;_domLoaders.each(function(resource){resource();});EzRez.Util.WebAnalytics.transmitWebBeacons();_exceptions.each(function(e){throw e;});_exceptions=[];});Event.observe(window,'load',function(evt){EzRez.Util.Profiler.stop('window:load');_windowloaded=true;_windowLoaders.each(function(resource){resource();});_exceptions.each(function(e){throw e;});_exceptions=[];}.bindAsEventListener(this));};if(EzRez===undefined){throw('ezrez-webapi.js requires ezrez.js');}
if(EzRez.Util===undefined){throw('ezrez-webapi.js requires ezrez-util.js');}
if(EzRez.UI===undefined){throw('ezrez-webapi.js requires ezrez-ui.js');}
if(EzRez.App===undefined){throw('ezrez-webapi.js requires ezrez-app.js');}
EzRez.WebApi={};(function(){var _matches='$Revision: 43474 $'.match(/^\$Revision: (\d+) \$$/);var _objectKeyCounter=1;EzRez.WebApi.revision=_matches[1];EzRez.WebApi.Base=function(json){var _json=Object.extend({_ezrezObjectKey:null},json);this.ezrezObjectKey=(!_json._ezrezObjectKey)?'localObjectKey'+_objectKeyCounter++:_json._ezrezObjectKey;};})();EzRez.WebApi.Address=function(json){var _json=Object.extend({_addressLines:[],_city:'',_countryCode:'',_stateCode:'',_zip:''},json);EzRez.WebApi.Base.apply(this,arguments);this.addressLines=_json._addressLines;this.city=_json._city;this.countryCode=_json._countryCode;this.stateCode=_json._stateCode;this.zip=_json._zip;};EzRez.WebApi.Price=function(json){var _json=Object.extend({_maxPoints:0,_maxPointsTax:0,_taxTotal:0,_markup:0,_total:0,_currency:''},json);EzRez.WebApi.Base.apply(this,arguments);this.maxPoints=_json._maxPoints;this.maxPointsTax=_json._maxPointsTax;this.taxTotal=_json._taxTotal;this.markup=_json._markup;this.total=_json._total;this.currency=_json._currency;};EzRez.WebApi.Traveler=function(json){var _json=Object.extend({_firstName:'',_lastName:'',_address:{}},json);EzRez.WebApi.Base.apply(this,arguments);this.firstName=_json._firstName;this.lastName=_json._lastName;this.address=new EzRez.WebApi.Address(_json._address);};EzRez.WebApi.Room=function(json){var _json=Object.extend({_name:'',_hotelName:'',_code:'',_description:'',_checkIn:'',_checkOut:'',_rateCode:'',_crsName:'',_airportCode:'',_hotelSharedId:0,_numNights:0,_supplierId:0,_pricePartial:{},_address:{}},json);EzRez.WebApi.Base.apply(this,arguments);this.name=_json._name;this.hotelName=_json._hotelName;this.code=_json._code;this.description=_json._description;this.crsName=_json._crsName;this.airportCode=_json._airportCode;this.numNights=_json._numNights;this.supplierId=_json._supplierId;this.hotelSharedId=_json._hotelSharedId;this.price=new EzRez.WebApi.Price(_json._pricePartial);this.address=new EzRez.WebApi.Address(_json._address);this.checkIn=new Date(Date.parseJSON(_json._checkIn));this.checkOut=new Date(Date.parseJSON(_json._checkOut));};EzRez.WebApi.Hotel=function(json){var _json=Object.extend({_name:'',_sharedHotelId:0,_hotelCode:'',_supplierId:0,_connectorPreference:0,_neighborhoodId:0,_amenities:[],_address:{},_priceForFiltering:0,_geoLat:0,_geoLng:0,_rating:0,_compositeScore:0,_checkIn:'',_checkOut:'',_roomPartials:[],_crsName:'',_brandCode:'',_chainCode:'',_chainName:'',_airportCode:'',_pricePartial:{}},json);EzRez.WebApi.Base.apply(this,arguments);var _rooms=$H();var _buildRooms=function(){if(_rooms.size()===0){var span=EzRez.Util.Profiler.start('EzRez.WebApi.Hotel ('+this.ezrezObjectKey+')::build rooms');_json._roomPartials.each(function(roomJson){var room=new EzRez.WebApi.Room(roomJson);_rooms.set(room.ezrezObjectKey,room);});span.stop();}};this.name=_json._name;this.sharedId=_json._sharedHotelId;this.code=_json._hotelCode;this.supplierId=_json._supplierId;this.connectorPreference=_json._connectorPreference;this.neighborhoodId=_json._neighborhoodId;this.amenities=_json._amenities;this.priceForFiltering=_json._priceForFiltering;this.price=new EzRez.WebApi.Price(_json._pricePartial);this.lat=_json._geoLat;this.lng=_json._geoLng;this.rating=_json._rating;this.compositeScore=_json._compositeScore;this.checkIn=new Date(Date.parseJSON(_json._checkIn));this.checkOut=new Date(Date.parseJSON(_json._checkOut));this.address=new EzRez.WebApi.Address(_json._address);this.crsName=_json._crsName;this.airportCode=_json._airportCode;this.brandCode=_json._brandCode;this.chainCode=_json._chainCode;this.chainName=_json._chainName;this.getRooms=function(){_buildRooms();return _rooms.values();};this.getRoom=function(ezrezObjectKey){_buildRooms();return _rooms.get(ezrezObjectKey);};};EzRez.WebApi.Car=function(json){var _json=Object.extend({_name:'',_code:'',_description:'',_airportCode:'',_companyCode:'',_companyName:'',_crsName:'',_pickupTime:'',_returnTime:'',_pricePartial:{}},json);EzRez.WebApi.Base.apply(this,arguments);this.name=_json._name;this.code=_json._code;this.description=_json._description;this.airportCode=_json._airportCode;this.companyCode=_json._companyCode;this.companyName=_json._companyName;this.crsName=_json._crsName;this.pickupDate=new Date(Date.parseJSON(_json._pickupTime));this.returnDate=new Date(Date.parseJSON(_json._returnTime));this.price=new EzRez.WebApi.Price(_json._pricePartial);};EzRez.WebApi.Activity=function(json){var _json=Object.extend({_name:'',_activityProductId:0,_isAnyDateEvent:false,_numAdults:0,_numChildren:0,_numInfants:0,_crsName:'',_pricePartial:{}},json);EzRez.WebApi.Base.apply(this,arguments);this.name=_json._name;this.productId=_json._activityProductId;this.isAnyDateEvent=_json._isAnyDateEvent;this.price=new EzRez.WebApi.Price(_json._pricePartial);this.numAdults=_json._numAdults;this.numChildren=_json._numChildren;this.numInfants=_json._numInfants;this.crsName=_json._crsName;};EzRez.WebApi.Flight=function(json){var _json=Object.extend({_flightNumber:0,_departureAirportCode:'',_arrivalAirportCode:'',_fareClass:'',_cabin:'',_airlineCode:'',_departureTimestamp:'',_arrivalTimestamp:'',_supplierCode:'',_miles:-1,_durationMinutes:-1,_stops:0,_layoverDurationMinutes:-1,_hasLayover:false,_isBulk:false},json);EzRez.WebApi.Base.apply(this,arguments);this.flightNumber=_json._flightNumber;this.departureAirportCode=_json._departureAirportCode;this.arrivalAirportCode=_json._arrivalAirportCode;this.fareClass=_json._fareClass;this.cabin=_json._cabin;this.isBulk=_json._isBulk;this.airlineCode=_json._airlineCode;this.supplierCode=_json._supplierCode;this.miles=_json._miles;this.stops=_json._stops;this.layoverDurationMinutes=_json._layoverDurationMinutes;this.hasLayover=_json._hasLayover;this.departureTimestamp=new Date(Date.parseJSON(_json._departureTimestamp));this.arrivalTimestamp=new Date(Date.parseJSON(_json._arrivalTimestamp));this.durationMinutes=_json._durationMinutes;};EzRez.WebApi.AirLeg=function(json){var _json=Object.extend({_departureAirportCode:'',_arrivalAirportCode:'',_departureTimestamp:'',_arrivalTimestamp:'',_durationMinutes:-1,_stops:0,_airlines:[],_airSegmentPartialList:[]},json);EzRez.WebApi.Base.apply(this,arguments);var _flights=[];_json._airSegmentPartialList.each(function(segmentJson){_flights.push(new EzRez.WebApi.Flight(segmentJson));});this.flights=_flights;this.departureAirportCode=_json._departureAirportCode;this.arrivalAirportCode=_json._arrivalAirportCode;this.departureTimestamp=new Date(Date.parseJSON(_json._departureTimestamp));this.arrivalTimestamp=new Date(Date.parseJSON(_json._arrivalTimestamp));this.durationMinutes=_json._durationMinutes;this.stops=_json.stops;this.airlines=_json._airlines;this.isNonStop=_flights.length===1;};EzRez.WebApi.AirOption=function(json){var _json=Object.extend({_numAirLegs:0,_numAdults:0,_numChildren:0,_numSeniors:0,_numInfantsInSeat:0,_numInfantsInLap:0,_isRoundTrip:false,_airLegPartialList:[],_pricePartial:{}},json);EzRez.WebApi.Base.apply(this,arguments);var _legs=[];_json._airLegPartialList.each(function(legJson){_legs.push(new EzRez.WebApi.AirLeg(legJson));});this.numAdults=_json._numAdults;this.numChildren=_json._numChildren;this.numSeniors=_json._numSeniors;this.numInfantsInSeat=_json._numInfantsInSeat;this.numInfantsInLap=_json._numInfantsInLap;this.isRoundTrip=_json._isRoundTrip;this.legs=_legs;this.price=new EzRez.WebApi.Price(_json._pricePartial);};EzRez.WebApi.Insurance=function(json){var _json=Object.extend({_contractName:'',_crsName:'',_pricePartial:{}},json);EzRez.WebApi.Base.apply(this,arguments);this.contractName=_json._contractName;this.crsName=_json._crsName;this.price=new EzRez.WebApi.Price(_json._pricePartial);};EzRez.WebApi.Certificate=function(json){var _json=Object.extend({_agentId:0,_custId:0,_amount:0,_beneficiary:'',_beginDate:'',_endDate:''},json);EzRez.WebApi.Base.apply(this,arguments);this.agentId=_json._agentId;this.custId=_json._custId;this.amount=_json._amount;this.beneficiary=_json._beneficiary;this.beginDate=new Date(Date.parseJSON(_json._beginDate));this.endDate=new Date(Date.parseJSON(_json._endDate));};EzRez.WebApi.Products=function(json){var _json=Object.extend({_hasAir:false,_hasRoom:false,_hasCar:false,_hasActivity:false,_hasCruise:false,_hasInsurance:false,_hasCertificate:false},json);EzRez.WebApi.Base.apply(this,arguments);this.hasAir=_json._hasAir;this.hasRoom=_json._hasRoom;this.hasCar=_json._hasCar;this.hasActivity=_json._hasActivity;this.hasCruise=_json._hasCruise;this.hasInsurance=_json._hasInsurance;this.hasCertificate=_json._hasCertificate;};EzRez.WebApi.Travelers=function(json){var _json=Object.extend({_numPassengers:0,_numAdults:0,_numSeniors:0,_numChildren:0,_numInfantsInSeat:0,_numInfantsInLap:0,_numTotalChildren:0,_numTotalAdults:0},json);EzRez.WebApi.Base.apply(this,arguments);this.total=_json._numPassengers;this.adults=_json._numAdults;this.seniors=_json._numSeniors;this.children=_json._numChildren;this.infantsInSeat=_json._numInfantsInSeat;this.infantsInLap=_json._numInfantsInLap;this.totalChildren=_json._numTotalChildren;this.totalAdults=_json._numTotalAdults;};EzRez.WebApi.Search=function(json){var _json=Object.extend({_departingArea:'',_arrivingArea:'',_departureDate:'',_returnDate:'',_airCabin:'',_featuredHotelId:0},json);EzRez.WebApi.Base.apply(this,arguments);this.departing={area:_json._departingArea,date:new Date(Date.parseJSON(_json._departureDate))};this.arriving={area:_json._arrivingArea,date:new Date(Date.parseJSON(_json._returnDate))};this.travelers=new EzRez.WebApi.Travelers(_json);this.products=new EzRez.WebApi.Products(_json);this.airCabin=_json._airCabin;this.featuredHotelId=_json._featuredHotelId;};EzRez.WebApi.Availability=function(json){var _json=Object.extend({_activityPartials:[],_airOptionPartials:[],_carPartials:[],_hotelsPartials:[]},json);EzRez.WebApi.Base.apply(this,arguments);var _hotels=$H();var _airOptions=$H();var _cars=$H();var _activities=$H();var _buildHotels=function(){if(_hotels.size()===0){var span=EzRez.Util.Profiler.start('EzRez.WebApi.Availability::build hotels');_json._hotelsPartials.each(function(hotelJson){var hotel=new EzRez.WebApi.Hotel(hotelJson);_hotels.set(hotel.ezrezObjectKey,hotel);});span.stop();}};var _buildCars=function(){if(_cars.size()===0){var span=EzRez.Util.Profiler.start('EzRez.WebApi.Availability::build cars');_json._carPartials.each(function(carJson){var car=new EzRez.WebApi.Car(carJson);_cars.set(car.ezrezObjectKey,car);});span.stop();}};var _buildAirOptions=function(){if(_airOptions.size()===0){var span=EzRez.Util.Profiler.start('EzRez.WebApi.Availability::build air options');_json._airOptionPartials.each(function(airJson){var airOption=new EzRez.WebApi.AirOption(airJson);_airOptions.set(airOption.ezrezObjectKey,airOption);});span.stop();}};var _buildActivities=function(){if(_activities.size()===0){var span=EzRez.Util.Profiler.start('EzRez.WebApi.Availability::build activities');_json._activityPartials.each(function(activityJson){var activity=new EzRez.WebApi.Activity(activityJson);_activities.set(activity.ezrezObjectKey,activity);});span.stop();}};this.products=new EzRez.WebApi.Products(_json);this.getHotels=function(){_buildHotels();return _hotels.values();};this.getHotel=function(ezrezObjectKey){_buildHotels();return _hotels.get(ezrezObjectKey);};this.getAirOptions=function(){_buildAirOptions();return _airOptions.values();};this.getAirOption=function(ezrezObjectKey){_buildAirOptions();return _airOptions.get(ezrezObjectKey);};this.getCars=function(){_buildCars();return _cars.values();};this.getCar=function(ezrezObjectKey){_buildCars();return _cars.get(ezrezObjectKey);};this.getActivities=function(){_buildActivities();return _activities.values();};this.getActivity=function(ezrezObjectKey){_buildActivities();return _activities.get(ezrezObjectKey);};this.numHotels=_json._hotelsPartials.length;this.numAirOptions=_json._airOptionPartials.length;this.numCars=_json._carPartials.length;this.numActivities=_json._activityPartials.length;};EzRez.WebApi.Itinerary=function(json){var _json=Object.extend({_hasInsurance:false,_roomPartials:[],_insurancePartial:{},_certificatePartials:[]},json);EzRez.WebApi.Availability.apply(this,arguments);var _hotel=new EzRez.WebApi.Hotel(_json);var _certificates=$H();var _certificate=new EzRez.WebApi.Certificate();delete this.getHotels;delete this.getHotel;var _buildCertificates=function(){if(_certificates.size()>0){return;}
var span=EzRez.Util.Profiler.start('EzRez.WebApi.Itinerary::build certificates');_json._certificatePartials.each(function(certificateJson){var certificate=new EzRez.WebApi.Certificate(certificateJson);_certificates.set(certificate.ezrezObjectKey,certificate);});_certificate=_certificates.values().first();span.stop();};this.insurance=new EzRez.WebApi.Insurance(_json._insurancePartial);this.getCertificates=function(){_buildCertificates();return _certificates.values();};this.getCertificate=function(ezrezObjectKey){_buildCertificates();return _certificates.get(ezrezObjectKey);};_buildCertificates();this.certificate=_certificate;this.getRooms=_hotel.getRooms;this.getRoom=_hotel.getRoom;this.numRooms=_json._roomPartials.length;};EzRez.WebApi.Booking=function(json){var _json=Object.extend({_bookingNumber:0,_agencyAgentMarkup:0,_agencyCommissionTotal:0,_packagePriceInCustomerCurrency:0,_packagePriceInPoints:0,_customerOwe:0,_customerPaymentTotal:0,_paymentTotalPoints:0,_paymentTotal:0,_creditCardType:'',_discountCode:'',_frequentFlyerNumber:'',_beginDate:'',_endDate:'',_enteredDate:'',_departureAirportCode:'',_destinationAirportCode:'',_isOnHold:false,_isSubsequentPayment:false,_isSubscribedToEmailList:false,_itineraryPartial:{},_leadTravelerPartial:{}},json);EzRez.WebApi.Itinerary.apply(this,[_json._itineraryPartial]);this.departureAirportCode=_json._departureAirportCode;this.destinationAirportCode=_json._destinationAirportCode;this.beginDate=new Date(Date.parseJSON(_json._beginDate));this.endDate=new Date(Date.parseJSON(_json._endDate));this.enteredDate=new Date(Date.parseJSON(_json._enteredDate));this.travelers=new EzRez.WebApi.Travelers(_json);this.number=_json._bookingNumber;this.packagePriceInCustomerCurrency=_json._packagePriceInCustomerCurrency;this.packagePriceInPoints=_json._packagePriceInPoints;this.customerOwe=_json._customerOwe;this.customerPaymentTotal=_json._customerPaymentTotal;this.paymentTotal=_json._paymentTotal;this.paymentTotalPoints=_json._paymentTotalPoints;this.frequentFlyerNumber=_json._frequentFlyerNumber;this.creditCardType=_json._creditCardType;this.isPaidInFull=(_json._customerOwe===0&&_json._customerPaymentTotal>0);this.isOnHold=_json._isOnHold;this.isSubsequentPayment=_json._isSubsequentPayment;this.isSubscribedToEmailList=_json._isSubscribedToEmailList;this.agencyAgentMarkup=_json._agencyAgentMarkup;this.agencyCommissionTotal=_json._agencyCommissionTotal;this.leadTraveler=new EzRez.WebApi.Traveler(_json._leadTravelerPartial);this.discountCode=_json._discountCode;this.isFirstPayment=false;};EzRez.WebApi.WebContext=function(json){var _json=Object.extend({_url:'',_clientUrl:'',_clientName:'',_cobrandName:'',_webAssetsRoot:'',_develSystemDsn:'',_tab:'',_pageName:'',_fileName:'',_debugMode:'',_isAgent:''},json);EzRez.WebApi.Base.apply(this,arguments);this.isDebugMode=_json._debugMode||_json._develSystemDsn.length>0||_json._url.include('localhost');this.isAgent=_json._isAgent;this.clientUrl=_json._clientUrl;this.clientName=_json._clientName;this.cobrandName=_json._cobrandName;this.url=_json._url;this.webAssetsRoot=_json._webAssetsRoot;this.develSystemDsn=_json._develSystemDsn;this.searchFormTab=_json._tab;this.pageName=_json._pageName;this.fileName=_json._fileName;};EzRez.WebApi.SysConf=function(json){var _json=Object.extend({_hotelsPerPage:10,_defaultCountryCode:'US',_omnitureAccountId:'',_useResultsAccordian:false,_isDisplayCashColumn:false},json);EzRez.WebApi.Base.apply(this,arguments);this.hotelsPerPage=_json._hotelsPerPage;this.defaultCountryCode=_json._defaultCountryCode;this.useResultsAccordian=_json._useResultsAccordian;this.omnitureAccountId=_json._omnitureAccountId;this.isDisplayCashColumn=_json._isDisplayCashColumn;};EzRez.WebApi.TravelerProfile=function(json){var _json=Object.extend({_totalRedemptionPoints:0,_customInfo:'',_accountDisplay:'',_externalProfileId:''},json);EzRez.WebApi.Traveler.apply(this,arguments);this.totalRedemptionPoints=_json._totalRedemptionPoints;this.customInfo=_json._customInfo;this.accountDisplay=_json._accountDisplay;this.externalProfileId=_json._externalProfileId;};EzRez.WebApi.Agent=function(json){var _json=Object.extend({_id:0,_type:'',_agencyId:0,_firstName:'',_lastName:''},json);EzRez.WebApi.Base.apply(this,arguments);this.id=_json._id;this.type=_json._type;this.agencyId=_json._agencyId;this.firstName=_json._firstName;this.lastName=_json._lastName;};var formWasSubmitted=false;function validateAndDisableForm(form){if(validateForm(form)){form.submit.disabled=true;return true;}else{return false;}}
function disableForm(form){form.submit.disabled=true;return true;}
function submitAndDisableForm(form){if(!formWasSubmitted){formWasSubmitted=true;form.submit();}
return true;}
function submitForm(formName){var form=document[formName];if(!form){return;}
form.submit();}
function confirmAction(msg){return confirm("Are you sure you want to "+msg)}
function displaySection(display,displayId){var objDisplay=document.getElementById(displayId);if(display){objDisplay.style.visibility="visible";objDisplay.style.display=(objDisplay.tagName.toUpperCase()!="TR"||document.all)?"block":"table-row";}else{objDisplay.style.visibility="hidden";objDisplay.style.display="none";}}
function visibilitySection(display,displayId){var objDisplay=document.getElementById(displayId);if(display){objDisplay.style.visibility="visible";}else{objDisplay.style.visibility="hidden";}}
function areaWindow(property){bookWindow=window.open(property,'_blank','height=500,width=400,scrollbars=yes');bookWindow.focus();}
function newWindow(property){bookWindow=window.open(property,'_blank','height=500,width=680,scrollbars=yes')
bookWindow.focus()}
function newTallWindow(property){bookWindow=window.open(property,'_blank','height=700,width=680,scrollbars=yes')
bookWindow.focus()}
function isText(textObj,msg){var objRegExp=/^[a-zA-Z0-9]+$/;if(objRegExp.test(textObj.value)){return true;}else{alert(msg);try{textObj.focus();}catch(e){}
return false;}}
function isNonNull(textObj,msg){if(trim(textObj.value)>''){return true;}else{alert(msg);try{textObj.focus();}catch(e){}
return false;}}
function isNumeric(textObj,msg){var objRegExp=/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;if(objRegExp.test(textObj.value)){return true;}else{alert(msg);try{textObj.focus();}catch(e){}
return false;}}
function isNumericList(textObj,msg){if(trim(textObj.value)==''){return true;}
var tokens=textObj.value.split(/ *, */);var numericRegExp=/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;for(var i=0;i<tokens.length;i++){if(!numericRegExp.test(tokens[i])){alert(msg);try{textObj.focus();}catch(e){}
return false;}}
return true;}
function isIntegerList(textObj,msg){if(trim(textObj.value)==''){return true;}
var tokens=textObj.value.split(/ *, */);var integerRegExp=/(^-?\d\d*$)/;for(var i=0;i<tokens.length;i++){if(!integerRegExp.test(tokens[i])){alert(msg);try{textObj.focus();}catch(e){}
return false;}}
return true;}
function isPositive(obj,msg){if(obj.value>0){return true;}else{alert(msg);try{obj.focus();}catch(e){}
return false;}}
function isInteger(textObj,msg){var objRegExp=/(^-?\d\d*$)/;if(objRegExp.test(textObj.value)){return true;}else{alert(msg);try{textObj.focus();}catch(e){}
return false;}}
function isEmail(textObj,msg){var objRegExp=/^[\w-]+(\.[\w-]+)*@[a-zA-Z0-9]([\w\.-]*[a-zA-Z0-9])*\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;if(objRegExp.test(textObj.value)){return true;}else{alert(msg);try{textObj.focus();}catch(e){}
return false;}}
function validateCountryState(countryObj,stateObj,msg){if((countryObj.value=='US'&&stateObj.options[stateObj.selectedIndex].value=='')||(countryObj.value=='CA'&&stateObj.options[stateObj.selectedIndex].value=='')){alert(err_message);try{stateObj.focus();}catch(e){}
return false;}else{return true;}}
function validateSelection(selectObj,msg){if((selectObj.options[selectObj.selectedIndex].value==0)||(selectObj.options[selectObj.selectedIndex].value=='')){alert(msg);try{selectObj.focus();}catch(e){}
return false;}else{return true;}}
validationFields=new Array();validationFields2=new Array();validationMessages=new Array();validationType=new Array();function validateForm(form){for(var i=0;i<validationFields.length;i++){if(validationType[i]=='text'){if(!isText(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='non null'){if(!isNonNull(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='checkbox_with_text'){if(validationFields[i].checked&&!isNonNull(validationFields2[i],validationMessages[i])){return false;}}else if(validationType[i]=='int'){if(!isInteger(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='double'){if(!isNumeric(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='email'){if(!isEmail(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='country_state'){if(!validateCountryState(validationFields[i],validationFields2[i],validationMessages[i])){return false;}}else if(validationType[i]=='selection'){if(!validateSelection(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='positive'){if(!isNumeric(validationFields[i],validationMessages[i])){return false;}
if(!isPositive(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='numeric_list'){if(!isNumericList(validationFields[i],validationMessages[i])){return false;}}else if(validationType[i]=='integer_list'){if(!isIntegerList(validationFields[i],validationMessages[i])){return false;}}}
return true;}
function addValidation(fieldObject,fieldObject2,message,type){if(fieldObject){var index=findValidationField(fieldObject);if(index==-1){var cur=validationFields.length;validationFields[cur]=fieldObject;validationFields2[cur]=fieldObject2;validationMessages[cur]=message;validationType[cur]=type;}}}
function removeValidation(fieldObject){var index=findValidationField(fieldObject);if(index>=0){validationFields[index]=null;validationFields2[index]=null;validationMessages[index]=null;validationType[index]=null;}}
function findValidationField(fieldObject){var foundIndex=-1;for(var i=0;i<validationFields.length;i++){if(validationFields[i]==fieldObject){foundIndex=i;break;}}
return foundIndex;}
function isDate(month,year,day_object,this_form){var today=new Date();day=day_object[day_object.selectedIndex].value;month=month-1;if(today.getMonth()>month)
year=((year==99999)?today.getFullYear()+1:year);else
year=((year==99999)?today.getFullYear():year);var test=new Date(year,month,day);if((year==test.getFullYear())&&(month==test.getMonth())&&(day==test.getDate())){makeDatesClose(this_form,year,day_object);return true;}else{for(d=28;d<day;d++){var test=new Date(year,month,d);if((year==test.getFullYear())&&(month==test.getMonth())&&(d==test.getDate())){day_object[d-1].selected=true;}else{break;}}
makeDatesClose(this_form,year,day_object);return false;}}
function makeDatesClose(this_form,this_year,day_object){try{var date1_month=this_form.date1_month.value*1;var date2_month=this_form.date2_month.value*1;var date1_day=this_form.date1_day.value*1;var date2_day=this_form.date2_day.value*1;if(date1_month<=date2_month){months_diff=date2_month-date1_month;}else{months_diff=date2_month-date1_month+12;}
if((months_diff>4)||((months_diff==0)&&(date1_day>=date2_day))){changeDate2(this_year,day_object,this_form);}
if((date1_month==date2_month)&&(this_form.date1_day.value*1>this_form.date2_day.value*1)){this_form.date2_day.value=this_form.date1_day.value*1;}}catch(e){}}
function roundToPennies(amount){var r=Math.round(amount*Math.pow(10,2))/Math.pow(10,2);return r.toFixed(2);}
function changeClass(obj,className){obj.className=className;}
function trim(theString){return theString.replace(/^\s+|\s+$/g,'');}
var req;function loadXMLDoc(url){if(window.XMLHttpRequest){req=new XMLHttpRequest();req.onreadystatechange=processReqChange;req.open("GET",url,true);req.send(null);}else if(window.ActiveXObject){isIE=true;req=new ActiveXObject("Microsoft.XMLHTTP");if(req){req.onreadystatechange=processReqChange;req.open("GET",url,true);req.send();}}}
function processReqChange(){if(req.readyState==4){if(req.status==200){processAjaxResponse();}else{alert("There was a problem retrieving the XML data:\n"+req.statusText);}}}
function hasClass(el,className){var classes=el.className.split(" ");for(var i=0;i<classes.length;i++){if(classes[i]==className){return true;}}
return false;}
function appendClass(el,className){if(!hasClass(el,className)){el.className=el.className+" "+className;}}
function removeClass(el,className){if(hasClass(el,className)){el.className=el.className.replace(className,"");}}
function swapClass(el,oldClass,newClass){removeClass(el,oldClass);appendClass(el,newClass);}
function validateCPF(CPF){var POSICAO,I,SOMA,DV,DV_INFORMADO;var DIGITO=new Array(10);DV_INFORMADO=CPF.substr(9,2);for(I=0;I<=8;I++){DIGITO[I]=CPF.substr(I,1);}
POSICAO=10;SOMA=0;for(I=0;I<=8;I++){SOMA=SOMA+DIGITO[I]*POSICAO;POSICAO=POSICAO-1;}
DIGITO[9]=SOMA%11;if(DIGITO[9]<2){DIGITO[9]=0;}else{DIGITO[9]=11-DIGITO[9];}
POSICAO=11;SOMA=0;for(I=0;I<=9;I++){SOMA=SOMA+DIGITO[I]*POSICAO;POSICAO=POSICAO-1;}
DIGITO[10]=SOMA%11;if(DIGITO[10]<2){DIGITO[10]=0;}else{DIGITO[10]=11-DIGITO[10];}
DV=DIGITO[9]*10+DIGITO[10];if(DV!=DV_INFORMADO){return false;}
return true;}
var validateNonEmptyField=function(fieldId,message){if($F(fieldId).blank()){alert(message);$(fieldId).focus();return false;}
return true;}
function displayDetails(divId,linkTextId,closeText,openText){var elm=document.getElementById(divId);if(!elm){return;}
var divVisibility=elm.style.visibility;var visible=(divVisibility=="visible"||divVisibility=="")?false:true;displaySection(visible,divId);createDetailsLinkText(visible,linkTextId,closeText,openText);}
function createDetailsLinkText(visible,linkTextId,closeText,openText){var elm=document.getElementById(linkTextId);if(!elm){return;}
var text=(visible)?closeText:openText;elm.innerHTML=text;}
function displayAllDetails(visible,showHideObj,showAllTextId,closeText,openText,closeAllText,openAllText){for(i=0;i<showHideObj.length;i++){displaySection(visible,showHideObj[i].divId);createDetailsLinkText(visible,showHideObj[i].linkTextId,closeText,openText);}
createShowHideAllLinkText(visible,showAllTextId,closeAllText,openAllText);}
function createShowHideAllLinkText(visible,showAllTextId,closeAllText,openAllText){var elm=document.getElementById(showAllTextId);if(!elm){return;}
var text=(visible)?closeAllText:openAllText;elm.innerHTML=text;}
var highZ=3;function showHelp(helpLinkId,text){var helpContent=xGetElementById("helpAreaHelpContent");var helpBox=xGetElementById("helpArea");if(!helpBox){var mybody=document.getElementsByTagName("body").item(0);helpBox=document.createElement("DIV");helpBox.setAttribute("id","helpArea");helpBox.className="helpBox";helpBar=document.createElement("DIV");helpBar.className="helpBar";helpCloseImg=document.createElement("IMG");helpCloseImg.setAttribute("src","/images/delete.gif");helpCloseImg.setAttribute("align","right");xAddEventListener(helpCloseImg,"mousedown",hideHelpArea,false);helpBar.appendChild(helpCloseImg);helpBox.appendChild(helpBar);helpContent=document.createElement("DIV");helpContent.className="helpContent";helpContent.setAttribute("id","helpAreaHelpContent");helpBox.appendChild(helpContent);mybody.appendChild(helpBox);}
helpContent.innerHTML=text;xMoveTo(helpBox,xPageX(helpLinkId)+50,xPageY(helpLinkId));helpBox.style.display='block';}
function hideHelpArea(){var helpArea=xGetElementById("helpArea");if(helpArea){helpArea.style.display='none';}}