function onMouseOver(btn)
{
	btn.src = btn.src.replace(".normal", ".hover");
}

function onMouseOut(btn)
{
	btn.src = btn.src.replace(".hover", ".normal");
}
function Fullsize(url, width, height)
{
	this.url	= url;
	this.width	= width;
	this.height	= height;
}
var img;
var img1;
var img2;
var img3;
var img4;
var idInterval;
var imgCurrent;
var Opacity;
var aThumbnails = new Array();
var aFullsize = new Array();
var nCurrent = 0;
function setOpacity(opacity)
{
  opacity = (opacity == 100) ? 99.999 : opacity;
  
  // IE/Win
  img.style.filter = "alpha(opacity:" + opacity + ")";
  
  // Safari<1.2, Konqueror
  img.style.KHTMLOpacity = opacity / 100;
  
  // Older Mozilla and Firefox
  img.style.MozOpacity = opacity / 100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  img.style.opacity = opacity / 100;
}
function fadeIn()
{
	if ( Opacity <= 100 )
	{
		setOpacity(Opacity);
		Opacity += 10;
	}
	else
	{
		if ( (Opacity += 10) > 400 )
		{
			if ( ++nCurrent >= aThumbnails.length )
			{
				nCurrent = 0;
			}
			animate();
		}
	}
}
function init(src1, src2, src3, src4)
{
	img1 = new Image();
	img1.src = src1;
	aThumbnails[0] = img1;

	img2 = new Image();
	img2.src = src2;
	aThumbnails[1] = img2;

	if ( arguments.length >= 3 )
	{
		img3 = new Image();
		img3.src = src3;
		aThumbnails[2] = img3;
	}
	else
	{
		img3 = null;
	}

	if ( arguments.length >= 4 )
	{
		img4 = new Image();
		img4.src = src4;
		aThumbnails[3] = img4;
	}
	else
	{
		img4 = null;
	}

	img = document.getElementById("imgModel");

	nCurrent = 0;
	animate();
	idInterval = setInterval("fadeIn()", 100);
}
function animate()
{
	img.src = aThumbnails[nCurrent].src;
	setOpacity(0);
	img.style.visibility = 'visible';
	Opacity = 0;
}
function addFullsize(url, width, height)
{
	aFullsize[aFullsize.length] = new Fullsize(url, width, height);
}
function showImage()
{
	var width = aFullsize[nCurrent].width;
	var height = aFullsize[nCurrent].height;
	if ( screen.width < (width + 20) )
	{
		width = screen.width * 3 / 4;
	}
	else
	{
		width += 20;
	}
	if ( screen.height < (height + 20) )
	{
		height = screen.height * 3 / 4;
	}
	else
	{
		height += 20;
	}
	window.open(aFullsize[nCurrent].url, "_blank", "width=" + aFullsize[nCurrent].width + ",height=" + aFullsize[nCurrent].height + ",toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=yes,menubar=no");
	if ( navigator.appName == "Microsoft Internet Explorer" )
	{
		window.event.returnValue = false;
	}
	else
	{
		return false;
	}
}
function Popup(id)
{
	var floater = document.getElementById(id);
	var yScroll = 0;

	if ( (window.navigator.appName.toLowerCase().indexOf('explorer') == -1) )
	{
		yScroll = window.pageYOffset;
	}
	else
	{
		if ( document.documentElement && document.documentElement.scrollTop )
		{
			yScroll = document.documentElement.scrollTop;
		}
		else
		{
			if ( document.body )
			{
				yScroll = document.body.scrollTop;
			}
		}
	}

	floater.style.top = (20 + yScroll) + 'px';
	floater.style.right = 30 + 'px';
} 
function onMouseOverZoom(btn)
{
	btn.src = "images/zoomin_h.png";
}

function onMouseOutZoom(btn)
{
	btn.src = "images/zoomin_n.png";
}
