function PrintResizedPicture(url,MaxX,MaxY){
	var Img = new Image();
	Img.src = url;
	propX = MaxX/Img.width;;
	propY = MaxY/Img.height;
	if (propX > propY){
		prop = MaxY/Img.height;
	}else{
		prop = MaxX/Img.width;
	}
	width = Math.round(Img.width*prop);
	height = Math.round(Img.height*prop);
	document.write("<img src='"+url+"' width='"+width+"' height='"+height+"'>");
}

function ResizePicture(Img,MaxX,MaxY){
//	alert(Img.width + ' ' + Img.height + ' ' + Img.complete);
	if (Img.width == 0){
		width = MaxX;
		height = MaxY;
	}else{
		propX = MaxX/Img.width;
		propY = MaxY/Img.height;
		if (propX > propY){
			prop = MaxY/Img.height;
		}else{
			prop = MaxX/Img.width;
		}
		width = Math.round(Img.width*prop);
		height = Math.round(Img.height*prop);
	}
	Img.width = width;
	Img.height = height;
}

function ResizePictureNotMore(Img,MaxX,MaxY){
	propX = MaxX/Img.width;;
	propY = MaxY/Img.height;
	if (propX > propY){
		prop = MaxY/Img.height;
	}else{
		prop = MaxX/Img.width;
	}
	width = Math.round(Img.width*prop);
	height = Math.round(Img.height*prop);
	if(Img.width>width || Img.height>height){
		Img.width = width;
		Img.height = height;
	}
}


