/* udovenko-advokat.ru common script */

function menuPreload(items)
{
	// fields:
	this.items = items.length > 0 ? items : new Array();
	this.path = '/images/';
	this.hover_prx = '-a';
	this.ext = 'gif';
	
	// methods for mouse events:
	this.activate = menuActivate;
	this.over = menuItemOver;
	this.out = menuItemOut;
}

// activate images preload
function menuActivate()
{
	this.preloadItems = new Array();
	if (document.images)
	{
		for (i in this.items)
			this.preloadItems[this.items[i]] = new preloadImg(this.items[i], this.path, this.ext, this.hover_prx);
	}
}

function menuItemOver(item)
{
	if (this.preloadItems[item])
		document.getElementById(item).src = this.preloadItems[item].over.src;
}

function menuItemOut(item)
{
	if (this.preloadItems[item])
		document.getElementById(item).src = this.preloadItems[item].normal.src;
}

function preloadImg(srcFileName, path, ext, hover_prx)
{
	this.normal = new Image();
	this.normal.src = path + srcFileName + '.' + ext;
	this.over = new Image();
	this.over.src = path + srcFileName + hover_prx + '.' + ext;
}