var menucanclick = true; function CatClick(clickcatid) { catid=clickcatid; RefreshDisplay(); document.getElementById('lblheader').innerHTML = FindCatById(clickcatid).name; } function ItemClick(from,itemid) { if(menucanclick) { document.location.href="act/action.php?catuid=" + from + "&additem=" + itemid + "&service=" + service; menucanclick=false; var s=document.getElementById(itemid); s.className=s.className.substring(0,9) + 'a'; s.style.backgroundColor="yellow"; } } function IsBetweenTime(date1,date2) { if(date1[0]<=currentTime.getHours() && date2[0]>currentTime.getHours()) return true; else if(date1[0]>currentTime.getHours() || date2[0]=currentTime.getMinutes()) return true; else if(date1[1]>currentTime.getMinutes() || date2[1] 0) Item.price = Item.priceDelivery; itemlist.push(Item); } function FindCatById(cat) { for(i in catlist) { if(catlist[i].id==cat) return catlist[i]; } return null; } function RemoveAccent(s) { s=s.replace(/[àâä]/gi,"a"); s=s.replace(/[éèêë]/gi,"e"); s=s.replace(/[îï]/gi,"i"); s=s.replace(/[ôö]/gi,"o"); s=s.replace(/[ùûü]/gi,"u"); return s; } function GetListToDisplay() { var list=new Array(); for(i in catlist) { if(catlist[i].from==catid) if(catlist[i].timefrom=="" || IsBetweenTime(catlist[i].timefrom,catlist[i].timeto)) list.push(catlist[i]); } for(i in itemlist) { if(itemlist[i].from==catid) list.push(itemlist[i]); } return list; } function ClearDisplay() { var iStart=0; if(catid==0) { if(document.getElementById('service')!=null) iStart=1; } if(document.getElementById('scroller').childNodes[iStart]!=null) { while(document.getElementById('scroller').childNodes[iStart]!=null) { document.getElementById('scroller').removeChild(document.getElementById('scroller').childNodes[iStart]); } } } function CreateDisplay() { currentTime=new Date(); var i=0; var list=GetListToDisplay(); for(iCpt in list) { var newdiv=document.createElement('div'); if(list[iCpt].IsService==null) { // ITEMS if (list[iCpt].infos == "") // Normal item name only newdiv.innerHTML="
" + GetItemPrice(list[iCpt]) + "$
" + list[iCpt].name + "
"; else // Show additional information below item name newdiv.innerHTML="
" + GetItemPrice(list[iCpt]) + "$
" + list[iCpt].name + "
" + list[iCpt].infos + "
"; } else // CATEGORIES newdiv.innerHTML="
>>>
" + list[iCpt].name + "
"; document.getElementById('scroller').appendChild(newdiv); i = 1 - i; } // update Header to show actual category name if (catid == 0) { document.getElementById('lblheader').innerHTML = ""; } else document.getElementById('lblheader').innerHTML = FindCatById(catid).name; if(myScroll!=null) myScroll.scrollTo(0,0); } function RefreshDisplay() { ClearDisplay(); CreateDisplay(); } function include(file) { script=document.createElement('script'); script.src=file; script.type='text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); } include("menu-js/pjs.php?pjs=options"); include("menu-js/pjs.php?pjs=ingredients");