﻿var Img = new Object()
Img.showAtResize = function(pic_id,src,width,height){
     var oImg = new Image();
     oImg.onload = function(){
           if (oImg.width>width) 
           {
                 oImg.height = oImg.height * (width/oImg.width);
                 oImg.width = width;
           }
           if (oImg.height>height) {
                 oImg.width = oImg.width * (height/oImg.height);
                 oImg.height = height;
           }
           var objImg = document.getElementById(pic_id);
	   if(objImg!=undefined){
           objImg.src = oImg.src;
           objImg.width = oImg.width;
           objImg.height = oImg.height;
           objImg.style.display = 'block';
	   }
           var obj=document.getElementById("__imgloading"+pic_id);
	   if(obj!=undefined)
	   {
	   obj.style.display="none";
	   }
	   obj = null;
           oImg = null;
     }
     oImg.onerror = function(){
	   var obj=document.getElementById("__imgloading"+pic_id);
	   if(obj!=undefined){
           obj.style.display="none";
	   }
	   var obj=document.getElementById("__imgloaderror"+pic_id);
	   if(obj!=undefined)
	   {
	   obj.style.display="block";
	   }
	   obj=null;
           oImg = null;
     }
     oImg.src = src + "?" +Math.random();
}
