var fixers = new Array ();

function fixSize (im, fit) {
	imw = im.offsetWidth;
	imh = im.offsetHeight;

	aspect = imw / imh;

	if (aspect == 1) {
		//square

		im.width = fit;
		im.height = fit;

	} else if (aspect > 1) {
		//landscape

		im.width = fit;
		im.height = parseInt (fit / aspect);
	} else if (aspect < 1) {
		//portrait
		im.width = parseInt (fit * aspect);
		im.height = fit;
	}
}

function addImage (im) {
	fixers [fixers.length] = im;
}

function fixSizes (fit) {
	for (i = 0; i < fixers.length; i ++) {
		fixSize (fixers [i], fit);
	}

	for (i = 0; i < fixers.length; i ++) {
		fixers [i].style.visibility = "visible";
	}
}

function fix156() {
	fixSizes(156);
}

function fix193() {
	fixSizes(193);
}

function fix638() {
	fixSizes(638);
}

window.onload = fix156;
