
var $u=YAHOO.util;var $d=$u.Dom;var $=$u.Dom.get;var $e=$u.Event;var $j=YAHOO.lang.JSON.parse;var $w=YAHOO.widget;var $q=$u.Selector.query;var $l=YAHOO.lang;FNS={autocomplete:function(url,schema,input,container,callback,typeahead)
{var oDS=new $u.XHRDataSource(url);oDS.connMethodPost=true;oDS.responseType=$u.XHRDataSource.TYPE_JSARRAY;oDS.responseSchema=schema;oDS.connXhrMode="cancelStaleRequests";var oAC=new YAHOO.widget.AutoComplete(input,container,oDS);typeahead=typeof(typeahead)!='undefined'?typeahead:true;oAC.typeAhead=typeahead;if(callback!=null)
oAC.itemSelectEvent.subscribe(callback);return{oDS:oDS,oAC:oAC};},is_inside:function(event,id)
{e=$e.getTarget(event);function isMatch(el){if(!el){return false;}
if(el.id&&el.id==id){return true;}
return false;};if(isMatch(e)){return e;}
var p=e.parentNode;while(p&&p.tagName.toUpperCase()!='BODY'){if(isMatch(p)){return true;}
p=p.parentNode;}
return false;}};function FNSDateFormat(d){var dd=d.split('/');var dat=new Date();if(dd[0]<1)
dd[0]=1;dat.setFullYear(dd[2],dd[0]-1,dd[1]);return dat;}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");}
String.prototype.ltrim=function(){return this.replace(/^\s+/,"");}
String.prototype.rtrim=function(){return this.replace(/\s+$/,"");}
function isEmpty(inputStr){if(null==inputStr||""==inputStr.trim){return true;}return false;}
function isDefined(variable){return(typeof(variable)=="undefined")?false:true;}
function is_array(input){return typeof(input)=='object'&&(input instanceof Array);}
Search={init:function(){searchPanel=new $w.Panel("search-type",{width:"280px",fixedcenter:false,constraintoviewport:true,underlay:"none",close:true,visible:false,context:['search_box','tl','bl'],draggable:false});searchPanel.render(document.body);$e.addListener('what',"focus",Search.show_type);},show_type:function(e)
{searchPanel.show();if($('what').value=='Search')
$('what').value='';$e.addListener(document,"click",Search.hide_type);setTimeout("$('what').focus()",100);},hide_type:function(e)
{if(FNS.is_inside(e,'search_box')||FNS.is_inside(e,'search-type'))
return;searchPanel.hide();$e.removeListener(document,"click",Search.hide_type);}}
$e.addListener(window,"load",Search.init);User={init:function(){$e.addListener('username',"focus",User.clear);$e.addListener('password2',"focus",User.clear);$e.addListener('newsletter_email',"focus",User.clear);},clear:function(e)
{if(this.value=='Username'||this.value=='Password'||this.value=='Email address')
this.value='';},Newsletter:function()
{var callback={success:function(o){try{var response=$j(o.responseText);if(response.error)
{alert(response.error_message);}else{$('newsletter_message').innerHTML=response.message;$d.setStyle('newsletter_box','display','none');}}
catch(e){alert("Internal server error. Please try again.");}},failure:function(o){alert("Failure! Internal server error. Please try again.");}};$u.Connect.asyncRequest('POST','/ajax/newsletter',callback,'email='+$('newsletter_email').value+'&location='+$('newsletter_loc').value);}}
$e.addListener(window,"load",User.init);Location={init:function()
{Location.fnPanel();var myHandler=function(e,args){$("new-location").value=args[2][1];};FNS.autocomplete("/ajax/location",{fields:["location","hidden"]},"location-input","location-container",myHandler);},fnPanel:function(){locationPanel=new $w.Panel("newlocation",{width:"280px",fixedcenter:false,constraintoviewport:true,underlay:"none",close:true,visible:false,context:['city-province','tl','bl'],draggable:false});$d.removeClass("newlocation","hidden-container");locationPanel.render(document.body);$e.addListener('change-location',"submit",Location.change);$e.addListener('recentlocation',"click",Location.recent);},show:function()
{var v=$d.getStyle('newlocation_c','visibility');if(v=="hidden"||v=="none")
{locationPanel.show();$e.addListener(document,"click",Location.hide);}
else
{locationPanel.hide();$e.removeListener(document,"click",Location.hide);}},hide:function(e)
{if(FNS.is_inside(e,'newlocation_c')||FNS.is_inside(e,'location-chooser'))
return;locationPanel.hide();$e.removeListener(document,"click",Location.hide);},recent:function(e){var t=$e.getTarget(e);if(t.nodeName.toLowerCase()==='a')
{$('new-location').value=t.id;Location.change(e);}},change:function(e){var callback={success:function(o){try{var response=$j(o.responseText);if(response.url==''){$('city-province').innerHTML=response.string+' |';Location.show();}else
location.href=response.url;}
catch(e){alert("Internal server error. Please try again.");}},failure:function(o){alert("Failure! Internal server error. Please try again.");}};if(!isEmpty($('new-location').value))
{$u.Connect.asyncRequest('POST','/ajax/change_location',callback,"location="+$('new-location').value+"&url="+$('url').value);$('new-location').value='';$('location-input').value='';}
$e.stopEvent(e);}}
$e.addListener(window,"load",Location.init);(function(){function IntervalCalendar(container,cfg){this._iState=0;cfg=cfg||{};cfg.multi_select=true;IntervalCalendar.superclass.constructor.call(this,container,cfg);this.beforeSelectEvent.subscribe(this._intervalOnBeforeSelect,this,true);this.selectEvent.subscribe(this._intervalOnSelect,this,true);this.beforeDeselectEvent.subscribe(this._intervalOnBeforeDeselect,this,true);this.deselectEvent.subscribe(this._intervalOnDeselect,this,true);}
IntervalCalendar._DEFAULT_CONFIG=YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;YAHOO.lang.extend(IntervalCalendar,YAHOO.widget.CalendarGroup,{_dateString:function(d){var a=[];a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_MONTH_POSITION.key)-1]=(d.getMonth()+1);a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_DAY_POSITION.key)-1]=d.getDate();a[this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.MDY_YEAR_POSITION.key)-1]=d.getFullYear();var s=this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.DATE_FIELD_DELIMITER.key);return a.join(s);},_dateIntervalString:function(l,u){var s=this.cfg.getProperty(IntervalCalendar._DEFAULT_CONFIG.DATE_RANGE_DELIMITER.key);return(this._dateString(l)
+s+this._dateString(u));},getInterval:function(){var dates=this.getSelectedDates();if(dates.length>0){var l=dates[0];var u=dates[dates.length-1];return[l,u];}
else{return[];}},setInterval:function(d1,d2){var b=(d1<=d2);var l=b?d1:d2;var u=b?d2:d1;this.cfg.setProperty('selected',this._dateIntervalString(l,u),false);this._iState=2;},resetInterval:function(){this.cfg.setProperty('selected',[],false);this._iState=0;},_intervalOnBeforeSelect:function(t,a,o){this._iState=(this._iState+1)%3;if(this._iState==0){this.deselectAll();this._iState++;}},_intervalOnSelect:function(t,a,o){var dates=this.getSelectedDates();if(dates.length>1){var l=dates[0];var u=dates[dates.length-1];this.cfg.setProperty('selected',this._dateIntervalString(l,u),false);}
this.render();},_intervalOnBeforeDeselect:function(t,a,o){if(this._iState!=0){return false;}},_intervalOnDeselect:function(t,a,o){if(this._iState!=0){this._iState=0;this.deselectAll();var d=a[0][0];var date=YAHOO.widget.DateMath.getDate(d[0],d[1]-1,d[2]);var page=this.getCalendarPage(date);if(page){page.beforeSelectEvent.fire();this.cfg.setProperty('selected',this._dateString(date),false);page.selectEvent.fire([d]);}
return false;}}});YAHOO.namespace("example.calendar");YAHOO.example.calendar.IntervalCalendar=IntervalCalendar;})();YAHOO.util.Event.onDOMReady(function(){var inTxt=YAHOO.util.Dom.get("from_date"),outTxt=YAHOO.util.Dom.get("to_date"),inDate,outDate,interval;inTxt.value="";outTxt.value="";var cal=new YAHOO.example.calendar.IntervalCalendar("calContainer",{locale_weekdays:'1char',locale_months:'short',pages:1});cal.selectEvent.subscribe(function(){interval=this.getInterval();if(interval.length==2){inDate=interval[0];inTxt.value=(inDate.getMonth()+1)+"/"+inDate.getDate()+"/"+inDate.getFullYear();outDate=interval[1];outTxt.value=(outDate.getMonth()+1)+"/"+outDate.getDate()+"/"+outDate.getFullYear();}},cal,true);cal.render();});morelinks={hideClass:'dynamic',moreContentClass:'more',hideLinkClass:'hidden-container',lessLabel:'Hide',init:function(moreLabel){morelinks.moreLabel=moreLabel;$d.addClass(this,morelinks.hideClass);var bios=$d.getElementsByClassName(morelinks.moreContentClass,null,this);for(var i=0;i<bios.length;i++){var moreLink=document.createElement('a');moreLink.setAttribute('href','#');moreLink.appendChild(document.createTextNode(morelinks.moreLabel));$e.addListener(moreLink,'click',morelinks.show,bios[i]);bios[i].parentNode.insertBefore(moreLink,bios[i]);var lessLink=document.createElement('a');lessLink.setAttribute('href','#');lessLink.appendChild(document.createTextNode(morelinks.lessLabel));$e.addListener(lessLink,'click',morelinks.hide,bios[i]);bios[i].appendChild(lessLink,bios[i]);}},show:function(e,o){$d.addClass(this,morelinks.hideLinkClass);$d.removeClass(o,morelinks.moreContentClass);$e.preventDefault(e);},hide:function(e,o){$d.removeClass(o.previousSibling,morelinks.hideLinkClass);$d.addClass(o,morelinks.moreContentClass);$e.preventDefault(e);}}