function detectMacXFF2() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (/firefox[\/\s](\d+\.\d+)/.test(userAgent)) {
    var ffversion = new Number(RegExp.$1);
    if (ffversion < 3 && userAgent.indexOf('mac') != -1) {
      return true;
    }
  }
}
sfHover = function() {
	if(document.getElementById("nav"))
	{
		var sfEls = document.getElementById("nav").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"), "");
			}
		}
	}
}
function $(e){
	return document.getElementById(e)
}
function findPosX(obj){
	var curleft=0;
	if(obj.offsetParent)
		while(1){
			curleft+=obj.offsetLeft
			if(!obj.offsetParent)
				break
			obj=obj.offsetParent
		}
	else if(obj.x)
		curleft+=obj.x
	return curleft
}
function isIE(){
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)
}
function init(){
	var i,lastmenu_width
	for(i=1;i<9;i++)
	{
		if(($("menu"+i))&&($("amenu"+i)))
		{
			$("menu"+i).style.backgroundPosition=parseInt($("amenu"+i).offsetWidth+1)+"px 0"
		}
	}
	i=9
	if(($("menu"+i))&&($("amenu"+i)))
	{
		lastmenu_width=(-1)*(findPosX($("amenu"+9))-findPosX($("nav"))-$("nav").offsetWidth)+1
		if(isIE())
			lastmenu_width-=1
		$("menu"+i).style.backgroundPosition=parseInt(lastmenu_width)+"px 0"
	}
	var l=false
       l=detectMacXFF2()
       if(l){
               $("amenu9").style.width="142px;"
       }

}
window.onload=init
if (window.attachEvent) window.attachEvent("onload", sfHover);