global $calledBefore,$doctype,$action,$up,$x,$y,$previousScore,$currentStep,$previousStep,$function,$currentScore,$down,$nextStep,$nextScore,$deleteFunc,$previousFunction,$nextFunction;
if(!($calledBefore))
{
displayFunctions($doctype, $action);
} // END if
else
{
if(isset($up))
{
# Destroy memory space associated with x and y coordinates
# which were passed from the input image...
unset($x);
unset($y);
# Destroy $up...
unset($up);
# Make a query string to update the row to move, to its new
# score and step values...
$queryStringA = "UPDATE sbmFUNCTIONS SET score = "
. "'$previousScore'";
if($previousStep < $currentStep)
{ # If the function aboves step is lower, then we must also
# change this...
$queryStringA = $queryStringA . ", step = "
. "'$previousStep'";
} // END if
$queryStringA = $queryStringA . " WHERE doctype = '$doctype'"
. " AND function = '$function' AND score = "
. "'$currentScore' AND step = '$currentStep' and action='$action'";
# Now, make another query string to update the function that
# was above the function that we have just updated in the
# order. This function should be updated to have the values
# that the function that we just updated had!
$queryStringB = "UPDATE sbmFUNCTIONS SET score = "
. "'$currentScore'";
if($previousStep < $currentStep)
{ # If the function we are alterring to the one above has a
# lower step than the one that came after it in the list,