function picsize(obj,MaxWidth,MaxHeight){
	if(obj.resized) return;
  img=new Image();
  img.src=obj.src;
  if (img.width>MaxWidth && img.height>MaxHeight){
    if (img.width/img.height>MaxWidth/MaxHeight) {
      obj.height=MaxWidth*img.height/img.width;
      obj.width=MaxWidth;
    }else {
      obj.width=MaxHeight*img.width/img.height;
      obj.height=MaxHeight;
    }
  }else if (img.width>MaxWidth) {
    obj.height=MaxWidth*img.height/img.width;
    obj.width=MaxWidth;
  }else if (img.height>MaxHeight) {
    obj.width=MaxHeight*img.width/img.height;
    obj.height=MaxHeight;
  }else{
    obj.width=img.width;
    obj.height=img.height;
  }
  obj.resized=true;
}