Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.abbrDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.abbrMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Date.firstDayOfWeek=1;Date.format="dd/mm/yyyy";Date.fullYearStart="20";(function(){function b(c,d){if(!Date.prototype[c]){Date.prototype[c]=d;}}b("isLeapYear",function(){var c=this.getFullYear();return(c%4==0&&c%100!=0)||c%400==0;});b("isWeekend",function(){return this.getDay()==0||this.getDay()==6;});b("isWeekDay",function(){return !this.isWeekend();});b("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];});b("getDayName",function(c){return c?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()];});b("getMonthName",function(c){return c?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()];});b("getDayOfYear",function(){var c=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-c.getTime())/86400000);});b("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7);});b("setDayOfYear",function(c){this.setMonth(0);this.setDate(c);return this;});b("addYears",function(c){this.setFullYear(this.getFullYear()+c);return this;});b("addMonths",function(d){var c=this.getDate();this.setMonth(this.getMonth()+d);if(c>this.getDate()){this.addDays(-this.getDate());}return this;});b("addDays",function(c){this.setTime(this.getTime()+(c*86400000));return this;});b("addHours",function(c){this.setHours(this.getHours()+c);return this;});b("addMinutes",function(c){this.setMinutes(this.getMinutes()+c);return this;});b("addSeconds",function(c){this.setSeconds(this.getSeconds()+c);return this;});b("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this;});b("asString",function(d){var c=d||Date.format;if(c.split("mm").length>1){c=c.split("mmmm").join(this.getMonthName(false)).split("mmm").join(this.getMonthName(true)).split("mm").join(a(this.getMonth()+1));}else{c=c.split("m").join(this.getMonth()+1);}c=c.split("yyyy").join(this.getFullYear()).split("yy").join((this.getFullYear()+"").substring(2)).split("dd").join(a(this.getDate())).split("d").join(this.getDate());return c;});Date.fromString=function(t){var n=Date.format;var p=new Date("01/01/1970");if(t==""){return p;}t=t.toLowerCase();var m="";var e=[];var c=/(dd?d?|mm?m?|yy?yy?)+([^(m|d|y)])?/g;var k;while((k=c.exec(n))!=null){switch(k[1]){case"d":case"dd":case"m":case"mm":case"yy":case"yyyy":m+="(\\d+\\d?\\d?\\d?)+";e.push(k[1].substr(0,1));break;case"mmm":m+="([a-z]{3})";e.push("M");break;}if(k[2]){m+=k[2];}}var l=new RegExp(m);var q=t.match(l);for(var h=0;h<e.length;h++){var o=q[h+1];switch(e[h]){case"d":p.setDate(o);break;case"m":p.setMonth(Number(o)-1);break;case"M":for(var g=0;g<Date.abbrMonthNames.length;g++){if(Date.abbrMonthNames[g].toLowerCase()==o){break;}}p.setMonth(g);break;case"y":p.setYear(o);break;}}return p;};var a=function(c){var d="0"+c;return d.substring(d.length-2);};})();(function(d){d.fn.extend({renderCalendar:function(t){var C=function(i){return document.createElement(i);};t=d.extend({},d.fn.datePicker.defaults,t);if(t.showHeader!=d.dpConst.SHOW_HEADER_NONE){var o=d(C("tr"));for(var x=Date.firstDayOfWeek-1;x<Date.firstDayOfWeek+6;x++){var h=x%7;var v=Date.dayNames[h];o.append(jQuery(C("th")).attr({"scope":"col","abbr":v,"title":v,"class":(h==0||h==6?"weekend":"weekday")}).html(t.showHeader==d.dpConst.SHOW_HEADER_SHORT?v.substr(0,1):v));}}var e=d(C("table")).attr({"cellspacing":0}).addClass("jCalendar").append((t.showHeader!=d.dpConst.SHOW_HEADER_NONE?d(C("thead")).append(o):C("thead")));var f=d(C("tbody"));var z=(new Date()).zeroTime();z.setHours(12);var B=t.month==undefined?z.getMonth():t.month;var p=t.year||z.getFullYear();var m=(new Date(p,B,1,12,0,0));var l=Date.firstDayOfWeek-m.getDay();if(l>1){l-=7;}var q=Math.ceil(((-1*l+1)+m.getDaysInMonth())/7);m.addDays(l-1);var A=function(i){return function(){if(t.hoverClass){var r=d(this);if(!t.selectWeek){r.addClass(t.hoverClass);}else{if(i&&!r.is(".disabled")){r.parent().addClass("activeWeekHover");}}}};};var g=function(){if(t.hoverClass){var i=d(this);i.removeClass(t.hoverClass);i.parent().removeClass("activeWeekHover");}};var n=0;while(n++<q){var u=jQuery(C("tr"));var k=t.dpController?m>t.dpController.startDate:false;for(var x=0;x<7;x++){var j=m.getMonth()==B;var y=d(C("td")).text(m.getDate()+"").addClass((j?"current-month ":"other-month ")+(m.isWeekend()?"weekend ":"weekday ")+(j&&m.getTime()==z.getTime()?"today ":"")).data("datePickerDate",m.asString()).hover(A(k),g);u.append(y);if(t.renderCallback){t.renderCallback(y,m,B,p);}m=new Date(m.getFullYear(),m.getMonth(),m.getDate()+1,12,0,0);}f.append(u);}e.append(f);return this.each(function(){d(this).empty().append(e);});},datePicker:function(e){if(!d.event._dpCache){d.event._dpCache=[];}e=d.extend({},d.fn.datePicker.defaults,e);return this.each(function(){var g=d(this);var i=true;if(!this._dpId){this._dpId=d.event.guid++;d.event._dpCache[this._dpId]=new a(this);i=false;}if(e.inline){e.createButton=false;e.displayClose=false;e.closeOnSelect=false;g.empty();}var f=d.event._dpCache[this._dpId];f.init(e);if(!i&&e.createButton){f.button=d('<a href="#" class="dp-choose-date" title="'+d.dpText.TEXT_CHOOSE_DATE+'">'+d.dpText.TEXT_CHOOSE_DATE+"</a>").bind("click",function(){g.dpDisplay(this);this.blur();return false;});g.after(f.button);}if(!i&&g.is(":text")){g.bind("dateSelected",function(k,j,l){this.value=j.asString();}).bind("change",function(){if(this.value==""){f.clearSelected();}else{var j=Date.fromString(this.value);if(j){f.setSelected(j,true,true);}}});if(e.clickInput){g.bind("click",function(){g.trigger("change");g.dpDisplay();});}var h=Date.fromString(this.value);if(this.value!=""&&h){f.setSelected(h,true,true);}}g.addClass("dp-applied");});},dpSetDisabled:function(e){return b.call(this,"setDisabled",e);},dpSetStartDate:function(e){return b.call(this,"setStartDate",e);},dpSetEndDate:function(e){return b.call(this,"setEndDate",e);},dpGetSelected:function(){var e=c(this[0]);if(e){return e.getSelected();}return null;},dpSetSelected:function(i,g,f,h){if(g==undefined){g=true;}if(f==undefined){f=true;}if(h==undefined){h=true;}return b.call(this,"setSelected",Date.fromString(i),g,f,h);},dpSetDisplayedMonth:function(e,f){return b.call(this,"setDisplayedMonth",Number(e),Number(f),true);},dpDisplay:function(f){return b.call(this,"display",f);},dpSetRenderCallback:function(e){return b.call(this,"setRenderCallback",e);},dpSetPosition:function(e,f){return b.call(this,"setPosition",e,f);},dpSetOffset:function(e,f){return b.call(this,"setOffset",e,f);},dpClose:function(){return b.call(this,"_closeCalendar",false,this[0]);},dpRerenderCalendar:function(){return b.call(this,"_rerenderCalendar");},_dpDestroy:function(){}});var b=function(h,g,e,j,i){return this.each(function(){var f=c(this);if(f){f[h](g,e,j,i);}});};function a(e){this.ele=e;this.displayedMonth=null;this.displayedYear=null;this.startDate=null;this.endDate=null;this.showYearNavigation=null;this.closeOnSelect=null;this.displayClose=null;this.rememberViewedMonth=null;this.selectMultiple=null;this.numSelectable=null;this.numSelected=null;this.verticalPosition=null;this.horizontalPosition=null;this.verticalOffset=null;this.horizontalOffset=null;this.button=null;this.renderCallback=[];this.selectedDates={};this.inline=null;this.context="#dp-popup";this.settings={};}d.extend(a.prototype,{init:function(e){this.setStartDate(e.startDate);this.setEndDate(e.endDate);this.setDisplayedMonth(Number(e.month),Number(e.year));this.setRenderCallback(e.renderCallback);this.showYearNavigation=e.showYearNavigation;this.closeOnSelect=e.closeOnSelect;this.displayClose=e.displayClose;this.rememberViewedMonth=e.rememberViewedMonth;this.selectMultiple=e.selectMultiple;this.numSelectable=e.selectMultiple?e.numSelectable:1;this.numSelected=0;this.verticalPosition=e.verticalPosition;this.horizontalPosition=e.horizontalPosition;this.hoverClass=e.hoverClass;this.setOffset(e.verticalOffset,e.horizontalOffset);this.inline=e.inline;this.settings=e;if(this.inline){this.context=this.ele;this.display();}},setStartDate:function(e){if(e){this.startDate=Date.fromString(e);}if(!this.startDate){this.startDate=(new Date()).zeroTime();}this.setDisplayedMonth(this.displayedMonth,this.displayedYear);},setEndDate:function(e){if(e){this.endDate=Date.fromString(e);}if(!this.endDate){this.endDate=(new Date("12/31/2999"));}if(this.endDate.getTime()<this.startDate.getTime()){this.endDate=this.startDate;}this.setDisplayedMonth(this.displayedMonth,this.displayedYear);},setPosition:function(e,f){this.verticalPosition=e;this.horizontalPosition=f;},setOffset:function(e,f){this.verticalOffset=parseInt(e)||0;this.horizontalOffset=parseInt(f)||0;},setDisabled:function(e){$e=d(this.ele);$e[e?"addClass":"removeClass"]("dp-disabled");if(this.button){$but=d(this.button);$but[e?"addClass":"removeClass"]("dp-disabled");$but.attr("title",e?"":d.dpText.TEXT_CHOOSE_DATE);}if($e.is(":text")){$e.attr("disabled",e?"disabled":"");}},setDisplayedMonth:function(f,n,j){if(this.startDate==undefined||this.endDate==undefined){return;}var i=new Date(this.startDate.getTime());i.setDate(1);var l=new Date(this.endDate.getTime());l.setDate(1);var h;if((!f&&!n)||(isNaN(f)&&isNaN(n))){h=new Date().zeroTime();h.setDate(1);}else{if(isNaN(f)){h=new Date(n,this.displayedMonth,1);}else{if(isNaN(n)){h=new Date(this.displayedYear,f,1);}else{h=new Date(n,f,1);}}}if(h.getTime()<i.getTime()){h=i;}else{if(h.getTime()>l.getTime()){h=l;}}var g=this.displayedMonth;var k=this.displayedYear;this.displayedMonth=h.getMonth();this.displayedYear=h.getFullYear();if(j&&(this.displayedMonth!=g||this.displayedYear!=k)){this._rerenderCalendar();d(this.ele).trigger("dpMonthChanged",[this.displayedMonth,this.displayedYear]);}},setSelected:function(l,e,f,h){if(l<this.startDate||l.zeroTime()>this.endDate.zeroTime()){return;}var g=this.settings;if(g.selectWeek){l=l.addDays(-(l.getDay()-Date.firstDayOfWeek+7)%7);if(l<this.startDate){return;}}if(e==this.isSelected(l)){return;}if(this.selectMultiple==false){this.clearSelected();}else{if(e&&this.numSelected==this.numSelectable){return;}}if(f&&(this.displayedMonth!=l.getMonth()||this.displayedYear!=l.getFullYear())){this.setDisplayedMonth(l.getMonth(),l.getFullYear(),true);}this.selectedDates[l.asString()]=e;this.numSelected+=e?1:-1;var j="td."+(l.getMonth()==this.displayedMonth?"current-month":"other-month");var k;d(j,this.context).each(function(){if(d(this).data("datePickerDate")==l.asString()){k=d(this);if(g.selectWeek){k.parent()[e?"addClass":"removeClass"]("selectedWeek");}k[e?"addClass":"removeClass"]("selected");}});d("td",this.context).not(".selected")[this.selectMultiple&&this.numSelected==this.numSelectable?"addClass":"removeClass"]("unselectable");if(h){var g=this.isSelected(l);$e=d(this.ele);var i=Date.fromString(l.asString());$e.trigger("dateSelected",[i,k,g]);$e.trigger("change");}},isSelected:function(e){return this.selectedDates[e.asString()];},getSelected:function(){var f=[];for(var e in this.selectedDates){if(this.selectedDates[e]==true){f.push(Date.fromString(e));}}return f;},clearSelected:function(){this.selectedDates={};this.numSelected=0;d("td.selected",this.context).removeClass("selected").parent().removeClass("selectedWeek");},display:function(e){if(d(this.ele).is(".dp-disabled")){return;}e=e||this.ele;var m=this;var i=d(e);var l=i.offset();var n;var o;var g;var j;if(m.inline){n=d(this.ele);o={"id":"calendar-"+this.ele._dpId,"class":"dp-popup dp-popup-inline"};d(".dp-popup",n).remove();j={};}else{n=d("body");o={"id":"dp-popup","class":"dp-popup"};j={"top":l.top+m.verticalOffset,"left":l.left+m.horizontalOffset};var k=function(r){var p=r.target;var q=d("#dp-popup")[0];while(true){if(p==q){return true;}else{if(p==document){m._closeCalendar();return false;}else{p=d(p).parent()[0];}}}};this._checkMouse=k;m._closeCalendar(true);d(document).bind("keydown.datepicker",function(p){if(p.keyCode==27){m._closeCalendar();}});}if(!m.rememberViewedMonth){var h=this.getSelected()[0];if(h){h=new Date(h);this.setDisplayedMonth(h.getMonth(),h.getFullYear(),false);}}n.append(d("<div></div>").attr(o).css(j).append(d("<h4></h4>"),d('<div class="dp-nav-prev"></div>').append(d('<a class="dp-nav-prev-year" href="#" title="'+d.dpText.TEXT_PREV_YEAR+'">&lt;&lt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,0,-1);}),d('<a class="dp-nav-prev-month" href="#" title="'+d.dpText.TEXT_PREV_MONTH+'">&lt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,-1,0);})),d('<div class="dp-nav-next"></div>').append(d('<a class="dp-nav-next-year" href="#" title="'+d.dpText.TEXT_NEXT_YEAR+'">&gt;&gt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,0,1);}),d('<a class="dp-nav-next-month" href="#" title="'+d.dpText.TEXT_NEXT_MONTH+'">&gt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,1,0);})),d('<div class="dp-calendar"></div>')).bgIframe());var f=this.inline?d(".dp-popup",this.context):d("#dp-popup");if(this.showYearNavigation==false){d(".dp-nav-prev-year, .dp-nav-next-year",m.context).css("display","none");}if(this.displayClose){f.append(d('<a href="#" id="dp-close">'+d.dpText.TEXT_CLOSE+"</a>").bind("click",function(){m._closeCalendar();return false;}));}m._renderCalendar();d(this.ele).trigger("dpDisplayed",f);if(!m.inline){if(this.verticalPosition==d.dpConst.POS_BOTTOM){f.css("top",l.top+i.height()-f.height()+m.verticalOffset);}if(this.horizontalPosition==d.dpConst.POS_RIGHT){f.css("left",l.left+i.width()-f.width()+m.horizontalOffset);}d(document).bind("mousedown.datepicker",this._checkMouse);}},setRenderCallback:function(e){if(e==null){return;}if(e&&typeof(e)=="function"){e=[e];}this.renderCallback=this.renderCallback.concat(e);},cellRender:function(i,e,g,f){var j=this.dpController;var h=new Date(e.getTime());i.bind("click",function(){var m=d(this);if(!m.is(".disabled")){j.setSelected(h,!m.is(".selected")||!j.selectMultiple,false,true);if(j.closeOnSelect){if(j.settings.autoFocusNextInput){var l=j.ele;var k=false;d(":input",l.form).each(function(){if(k){d(this).focus();return false;}if(this==l){k=true;}});}else{j.ele.focus();}j._closeCalendar();}}});if(j.isSelected(h)){i.addClass("selected");if(j.settings.selectWeek){i.parent().addClass("selectedWeek");}}else{if(j.selectMultiple&&j.numSelected==j.numSelectable){i.addClass("unselectable");}}},_applyRenderCallbacks:function(){var e=this;d("td",this.context).each(function(){for(var f=0;f<e.renderCallback.length;f++){$td=d(this);e.renderCallback[f].apply(this,[$td,Date.fromString($td.data("datePickerDate")),e.displayedMonth,e.displayedYear]);}});return;},_displayNewMonth:function(f,e,g){if(!d(f).is(".disabled")){this.setDisplayedMonth(this.displayedMonth+e,this.displayedYear+g,true);}f.blur();return false;},_rerenderCalendar:function(){this._clearCalendar();this._renderCalendar();},_renderCalendar:function(){d("h4",this.context).html((new Date(this.displayedYear,this.displayedMonth,1)).asString(d.dpText.HEADER_FORMAT));d(".dp-calendar",this.context).renderCalendar(d.extend({},this.settings,{month:this.displayedMonth,year:this.displayedYear,renderCallback:this.cellRender,dpController:this,hoverClass:this.hoverClass}));if(this.displayedYear==this.startDate.getFullYear()&&this.displayedMonth==this.startDate.getMonth()){d(".dp-nav-prev-year",this.context).addClass("disabled");d(".dp-nav-prev-month",this.context).addClass("disabled");d(".dp-calendar td.other-month",this.context).each(function(){var j=d(this);if(Number(j.text())>20){j.addClass("disabled");}});var i=this.startDate.getDate();d(".dp-calendar td.current-month",this.context).each(function(){var j=d(this);if(Number(j.text())<i){j.addClass("disabled");}});}else{d(".dp-nav-prev-year",this.context).removeClass("disabled");d(".dp-nav-prev-month",this.context).removeClass("disabled");var f=this.startDate.getDate();if(f>20){var g=this.startDate.getTime();var h=new Date(g);h.addMonths(1);if(this.displayedYear==h.getFullYear()&&this.displayedMonth==h.getMonth()){d(".dp-calendar td.other-month",this.context).each(function(){var j=d(this);if(Date.fromString(j.data("datePickerDate")).getTime()<g){j.addClass("disabled");}});}}}if(this.displayedYear==this.endDate.getFullYear()&&this.displayedMonth==this.endDate.getMonth()){d(".dp-nav-next-year",this.context).addClass("disabled");d(".dp-nav-next-month",this.context).addClass("disabled");d(".dp-calendar td.other-month",this.context).each(function(){var j=d(this);if(Number(j.text())<14){j.addClass("disabled");}});var f=this.endDate.getDate();d(".dp-calendar td.current-month",this.context).each(function(){var j=d(this);if(Number(j.text())>f){j.addClass("disabled");}});}else{d(".dp-nav-next-year",this.context).removeClass("disabled");d(".dp-nav-next-month",this.context).removeClass("disabled");var f=this.endDate.getDate();if(f<13){var e=new Date(this.endDate.getTime());e.addMonths(-1);if(this.displayedYear==e.getFullYear()&&this.displayedMonth==e.getMonth()){d(".dp-calendar td.other-month",this.context).each(function(){var k=d(this);var j=Number(k.text());if(j<13&&j>i){k.addClass("disabled");}});}}}this._applyRenderCallbacks();},_closeCalendar:function(e,f){if(!f||f==this.ele){d(document).unbind("mousedown.datepicker");d(document).unbind("keydown.datepicker");this._clearCalendar();d("#dp-popup a").unbind();d("#dp-popup").empty().remove();if(!e){d(this.ele).trigger("dpClosed",[this.getSelected()]);}}},_clearCalendar:function(){d(".dp-calendar td",this.context).unbind();d(".dp-calendar",this.context).empty();}});d.dpConst={SHOW_HEADER_NONE:0,SHOW_HEADER_SHORT:2,SHOW_HEADER_LONG:2,POS_TOP:0,POS_BOTTOM:1,POS_LEFT:0,POS_RIGHT:1,DP_INTERNAL_FOCUS:"dpInternalFocusTrigger"};d.dpText={TEXT_PREV_YEAR:"Previous year",TEXT_PREV_MONTH:"Previous month",TEXT_NEXT_YEAR:"Next year",TEXT_NEXT_MONTH:"Next month",TEXT_CLOSE:"Close",TEXT_CHOOSE_DATE:"Choose date",HEADER_FORMAT:"mmmm yyyy"};d.dpVersion="$Id: jquery.datePicker.js 102 2010-09-13 14:00:54Z kelvin.luck $";d.fn.datePicker.defaults={month:undefined,year:undefined,showHeader:d.dpConst.SHOW_HEADER_SHORT,startDate:undefined,endDate:undefined,inline:false,renderCallback:null,createButton:true,showYearNavigation:true,closeOnSelect:true,displayClose:false,selectMultiple:false,numSelectable:Number.MAX_VALUE,clickInput:false,rememberViewedMonth:true,selectWeek:false,verticalPosition:d.dpConst.POS_TOP,horizontalPosition:d.dpConst.POS_LEFT,verticalOffset:0,horizontalOffset:0,hoverClass:"dp-hover",autoFocusNextInput:false};function c(e){if(e._dpId){return d.event._dpCache[e._dpId];}return false;}if(d.fn.bgIframe==undefined){d.fn.bgIframe=function(){return this;};}d(window).bind("unload",function(){var f=d.event._dpCache||[];for(var e in f){d(f[e].ele)._dpDestroy();}});})(jQuery);(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);c.highlight=c.highlight||function(e){return e;};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c);});},result:function(b){return this.bind("result",b);},search:function(b){return this.trigger("search",[b]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(b){return this.trigger("setOptions",[b]);},unautocomplete:function(){return this.trigger("unautocomplete");}});a.Autocompleter=function(l,g){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var b=a(l).attr("autocomplete","off").addClass(g.inputClass);var j;var p="";var m=a.Autocompleter.Cache(g);var e=0;var u;var x={mouseDownOnSelect:false};var r=a.Autocompleter.Select(g,l,d,x);var w;a.browser.opera&&a(l.form).bind("submit.autocomplete",function(){if(w){w=false;return false;}});b.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(y){e=1;u=y.keyCode;switch(y.keyCode){case c.UP:y.preventDefault();if(r.visible()){r.prev();}else{t(0,true);}break;case c.DOWN:y.preventDefault();if(r.visible()){r.next();}else{t(0,true);}break;case c.PAGEUP:y.preventDefault();if(r.visible()){r.pageUp();}else{t(0,true);}break;case c.PAGEDOWN:y.preventDefault();if(r.visible()){r.pageDown();}else{t(0,true);}break;case g.multiple&&a.trim(g.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RETURN:if(d()){y.preventDefault();w=true;return false;}break;case c.ESC:r.hide();break;default:clearTimeout(j);j=setTimeout(t,g.delay);break;}}).focus(function(){e++;}).blur(function(){e=0;if(!x.mouseDownOnSelect){s();}}).click(function(){if(e++>1&&!r.visible()){t(0,true);}}).bind("search",function(){var y=(arguments.length>1)?arguments[1]:null;function z(D,C){var A;if(C&&C.length){for(var B=0;B<C.length;B++){if(C[B].result.toLowerCase()==D.toLowerCase()){A=C[B];break;}}}if(typeof y=="function"){y(A);}else{b.trigger("result",A&&[A.data,A.value]);}}a.each(h(b.val()),function(A,B){f(B,z,z);});}).bind("flushCache",function(){m.flush();}).bind("setOptions",function(){a.extend(g,arguments[1]);if("data" in arguments[1]){m.populate();}}).bind("unautocomplete",function(){r.unbind();b.unbind();a(l.form).unbind(".autocomplete");});function d(){var B=r.selected();if(!B){return false;}var y=B.result;p=y;if(g.multiple){var E=h(b.val());if(E.length>1){var A=g.multipleSeparator.length;var D=a(l).selection().start;var C,z=0;a.each(E,function(F,G){z+=G.length;if(D<=z){C=F;return false;}z+=A;});E[C]=y;y=E.join(g.multipleSeparator);}y+=g.multipleSeparator;}b.val(y);v();b.trigger("result",[B.data,B.value]);return true;}function t(A,z){if(u==c.DEL){r.hide();return;}var y=b.val();if(!z&&y==p){return;}p=y;y=i(y);if(y.length>=g.minChars){b.addClass(g.loadingClass);if(!g.matchCase){y=y.toLowerCase();}f(y,k,v);}else{n();r.hide();}}function h(y){if(!y){return[""];}if(!g.multiple){return[a.trim(y)];}return a.map(y.split(g.multipleSeparator),function(z){return a.trim(y).length?a.trim(z):null;});}function i(y){if(!g.multiple){return y;}var A=h(y);if(A.length==1){return A[0];}var z=a(l).selection().start;if(z==y.length){A=h(y);}else{A=h(y.replace(y.substring(z),""));}return A[A.length-1];}function q(y,z){if(g.autoFill&&(i(b.val()).toLowerCase()==y.toLowerCase())&&u!=c.BACKSPACE){b.val(b.val()+z.substring(i(p).length));a(l).selection(p.length,p.length+z.length);}}function s(){clearTimeout(j);j=setTimeout(v,200);}function v(){var y=r.visible();r.hide();clearTimeout(j);n();if(g.mustMatch){b.search(function(z){if(!z){if(g.multiple){var A=h(b.val()).slice(0,-1);b.val(A.join(g.multipleSeparator)+(A.length?g.multipleSeparator:""));}else{b.val("");b.trigger("result",null);}}});}}function k(z,y){if(y&&y.length&&e){n();r.display(y,z);q(z,y[0].value);r.show();}else{v();}}function f(z,B,y){if(!g.matchCase){z=z.toLowerCase();}var A=m.load(z);if(A&&A.length){B(z,A);}else{if((typeof g.url=="string")&&(g.url.length>0)){var C={timestamp:+new Date()};a.each(g.extraParams,function(D,E){C[D]=typeof E=="function"?E():E;});a.ajax({mode:"abort",port:"autocomplete"+l.name,dataType:g.dataType,url:g.url,data:a.extend({q:i(z),limit:g.max},C),success:function(E){var D=g.parse&&g.parse(E)||o(E);m.add(z,D);B(z,D);}});}else{r.emptyList();y(z);}}}function o(B){var y=[];var A=B.split("\n");for(var z=0;z<A.length;z++){var C=a.trim(A[z]);if(C){C=C.split("|");y[y.length]={data:C,value:C[0],result:g.formatResult&&g.formatResult(C,C[0])||C[0]};}}return y;}function n(){b.removeClass(g.loadingClass);}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(b){return b[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};a.Autocompleter.Cache=function(c){var f={};var d=0;function h(l,k){if(!c.matchCase){l=l.toLowerCase();}var j=l.indexOf(k);if(c.matchContains=="word"){j=l.toLowerCase().search("\\b"+k.toLowerCase());}if(j==-1){return false;}return j==0||c.matchContains;}function g(j,i){if(d>c.cacheLength){b();}if(!f[j]){d++;}f[j]=i;}function e(){if(!c.data){return false;}var k={},j=0;if(!c.url){c.cacheLength=1;}k[""]=[];for(var m=0,l=c.data.length;m<l;m++){var p=c.data[m];p=(typeof p=="string")?[p]:p;var o=c.formatMatch(p,m+1,c.data.length);if(o===false){continue;}var n=o.charAt(0).toLowerCase();if(!k[n]){k[n]=[];}var q={value:o,data:p,result:c.formatResult&&c.formatResult(p)||o};k[n].push(q);if(j++<c.max){k[""].push(q);}}a.each(k,function(r,s){c.cacheLength++;g(r,s);});}setTimeout(e,25);function b(){f={};d=0;}return{flush:b,add:g,populate:e,load:function(n){if(!c.cacheLength||!d){return null;}if(!c.url&&c.matchContains){var m=[];for(var j in f){if(j.length>0){var o=f[j];a.each(o,function(p,k){if(h(k.value,n)){m.push(k);}});}}return m;}else{if(f[n]){return f[n];}else{if(c.matchSubset){for(var l=n.length-1;l>=c.minChars;l--){var o=f[n.substr(0,l)];if(o){var m=[];a.each(o,function(p,k){if(h(k.value,n)){m[m.length]=k;}});return m;}}}}}return null;}};};a.Autocompleter.Select=function(e,j,l,p){var i={ACTIVE:"ac_over"};var k,f=-1,r,m="",s=true,c,o;function n(){if(!s){return;}c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").appendTo(document.body);o=a("<ul/>").appendTo(c).mouseover(function(t){if(q(t).nodeName&&q(t).nodeName.toUpperCase()=="LI"){f=a("li",o).removeClass(i.ACTIVE).index(q(t));a(q(t)).addClass(i.ACTIVE);}}).click(function(t){a(q(t)).addClass(i.ACTIVE);l();j.focus();return false;}).mousedown(function(){p.mouseDownOnSelect=true;}).mouseup(function(){p.mouseDownOnSelect=false;});if(e.width>0){c.css("width",e.width);}s=false;}function q(u){var t=u.target;while(t&&t.tagName!="LI"){t=t.parentNode;}if(!t){return[];}return t;}function h(t){k.slice(f,f+1).removeClass(i.ACTIVE);g(t);var v=k.slice(f,f+1).addClass(i.ACTIVE);if(e.scroll){var u=0;k.slice(0,f).each(function(){u+=this.offsetHeight;});if((u+v[0].offsetHeight-o.scrollTop())>o[0].clientHeight){o.scrollTop(u+v[0].offsetHeight-o.innerHeight());}else{if(u<o.scrollTop()){o.scrollTop(u);}}}}function g(t){f+=t;if(f<0){f=k.size()-1;}else{if(f>=k.size()){f=0;}}}function b(t){return e.max&&e.max<t?e.max:t;}function d(){o.empty();var u=b(r.length);for(var v=0;v<u;v++){if(!r[v]){continue;}var w=e.formatItem(r[v].data,v+1,u,r[v].value,m);if(w===false){continue;}var t=a("<li/>").html(e.highlight(w,m)).addClass(v%2==0?"ac_even":"ac_odd").appendTo(o)[0];a.data(t,"ac_data",r[v]);}k=o.find("li");if(e.selectFirst){k.slice(0,1).addClass(i.ACTIVE);f=0;}if(a.fn.bgiframe){o.bgiframe();}}return{display:function(u,t){n();r=u;m=t;d();},next:function(){h(1);},prev:function(){h(-1);},pageUp:function(){if(f!=0&&f-8<0){h(-f);}else{h(-8);}},pageDown:function(){if(f!=k.size()-1&&f+8>k.size()){h(k.size()-1-f);}else{h(8);}},hide:function(){c&&c.hide();k&&k.removeClass(i.ACTIVE);f=-1;},visible:function(){return c&&c.is(":visible");},current:function(){return this.visible()&&(k.filter("."+i.ACTIVE)[0]||e.selectFirst&&k[0]);},show:function(){var v=a(j).offset();c.css({width:typeof e.width=="string"||e.width>0?e.width:a(j).width(),top:v.top+j.offsetHeight,left:v.left}).show();if(e.scroll){o.scrollTop(0);o.css({maxHeight:e.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var t=0;k.each(function(){t+=this.offsetHeight;});var u=t>e.scrollHeight;o.css("height",u?e.scrollHeight:t);if(!u){k.width(o.width()-parseInt(k.css("padding-left"))-parseInt(k.css("padding-right")));}}}},selected:function(){var t=k&&k.filter("."+i.ACTIVE).removeClass(i.ACTIVE);return t&&t.length&&a.data(t[0],"ac_data");},emptyList:function(){o&&o.empty();},unbind:function(){c&&c.remove();}};};a.fn.selection=function(i,b){if(i!==undefined){return this.each(function(){if(this.createTextRange){var j=this.createTextRange();if(b===undefined||i==b){j.move("character",i);j.select();}else{j.collapse(true);j.moveStart("character",i);j.moveEnd("character",b);j.select();}}else{if(this.setSelectionRange){this.setSelectionRange(i,b);}else{if(this.selectionStart){this.selectionStart=i;this.selectionEnd=b;}}}});}var g=this[0];if(g.createTextRange){var c=document.selection.createRange(),h=g.value,f="<->",d=c.text.length;c.text=f;var e=g.value.indexOf(f);g.value=h;this.selection(e,e+d);return{start:e,end:e+d};}else{if(g.selectionStart!==undefined){return{start:g.selectionStart,end:g.selectionEnd};}}};})(jQuery);(function($){$.fn.carouFredSel=function(o){if(this.length===0){return log("No element selected.");}if(this.length>1){return this.each(function(){$(this).carouFredSel(o);});}this.init=function(o){if(typeof o!=="object"){o={};}if(typeof o.scroll==="number"){if(o.scroll<=50){o.scroll={items:o.scroll};}else{o.scroll={duration:o.scroll};}}else{if(typeof o.scroll==="string"){o.scroll={easing:o.scroll};}}if(typeof o.items==="number"){o.items={visible:o.items};}else{if(typeof o.items==="string"){o.items={visible:o.items,width:o.items,height:o.items};}}opts=$.extend(true,{},$.fn.carouFredSel.defaults,o);opts.padding=getPadding(opts.padding);opts.usePadding=(opts.padding[0]===0&&opts.padding[1]===0&&opts.padding[2]===0&&opts.padding[3]===0)?false:true;direction=(opts.direction==="up"||opts.direction==="left")?"next":"prev";if(opts.direction==="right"||opts.direction==="left"){opts.dimentions=["width","outerWidth","height","outerHeight","left","top","marginRight","innerWidth"];}else{opts.dimentions=["height","outerHeight","width","outerWidth","top","left","marginBottom","innerHeight"];opts.padding=[opts.padding[3],opts.padding[2],opts.padding[1],opts.padding[0]];}if(!opts.items.width){opts.items.width=getItems($cfs).outerWidth(true);}if(!opts.items.height){opts.items.height=getItems($cfs).outerHeight(true);}if(opts.items.visible==="variable"){if(typeof opts[opts.dimentions[0]]==="number"){opts.maxDimention=opts[opts.dimentions[0]];opts[opts.dimentions[0]]=null;}else{opts.maxDimention=$wrp.parent()[opts.dimentions[7]]();}if(opts.items[opts.dimentions[0]]==="variable"){varnumvisitem=true;opts.items.visible=0;}else{opts.items.visible=Math.floor(opts.maxDimention/opts.items[opts.dimentions[0]]);}}if(typeof opts.items.minimum!=="number"){opts.items.minimum=opts.items.visible;}if(typeof opts.scroll.items!=="number"){opts.scroll.items=opts.items.visible;}if(typeof opts.scroll.duration!=="number"){opts.scroll.duration=500;}opts.auto=getNaviObject(opts.auto,false,true);opts.prev=getNaviObject(opts.prev);opts.next=getNaviObject(opts.next);opts.pagination=getNaviObject(opts.pagination,true);opts.auto=$.extend({},opts.scroll,opts.auto);opts.prev=$.extend({},opts.scroll,opts.prev);opts.next=$.extend({},opts.scroll,opts.next);opts.pagination=$.extend({},opts.scroll,opts.pagination);if(typeof opts.pagination.keys!=="boolean"){opts.pagination.keys=false;}if(typeof opts.pagination.anchorBuilder!=="function"){opts.pagination.anchorBuilder=$.fn.carouFredSel.pageAnchorBuilder;}if(typeof opts.auto.play!=="boolean"){opts.auto.play=true;}if(typeof opts.auto.nap!=="boolean"){opts.auto.nap=true;}if(typeof opts.auto.delay!=="number"){opts.auto.delay=0;}if(typeof opts.auto.pauseDuration!=="number"){opts.auto.pauseDuration=(opts.auto.duration<10)?2500:opts.auto.duration*5;}};this.build=function(){$wrp.css({position:"relative",overflow:"hidden"});$cfs.data("cfs_origCss",{width:$cfs.css("width"),height:$cfs.css("height"),position:$cfs.css("position"),top:$cfs.css("top"),left:$cfs.css("left")}).css({position:"absolute"});if(opts.usePadding){getItems($cfs).each(function(){var m=parseInt($(this).css(opts.dimentions[6]),10);if(isNaN(m)){m=0;}$(this).data("cfs_origCssMargin",m);});}showNavi(opts,totalItems);};this.bind_events=function(){$cfs.bind("pause",function(e,g){if(typeof g!=="boolean"){g=false;}if(g){pausedGlobal=true;}if(autoTimeout!==null){clearTimeout(autoTimeout);}if(autoInterval!==null){clearInterval(autoInterval);}});$cfs.bind("play",function(e,d,f,g){$cfs.trigger("pause");if(opts.auto.play){if(typeof g!=="boolean"){if(typeof f==="boolean"){g=f;}else{if(typeof d==="boolean"){g=d;}else{g=false;}}}if(typeof f!=="number"){if(typeof d==="number"){f=d;}else{f=0;}}if(d!=="prev"&&d!=="next"){d=direction;}if(g){pausedGlobal=false;}if(pausedGlobal){return;}autoTimeout=setTimeout(function(){if($cfs.is(":animated")){$cfs.trigger("play",d);}else{pauseTimePassed=0;$cfs.trigger(d,opts.auto);}},opts.auto.pauseDuration+f-pauseTimePassed);if(opts.auto.pauseOnHover==="resume"){autoInterval=setInterval(function(){pauseTimePassed+=100;},100);}}});if(varnumvisitem){$cfs.bind("prev",function(e,sO,nI){if($cfs.is(":animated")){return false;}var items=getItems($cfs),total=0,x=0;if(typeof sO==="number"){nI=sO;}if(typeof nI!=="number"){for(var a=items.length-1;a>=0;a--){current=items.filter(":eq("+a+")")[opts.dimentions[1]](true);if(total+current>opts.maxDimention){break;}total+=current;x++;}nI=x;}for(var a=items.length-nI;a<items.length;a++){current=items.filter(":eq("+a+")")[opts.dimentions[1]](true);if(total+current>opts.maxDimention){break;}total+=current;if(a===items.length-1){a=0;}x++;}opts.items.visible=x;$cfs.trigger("scrollPrev",[sO,nI]);});$cfs.bind("next",function(e,sO,nI){if($cfs.is(":animated")){return false;}var items=getItems($cfs),total=0,x=0;if(typeof sO==="number"){nI=sO;}if(typeof nI!=="number"){nI=opts.items.visible;}for(var a=nI;a<items.length;a++){current=items.filter(":eq("+a+")")[opts.dimentions[1]](true);if(total+current>opts.maxDimention){break;}total+=current;if(a===items.length-1){a=0;}x++;}opts.items.visible=x;$cfs.trigger("scrollNext",[sO,nI]);}).trigger("next",{duration:0});}else{$cfs.bind("prev",function(e,sO,nI){$cfs.trigger("scrollPrev",[sO,nI]);});$cfs.bind("next",function(e,sO,nI){$cfs.trigger("scrollNext",[sO,nI]);});}$cfs.bind("scrollPrev",function(e,sO,nI){if($cfs.is(":animated")){return false;}if(opts.items.minimum>=totalItems){return log("Not enough items: not scrolling");}if(typeof sO==="number"){nI=sO;}if(typeof sO!=="object"){sO=opts.prev;}if(typeof nI!=="number"){nI=sO.items;}if(typeof nI!=="number"){return log("Not a valid number: not scrolling");}if(!opts.circular){var nulItem=totalItems-firstItem;if(nulItem-nI<0){nI=nulItem;}if(firstItem===0){nI=0;}}firstItem+=nI;if(firstItem>=totalItems){firstItem-=totalItems;}if(!opts.circular){if(firstItem===0&&nI!==0&&opts.prev.onEnd){opts.prev.onEnd();}if(opts.infinite){if(nI===0){$cfs.trigger("next",totalItems-opts.items.visible);return false;}}else{if(firstItem===0&&opts.prev.button){opts.prev.button.addClass("disabled");}if(opts.next.button){opts.next.button.removeClass("disabled");}}}if(nI===0){return false;}getItems($cfs,":gt("+(totalItems-nI-1)+")").prependTo($cfs);if(totalItems<opts.items.visible+nI){getItems($cfs,":lt("+((opts.items.visible+nI)-totalItems)+")").clone(true).appendTo($cfs);}var c_itm=getCurrentItems($cfs,opts,nI),l_cur=getItems($cfs,":nth("+(nI-1)+")"),l_old=c_itm[1].filter(":last"),l_new=c_itm[0].filter(":last");if(opts.usePadding){l_old.css(opts.dimentions[6],l_old.data("cfs_origCssMargin"));}var i_siz=getSizes(opts,getItems($cfs,":lt("+nI+")")),w_siz=mapWrapperSizes(getSizes(opts,c_itm[0],true),opts);if(opts.usePadding){l_old.css(opts.dimentions[6],l_old.data("cfs_origCssMargin")+opts.padding[1]);}var a_cfs={},a_new={},a_cur={},a_dur=sO.duration;if(a_dur==="auto"){a_dur=opts.scroll.duration/opts.scroll.items*nI;}else{if(a_dur<=0){a_dur=0;}else{if(a_dur<10){a_dur=i_siz[0]/a_dur;}}}if(sO.onBefore){sO.onBefore(c_itm[1],c_itm[0],w_siz,a_dur);}if(opts.usePadding){var new_m=opts.padding[3];a_cur[opts.dimentions[6]]=l_cur.data("cfs_origCssMargin");a_new[opts.dimentions[6]]=l_new.data("cfs_origCssMargin")+opts.padding[1];l_cur.css(opts.dimentions[6],l_cur.data("cfs_origCssMargin")+opts.padding[3]);l_cur.stop().animate(a_cur,{duration:a_dur,easing:sO.easing});l_new.stop().animate(a_new,{duration:a_dur,easing:sO.easing});}else{var new_m=0;}a_cfs[opts.dimentions[4]]=new_m;if((typeof opts[opts.dimentions[0]]!=="number"&&typeof opts.items[opts.dimentions[0]]!=="number")||(typeof opts[opts.dimentions[2]]!=="number"&&typeof opts.items[opts.dimentions[2]]!=="number")){$wrp.stop().animate(w_siz,{duration:a_dur,easing:sO.easing});}$cfs.data("cfs_numItems",nI).data("cfs_slideObj",sO).data("cfs_oldItems",c_itm[1]).data("cfs_newItems",c_itm[0]).data("cfs_wrapSize",w_siz).css(opts.dimentions[4],-i_siz[0]).animate(a_cfs,{duration:a_dur,easing:sO.easing,complete:function(){if($cfs.data("cfs_slideObj").onAfter){$cfs.data("cfs_slideObj").onAfter($cfs.data("cfs_oldItems"),$cfs.data("cfs_newItems"),$cfs.data("cfs_wrapSize"));}if(totalItems<opts.items.visible+$cfs.data("cfs_numItems")){getItems($cfs,":gt("+(totalItems-1)+")").remove();}var l_itm=getItems($cfs,":nth("+(opts.items.visible+$cfs.data("cfs_numItems")-1)+")");if(opts.usePadding){l_itm.css(opts.dimentions[6],l_itm.data("cfs_origCssMargin"));}}});$cfs.trigger("updatePageStatus").trigger("play",a_dur);});$cfs.bind("scrollNext",function(e,sO,nI){if($cfs.is(":animated")){return false;}if(opts.items.minimum>=totalItems){return log("Not enough items: not scrolling");}if(typeof sO==="number"){nI=sO;}if(typeof sO!=="object"){sO=opts.next;}if(typeof nI!=="number"){nI=sO.items;}if(typeof nI!=="number"){return log("Not a valid number: not scrolling");}if(!opts.circular){if(firstItem===0){if(nI>totalItems-opts.items.visible){nI=totalItems-opts.items.visible;}}else{if(firstItem-nI<opts.items.visible){nI=firstItem-opts.items.visible;}}}firstItem-=nI;if(firstItem<0){firstItem+=totalItems;}if(!opts.circular){if(firstItem===opts.items.visible&&nI!==0&&opts.next.onEnd){opts.next.onEnd();}if(opts.infinite){if(nI===0){$cfs.trigger("prev",totalItems-opts.items.visible);return false;}}else{if(firstItem===opts.items.visible&&opts.next.button){opts.next.button.addClass("disabled");}if(opts.prev.button){opts.prev.button.removeClass("disabled");}}}if(nI===0){return false;}if(totalItems<opts.items.visible+nI){getItems($cfs,":lt("+((opts.items.visible+nI)-totalItems)+")").clone(true).appendTo($cfs);}var c_itm=getCurrentItems($cfs,opts,nI),l_cur=getItems($cfs,":nth("+(nI-1)+")"),l_old=c_itm[0].filter(":last"),l_new=c_itm[1].filter(":last");if(opts.usePadding){l_old.css(opts.dimentions[6],l_old.data("cfs_origCssMargin"));l_new.css(opts.dimentions[6],l_new.data("cfs_origCssMargin"));}var i_siz=getSizes(opts,getItems($cfs,":lt("+nI+")")),w_siz=mapWrapperSizes(getSizes(opts,c_itm[1],true),opts);if(opts.usePadding){l_old.css(opts.dimentions[6],l_old.data("cfs_origCssMargin")+opts.padding[1]);l_new.css(opts.dimentions[6],l_new.data("cfs_origCssMargin")+opts.padding[1]);}var a_cfs={},a_old={},a_cur={},a_dur=sO.duration;if(a_dur==="auto"){a_dur=opts.scroll.duration/opts.scroll.items*nI;}else{if(a_dur<=0){a_dur=0;}else{if(a_dur<10){a_dur=i_siz[0]/a_dur;}}}if(sO.onBefore){sO.onBefore(c_itm[0],c_itm[1],w_siz,a_dur);}a_cfs[opts.dimentions[4]]=-i_siz[0];if(opts.usePadding){a_old[opts.dimentions[6]]=l_old.data("cfs_origCssMargin");a_cur[opts.dimentions[6]]=l_cur.data("cfs_origCssMargin")+opts.padding[3];l_new.css(opts.dimentions[6],l_new.data("cfs_origCssMargin")+opts.padding[1]);l_old.stop().animate(a_old,{duration:a_dur,easing:sO.easing});l_cur.stop().animate(a_cur,{duration:a_dur,easing:sO.easing});}if((typeof opts[opts.dimentions[0]]!=="number"&&typeof opts.items[opts.dimentions[0]]!=="number")||(typeof opts[opts.dimentions[2]]!=="number"&&typeof opts.items[opts.dimentions[2]]!=="number")){$wrp.stop().animate(w_siz,{duration:a_dur,easing:sO.easing});}$cfs.data("cfs_numItems",nI).data("cfs_slideObj",sO).data("cfs_oldItems",c_itm[0]).data("cfs_newItems",c_itm[1]).data("cfs_wrapSize",w_siz).animate(a_cfs,{duration:a_dur,easing:sO.easing,complete:function(){if($cfs.data("cfs_slideObj").onAfter){$cfs.data("cfs_slideObj").onAfter($cfs.data("cfs_oldItems"),$cfs.data("cfs_newItems"),$cfs.data("cfs_wrapSize"));}if(totalItems<opts.items.visible+$cfs.data("cfs_numItems")){getItems($cfs,":gt("+(totalItems-1)+")").remove();}var org_m=(opts.usePadding)?opts.padding[3]:0;$cfs.css(opts.dimentions[4],org_m);var l_itm=getItems($cfs,":lt("+$cfs.data("cfs_numItems")+")").appendTo($cfs).filter(":last");if(opts.usePadding){l_itm.css(opts.dimentions[6],l_itm.data("cfs_origCssMargin"));}}});$cfs.trigger("updatePageStatus").trigger("play",a_dur);});$cfs.bind("slideTo",function(e,num,dev,org,obj){if($cfs.is(":animated")){return false;}num=getItemIndex(num,dev,org,firstItem,totalItems,$cfs);if(num===0){return false;}if(typeof obj!=="object"){obj=false;}if(opts.circular){if(num<totalItems/2){$cfs.trigger("next",[obj,num]);}else{$cfs.trigger("prev",[obj,totalItems-num]);}}else{if(firstItem===0||firstItem>num){$cfs.trigger("next",[obj,num]);}else{$cfs.trigger("prev",[obj,totalItems-num]);}}}).bind("insertItem",function(e,itm,num,org,dev){if(typeof itm==="object"&&typeof itm.jquery==="undefined"){itm=$(itm);}if(typeof itm==="string"){itm=$(itm);}if(typeof itm!=="object"||typeof itm.jquery==="undefined"||itm.length===0){return log("Not a valid object.");}if(typeof num==="undefined"||num==="end"){$cfs.append(itm);}else{num=getItemIndex(num,dev,org,firstItem,totalItems,$cfs);var $cit=getItems($cfs,":nth("+num+")");if($cit.length){if(num<=firstItem){firstItem+=itm.length;}$cit.before(itm);}else{$cfs.append(itm);}}totalItems=getItems($cfs).length;link_anchors("",".caroufredsel",$cfs);setSizes($cfs,opts);showNavi(opts,totalItems);$cfs.trigger("updatePageStatus",true);}).bind("removeItem",function(e,num,org,dev){if(typeof num==="undefined"||num==="end"){getItems($cfs,":last").remove();}else{num=getItemIndex(num,dev,org,firstItem,totalItems,$cfs);var $cit=getItems($cfs,":nth("+num+")");if($cit.length){if(num<firstItem){firstItem-=$cit.length;}$cit.remove();}}totalItems=getItems($cfs).length;link_anchors("",".caroufredsel",$cfs);setSizes($cfs,opts);showNavi(opts,totalItems);$cfs.trigger("updatePageStatus",true);}).bind("updatePageStatus",function(e,bpa){if(!opts.pagination.container){return false;}if(typeof bpa==="boolean"&&bpa){getItems(opts.pagination.container).remove();for(var a=0;a<Math.ceil(totalItems/opts.items.visible);a++){opts.pagination.container.append(opts.pagination.anchorBuilder(a+1));}getItems(opts.pagination.container).unbind("click").each(function(a){$(this).click(function(e){e.preventDefault();$cfs.trigger("slideTo",[a*opts.items.visible,0,true,opts.pagination]);});});}var nr=(firstItem===0)?0:Math.round((totalItems-firstItem)/opts.items.visible);getItems(opts.pagination.container).removeClass("selected").filter(":nth("+nr+")").addClass("selected");});};this.bind_buttons=function(){if(opts.auto.pauseOnHover&&opts.auto.play){$wrp.hover(function(){$cfs.trigger("pause");},function(){$cfs.trigger("play");});}if(opts.prev.button){opts.prev.button.click(function(e){$cfs.trigger("prev");e.preventDefault();});if(opts.prev.pauseOnHover&&opts.auto.play){opts.prev.button.hover(function(){$cfs.trigger("pause");},function(){$cfs.trigger("play");});}if(!opts.circular&&!opts.infinite){opts.prev.button.addClass("disabled");}}if($.fn.mousewheel){if(opts.prev.mousewheel){$wrp.mousewheel(function(e,delta){if(delta>0){e.preventDefault();num=(typeof opts.prev.mousewheel==="number")?opts.prev.mousewheel:"";$cfs.trigger("prev",num);}});}if(opts.next.mousewheel){$wrp.mousewheel(function(e,delta){if(delta<0){e.preventDefault();num=(typeof opts.next.mousewheel==="number")?opts.next.mousewheel:"";$cfs.trigger("next",num);}});}}if(opts.next.button){opts.next.button.click(function(e){e.preventDefault();$cfs.trigger("next");});if(opts.next.pauseOnHover&&opts.auto.play){opts.next.button.hover(function(){$cfs.trigger("pause");},function(){$cfs.trigger("play");});}}if(opts.pagination.container){$cfs.trigger("updatePageStatus",true);if(opts.pagination.pauseOnHover&&opts.auto.play){opts.pagination.container.hover(function(){$cfs.trigger("pause");},function(){$cfs.trigger("play");});}}if(opts.next.key||opts.prev.key){$(document).keyup(function(e){var k=e.keyCode;if(k===opts.next.key){e.preventDefault();$cfs.trigger("next");}if(k===opts.prev.key){e.preventDefault();$cfs.trigger("prev");}});}if(opts.pagination.keys){$(document).keyup(function(e){var k=e.keyCode;if(k>=49&&k<58){k=(k-49)*opts.items.visible;if(k<=totalItems){e.preventDefault();$cfs.trigger("slideTo",[k,0,true,opts.pagination]);}}});}if(opts.auto.play){$cfs.trigger("play",opts.auto.delay);if($.fn.nap&&opts.auto.nap){$cfs.nap("pause","play");}}};this.destroy=function(){$cfs.css($cfs.data("cfs_origCss")).unbind("pause").unbind("play").unbind("prev").unbind("next").unbind("scrollTo").unbind("slideTo").unbind("insertItem").unbind("removeItem").unbind("updatePageStatus");$wrp.replaceWith($cfs);return this;};this.configuration=function(a,b){if(typeof a==="undefined"){return opts;}if(typeof b==="undefined"){var r=eval("opts."+a);if(typeof r==="undefined"){r="";}return r;}eval("opts."+a+" = b");this.init(opts);setSizes($cfs,opts);return this;};this.link_anchors=function($c,se){link_anchors($c,se,$cfs);};this.current_position=function(){if(firstItem===0){return 0;}return totalItems-firstItem;};if($(this).parent().is(".caroufredsel_wrapper")){log("Element allready is a carousel!");}else{var $cfs=$(this),$wrp=$(this).wrap('<div class="caroufredsel_wrapper" />').parent(),opts={},totalItems=getItems($cfs).length,firstItem=0,autoTimeout=null,autoInterval=null,pauseTimePassed=0,pausedGlobal=false,direction="next",varnumvisitem=false;this.init(o);this.build();this.bind_events();this.bind_buttons();link_anchors("",".caroufredsel",$cfs);setSizes($cfs,opts);if(opts.items.start!==0&&opts.items.start!==false){var s=opts.items.start;if(opts.items.start===true){s=window.location.hash;if(!s.length){s=0;}}$cfs.trigger("slideTo",[s,0,true,{duration:0}]);}}return this;};$.fn.carouFredSel.defaults={infinite:true,circular:true,direction:"left",padding:0,items:{visible:5,start:0},scroll:{easing:"swing",pauseOnHover:false,mousewheel:false}};$.fn.carouFredSel.pageAnchorBuilder=function(nr){return'<a href="#"><span>'+nr+"</span></a>";};function link_anchors($c,se,$cfs){if(typeof $c==="undefined"||$c.length===0){$c=$("body");}else{if(typeof $c==="string"){$c=$($c);}}if(typeof $c!=="object"){return false;}if(typeof se==="undefined"){se="";}$c.find("a"+se).each(function(){var h=this.hash||"";if(h.length>0&&getItems($cfs).index($(h))!==-1){$(this).unbind("click").click(function(e){e.preventDefault();$cfs.trigger("slideTo",h);});}});}function showNavi(o,t){if(o.items.minimum>=t){log("Not enough items: not scrolling");var f="hide";}else{var f="show";}if(o.prev.button){o.prev.button[f]();}if(o.next.button){o.next.button[f]();}if(o.pagination.container){o.pagination.container[f]();}}function getKeyCode(k){if(k==="right"){return 39;}if(k==="left"){return 37;}if(k==="up"){return 38;}if(k==="down"){return 40;}return -1;}function getNaviObject(obj,pagi,auto){if(typeof pagi!=="boolean"){pagi=false;}if(typeof auto!=="boolean"){auto=false;}if(typeof obj==="undefined"){obj={};}if(typeof obj==="string"){var temp=getKeyCode(obj);if(temp===-1){obj=$(obj);}else{obj=temp;}}if(pagi){if(typeof obj.jquery!=="undefined"){obj={container:obj};}if(typeof Object==="boolean"){obj={keys:obj};}if(typeof obj.container==="string"){obj.container=$(obj.container);}}else{if(auto){if(typeof obj==="boolean"){obj={play:obj};}if(typeof obj==="number"){obj={pauseDuration:obj};}}else{if(typeof obj.jquery!=="undefined"){obj={button:obj};}if(typeof obj==="number"){obj={key:obj};}if(typeof obj.button==="string"){obj.button=$(obj.button);}if(typeof obj.key==="string"){obj.key=getKeyCode(obj.key);}}}return obj;}function getItems(a,f){if(typeof f!=="string"){f="";}return $("> *"+f,a);}function getCurrentItems(c,o,n){var oi=getItems(c,":lt("+o.items.visible+")"),ni=getItems(c,":lt("+(o.items.visible+n)+"):gt("+(n-1)+")");return[oi,ni];}function getItemIndex(num,dev,org,firstItem,totalItems,$cfs){if(typeof num==="string"){if(isNaN(num)){num=$(num);}else{num=parseInt(num,10);}}if(typeof num==="object"){if(typeof num.jquery==="undefined"){num=$(num);}num=getItems($cfs).index(num);if(num===-1){num=0;}if(typeof org!=="boolean"){org=false;}}else{if(typeof org!=="boolean"){org=true;}}if(isNaN(num)){num=0;}else{num=parseInt(num,10);}if(isNaN(dev)){dev=0;}else{dev=parseInt(dev,10);}if(org){num+=firstItem;}num+=dev;if(totalItems>0){while(num>=totalItems){num-=totalItems;}while(num<0){num+=totalItems;}}return num;}function getSizes(o,$i,wrap){if(typeof wrap!=="boolean"){wrap=false;}var di=o.dimentions,s1=0,s2=0;if(wrap&&typeof o[di[0]]==="number"){s1+=o[di[0]];}else{if(typeof o.items[di[0]]==="number"){s1+=o.items[di[0]]*$i.length;}else{$i.each(function(){s1+=$(this)[di[1]](true);});}}if(wrap&&typeof o[di[2]]==="number"){s2+=o[di[2]];}else{if(typeof o.items[di[2]]==="number"){s2+=o.items[di[2]];}else{$i.each(function(){var m=$(this)[di[3]](true);if(s2<m){s2=m;}});}}return[s1,s2];}function mapWrapperSizes(ws,o){var pad=(o.usePadding)?o.padding:[0,0,0,0];var wra={};wra[o.dimentions[0]]=ws[0]+pad[1]+pad[3];wra[o.dimentions[2]]=ws[1]+pad[0]+pad[2];return wra;}function setSizes($c,o){var $w=$c.parent(),$i=getItems($c),$l=$i.filter(":nth("+(o.items.visible-1)+")"),is=getSizes(o,$i);$w.css(mapWrapperSizes(getSizes(o,$i.filter(":lt("+o.items.visible+")"),true),o));if(o.usePadding){$l.css(o.dimentions[6],$l.data("cfs_origCssMargin")+o.padding[1]);$c.css(o.dimentions[5],o.padding[0]);$c.css(o.dimentions[4],o.padding[3]);}$c.css(o.dimentions[0],is[0]*2);$c.css(o.dimentions[2],is[1]);}function getPadding(p){if(typeof p==="number"){p=[p];}else{if(typeof p==="string"){p=p.split("px").join("").split(" ");}}if(typeof p!=="object"){log('Not a valid value, padding set to "0".');p=[0];}for(i in p){p[i]=parseInt(p[i],10);}switch(p.length){case 0:return[0,0,0,0];case 1:return[p[0],p[0],p[0],p[0]];case 2:return[p[0],p[1],p[0],p[1]];case 3:return[p[0],p[1],p[2],p[1]];default:return p;}}function log(m){if(typeof m==="string"){m="carouFredSel: "+m;}if(window.console&&window.console.log){window.console.log(m);}else{try{console.log(m);}catch(err){}}return false;}$.fn.caroufredsel=function(o){this.carouFredSel(o);};}(jQuery));(Newsday.TopCarousel=function(){var d=false;var f={CAROUSEL_CONTAINER_ID:"div#photoCarousel",CAROUSEL_PANE:"ul.carousel li"};var h={document:$(document),carouselContainer:null,carouselPane:null,selected:null,historyLoad:false};var a=f;var b=h;var c=function(){$("#photoCarousel ul.carousel").carouFredSel({items:{visible:3,width:326},prev:"#photoCarousel a.prev",next:"#photoCarousel a.next",container:"#photoCarousel span.dots",auto:false,pagination:"#photoCarousel span.dots",scroll:{duration:800,onAfter:function(){e();}}});var m=null;$carousel=b.carouselContainer.find("ul.carousel");m=$carousel.children();var n=1;var l=0;m.each(function(){var j=$(this);j.attr("pane",n);l++;if(l===3){n++;l=0;}});};var e=function(){var j=$("#photoCarousel span.dots a.selected span");var k=parseInt(j.text(),10);if(!b.historyLoad){carouselLink(k);}else{b.historyLoad=false;}i(k);};var i=function(m){var l,j,k=null;l=b.carouselContainer.find("ul.carousel");j=l.children();j.each(function(){$this=$(this);currentPane=parseInt($this.attr("pane"),10);if(currentPane===m){var n=$this.find("a");n.live("click",function(p){if(p.button!==0){return;}p.preventDefault();var o=$(this).text();Newsday.Global.State.resetHashState();Newsday.Global.State.setHashState("tc",m);Newsday.Global.State.syncHashState();window.location.href=$(this).attr("href");});}});};var g=function(){var j=Newsday.Global.State.getHashState("tc");if(j!==null&&j!==1){b.historyLoad=true;$("ul.carousel").trigger("slideTo",parseInt((j*3-3),10));}else{j=0;}};return{initialize:function(){b.carouselContainer=b.carouselContainer||$(a.CAROUSEL_CONTAINER_ID);b.carouselPane=b.carouselPane||$(a.CAROUSEL_PANE);if(d||!b.carouselContainer.length){return;}c();g();d=true;}};}());$(document).ready(Newsday.TopCarousel.initialize);(Newsday.CalendarTabs=function(){var f=false;var e={HEADLINE_LENGTH:40,EVENT_LIST:"div#eventTabs ul.content",EVENT_TABS:"div#eventTabs ul.sels li",LOCAL_EVENTS_TAB:"div#eventTabs ul.sels li:last",LOCAL_EVENTS_SEARCH_FORM:"div#eventTabs span.setTown",LOCAL_EVENTS_HEADLINE:"div#eventTabs h3",LOGIN_BUTTON:"div#eventTabs a#loginLink",CHANGE_BUTTON:"div#eventTabs a#change",FLYOUT_ID:"div#locationSearch",RESULTS_LIST_ID:"ul#locationSearchResults",SEARCH_INPUT_ID:"input#searchLocale",INPUT_DEFAULT_VALUE:"Enter town or zip code...",LOCALE_COOKIE:"NDLiveLocale",ZIP_COOKIE:"zipcoordinates",LOCATION_LOOKUP_DATA:["Albertson (11507)","Amagansett (11930)","Amityville (11701)","Aquebogue (11931)","Atlantic Beach (11509)","Babylon (11702)","Baldwin (11510)","Bay Shore (11706)","Bayport (11705)","Bayville (11709)","Bellmore (11710)","Bellport (11713)","Bethpage (11714)","Blue Point (11715)","Bohemia (11716)","Brentwood (11717)","Bridgehampton (11932)","Brightwaters (11718)","Brookhaven (11719)","Brookville (11545)","Calverton (11933)","Carle Place (11514)","Cedarhurst (11516)","Center Moriches (11934)","Centereach (11720)","Centerport (11721)","Central Islip (11722)","Centre Island (11771)","Cold Spring Harbor (11724)","Commack (11725)","Copiague (11726)","Coram (11727)","Cutchogue (11935)","Deer Park (11729)","Dix Hills (11746)","East Hampton (11937)","East Islip (11730)","East Marion (11939)","East Meadow (11554)","East Moriches (11940)","East Northport (11731)","East Norwich (11732)","East Quogue (11942)","East Rockaway (11518)","East Setauket (11733)","Eastport (11941)","Elmont (11003)","Farmingdale (11735)","Farmingville (11738)","Floral Park (11001)","Fort Salonga (11768)","Franklin Square (11010)","Freeport (11520)","Garden City (11530)","Glen Cove (11542)","Glen Head (11545)","Glenwood Landing (11547)","Great Neck (11020)","Great Neck (11021)","Great Neck (11023)","Greenlawn (11740)","Greenport (11944)","Greenvale (11548)","Hampton Bays (11946)","Hauppauge (11788)","Hempstead (11550)","Hewlett (11557)","Hicksville (11801)","Holbrook (11741)","Holtsville (11742)","Huntington (11743)","Huntington Station (11746)","Inwood (11096)","Island Park (11558)","Islandia (11749)","Islip (11751)","Islip Terrace (11752)","Jamesport (11947)","Jericho (11753)","Kings Park (11754)","Kings Point (11024)","Lake Grove (11755)","Laurel (11948)","Lawrence (11559)","Levittown (11756)","Lido Beach (11561)","Lindenhurst (11757)","Locust Valley (11560)","Long Beach (11561)","Lynbrook (11563)","Malverne (11565)","Manhasset (11030)","Manorville (11949)","Massapequa (11758)","Massapequa Park (11762)","Mastic (11950)","Mastic Beach (11951)","Mattituck (11952)","Medford (11763)","Melville (11747)","Merrick (11566)","Middle Island (11953)","Mill Neck (11765)","Miller Place (11764)","Mineola (11501)","Montauk (11954)","Moriches (11955)","Mount Sinai (11766)","Muttontown (11791)","Nesconset (11767)","New Hyde Park (11040)","New Hyde Park (11042)","New Suffolk (11956)","North Babylon (11703)","North Bellmore (11710)","Northport (11768)","Oakdale (11769)","Ocean Beach (11770)","Oceanside (11572)","Old Bethpage (11804)","Old Westbury (11568)","Orient (11957)","Oyster Bay (11771)","Patchogue (11772)","Peconic (11958)","Plainview (11803)","Point Lookout (11569)","Port Jefferson (11777)","Port Jefferson Station (11776)","Port Washington (11050)","Quogue (11959)","Remsenburg (11960)","Ridge (11961)","Riverhead (11901)","Rockville Centre (11570)","Rocky Point (11778)","Ronkonkoma (11779)","Roosevelt (11575)","Roslyn (11576)","Roslyn Heights (11577)","Sag Harbor (11963)","Sagaponack (11962)","Sayville (11782)","Sea Cliff (11579)","Seaford (11783)","Selden (11784)","Setauket (11733)","Shelter Island (11964)","Shelter Island Heights (11965)","Shirley (11967)","Shoreham (11786)","Smithtown (11787)","Sound Beach (11789)","South Jamesport (11970)","Southampton (11968)","Southold (11971)","Speonk (11972)","St. James (11780)","Stony Brook (11790)","Stony Brook (11794)","Syosset (11791)","Uniondale (11553)","Valley Stream (11580)","Valley Stream (11581)","Wading River (11792)","Wantagh (11793)","Water Mill (11976)","West Babylon (11704)","West Hempstead (11552)","West Islip (11795)","West Sayville (11796)","Westbury (11590)","Westhampton (11977)","Westhampton Beach (11978)","Wheatley Heights (11798)","Williston Park (11596)","Woodbury (11797)","Woodmere (11598)","Wyandanch (11798)","Yaphank (11980)"]};var y={document:$(document),calendarContainer:null,eventList:null,eventTabs:null,localEventsTab:null,localEventsHeadline:null,localEventsSearchForm:null,loginButton:null,changeButton:null,flyout:null,tabLinks:null,activeTab:null,dataCount:null,jlistName:null};var r=e;var c=y;var z,d,m=null;var k=4;var s="11757";var j=polopoly.cookie.get(r.LOCALE_COOKIE);var g=polopoly.base64.stringDecode(polopoly.cookie.get(r.ZIP_COOKIE));function i(){if(j&&j.length){z=j.substr(j.indexOf("(")+1,5);if(z&&z.length){return z;}}else{if(g&&g.length){var A=0;var C=1;var B=g.split(",");if(B.length>C){if((B[C]!==null)&&(B[C]!=="")&&(B[C]!=="null")){return B[C];}}if(B[A]&&B[A].length){return B[A];}}}}var h=function(){if(j&&j.length){m=j.substr(0,j.indexOf("(")-1);if(m&&m.length){c.localEventsHeadline.html(m);}}else{if(g&&g.length){var F=null;var B=0;var D=3;var C=g.split(",");if(C.length>D){if((C[D]!==null)&&(C[D]!=="")&&(C[D]!=="null")){F=C[D];}}if(C[B]&&C[B].length){F=C[B];}var A="/cmlink/imported.weather."+F+"?view=json_weather";try{$.ajax({url:A,dataType:"json",success:function(G){m=G.temps[0].city;c.localEventsHeadline.html(m);},error:function(H,G){}});}catch(E){}}else{c.localEventsHeadline.html("Local events");}}};var a=function(){c.loginButton=$(r.LOGIN_BUTTON);if(c.loginButton.length){return;}Newsday.Global.State.resetHashState();Newsday.Global.State.setHashState("ct","4");Newsday.Global.State.syncHashState();return true;};var n=function(){c.changeButton=$(r.CHANGE_BUTTON);if(!c.changeButton.length){return;}c.changeButton.bind("click",o);};var o=function(A){if(A&&typeof A.preventDefault==="function"){A.preventDefault();}if(!c.flyout||!c.flyout.length){if(typeof c.eventList!=="object"||!c.eventList.length){return;}u();}c.flyout.show();};var q=function(A){if(A&&typeof A.preventDefault==="function"){A.preventDefault();}if(!c.flyout||!c.flyout.length){return;}c.flyout.hide();};var u=function(){c.flyout=$(r.FLYOUT_ID);c.resultsList=$(r.RESULTS_LIST_ID);c.searchInput=$(r.SEARCH_INPUT_ID);$("div#eventTabs button.cancel").show();$("div#eventTabs button.cancel").bind("click",q);c.searchInput.attr("value",$.cookie(r.LOCALE_COOKIE)||r.INPUT_DEFAULT_VALUE);c.searchInput.bind("focus",function(){if(this.value===r.INPUT_DEFAULT_VALUE){this.value="";}if(this.value===$.cookie(r.LOCALE_COOKIE)){this.value="";}}).bind("blur",function(){if(this.value===""){this.value=r.INPUT_DEFAULT_VALUE;c.resultsList.empty();}});c.searchInput.autocomplete(r.LOCATION_LOOKUP_DATA,{delay:150,resultTarget:c.resultsList,matchContains:true,scroll:false,autofill:true}).result(function(B,D,C){$("div#eventTabs button.save").show();d=C;});try{$("div#eventTabs button.save").bind("click",function(B){B.preventDefault();t();$("div#eventTabs button.save").hide();});}catch(A){}};var t=function(C){if(C){C.preventDefault();}var A=d.substr(d.indexOf("(")+1,5);var B=d.substr(0,d.indexOf("(")-1);polopoly.cookie.set(r.LOCALE_COOKIE,d);if(d!==null){q();b(A);c.localEventsHeadline.html(B);}};var p=function(){if(!c.eventList.length||!c.eventTabs.length){return;}c.eventTabs.each(function(C,A){var D=$(this);if(C===0){c.activeTab=D;}var B=D.attr("link");D.data("key",B);D.bind("click",v);C++;});$("ul.content li.vevent a").live("click",function(A){if(A.button!==0){return;}A.preventDefault();Newsday.Global.State.resetHashState();currentTab=parseInt(c.activeTab.attr("tabindex"),10);Newsday.Global.State.setHashState("ct",currentTab);Newsday.Global.State.syncHashState();window.location.href=$(this).attr("href");});};var v=function(B){if(B){B.preventDefault();}var A=$(this);c.jlistName=parseInt(A.attr("tabindex"),10);if(A.attr("tabindex")==="4"){h();}if(A.hasClass("active")){return;}c.activeTab=A;b("");};var b=function(B){if(!c.activeTab.length){return;}$.each(c.eventTabs,function(){$(this).removeClass("active");});c.activeTab.addClass("active");c.eventList.html('<div class="loading">Loading headlines</div>');var A=c.activeTab.data("key");if(B&&B!==""){A=A+"&zip="+B;}else{A=A+"&zip="+s;}var C=Math.round(new Date().getTime()/1000);A=A+"&timestamp="+C;try{$.ajax({url:A,dataType:"json",success:function(E){l(E);c.eventList.find("div.loading").remove();},error:function(F,E){}});}catch(D){}};var l=function(B){if(typeof B!=="object"){return;}var C=c.activeTab.get(0),A=B.headlines,E;if(!$.isArray(A)){return;}c.eventList.empty();var D;c.localEventsSearchForm=$(r.LOCAL_EVENTS_SEARCH_FORM);if(c.activeTab.attr("tabindex")==="4"){c.eventList.addClass("town");c.localEventsSearchForm.show();c.localEventsHeadline.show();k=3;a();n();}else{c.eventList.removeClass("town");c.localEventsSearchForm.hide();c.localEventsHeadline.html("").hide();k=4;}$.each(A,function(G,F){if(G<=k){$item=x(this,G+1);c.eventList.append($item);}});};var x=function(B,A){if(typeof B!=="object"){return;}var E=$("<li></li>");E.addClass("alt vevent");var D=function(){var F;if((B.month&&B.month!=="")&&(B.day&&B.day!=="")){try{F=Newsday.Builder.eventDate({month:B.month,day:B.day,days:B.days,link:B.link,pageSection:"xli-calendar",linkPosition:A,listName:c.jlistName});if(F){E.append(F);}}catch(G){}}};var C=function(){var G;var F;if((B.headline&&B.headline.length>0)&&(B.link&&B.link.length>0)){if(B.headline.length>r.HEADLINE_LENGTH){F=B.headline.substring(0,r.HEADLINE_LENGTH)+" ...";}else{F=B.headline;}try{G=Newsday.Builder.event({headline:F,link:B.link,pageSection:"xli-calendar",linkPosition:A,listName:c.jlistName,venue:B.venue,city:B.city});if(G){E.append(G);}}catch(H){}}};D();C();return E;};var w=function(){var A=Newsday.Global.State.getHashState("ct");if(A!==null&&A!==1){$selected=$("li[tabindex='"+A+"']");c.activeTab=$selected;b();}else{A=0;}};return{initialize:function(){c.eventList=c.eventList||$(r.EVENT_LIST);c.eventTabs=c.eventTabs||$(r.EVENT_TABS);c.localEventsHeadline=$(r.LOCAL_EVENTS_HEADLINE);if(f||!c.eventTabs.length){return;}p();w();f=true;}};}());$(document).ready(Newsday.CalendarTabs.initialize);(Newsday.MultimediaCarousel=function(){var g=false;var b={CAROUSEL_CONTAINER_ID:"div.strip"};var e={document:$(document),carouselContainer:null};var f=b;var c=e;var a=function(){$("#mezz ul").carouFredSel({items:{visible:4},prev:"#mezz a.prev",next:"#mezz a.next",container:"#mezz span.dots",auto:false,pagination:{container:"#mezz span.dots"},scroll:{duration:800,onAfter:function(){d();}}});};var d=function(){mediaCarouselLink();};return{initialize:function(){c.carouselContainer=c.carouselContainer||$(f.CAROUSEL_CONTAINER_ID);if(g||!c.carouselContainer.length){return;}a();g=true;}};}());$(document).ready(Newsday.MultimediaCarousel.initialize);$(function(){$(".eventCal").datePicker({inline:true}).bind("dateSelected",function(b,a,c){name="&lid=event calendar";eventCalLink();Date.format="yyyymmdd";window.location.href="/events/search#date=Custom&dates="+a.asString();});$(".dp-nav-next-month").bind("click",function(){name="&lid=event calendar: next month";eventCalLink(name);});$(".dp-nav-prev-month").bind("click",function(){name="&lid=event calendar: prev month";eventCalLink(name);});});
