function confirmUrl(url, message)
{
    if (confirm(message))
        document.location.href = url;
} // confirmUrl

function checkAll(maincheck, form, field)
{
	var oCheckbox = document.getElementById(field);
	with (form)
	{
		for (var i=0; i < elements.length; i++)
		{
			if (elements[i].type == 'checkbox' && elements[i].name == field)
				elements[i].checked = maincheck.checked;
		}
	}
} // checkAll

function listMoveUp(elementId)
{
	listBox = document.getElementById(elementId);
	
	if (listBox.selectedIndex < 1)
		return false;
		
	tempValue = listBox.options[listBox.selectedIndex].value;
	tempText = listBox.options[listBox.selectedIndex].text
	listBox.options[listBox.selectedIndex].value = listBox.options[listBox.selectedIndex-1].value;
	listBox.options[listBox.selectedIndex].text = listBox.options[listBox.selectedIndex-1].text;
	listBox.options[listBox.selectedIndex-1].value = tempValue;
	listBox.options[listBox.selectedIndex-1].text = tempText;
	listBox.selectedIndex -= 1;
	
} // listMoveUp

function listMoveDown(elementId)
{
	listBox = document.getElementById(elementId);
	
	if (listBox.selectedIndex == -1 || listBox.selectedIndex >= listBox.length-1)
		return false;
		
	tempValue = listBox.options[listBox.selectedIndex].value;
	tempText = listBox.options[listBox.selectedIndex].text
	listBox.options[listBox.selectedIndex].value = listBox.options[listBox.selectedIndex+1].value;
	listBox.options[listBox.selectedIndex].text = listBox.options[listBox.selectedIndex+1].text;
	listBox.options[listBox.selectedIndex+1].value = tempValue;
	listBox.options[listBox.selectedIndex+1].text = tempText;
	listBox.selectedIndex += 1;
	
} // listMoveDown

function listSelectAll(elementId)
{
	listBox = document.getElementById(elementId);
	for(i = 0;i < listBox.length;i++)
	{
		listBox.options[i].selected = true;
	}
} // listSelectAll

function listSelectTop(elementId)
{
	listBox = document.getElementById(elementId);
	foundSelection = false;
	for(i = 0;i < listBox.length; i++)
	{
		if (foundSelection)
			listBox.options[i].selected = false;
		else if (listBox.options[i].selected)
			foundSelection = true;
	}
} // listSelectTop

function listGetSelectedOption(elementId)
{
	listBox = document.getElementById(elementId);
	for(i = 0;i < listBox.length; i++)
	{
		if (listBox.options[i].selected)
			return listBox.options[i];
	}
} // listGetSelectedOption