function makeDropDownMenuWork(menu_id)
{
	if( !document.getElementById(menu_id) ){
		return false;
	}
		
	var menu		=	document.getElementById(menu_id);
	
	var menu_li		=	menu.getElementsByTagName('li');
	var menu_li_c	=	menu_li.length;
	
	for(var i = 0; i < menu_li_c; i++)
	{
		menu_li[i].onmouseover	=	function()
		{
			if( this.parentNode.id != menu_id && this.getElementsByTagName('ul').length > 0){
				this.className	=	'more_red';
			}
			if( this.getElementsByTagName('ul').length > 0 )
			{				
				var current_ul	=	this.getElementsByTagName('ul')[0];
				current_ul.style.display	=	'block';
				
				if( this.parentNode.id	==	menu_id && this.className == this.className + ' drop'){
					this.className	=	this.className + ' drop active';
				}
				
				this.onmouseout	=	function()
				{
					current_ul.style.display	=	'none';
					if( this.parentNode.id == menu_id && this.className == this.className + ' drop active' )
					{
						this.className = this.className + ' drop';
					}
					if( this.parentNode.id != menu_id && this.getElementsByTagName('ul').length > 0){
						this.className = 'more_gray';
					}
					this.className = this.className.replace("stupidie","");
				}
			}	
			else{
				this.onmouseout = function(){
					this.className = this.className.replace("stupidie","");
				}
			}
			
			if( this.parentNode.id != menu_id ){
				this.className = 'stupidie';
			}
		}
		
		var li	=	menu_li[i];
		
		if( li.parentNode.id != menu_id && li.getElementsByTagName('ul').length > 0){
			li.className	=	'more_gray';
		}
		if( li.parentNode.id == menu_id && li.getElementsByTagName('ul').length > 0 )
		{
			if( li.className.search(/active/) != -1){
				li.className	=	li.className + ' drop active';
			}
			else{
				li.className	=	li.className + ' drop';
			}
		}
		
	}
	
}



function makeSubMenuItems()
{
	if( document.getElementById('leftpage') )
	{
		var left = document.getElementById('leftpage');
		
		if( left.getElementsByTagName('ul').length > 0 )
		{
			var root	=	left.getElementsByTagName('ul')[0];
			var childs	=	root.getElementsByTagName('li');
			var len		=	childs.length;
			
			for(var i = 0; i < len; i++)
			{
				if( childs[i].parentNode.className == 'menu' ){
					childs[i].onclick = function()
					{
						if( this.getElementsByTagName('ul').length > 0 )
						{
							var display = this.getElementsByTagName('ul')[0].style.display == 'block' ? 'none' : 'block';
							this.getElementsByTagName('ul')[0].style.display = display;
							
							if (this.getElementsByTagName('ul')[0].style.display == 'block')
							{
								this.getElementsByTagName('ul')[0].parentNode.className = this.getElementsByTagName('ul')[0].parentNode.className + " active";
							}
							else
							{
								this.getElementsByTagName('ul')[0].parentNode.className = this.getElementsByTagName('ul')[0].parentNode.className.replace("active","");
							}
							
							
						
						}
					}
				}
				else{
					if( childs[i].getElementsByTagName('a').length > 0 ){
						childs[i].onclick = function()
						{
							clear(left);
							window.location = this.getElementsByTagName('a')[0].href;
						}
					}
					else{
						childs[i].onclick = null;
					}
				}	
				
			}
		}
		separatorHover(left);
	}
}


function clear(obj)
{
	var childs = obj.getElementsByTagName('*');
	for(var i = 0; i < childs.length; i++)
	{
		childs[i].onclick = null;
	}	
}


function separatorHover(obj)
{
	var leftpage = obj;
	var spans    = leftpage.getElementsByTagName('span');
	
	for(var i = 0; i < spans.length; i++)
	{
		if( spans[i].className == 'separator' )
		{
			spans[i].onmouseover = function(){
				if( this.style.backgroundColor != '#5da9d9' ){
					this.style.backgroundColor = '#5da9d9';
					this.style.color = 'white';
					
					this.onmouseout = function()
					{
						if( this.className != 'active' ){
							this.style.backgroundColor = '#E9EEF3';
							this.style.color = '#474747';
						}
					}
					
				}
			}
		}
	}
}

/*
	if( document.getElementById('leftpage') )
	{
		var left	=	document.getElementById('leftpage');
		
		if( left.getElementsByTagName('ul').length > 0 )
		{
			var root	=	left.getElementsByTagName('ul')[0];
			var childs	=	root.getElementsByTagName('li');
			var len		=	childs.length;
			
			for(var i = 0; i < len; i++)
			{
				if( childs[i].getElementsByTagName('ul').length > 0 )
				{
					childs[i].getElementsByTagName('span')[0].className	=	'child';
					
				
				}
							
				
				childs[i].onmousedown=function(){
					if (this.getElementsByTagName('ul')[0].style.display=='none')
					{
						this.getElementsByTagName('ul')[0].style.display='block';
					}
					else
					{
						this.getElementsByTagName('ul')[0].style.display='none';
					}
				}
			}
			
		}
	}
	
}*/