// Sitemaker specific support
// (C) www.in.gr

function AdjustSize(Img, nMaxWidth, nMaxHeight)
{
	var fRatioX = 1.0
	var fRatioY = 1.0;
	var fRatio;
	var nWidth, nHeight;
	
	if (nMaxWidth > 0) {
		if (Img.width > nMaxWidth) fRatioX = nMaxWidth / Img.width;
	}
	if (nMaxHeight > 0) {
		if (Img.height > nMaxHeight) fRatioY = nMaxHeight / Img.height;
	}
	
	if (fRatioX < fRatioY) fRatio = fRatioX; else fRatio = fRatioY;
	
	if (fRatio != 1.0) {
		nWidth = Img.width; nHeight = Img.height;
		nWidth *= fRatio; nHeight *= fRatio;
		Img.width = nWidth; Img.height = nHeight;
	}
	
}

function FixAllImages()
{
	var i;
	var Image;
	
	for (i = 0; i < document.images.length; i++) {
		Image = document.images[i];
		Image.src = Image.src;
	}
}

function CreateImageWindow(strURL, strLegend)
{
	var Wnd = window.open('', 'ImageView');
	Wnd.document.body.style.fontFamily = "Verdana, Arial";
	try { Wnd.document.charset = "UTF-8"; } catch(error) {}
	Wnd.document.body.innerHTML = "<table><tr><td><img src='" + strURL + "' /></td></tr><tr><td><div style='background-color: #E0E0E0; padding: 2px; font-size: 10px; '>" + strLegend + "</div></td></tr></table>";
	Wnd.document.title = strLegend;
	Wnd.focus();
	return true;
}

function NOP()
{
}

window.onload = FixAllImages;

