
// Show and Hide drop down menu lists.
function showHideList(mainLi, secondUl)
{
	if(document.getElementById(mainLi) != null )
	{
		document.getElementById(mainLi).onmousedown = function()
		{
			document.getElementById(secondUl).style.display = 'block';
		}
		document.getElementById(mainLi).onblur = function()
		{
			document.getElementById(secondUl).style.display = 'none';
		}
		if(document.getElementById(secondUl).style.display == 'block')
		{
			document.getElementById(mainLi).onclick = function()
			{
				document.getElementById(secondUl).style.display = 'none';
			}
		}
	}
}
////////////////////////////////////////////////////////////////////////

// This function use arguments to know with which Unordered List working.
// Set classes.
// Change classes on events.
function getList(mainLi, secondUl)
{
	if(document.getElementById(mainLi) != null)
	{
	showHideList(mainLi, secondUl);
	var curElement = document.getElementById(secondUl).getElementsByTagName('li');
	
		for(i = 0; i < curElement.length; i++)
		{
			curElement[i].onmouseover = function()
			{
				this.className = 'listStyleHover';
			}
			curElement[i].onmouseout = function()
			{
				this.className = 'listStyle';
			}
			curElement[i].onclick = function()
			{
				//Get firstChild.data from List tag and put for every hidden input field
				//start
				document.getElementById(mainLi).firstChild.data = this.firstChild.data;
				if(document.getElementById('job_pos') != null)
				{
					document.getElementById('job_pos').value = this.id;
					// alert(document.getElementById('job_pos').value);
				}
				if(document.getElementById('contact_to') != null)
				{
					document.getElementById('contact_to').value = this.firstChild.data;
				}
				//end
				
				document.getElementById(secondUl).style.display = 'none';
			}
		}
	}
}
////////////////////////////////////////////////////////////////////////

