/* nice function that gives each admin-icon a nice mouseover */
function iconSwitcher()
{
	for(i=0;i<document.images.length;i++)
	{
		if(document.images[i].src.indexOf("/resources/images/icons/")>-1)
		{
			document.images[i].style.margin = '0px 0px 1px 1px';
			document.images[i].onmouseover = function()
			{
				this.style.margin = '1px 1px 0px 0px';
			}
			document.images[i].onmouseout = function()
			{
				this.style.margin = '0px 0px 1px 1px';
			}
		}
	}
}

addLoadEvent(iconSwitcher);

//cleanup the directorynames
function cleanDirname(dest,val)
{
	if(dest.value.length==0)
	{
		var cleaned = val.toLowerCase();
		var repl = ["їїїїїабвгдезийклмнопстуфхцшщъыьэя","_____aaaaaaceeeeiiiinoooooouuuuyy"];
		
		cleaned = cleaned.replace(/[\!\?\$#\(\)\*\&\^\%\@\'\/\"\]\[\;]/gi, "");
		cleaned = cleaned.replace(/[ ]+/gi, "_");

		cleaned = cleaned.split("");
		
		for(var i=0;i<cleaned.length;i++)
		{
			var fnd = repl[0].indexOf(cleaned[i]);
			if(fnd>=0)
			{
				cleaned[i] = repl[1].split("")[fnd];
			}
		}
		dest.value = cleaned.join("");
	}
}