function markCurrentPage(curPage, levels, filename) {
  var path = '';
  for (var i = 0; i < levels; i++) {
    path = path + "../";
  }
  path = path + "images/";
  
  if (filename) {
    document[curPage].src = path + filename;
  } else {
    // default image
    document[curPage].src = path + "arrow-inc.gif";
  }
}

function formatField(objField, strFormat)
{
  if(document.all)
  {
    if(event.keyCode == 46 | event.keyCode == 8) return
    if(document.selection.createRange().offsetLeft < objField.createTextRange().boundingWidth) return
  }
  for( i = 0 ; i < strFormat.length ; i++)
  {
    if(strFormat.charAt(i) == "#") // the current character must be a digit
    {
      if(objField.value.length > i )
      {
        if(isNaN(objField.value.charAt(i)) || objField.value.charAt(i) == " ") // if its not a number, it's erased and the loop is set back one
        {
          objField.value = objField.value.substring(0,i) + objField.value.substring(i + 1,objField.value.length)
          i--
        }
      }
    }
    else if(strFormat.charAt(i) == "a") // the current character must be a letter (case insensitive)
    {
      if(objField.value.length > i )
      {
        // if its not a letter, it's erased
        if(objField.value.charAt(i).toUpperCase() < "A" || objField.value.charAt(i).toUpperCase() > "Z" )
        {
          objField.value = objField.value.substring(0,i) + objField.value.substring(i + 1,objField.value.length)
          i--
        }
      }
    }
    else if(strFormat.charAt(i) == "A") // the current character must be an uppercase letter
    {
      if(objField.value.length > i )
      {
        // if its not a letter, it's removed
        if(objField.value.charAt(i).toUpperCase() < "A" || objField.value.charAt(i).toUpperCase() > "Z" )
        {
          objField.value = objField.value.substring(0,i) + objField.value.substring(i + 1,objField.value.length)
          i--
        }
        else // otherwise, it is set to uppercase
        {
          objField.value = objField.value.substring(0,i) + objField.value.charAt(i).toUpperCase() + objField.value.substring(i + 1,objField.value.length)
        }
      }
    }
    else // the current character must be the same as the one in the format string
    {
      if(objField.value.length > i )
      {
        // if it isn't already the correct character, insert the character
        if(objField.value.charAt(i) != strFormat.charAt(i))
        {
          objField.value = objField.value.substring(0,i) + strFormat.charAt(i) + objField.value.substring(i,objField.value.length)
        }
      }
    }
  }
  if(objField.value.length > strFormat.length)
  {
    objField.value = objField.value.substring(0,strFormat.length)
  }
}

