var jwebPaperpatch={
	
	init:function(idWrap,idText,idImg,imgX,imgY,padT,padR,padB,padL){
		
		var wrap=document.getElementById(idWrap);
		var text=document.getElementById(idText);
		var img=document.getElementById(idImg);
		
		if(!wrap)return;
		
		var textSize=jweb.xy.size(text,1);
		var areaSize={x:imgX-padR-padL,y:imgY-padT-padB};
		
		var textSizeRatio=textSize.x/textSize.y; // > 1 = liggande
		var areaSizeRatio=areaSize.x/areaSize.y;
		
		if(textSizeRatio>areaSizeRatio){ // text mer liggande än bild
			var factor=textSize.x/areaSize.x;
			}
		else{
			var factor=(textSize.y*areaSizeRatio)/areaSize.x;
			}
		
		var imgX=Math.round(imgX*factor);
		var imgY=Math.round(imgY*factor);
		var posX=Math.round(padL*factor);
		var posY=Math.round(padT*factor);
		
		text.style.top=posY+'px';
		text.style.left=posX+'px';
		wrap.style.width=imgX+'px';
		wrap.style.height=imgY+'px';
		img.style.width=imgX+'px';
		img.style.height=imgY+'px';
		
		}
	
	};