var
	num_imatges_escalar = 0,
	foto_escalables = new Array(),
	nom_foto = new Array(),
	origens = new Array(),
	ample_max = new Array(),
	alt_max = new Array(),
	acabada = new Array(),
	total_carregades = 0;


function _escala_imatge()
{
	var ample,alt,objecte,i;
	
	for(i=1;i<=num_imatges_escalar;i++)
	{
//		if((foto_escalables[i].complete) && (acabada[i]==0))		
//		{
		acabada[i]=1;
		if ((foto_escalables[i].width <= ample_max[i]) &&
			(foto_escalables[i].height <= alt_max[i]))
		{
			ample = foto_escalables[i].width;
			alt = foto_escalables[i].height;
		}
		else
		{
			ample = ample_max[i];
			alt = foto_escalables[i].height * ample_max[i] / foto_escalables[i].width;
			if (alt > alt_max[i])
			{
				ample = ample * alt_max[i] / alt;
				alt = alt_max[i];
			}
		}
			objecte=MM_findObj(nom_foto[i]);
			if (objecte!=null)
			{
				if ((ample ==0) || (alt==0))
				{
					objecte.width = ample_max;
					objecte.height = alt_max;
				}
				else		
				{
					objecte.width = ample;
					objecte.height = alt;
				}
//				objecte.src = "top.gif";
//				alert(nom_foto[i]);
			}
//		}
	}
}

