/***************************************************************************************************************************/
var contentmaxheight = 145;
var openedcontent = 0;
var rolltimeout = false;
var rollspeed = 15;
var nextrollid = 0;

var hidetimeout_id = 0;
var hidetimeout_wait = 500;
var hidetimeout = false;

var lastover = 0;
var mouseout = false;

function rollupdown_content(up,down,upheight,downheight)
	{
		if (up != 0) 
			{
				upheight -= rollspeed;
				document.getElementById("contentbox_"+up).style.height = upheight+"px";
				if (upheight > rollspeed)
					{ 
						setTimeout('rollupdown_content('+up+','+down+','+upheight+','+downheight+')', 1);
						rolltimeout = true;
					}
				else
					{	
						document.getElementById("contentbox_"+up).style.display = "none";
						document.getElementById("topmenu_button_"+up).style.backgroundPosition = "0px 0px";
						
						if (down != 0)
							{
								setTimeout('rollupdown_content('+0+','+down+','+upheight+','+downheight+')', 1);
								rolltimeout = true;
							}
						else
							{
								openedcontent = 0;
								rolltimeout = false;

								if (nextrollid != 0) 
									{ 
										setTimeout('rollupdown_content('+down+','+nextrollid+','+contentmaxheight+','+1+')', 1);
										rolltimeout = true;
									}
							}
					}
			}
		else 
			{
				document.getElementById("contentbox_"+down).style.display = "block";
				
				downheight += rollspeed;
				document.getElementById("contentbox_"+down).style.height = downheight+"px";
				if (downheight < (contentmaxheight-rollspeed))
					{ 
						setTimeout('rollupdown_content('+up+','+down+','+upheight+','+downheight+')', 1);
						rolltimeout = true;
					}
				else
					{	
						document.getElementById("contentbox_"+down).style.height = contentmaxheight+"px";
						openedcontent = down;
						rolltimeout = false;
						
						if (openedcontent == nextrollid || nextrollid == 0) 
							{
								nextrollid = 0;
								document.getElementById("topmenu_button_"+down).style.backgroundPosition = "0px -92px";
								if (mouseout) hidecontent(down);
							}
						else
							{ 
								setTimeout('rollupdown_content('+down+','+nextrollid+','+contentmaxheight+','+1+')', 1);
								rolltimeout = true;
							}
					}
			}
	}

function showcontent(id)
	{
		mouseout = false;
		hidecontent_stop();
		if (openedcontent != id)
			{
				if (lastover != id)
					{ 
						if (lastover != 0) document.getElementById("topmenu_button_"+lastover).style.backgroundPosition = "0px 0px"; 
						document.getElementById("topmenu_button_"+id).style.backgroundPosition = "0px -46px"; 
						lastover = id;
					}
				
				if (!rolltimeout) rollupdown_content(openedcontent,id,145,1);
					else  nextrollid = id;
			}
	}
	
function hidecontent(id)
	{
		mouseout = true;
		if (!rolltimeout) 
			{
			 	hidetimeout_id = setTimeout('rollupdown_content('+id+','+0+','+145+','+1+')', hidetimeout_wait);
				hidetimeout = true;
			}
	}

function hidecontent_stop()
	{ if (hidetimeout) { clearTimeout(hidetimeout_id); hidetimeout = false; hidetimeout_id = 0; } }
	
/***************************************************************************************************************************/
	
function groupbox_head_over(obj)
	{
		obj.className="groupbox_head_over";
	}

function groupbox_head_out(obj)
	{
		obj.className="groupbox_head";
	}
	
/***************************************************************************************************************************/

function menulink_opencontent(id)
	{
		if (document.getElementById("menucontent_"+id).style.display == "block")
			{ 
				document.getElementById("menucontent_"+id).style.display = "none";
			}
			else
			{ 
				document.getElementById("menucontent_"+id).style.display = "block"; 
			}
	}
	
function menulink_over(obj)
	{
		obj.className = "menulink_over";
	}
	
function menulink_out(obj)
	{
		obj.className = "menulink";
	}
	
