var saveImgWidthLarge = [];
var saveImgWidthSmall = [];
var midSize=[];

function enlargerScaleImg(imageId, displayWidth, callSource)
{
	currentImg = document.images[imageId];

	if (callSource == 1)
	{
		saveImgWidthLarge[currentImg.id]=(currentImg.width);
		saveImgWidthSmall[currentImg.id]=(displayWidth);
		temp=((saveImgWidthLarge[currentImg.id] - saveImgWidthSmall[currentImg.id]) /2);
		midSize[currentImg.id]=(saveImgWidthSmall[currentImg.id] + temp);
	}

	if (currentImg.width>midSize[currentImg.id])
	{
		currentImg.width=(saveImgWidthSmall[currentImg.id]);
	}
	else
	{
		currentImg.width=(saveImgWidthLarge[currentImg.id]);
	}

	enlargerInitImage(imageId); 
	currentImg.style.cursor = "pointer";
}

function enlargerInitImage(imageId) 
{
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	enlargerFadeIn(imageId,0);
}

function enlargerFadeIn(objId,opacity) 
{
	if (document.getElementById)
	{
		obj = document.getElementById(objId);
		if (opacity <= 100) 
		{
			setOpacity(obj, opacity);
			opacity += 4;
			window.setTimeout("enlargerFadeIn('"+objId+"',"+opacity+")", 20);
		}
	}
}

function setOpacity(obj, opacity) 
{
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}
