// JavaScript Document
function maxWidth(img,maxW) {
	//proportionally resizes an image to a maximum pixel width... Useful for e.g. images inserted from a database record with variable widths
	var curW = img.width;
	var curH = img.height;
	// only if the maximum Width is larger than current width...
	if(maxW < curW) {
		var newH = curH/curW*maxW;
		img.width = maxW;
		img.height = newH;
		 }
	//images checked with this function are often set to invisible initially (to avoid visual resizing effect)
	img.style.visibility = "visible";
}
