var width_div = document.getElementById('picture_div').offsetWidth;
var height_div = document.getElementById('picture_div').offsetHeight;

function getMarime(width,height){
	var return_value = new Array(2);
	var x = width_div;
	var y = height_div;
	var imageWidth = width;
	var imageHeight = height;
	
	if (imageWidth > x) {
		imageHeight = imageHeight * (x / imageWidth); 
		imageWidth = x; 
		if (imageHeight > y) { 
			imageWidth = imageWidth * (y / imageHeight); 
			imageHeight = y; 
		}
	} else if (imageHeight > y) { 
		imageWidth = imageWidth * (y / imageHeight); 
		imageHeight = y; 
		if (imageWidth > x) { 
			imageHeight = imageHeight * (x / imageWidth); 
			imageWidth = x;
		}
	}
	return_value[0] = imageWidth;
	return_value[1] = imageHeight;
	
	return return_value;
}
