

function m_setCookie( name, value, expires ){
	document.cookie = name + '=' + escape(value) + (( !expires ) ? "" : ('; expires=' + expires.toUTCString())) + '; path=/';
} 
function m_getCookie( name ){
	var cookie  = document.cookie;
	var startPos = cookie.indexOf( name );
	if ( startPos != -1 ){
		startPos += name.length + 1;
	var endPos = cookie.indexOf( ";", startPos );
	if ( endPos == -1 )
		endPos = cookie.length;
           return unescape( cookie.substring(startPos, endPos) );
	}
	return null;
} 
  
function m_setCookieFromArray( name, valuesArray, expires, delimiter ){
	var strCookie = valuesArray.join( delimiter );
	m_setCookie( name, strCookie, expires );
}
 
function m_getCookieToArray( name, delimiter ){
	var valuesArray = new Array( 0 );
	var strCookie = m_getCookie( name );
	if ( strCookie ){
		valuesArray = strCookie.split( delimiter );
	}
	return valuesArray;
}

// MENU

var delay=30;
var step=10;
var m=2;


function show_sub(id)
{
	if (document.getElementById(id).style.display=="block")
	{
		a_min(id,getH(id),getH(id));
	}
	else
	{
		document.getElementById(id).style.display="block";
		a_max(id,m,getH(id));
	}
/*
	if ((document.getElementById("over_"+id).style.height=='2') || (document.getElementById("over_"+id).style.height=='2px'))
	{
		a_max(id,m,getH(id));
	}
	else
	{
		a_min(id,getH(id),getH(id));
	}
*/
}

function a_max(id,h,h2)
{
	document.getElementById(id).style.height=h;
//	document.getElementById("over_"+id).style.height=h;
	h=h+step;
	if (h<=h2)
		setTimeout(function(){a_max(id,h,h2)}, delay);
	else
		document.getElementById(id).style.height=h2;
//		document.getElementById("over_"+id).style.height=h2;
	
}

function a_min(id,h,h2)
{
	document.getElementById(id).style.height=h;
//	document.getElementById("over_"+id).style.height=h;
	h=h-step;
	if (h>=m)
		setTimeout(function(){a_min(id,h,h2)}, delay);
	else
	{
		document.getElementById(id).style.display="none";
//		document.getElementById("over_"+id).style.height=h2;
//		document.getElementById("over_"+id).style.height=2;
		document.getElementById(id).style.height=h2;
	}
}

function getH(id)
{
	h=document.getElementById(id).offsetHeight;
	return h;
}

