//-------------------//---- FUNCTIONS ----//-------------------
// Returns true if string s is English letters 
// (A .. Z, a..z) and numbers only.
function isAlphanumeric (s) {
  var i;

  // Search through string's characters one by one until we find
  // a non-alphanumeric character. When we do, return false; otherwise,
  // return true.
  for (i = 0; i < s.length; i++)
  {   
    // Check that current character is number or letter
    var c = s.charAt(i);

    if (!(isLetter(c) || isDigit(c)))
      return false;
  }

  // All characters are numbers or letters.
  return true;
}

// Returns true if character c is an English letter 
// (A .. Z, a..z).
function isLetter (c)
{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

// Returns true if character c is a digit 
// (0 .. 9).
function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

// Returns true if character c is a letter or digit.
function isLetterOrDigit (c)
{   return (isLetter(c) || isDigit(c))
}

// Opens a new browser window and loads the given URL
function openWin(url){
    var strWindowOptions = "location=yes,toolbar=yes,menubar=yes,status=yes" +
  	    ",scrollbars=yes,resizable=yes,top=20,left=20,width=600,height=400";
  	window.open(url,"",strWindowOptions);
}

function confirmDelete(url) {
  if(confirm("Are you sure you want to delete this record?")) {
    parent.location = url;
  }
  return;
}

function savePage(form, action, nextPage) {
  if(validateForm()){
    eval("document." + form + ".action.value = '" + action + "'");
    eval("document." + form + ".nextPage.value = '" + nextPage + "'");
    //alert(eval("document." + form + ".action.value"));
    eval("document." + form + ".submit()");
  }
}
