var theImg, wMax, hMax, wFinal, hFinal;

function ZoomOut() {
	var NewWidth, NewHeight;
	
	NewWidth = theImg.width - 10;
	if (NewWidth >= wFinal) {
		theImg.width = NewWidth;
	} else {
		theImg.width = wFinal;
	}
	
	NewHeight = theImg.height - 10;
	if (NewHeight >= hFinal) {
		theImg.height = NewHeight;
	} else {
		theImg.height = hFinal;
	}
	
	if (theImg.width > wFinal || theImg.height > hFinal) {
		setTimeout('ZoomOut()', 10);
	}
}

function ZoomIn() {
	var NewWidth, NewHeight;
	
	NewWidth = theImg.width + 10;
	if (NewWidth <= wMax) {
		theImg.width = NewWidth;
	} else {
		theImg.width = wMax;
	}
	
	NewHeight = theImg.height + 10;
	if (NewHeight <= hMax) {
		theImg.height = NewHeight;
	} else {
		theImg.height = hMax;
	}
	
	if (theImg.width < wMax || theImg.height < hMax) {
		setTimeout('ZoomIn()', 10);
	} else {
		ZoomOut();
	}
}

function ZoomImg(idImg, widthMax, heightMax, widthFinal, heightFinal) {
	// get the img object
	theImg = MM_findObj(idImg);
	theImg.width = 1;
	theImg.height = 1;
	// Make the parameters global vars
	wMax = widthMax;
	hMax = heightMax;
	wFinal = widthFinal;
	hFinal = heightFinal;
	// Start the zooming
	ZoomIn();
}

var ToggleNotice = function(idNotice, CollapsedHeight, ExpandedHeight){
	var objNotice = document.getElementById(idNotice);
	var NoticeHeight;
	
	if (objNotice) {
		NoticeHeight = parseInt(objNotice.style.height);
		if (NoticeHeight > CollapsedHeight) {
			objNotice.scrollTop = 0;
			objNotice.style.height = CollapsedHeight + 'px';
			objNotice.style.overflow = 'hidden';
		} else {
			objNotice.style.height = ExpandedHeight + 'px';
			objNotice.style.overflow = 'auto';
		}
	}
}

