//***************************
// DropdownMenu Constructor *
//***************************
function S_DepartmentMenu(menu_wrapper_node, timer_interval)
{
	// settings
	this.timer_interval	= !timer_interval ? 0 : timer_interval;
	
	// get id's
	this.menu_wrapper	= document.getElementById(menu_wrapper_node);
	this.menu			= this.menu_wrapper.getElementsByTagName('ul')[0];

	// set strings
	this.hover_class	= 'cs_hover';
	this.active_class	= 'cs_active';
	
	// initialize menu object
	this.init();
}

//***************************
// Function initialize menu *
//***************************
S_DepartmentMenu.prototype.init = function()
{
	var _this = this;
	
	for (a=0; a<this.menu.childNodes.length; a++)
	{
		var item_node = this.menu.childNodes[a];
		
		if (item_node.nodeName == 'LI')
		{
			var submenu = item_node.getElementsByTagName('ul')[0];
	
			if(submenu)
			{
				var item_anchor = item_node.getElementsByTagName('a')[0];
				
				if (item_anchor)
				{
					item_anchor.onclick = function()
					{
						// hide active submenu
						_this.hideSubMenu();
						
						// show submenu
						this.parentNode.className	= _this.hover_class;
						
						return false;
					}
				}
			}
		}
	}
}

//************************
// Function hide submenu *
//************************
S_DepartmentMenu.prototype.hideSubMenu = function()
{
	var _this = this;
	
	for (a=0; a<this.menu.childNodes.length; a++)
	{
		var item_node = this.menu.childNodes[a];
		
		if (item_node.nodeName == 'LI')
		{
			item_node.className = '';
		}
	}
}
