sfHover = function() {
	var sfEls = document.getElementById("navmenu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

//if (window.attachEvent) window.attachEvent("onload", sfHover);
//----------------------------------------------------------

/*
	Opens popup window, whitch is centered in screen
	Param:
		url string (link to the file you want to open)
		width int (window width)
		height int (window height)
*/
function OpenImagePopup(url,width,height) {
	var rnd = (Math.round((Math.random()*999)+1));
	
	var SH = screen.height;
	var SW = screen.width;

	if (SW < width)
	{
		newW = Math.round(SW * 0.90);
		dif = newW / width;
		newH = Math.round(height * dif);
		height = newH;
		width = newW;
	}

	if (SH < height)
	{
		newH = Math.round(SH * 0.90);
		dif = newH / height;
		newW = Math.round(width * dif);
		height = newH;
		width = newW;
	}

	var top = (screen.height) ? (screen.height-height)/2 : 0;
	var left = (screen.width) ? (screen.width-width)/2 : 0;

	iw = width;
	ih = height;
	my_window = window.open("", "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
	my_window.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" "+"\"http://www.w3.org/TR/html4/strict.dtd\">");
	my_window.document.writeln("<html><head><title>Picture preview</title>");
	my_window.document.writeln("<meta http-equiv=\"Content-Script-Type\" ","content=\"text/javascript\"><\/head>");
	my_window.document.writeln("<body style='margin:0px;padding:0px;'>")
	my_window.document.writeln("<img src='" + url + "' onclick='window.close();' border='0' width='" + iw + "' height='" + ih + "' alt='' />");
	my_window.document.writeln("<\/body><\/html>");
	my_window.document.close();
}
//---------------------------------------------------------------

/*
	Opens popup window, whitch is centered in screen
	Param:
		url string (link to the file you want to open)
		width int (window width)
		height int (window height)
*/
function openPopup(url,width,height) {
	var rnd = (Math.round((Math.random()*999)+1));
	
	scrollbars = 'yes';
	
	var top = (screen.height) ? (screen.height-height)/2 : 0;
	var left = (screen.width) ? (screen.width-width)/2 : 0;

	my_window = window.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars="+scrollbars+",location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
	my_window.document.close();
}
//---------------------------------------------------------------

function trimString (str)
{
	while (str.charAt(0) == ' ')
		str = str.substring(1);
	while (str.charAt(str.length - 1) == ' ')
		str = str.substring(0, str.length - 1);

	return str;
}
//---------------------------------------------------------------

function truebody() {
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
//---------------------------------------------------------------
