// JavaScript Document

function inverse_photo(obj)
{
		var principale_taille_max_width = 400;
		var principale_taille_max_height = 300;
		var miniature_taille_max_width = 80;
		var miniature_taille_max_height = 60;
		
	    image_temp = new Image();
        image_temp.src = document.getElementById('photo_princ').src;
		width_temp = document.getElementById('photo_princ').width;
		height_temp = document.getElementById('photo_princ').height;
		
		document.getElementById('photo_princ').src = obj.src;

		if (obj.width>obj.height)
		{
			document.getElementById('photo_princ').width = principale_taille_max_width;
			document.getElementById('photo_princ').height = Math.round(obj.height*principale_taille_max_width/obj.width);
		}
		else 
		{
			document.getElementById('photo_princ').height = principale_taille_max_height;
			document.getElementById('photo_princ').width = Math.round(obj.width*principale_taille_max_height/obj.height);		
		}
		
		if (width_temp>height_temp)
		{
			obj.width = miniature_taille_max_width;
			obj.height = Math.round(height_temp*miniature_taille_max_width/width_temp);
		}
		else 
		{
			obj.height = miniature_taille_max_height;
			obj.width = Math.round(width_temp*miniature_taille_max_height/height_temp);		
		}
		
		obj.src = image_temp.src;
}
