function VsbPreloadImg(imgsrc,imgid,onimgload){var _this=this;var img=new Image();var vsbpreloadimg_onimgload=function(){if(img.getAttribute("loadedflag")==true){return}img.setAttribute("loadedflag",true);if(onimgload!=undefined&&onimgload!=null){onimgload(_this,imgid)}};_this.showImg=function(imgobj,maxwidth,maxheight,stretch,zoomin,isCenterCutImg){if(img.getAttribute("loadedflag")==null){imgobj.src="about:blank";imgobj.removeAttribute("src");return}if(maxwidth==undefined||maxheight==undefined||maxwidth==0||maxheight==0){imgobj.width=img.width;imgobj.height=img.height}else{var widthrate=img.width/maxwidth;var heightrate=img.height/maxheight;var imgwidth=0;var imgheight=0;if(widthrate>1||heightrate>1){if(!isCenterCutImg){if(stretch==undefined||stretch==false){var rate=Math.max(widthrate,heightrate);imgwidth=Math.max(1,Math.min(Math.ceil(img.width/rate),maxwidth));imgheight=Math.max(1,Math.min(Math.ceil(img.height/rate),maxheight))}else{imgwidth=maxwidth;imgheight=maxheight}}}else{if(widthrate<1||heightrate<1){if(!isCenterCutImg){if(zoomin==true){if(stretch==undefined||stretch==false){var rate=Math.max(widthrate,heightrate);imgwidth=Math.max(1,Math.min(Math.ceil(img.width/rate),maxwidth));imgheight=Math.max(1,Math.min(Math.ceil(img.height/rate),maxheight))}else{imgwidth=maxwidth;imgheight=maxheight}}else{imgwidth=img.width;imgheight=img.height}}}else{imgwidth=maxwidth;imgheight=maxheight}}if(imgobj){imgobj.src=img.src}if(imgobj){if(!isCenterCutImg){imgobj.width=imgwidth;imgobj.height=imgheight;imgobj.style.marginTop=(maxheight-imgheight)/2+"px"}else{cutImg(imgobj,"autocut")}}}};_this.getImage=function(){return img};_this.setAttribute=function(name,value){img.setAttribute(name,value)};_this.getAttribute=function(name){return img.getAttribute(name)};_this.getSrc=function(){return img.src};_this.getWidth=function(){return img.width};_this.getHeight=function(){return img.height};img.onload=function(){vsbpreloadimg_onimgload()};img.src=imgsrc}function VsbPreloadImgArray(){var _this=this;_this.imgs=new Array();_this.addImg=function(imgsrc,imgid,onimgload){var imgcount=_this.imgs.length;_this.imgs[imgcount]=new VsbPreloadImg(imgsrc,imgid,onimgload);_this.imgs[imgcount].setAttribute("imgindex",imgcount)};_this.size=function(){return _this.imgs.length};_this.length=_this.size;_this.getImage=function(index){return _this.imgs[index]}};