$(document).on("pageinit","#guest-page",function(){vard=Date.now();$("#logoarea").html('<img src="php/ossystem.php?command=getlogo&t='+d+'" style="max-height:300px;"/>');intervalCheckLastOsSystemAccess(5);tablesPreselected=false;varc=location.search;if(c.length!=0){vara=c.slice(1);varf=a.split("=");if((f.length>=2)&&(f[0]=="code")){varb=f[1];vare=b.split("_");if(e.length>=2){tablecode=e[0];selectedTableid=e[1];tablesPreselected=true}}}getTables()});vartablesPreselected=false;varselectedTableid=null;varsyncisWorking=false;vardailycode=null;vartablecode=null;varproducts=null;vartypes=null;varcurrency="";vardecpoint=".";varselectedproduct=null;varselectedtable=null;vartimeout=0;vartimecounter=0;varaskdaycode=1;varasktablecode=1;varfetchTimer=null;varorders=[];vartablevalues=[];functionintervalCheckLastOsSystemAccess(b){doAjax("GET","php/ossystem.php?command=getsystemstatus",null,insertSyncIsWorking,true);vara=setInterval(function(){doAjax("GET","php/ossystem.php?command=getsystemstatus",null,insertSyncIsWorking,true)},b*1000)}functiontimeouting(){if(fetchTimer!=null){clearTimeout(fetchTimer)}if(timeout!=0){timecounter=0;fetchTimer=setInterval(function(){updateTimer()},1000)}}functioncreateReadableTimeValue(c){varb=Math.floor(c/60);vara=c%60;if(a<10){a="0"+a.toString()}return"Verbleibende Zeit bis Neuanmeldung: "+b+":"+a+" "}functionupdateTimer(){if(timecounter>0){$("#timecounter").show();$("#timecounter").html(createReadableTimeValue(timecounter))}else{$("#timecounter").hide()}if(timecounter>0){timecounter--;if(timecounter==0){vara=$("#tableselection").is(":visible");if(!a){$(".notcollapsible").hide();getTables()}}}}functioninsertSyncIsWorking(c){if(c.status=="OK"){if(c.msg.lastaccessok==1){syncisWorking=true}else{syncisWorking=false}if(syncisWorking){$("#warningdiv").hide()}else{$("#warningdiv").show()}vara=c.msg.dbwritestatus;vard=a.writeable;if(d==0){varb=a.file;if(a.reason!=""){b+=" (Zusatzinfo: "+a.reason+")"}$("#writeprotectedfile").html(b);$("#warningdiv2").show()}else{$("#warningdiv2").hide()}}}functionrequestTableInfoWithoutGUI(){orders=[];doAjax("GET","php/tables.php?command=gettables",null,insertTablesNoGui,"Fehler beim Abruf der Tische",true)}functionrequestTableInfoWithGUI(){orders=[];doAjax("GET","php/tables.php?command=gettables",null,insertTables,"Fehler beim Abruf der Tische",true)}functiongetTables(){if(tablesPreselected){requestTableInfoWithoutGUI()}else{requestTableInfoWithGUI()}}functionpreventCollapsible(){$(".notcollapsible").off("collapsiblecollapse").on("collapsiblecollapse",function(a){a.stopImmediatePropagation();a.preventDefault();varb=this.id;$("#"+b).collapsible("expand")})}functioninsertTablesNoGui(a){if(a.status!="OK"){alert("Es ist ein Fehler aufgetreten: "+a.msg)}else{currency=a.currency;decpoint=a.decpoint;timeout=a.timeout;askdaycode=a.askdaycode;asktablecode=a.asktablecode;tablevalues=a.msg;timeouting();handleCodeInput()}}functioninsertTables(b){if(b.status!="OK"){alert("Es ist ein Fehler aufgetreten: "+b.msg)}else{currency=b.currency;decpoint=b.decpoint;timeout=b.timeout;askdaycode=b.askdaycode;asktablecode=b.asktablecode;vara="";a+=fillSelectionBox("tableselect",b.msg,"Tischauswahl");$("#tableselectionbox").html(a);$("#tableselection").show();$("#tableselection").trigger("create");preventCollapsible();$("#tableselectionbox").off("change").on("change",function(c){c.stopImmediatePropagation();c.preventDefault();selectedTableid=$("#tableselect").val();if(selectedTableid!=(-1)){$("#tableselection").hide();handleCodeInput()}});timeouting()}}functionhandleCodeInput(){if((askdaycode==0)&&tablesPreselected){startCodeCheck(selectedTableid,tablecode,"empty");return}if((askdaycode==0)&&(asktablecode==0)){if(!tablesPreselected){tablecode="empty"}dailycode="empty";timecounter=timeout;initProductsView();return}$("#tablecodediv").show();preventCollapsible();if(askdaycode==1){if(!tablesPreselected){tablecode="empty"}$("#daycodearea").show()}if((asktablecode==1)&&!tablesPreselected){dailycode="empty";$("#tablecodearea").show()}$("#tablecodefield"