
/*----------------------------------------------------------------------------
MOUSEOVERIMG.JS

Copyright by
plenum stoll & fischbach Communication GmbH,
Herrenberg, Germany

mouseoverimg.js 	contains functionality image preloading and
					mouseover functionality
					
					requires js-include: /global/js/onloadhandler.js
					requires js-include: /global/js/getelementsbyclassname.js
----------------------------------------------------------------------------*/


//	initMouseOverImages()
//
//	No arguments
//
//	what:	finds images with class name "mouseOverImage"
//	how:	by looking through image elements of the document
//			with class name "mouseOverImage", reading image source,
//			and loading over image by adding "_over" to over image source
function initMouseOverImages()
{
	if (document.getElementById && document.getElementsByTagName)
	{
		var images = getElementsByClassName('mouseOverImage','img');

		for (var i = 0; i < images.length; i++)
		{
			var thumbnail = new function()
			{
				this.image = images[i];
				if (this.image)
				{
					this.out = new Image();
					this.out.src = this.image.src;
					this.over = new Image();
					//this.over.src = this.out.src.replace(/(\.(gif|jpg))/, '_over' + '$1');

					this.image.obj = this;
					this.image.onmouseover = function()
					{
						if (this.src.indexOf('_over') == -1) this.src = this.src.replace(/(\.(gif|jpg))/, '_over' + '$1');
						window.setTimeout("window.status = ''",50);
					}
					this.image.onmouseout = function()
					{
						this.src = this.obj.out.src;
					}
				}
			}
		}
	}
}

// Add function to window.onload event
AddToOnloadHandler(initMouseOverImages)

