sfHover = function()
{
    var sfEls = document.getElementById("menu_list_2").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)
    {
	var navigator_version = navigator.appVersion;
	if (navigator_version < '4.0 (compatible; MSIE 7')
	    window.attachEvent("onload", sfHover);
    }

show_or_hide = function(element)
{
    var e = $(element);
    if (e)
	Element.toggle(element);
}

show_or_hide_if = function(element, cond)
{
    var e = $(element);
    if (e)
	{
	    if (cond == 0 || cond == false)
		Element.hide(e);
	    else
		Element.show(e);
	}
}

function addLoadEvent(func)
{
  var oldonload = window.onload;
 
  if (typeof window.onload != "function")
  {
    window.onload = func;
  }
  else
  {
    window.onload = function ()
    {
      oldonload();
      func();
    }
  }
}

function toggle_tab(tab_selected, tab_content, tab_ids, tab_content_ids)
{
    for (i in tab_ids)
	{
	    var id = tab_ids[i];
	    if (typeof id != "string")
		continue;
	    if (tab_selected == id)
		$(id).className = "tab_selected";
	    else
		$(id).className = "";
	}
    for (i in tab_content_ids)
	{
	    var id = tab_content_ids[i];
	    if (typeof id != "string")
		continue;
	    if (tab_content == id)
		Element.show(id);
	    else
		Element.hide(id);
	}
}

var myPopup;
var ww = 100;
var hh = 100;
var step = 15;
function popup(url, titre, width, height, autosize)
{
    option = 'resizable=yes,location=no,menubar=yes,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,';
    
    if (!width) width = ww;
    if (!height) height = hh;
    if (!autosize) autosize = false;
    
    var top = ((screen.height - height) / 2);
    var left = ((screen.width - width) / 2);
    option += ', width='+width+', height='+height+', top='+top+', left='+left;
    
    myPopup = window.open(url, titre, option);
    if (autosize)
	myPopup.onload = resize;
    return (false);
}

function resize()
{
    if (myPopup.document.all)
	{
	    x = myPopup.document.body.scrollWidth;
	    ww = (x < (screen.width - step) && x > ww) ? x : ww;
	    x = myPopup.document.body.scrollHeight;
	    hh = (x < (screen.height - step) && x > hh) ? x : hh;
	}
    else
	{
	    ww = (myPopup.document.width > ww) ? (myPopup.document.width) : ww;
	    hh = (myPopup.document.height > hh) ? (myPopup.document.height) : hh;
	}
    ww = (ww + 25);
    hh = (hh + 95);
    setTimeout("myPopup.window.resizeTo(ww, hh);",100);
    var top = ((screen.height - hh) / 2);
    var left = ((screen.width - ww) / 2);
    myPopup.window.moveTo(left, top);
    
}
