function doNothing() {
}
function handle() {
	convertFontSize();
	resizeImages();
}
function convertFontSize() {
	var coll = document.getElementsByTagName('font');
	if (coll != null) {
		for (var i = 0; i < coll.length; i++) {
			//alert(coll[i].size);
			if (!isNaN(coll[i].size)) {
				var  percentuale = "";
				switch(coll[i].size) {
					case '1': 
						percentuale = "50%";
						break;
					case '2': 
						percentuale = "60%";
						break;
					case '3': 
						percentuale = "70%";
						break;
					case '4': 
						percentuale = "80%";
						break;
					case '5':
						percentuale = "90%";
						break;
					case '6':
						percentuale = "100%";
						break;
					case '7':
						percentuale = "110%";
						break;
				}
				coll[i].style.fontSize = percentuale;
			}
		}
	}
}
function resizeImages() {
	var images = document.getElementsByTagName('img');
	if (images != null) {
		for (var i = 0; i < images.length; i++) {
			var styleClass = images[i].className;
			switch (styleClass) {
				case 'onfocus':
					resize(images[i], 150, 150);
					//alert('width: ' + images[i].width + ' - height: ' + images[i].height);
					break;
				case 'comm':
					resize(images[i], 100, 100);
					//alert('width: ' + images[i].width + ' - height: ' + images[i].height);
					break;
			}
		}
	}
}
function resize(img, w, h) {
	var newW = img.width;
	var newH = img.height;
	while (newW > w || newH > h) {
		var wDiff = img.width-w;
		var hDiff = img.height-h;
		var coeff = 1;
		if (wDiff > hDiff) {
			coeff = w/newW;
		} else {
			coeff = h/newH;
		}
		newW = newW*coeff;
		newH = newH*coeff;
	}
	img.width = newW;
	img.height = newH;
}
var setImageMaxWidthCount= 0;
var imageCount = 1;
function setImageMaxWidth(id, maxWidth) {
	if (setImageMaxWidthCount < imageCount) {
		var image = document.getElementById(id);
		//alert('setImageMaxWidth width: ' + image.width);
		//alert('setImageMaxWidth height: '+image.height);
		if (image.width > maxWidth) {
			image.width = maxWidth;
		}
		//alert('setImageMaxWidth width: ' + image.width);
		//alert('setImageMaxWidth height: '+image.height);
		setImageMaxWidthCount++;
		return image.width;
	}
}
var setImageMaxHeightCount= 0;
function setImageMaxHeight(id, maxHeight) {
	if (setImageMaxHeightCount < imageCount) {
		var image = document.getElementById(id);
		//alert(setImageMaxHeight - 'width: ' + image.width);
		//alert('setImageMaxHeight - height: '+image.height);
		if (image.width > maxHeight) {
			image.height = maxHeight;
		}
		//alert(setImageMaxHeight - 'width: ' + image.width);
		//alert('setImageMaxHeight - height: '+image.height);
		setImageMaxHeightCount++;
		return image.height;
	}
}
