function listbox_move(listID, direction)
{
	var listbox = document.getElementById(listID);
	var selIndex = listbox.selectedIndex;
	
	if(-1 == selIndex)
	{
		alert("Sinun pitää ensin valita listalta kohde.");
		return;
	}
	
	var increment = -1;
	
	if(direction == 'up')
	{
		increment = -1;
	}
	else
	{
		increment = 1;
	}

	if((selIndex + increment) < 0 || (selIndex + increment) > (listbox.options.length-1))
	{
		return;
	}

	var selValue = listbox.options[selIndex].value;
	var selText = listbox.options[selIndex].text;
	listbox.options[selIndex].value = listbox.options[selIndex + increment].value
	listbox.options[selIndex].text = listbox.options[selIndex + increment].text
	
	listbox.options[selIndex + increment].value = selValue;
	listbox.options[selIndex + increment].text = selText;
	
	listbox.selectedIndex = selIndex + increment;
}

function listbox_selectall(listID, isSelect)
{
	var listbox = document.getElementById(listID);
	for(var count=0; count < listbox.options.length; count++)
	{
		listbox.options[count].selected = isSelect;
	}
}
