/*	Rollover
	Autore: Emanuele Lanza - 10.2002
	emanuelelanza@tiscali.it
*/

function LoadImgs()	// path, nomi
{
	// carica in memoria le immagini
	var a, path, l;

	// ------------------------------
	a = LoadImgs.arguments;

	if (a.length != 2)
		return (false);

	path = a[0];
	l = a[1];

	if ((l.length % 2) != 0)
		return (false);
	// ------------------------------

	var n, i, nome, nf, f, nome_ogg, istr_a, nome_src_ogg, istr_b, idf, nome_img;

	n = l.length / 2;	// num. di immagini
	for (i = 0 ; i < n ; i++)
	{
		nome = l[i * 2];	// nome
		nf = l[i * 2 + 1];	// numero frame

		for (f = 1 ; f <= nf ; f++)
		{
			nome_ogg = "r" + f + "_" + nome;
			istr_a = nome_ogg + " = new Image()";

			nome_src_ogg = nome_ogg + ".src";

			if (f == 1)
				idf = "";
			else
				idf = "_f" + f;

			nome_img = path + nome + idf + ".gif";
			istr_b = nome_src_ogg + " = '" + nome_img + "'";

			//alert(istr_a);
			eval(istr_a);

			//alert(istr_b);
			eval(istr_b);
		}
	}
}

// cambia src immagine
function VisImgs()	// nome, frame
{
	var a, n, i, ogg, nome_f;
	
	a = VisImgs.arguments;
	
	if ((a.length % 2) != 0)
		return (false);
	
	n = a.length / 2;
	for (i = 0 ; i < n ; i++)
	{
		ogg = document.images[a[i * 2]];
		nome_f = "r" + a[i * 2 + 1] + "_" + a[i * 2] + ".src";
		
		ogg.src = eval(nome_f);
	}
}

// cambia src immagini su un document specificato con object
function VisImgsDoc()	// object, nome, frame
{
	var a, n, i, ogg, nome_f, obj;
	
	a = VisImgsDoc.arguments;
	
	if ((a.length % 2) != 1)
		return (false);
	
	if (a[0] == "")
		obj = window.document;
	else
		obj = eval(a[0]);
		
	n = (a.length - 1) / 2;
	for (i = 0 ; i < n ; i++)
	{
		ogg = obj.images[a[i * 2 + 1]];
		nome_f = "r" + a[i * 2 + 2] + "_" + a[i * 2 + 1] + ".src";
		
		ogg.src = eval(nome_f);
	}
}