/**
 * @author Jonas Wilson Schnack
 */
var resize_image = function( img_object, width, height )
{
	var imgSrc = new Image();
	imgSrc.src = img_object.src;
	
	var imageWidth = imgSrc.width;
	var imageHeight = imgSrc.height;
	
	//document.getElementById("debugger").innerHTML += imgSrc.src + ", " + imageWidth + ", " + imageHeight + "<br>";
	
	var imgRatio = imageWidth/imageHeight;
	var targetRatio = width/height;
	
	var resizeRatio;
	
	// check is image is more 'landscapey'
	if ( imgRatio > targetRatio )
	{
		resizeRatio = imageWidth/width;
	}
	
	// check is image is 'portraity' or squarey
	else
	{
		resizeRatio = imageHeight/height;
	}
	img_object.style.width = imageWidth/resizeRatio + 'px';
	img_object.style.height = imageHeight/resizeRatio + 'px';
};
