/*
 * This is the powerful script that makes image swapping more convenient
 * The Initial Developer of the Original Code is Leon S. Koshelev <koshelev_leon@mail.ru>
 * Contributor(s): Web-Master Co., Saint-Petersburg, Russia
 * Version 3.000_01 07.11.2003 (Since 20.10.2001)
 * Copyright (c) 2001-2003 Leon S. Koshelev, Saint-Petersburg, Russia. All Rights Reserved.
 * This library is opensource software and distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
 * Permission to use, copy, modify, and distribute this software for any purposes and without fee is hereby granted provided that this copyright notice appears in all copies.
 */

// This script will work in Navigator 3+, Explorer 4+, Opera 5+, etc.

function _imgNew(URI)
{
	var o=new Image(); o.src=URI; return o;
}

function imgSrcAdd(obj)
{
	with(obj)
	{
		onload=srcDown=srcOver=srcOut=null;
	}

	if(arguments.length>2)
	{
		obj.srcDown=_imgNew(arguments[2]);
	}
	if (arguments.length>1)
	{
		obj.srcOver=_imgNew(arguments[1]);
		obj.srcOut=_imgNew(obj.src);
	}
}

function imgOver(obj, images)
{
	obj.images = images;

	for(var i=0;i<obj.images.length;i++)
	{
		with (obj.images[i])
		{
			if (complete && srcOver) src=srcOver.src;
		}
	}
}

function imgDown(obj)
{
	for(var i=0;i<obj.images.length;i++)
	{
		with (obj.images[i])
		{
			if (complete && srcDown) src=srcDown.src;
		}
	}
}

function imgOut(obj)
{
	for(var i=0;i<obj.images.length;i++)
	{
		with (obj.images[i])
		{
			if (complete && srcOut) src=srcOut.src;
		}
	}
}
