function LargePreviewPage(sDishID) { this.sDishID=sDishID; this.imgDish=null; this.getDiv = function(left,top,width,height) { //create Dish Ddata var div=document.createElement("div"); div.dir = T_MenuLanguages.isLangRTL() ? "rtl" : "ltr"; div.style.left=(left+"").indexOf("px")!=-1?left:(left+"px"); div.style.top=(left+"").indexOf("px")!=-1?top:(top+"px"); div.style.width= (width+"").indexOf("px")!=-1?width:(width+"px"); div.style.minHeight=(height+"").indexOf("px")!=-1?height:(height+"px"); div.style.position="absolute"; var table = document.createElement("table"); table.style.borderSpacing="0px"; table.style.width="100%"; table.style.height="100%"; table.cellPadding="0"; div.appendChild(table); //table.setAttribute("height", "100%"); var tr = document.createElement("tr"); tr.vAlign = "top"; tr.setAttribute("height","1px");//will be auto increased if there's an image table.appendChild(tr); var td = document.createElement("td"); tr.appendChild(td); this.imgDish = document.createElement("img"); this.imgDish.alt = ""; this.imgDish.style.maxWidth = "100%"; this.imgDish.style.maxHeight = window.innerHeight*0.6+"px"; td.appendChild(this.imgDish); td.align = "center"; var imgUrl = T_Dishes.getImagePath(this.sDishID); var sDefaultDishPictureUrl=Common.getUrl("smartphones/sites/"+Common.getSiteID()+"/defaultDishPicture.jpg"); if (imgUrl == null) { imgUrl = sDefaultDishPictureUrl; imgUrl.tryingDefault=true; } this.imgDish.onerror=function(e) { var img=e.target; if (img.tryingDefault!=true) { img.src=sDefaultDishPictureUrl; img.tryingDefault=true; } else { img.onerror=null; img.parentNode.removeChild(img);//src=null; } }; this.imgDish.pendingSrc = imgUrl; //dish name tr = document.createElement("tr"); tr.setAttribute("height", "10px");//will be more if content requires it tr.vAlign = "top"; table.appendChild(tr); var td = document.createElement("td"); tr.appendChild(td); td.align = "center"; td.className = "largePreviewDishName"; td.textContent = T_Dishes.getName(this.sDishID); //dish price tr = document.createElement("tr"); tr.vAlign = "top"; tr.setAttribute("height", "10px");//will be more if content requires it table.appendChild(tr); td = document.createElement("td"); tr.appendChild(td); td.align = "center"; td.className = "largePreviewDishPrice"; td.textContent = T_Dishes.getPrice(this.sDishID); //dish description tr = document.createElement("tr"); tr.vAlign = "top"; table.appendChild(tr); td = document.createElement("td"); tr.appendChild(td); //divDescription = document.createElement("div"); //divDescription.addEventListener("touchstart",function(e){e.cancelBubble=true;}); //divDescription.style.height = "100%"; //td.appendChild(divDescription); td.align = T_MenuLanguages.isLangRTL() ? "right" : "left"; td.className = "largePreviewDishDescription"; td.textContent = T_Dishes.getDescription(this.sDishID); //divDescription.style.overflowY = "scroll"; //td.textContent = T_Dishes.getDescription(this.sDishID); var divScroller=document.createElement("div"); divScroller.style.width=div.style.width; divScroller.style.height=div.style.minHeight; divScroller.style.float=T_MenuLanguages.isLangRTL() ? "right":"left"; divScroller.appendChild(div); var scroll = new iScroll(divScroller, { snap: false, hScroll: false, vScroll: true, checkDOMChanges:true, momentum: true, hScrollbar: false, vScrollbar: false, onScrollEnd: function() { //document.querySelector('#indicator > li.active').className = ''; //document.querySelector('#indicator > li:nth-child(' + (this.currPageX+1) + ')').className = 'active'; } }); return divScroller; }; };