function ModifyOrder(theform,thefield,theaction)
{
	var move_value;
	var move_index;
	var counter = 0;
	var cur_counter = 0;
	var i=0;
	var new_option = "";
	var old_order_list = new Array();
	var new_order_list = "";
						
	//alert(theform);
	if (theaction == "up")
	{
		//as long as they have selected a word
		if (theform[thefield].selectedIndex != -1)
		{
			move_index = theform[thefield].selectedIndex;
					
			if (move_index == 0)
			{
				alert("Sorry, already at top of the list");
			}
			else
			{
				//get the contents of the old dict list
				for (i=0;i<theform[thefield].options.length;i++)
				{
					//if it is any other index besides the one that was selected, add it to the new list
					//in its current position
					if (i != move_index)
					{
						//if the current item is the one before the one we have selected to move
						//, put the item to be moved up here now instead
						if (i == (move_index -1))
						{
							old_order_list[counter++] = theform[thefield].options[move_index].value;
							old_order_list[counter++] = theform[thefield].options[move_index].text;
						}
						else
						{
							old_order_list[counter++] = theform[thefield].options[i].value;
							old_order_list[counter++] = theform[thefield].options[i].text;
						}
					}
					else
					{
						old_order_list[counter++] = theform[thefield].options[i-1].value;
						old_order_list[counter++] = theform[thefield].options[i-1].text;
					}
				}
				//counter has gone one to far
				counter--;
								
				theform[thefield].options.length = 0;
				for(i=0;i<counter;i+=2)
				{
					new_option = new Option(old_order_list[i+1],old_order_list[i],null,null);
					theform[thefield].options[cur_counter] = new_option;
					//turn off the option (no longer want it selected
					cur_counter++;
					new_order_list = new_order_list + "," + old_order_list[i];
				}
						
				//grab the one that we moved down and mark it as the currently selected one
				theform[thefield].options[move_index-1].selected = 1;
				//set hidden ordering value
				theform.orderlist.value = new_order_list;
			}
		}
		else
			alert("Please select an item to move.");
	}
	//if they have moved it down 
	else
	{
		//as long as they have selected a word
		if (theform[thefield].selectedIndex != -1)
		{
			move_index = theform[thefield].selectedIndex;
				
			if (move_index == (theform[thefield].options.length -1))
			{
				alert("Sorry, already at bottom of list");
			}
			else
			{
				//get the contents of the old dict list
				for (i=0;i<theform[thefield].options.length;i++)
				{
					//if it is any other index besides the one that was selected, add it to the new list
					//in its current position
					if (i != move_index)
					{
						//if the current item is the one after the one we have selected to move
						//, put the item to be moved up here now instead
						if (i == (move_index + 1))
						{
							old_order_list[counter++] = theform[thefield].options[move_index].value;
							old_order_list[counter++] = theform[thefield].options[move_index].text;
						}
						else
						{
							old_order_list[counter++] = theform[thefield].options[i].value;
							old_order_list[counter++] = theform[thefield].options[i].text;
						}
					}
					else
					{
						old_order_list[counter++] = theform[thefield].options[i+1].value;
						old_order_list[counter++] = theform[thefield].options[i+1].text;
					}
				}
				//counter has gone one to far
				counter--;
							
				theform[thefield].options.length = 0;
				for(i=0;i<counter;i+=2)
				{
					new_option = new Option(old_order_list[i+1],old_order_list[i],null,null);
					theform[thefield].options[cur_counter] = new_option;
					//turn off the option (no longer want it selected
					cur_counter++;
					new_order_list = new_order_list + "," + old_order_list[i];
				}
		
				//grab the one that we moved down and mark it as the currently selected one
				theform[thefield].options[move_index+1].selected = 1;
				//set hidden ordering value
				theform.orderlist.value = new_order_list;
			}
		}
		else
			alert("Please select an item to move.");
	}
}

