var cacheManager=new CCacheManager,documentRenderer=new CDocumentRenderer;function CPage(d,c,e){var b=null,a=this;a.width_mm=d;a.height_mm=c;a.width_pix=parseInt(d*koef_mm_to_pix);a.height_pix=parseInt(c*koef_mm_to_pix);a.pageIndex=e;a.cachedImage=b;a.indexIteration=0;a.timerId=-1;a.Draw=function(a,e,f,d,c){a.fillStyle="#ffffff";a.strokeStyle="#bbbbbb";a.fillRect(e,f,d,c);a.strokeRect(e,f,d,c);if(b!=this.cachedImage)a.drawImage(this.cachedImage.image,e,f,d,c);else this.startRendering()};a.UpdateSize=function(c,b){var a=this;a.width_mm=c;a.height_mm=b;a.width_pix=parseInt(c*koef_mm_to_pix);a.height_pix=parseInt(b*koef_mm_to_pix)};a.startRendering=function(){var a=this;if(b!=a.cachedImage)return;a.cachedImage=cacheManager.Lock(a.width_pix,a.height_pix);a.indexIteration=0;documentRenderer.drawpage(a)};a.stopRendering=function(){if(-1!=this.timerId){clearInterval(this.timerId);this.timerId=-1}};a.stopRenderingAttack=function(){this.stopRendering();cacheManager.UnLock(this.cachedImage);this.cachedImage=b}}