if(typeof PSP==="undefined")var PSP={};function str_repeat(b,a){for(var e=[];a>0;e[--a]=b);return e.join("")}
function sprintf(){for(var b=0,a,e=arguments[b++],c=[],d,f,g;e;){if(d=/^[^\x25]+/.exec(e))c.push(d[0]);else if(d=/^\x25{2}/.exec(e))c.push("%");else if(d=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(e)){if((a=arguments[d[1]||b++])==null||a==undefined)alert("sprintf: Too few arguments.");/[^s]/.test(d[7])&&typeof a!="number"&&alert("sprintf: Expecting number but found "+typeof a);switch(d[7]){case "b":a=a.toString(2);break;case "c":a=String.fromCharCode(a);break;case "d":a=
parseInt(a);break;case "e":a=d[6]?a.toExponential(d[6]):a.toExponential();break;case "f":a=d[6]?parseFloat(a).toFixed(d[6]):parseFloat(a);break;case "o":a=a.toString(8);break;case "s":a=(a=String(a))&&d[6]?a.substring(0,d[6]):a;break;case "u":a=Math.abs(a);break;case "x":a=a.toString(16);break;case "X":a=a.toString(16).toUpperCase();break}a=/[def]/.test(d[7])&&d[2]&&a>0?"+"+a:a;f=d[3]?d[3]=="0"?"0":d[3].charAt(1):" ";g=d[5]-String(a).length;f=d[5]?str_repeat(f,g):"";c.push(d[4]?a+f:f+a)}else alert("sprintf: Huh ?!");
e=e.substring(d[0].length)}return c.join("")}String.prototype.isString=1;Array.prototype.isArray=1;Array.prototype.max=function(){for(var b=this[0],a=this.length,e=1;e<a;e++)if(this[e]>b)b=this[e];return b};Boolean.prototype.isBoolean=1;Date.prototype.isDate=1;RegExp.prototype.isRegExp=1;Function.prototype.isFunction=1;
Number.prototype.format=function(b){if(b.isString){var a=b.replace(/[^\d\.]/gi,""),e=-1<b.indexOf(",");a=a.split(".");var c=this;if(1<a.length)c=c.toFixed(a[1].length);else if(2<a.length)alert("NumberFormatException: invalid format, formats should have no more than 1 comma: "+b);else c=c.toFixed(0);c=c.toString();if(e){a=c.split(".");e=a[0];c=[];for(var d=e.length,f=Math.floor(d/3),g=e.length%3||3,h=0;h<d;h+=g){if(h!=0)g=3;c[c.length]=e.substr(h,g);f-=1}c=c.join(",");if(a[1])c+="."+a[1]}return b.replace(/[\d,?\.?]+/,
c)}};
PSP.Currency=new Class({Implements:[Options],options:{title:"GB Pound",symbol_left:"&pound;",symbol_right:"",decimal_point:".",thousands_point:",",decimal_places:"2",value:1,tax_rate:17.5,curType:"GBP",shTax:true},initialize:function(b){this.setOptions(b)},format:function(b,a,e){var c=b;if(a){c=e?e:this.options.value;a=sprintf("0%s0%s%0"+this.options.decimal_places+"d",this.options.thousands_point,this.options.decimal_point,0);c=b*c;c=c.format(a);c=this.options.symbol_left+c+this.options.symbol_right}return c},display:function(b,
a){if(this.options.shTax===true||this.options.shTax=="true")b+=b*$pick(a,this.options.tax_rate)/100;return this.format(b,true,null)}});PSP._currencyObj=new PSP.Currency;
PSP.Litebox=new Class({Implements:[Events],options:{formEl:{width:700,height:680,backgroundColor:"#fff",position:"fixed",display:"none",opacity:1,zIndex:1998,border:"2px solid #B4B4B4",y:"10%",x:"50%"},backgroundEl:{backgroundColor:"#020202",position:"fixed",display:"none",opacity:0.8,zIndex:1997,top:0,left:0,right:0,bottom:0},iframeURL:"./ajax/seatingForm.php",loaderEl:{src:"./ajax/images/venue-loader.gif",width:220,height:19,position:"fixed",x:"50%",y:"40%"},closeEl:{src:"./ajax/images/closed.png",
width:30,height:30,position:"fixed",zIndex:1999,x:"50%",y:"10%",display:"none"}},_productId:0,_domRootEl:null,_backgroundEl:null,_formEl:null,_closeEl:null,_isAdmin:0,initialize:function(b,a){this._productId=b.toInt();this._domRootEl=window.getDocument().body;if(a.toInt()>0)this._isAdmin=1;this._injectBoxElements();this._addEvents()},_injectBoxElements:function(){this._backgroundEl=(new Element("div",{styles:{backgroundColor:this.options.backgroundEl.backgroundColor||"black",position:this.options.backgroundEl.position,
display:this.options.backgroundEl.display,opacity:this.options.backgroundEl.opacity,zIndex:this.options.backgroundEl.zIndex,left:this.options.backgroundEl.left,top:this.options.backgroundEl.top,bottom:this.options.backgroundEl.bottom,right:this.options.backgroundEl.right}})).inject(this._domRootEl);this._formEl=(new Element("div",{styles:{backgroundColor:this.options.formEl.backgroundColor,width:this.options.formEl.width,height:this.options.formEl.height,position:this.options.formEl.position,display:this.options.formEl.display,
opacity:this.options.formEl.opacity,zIndex:this.options.formEl.zIndex,left:this.options.formEl.x,top:this.options.formEl.y,marginLeft:this.options.formEl.width/2*-1,border:this.options.formEl.border}})).inject(this._domRootEl);this._closeEl=(new Element("img",{src:this.options.closeEl.src,styles:{width:this.options.closeEl.width,height:this.options.closeEl.height,position:this.options.closeEl.position,display:this.options.closeEl.display,zIndex:this.options.closeEl.zIndex,left:this.options.closeEl.x,
top:this.options.closeEl.y,marginLeft:this.options.formEl.width/2-this.options.closeEl.width/2,marginTop:this.options.closeEl.height/2*-1}})).inject(this._domRootEl)},_addEvents:function(){this._closeEl.addEvent("click",function(){this.hide()}.bind(this))},show:function(){this._backgroundEl.setStyle("display","block");this._formEl.setStyle("display","block");this._closeEl.setStyle("display","block");(new IFrame({src:this.options.iframeURL+"?products_id="+this._productId+(this._isAdmin?"&is_admin=1":
""),frameborder:0,styles:{width:this.options.formEl.width,height:this.options.formEl.height}})).inject(this._formEl)},hide:function(){this._backgroundEl.setStyle("display","none");this._formEl.setStyle("display","none");this._closeEl.setStyle("display","none");this._formEl.empty()}});
PSP.BookingTimer=new Class({Implements:Events,options:{text:{and:" and ",expiredMessage:"Bookings have expired.",normalMessage:"Your seats reservation will expire in ",minutes:" minutes",minute:" minute",seconds:" seconds",second:" second"},settings:{refreshTime:3600,timeout:250,expire:1800,display:1,servertime:0}},_iteratorID:null,_timerElement:null,_displayElement:null,_startTime:null,_expireTime:null,_initTime:null,_lastTextRefresh:0,_expired:false,_hasStandby:0,initialize:function(b,a){this._displayElement=
$$(b)[0];this._timerElement=$$(a)[0];this._initTime=(new Date).getTime()},resetTimer:function(){this._expireTime=this._startTime=null;this._iteratorID=$clear(this._iteratorID);this._displayElement.set("text","");this._displayElement.addClass("bookingTimerEmpty");this._timerElement.set("value","")},initTimer:function(){if(!this._startTime)this._startTime=this._getCurrentTime();this._expireTime=this._startTime+this.options.settings.expire;this._expired=false;this._iteratorID=this._updateTimerElement.periodical(this.options.settings.timeout,
this)},getTimer:function(){if(this._startTime)return this._startTime.toInt();return this._getCurrentTime()},setTimer:function(b){if(!this._startTime)if(b.toInt()>0)this._startTime=b.toInt();this.initTimer()},_checkExpired:function(){if(this._expireTime<this._getCurrentTime()){this.fireEvent("seatsExpired");this._expired=true;this.resetTimer()}},_getCurrentTime:function(){var b=(((new Date).getTime()-this._initTime.toInt())/1E3).round().toInt();return this.options.settings.servertime.toInt()+b},_updateHiddenTimer:function(){this._startTime>
0&&this._timerElement.set("value",this._startTime)},_updateTimerElement:function(){if(this._getCurrentTime()>=this._lastTextRefresh+this.options.settings.display){if(this._startTime>0){this._checkExpired();this._updateHiddenTimer();var b="";if(this._expired)b=this.options.text.expiredMessage;else{b=this.options.text.normalMessage;var a=false;if(Math.floor((this._expireTime-this._getCurrentTime())/60)>0){b+=Math.floor((this._expireTime-this._getCurrentTime())/60);b+=Math.floor((this._expireTime-this._getCurrentTime())/
60)==1?this.options.text.minute:this.options.text.minutes;a=true}if((this._expireTime-this._getCurrentTime())%60){if(a)b+=this.options.text.and;b+=(this._expireTime-this._getCurrentTime())%60;b+=(this._expireTime-this._getCurrentTime())%60==1?this.options.text.second:this.options.text.seconds}b+="."}this._displayElement.set("text",b);this._displayElement[(b&&b.length?"remove":"add")+"Class"]("bookingTimerEmpty")}this._lastTextRefresh=this._getCurrentTime()}}});

