function img_sizing(img_src){
	var img = new Image();
	img.src = img_src;
	$(img).load(function(){
		if(img.height > img.width){
			$('#picture').css({'height':($(window).height()-40)+'px'});
			$('#picture').css({'width':(($(window).height()-40)/1.5)+'px'});
		}
		else{
			$('#picture').css({'height':($(window).height()-40)+'px'});
			$('#picture').css({'width':(($(window).height()-40)*1.5)+'px'});
		}
	});
}

$(function(){
	wait_img_loaded("pictures/places/places-10.jpg")
	//sizes correctly picture after page loaded, depending on resolution (part can eventually be cropped out to respect ratio)
	$(document).ready(function() {
		img_sizing("pictures/"+portfolio+"/"+portfolio+"-"+picture+".jpg");
	});
	
	// resizes picture when window is resized
	$(window).resize(function(){
		img_sizing("pictures/"+portfolio+"/"+portfolio+"-"+picture+".jpg");
	});
});
