if(typeof(StoreHours)=="undefined"){StoreHours={}}getLang(function(a){StoreHours.months=a.months
});StoreHours.Month=Class.create();Object.extend(StoreHours.Month.prototype,{date:null,days:null,initialize:function(a,b){this.date=new Date(a,b);
this.days=[]},addDay:function(a){this.days[a.getDate()-1]=a},getFullYear:function(){return this.date.getFullYear()
},getMonth:function(){return this.date.getMonth()},getDay:function(a){return this.days[a-1]
},isPast:function(){var a=new Date();a.setDate(1);a.setHours(0);a.setMinutes(0);
a.setSeconds(0);a.setMilliseconds(0);return this.date<a},toString:function(){return this.getFullYear()+" "+StoreHours.months[this.getMonth()]
},toHTML:function(){var h=document.createElement("h4");h.innerHTML=StoreHours.months[this.getMonth()];
var a=$(document.createElement("div"));a.addClassName("grid3col");var n=this.days.findAll(function(i){return !!(i)
});var l=3;var m=[];if(n.length<l){for(var g=0;g<n.length;g++){m.push(1)}}else{var c=Math.floor(n.length/l);
var e=c+(n.length%l);for(var g=0;g<n.length;g++){if(g==0){m.push(e)}else{m.push(c)
}}}var b=0;for(var g=0;g<l;g++){var k=m[g];var d=$(document.createElement("div"));
d.addClassName("column");if(g==0){d.addClassName("first")}else{if(g==l-1){d.addClassName("last")
}}for(var f=b;f<k+b;f++){d.appendChild(n[f].toHTML())}a.appendChild(d);b=b+k}return{header:h,dates:a}
}});StoreHours.Day=Class.create();Object.extend(StoreHours.Day.prototype,{date:null,open:null,close:null,initialize:function(b,a,c){this.date=b;
this.open=a;this.close=c},getFullYear:function(){return this.date.getFullYear()
},getMonth:function(){return this.date.getMonth()},getDate:function(){return this.date.getDate()
},isOpen:function(){return this.open&&this.close},isToday:function(){var a=new Date();
return a.getDate()==this.date.getDate()&&a.getMonth()==this.date.getMonth()&&a.getYear()==this.date.getYear()
},isPast:function(){var a=new Date();a.setHours(0);a.setMinutes(0);a.setSeconds(0);
a.setMilliseconds(0);return this.date<a},toString:function(){var a=StoreHours.months[this.getMonth()]+" "+this.date.getDate()+": ";
if(!this.isOpen()){return a+"CLOSED"}return a+this.open+" - "+this.close},toHTML:function(){var a=document.createElement("span");
a.innerHTML=StoreHours.months[this.getMonth()]+" "+this.date.getDate()+": ";var b=$(document.createElement("p"));
if(this.isToday()){b.addClassName("today")}if(!this.isOpen()){b.innerHTML=" CLOSED"
}else{b.innerHTML=" "+this.open.toString()+" - "+this.close.toString()}b.insertBefore(a,b.firstChild);
return b}});StoreHours.Time=Class.create();Object.extend(StoreHours.Time.prototype,{hour:null,minute:null,period:null,initialize:function(b){var a=b.match(/(\d+):(\d{2})/);
this.hour=a[1];this.minute=a[2];head=$$("html")[0],lang=head.readAttribute("lang");
switch(lang){case"it-IT":case"de-CH":case"fr-CH":case"fr-FR":case"de-DE":this.period=" ";
break;default:if(this.hour<12){this.period="am"}else{if(this.hour==12){this.period="noon"
}else{if(this.hour==24){this.period="midnight"}else{this.period="pm"}}}if(this.hour>12){this.hour=this.hour-12
}break}}});StoreHours.Time.prototype.toString=function(){if(!this.hour||!this.minute||!this.period){return""
}if(this.hour!=12){return this.hour+":"+this.minute+" "+this.period}else{return this.period.capitalize()
}};StoreHours.Application=Class.create();Object.extend(StoreHours.Application.prototype,{options:null,periods:null,initialize:function(b,a){this.options=a||{};
var c=b+"?z="+new Date().getTime();var d=new Ajax.Request(c,{method:"GET",onSuccess:this.parse.bind(this),onException:this.fail.bind(this),onFailure:this.fail.bind(this)})
},parse:function(response){var hoursData=eval("("+response.responseText+")");this.periods=[];
for(var i=0;i<hoursData.length;i++){var entry=hoursData[i];var date=new Date(entry.date);
var open=entry.open?new StoreHours.Time(entry.open):null;var close=entry.closed?new StoreHours.Time(entry.closed):null;
this.periods.push(new StoreHours.Day(date,open,close))}if(typeof(this.options.onSuccess)=="function"){this.options.onSuccess(this.periods)
}},fail:function(){if(typeof(this.options.onFailure)=="function"){this.options.onFailure()
}}});StoreHours.render=function(h){var e=document.createElement("div");var b=[];
var f=null;for(var c=0;c<h.length;c++){var g=h[c];if(!f||f.getMonth()!=g.getMonth()){var j=new StoreHours.Month(g.getFullYear(),g.getMonth());
b.push(j);f=j;j=null}f.addDay(g)}for(var c=0;c<b.length;c++){var d=b[c];var a=d.toHTML();
e.appendChild(a.header);e.appendChild(a.dates)}return e};
