function BuildTestURL (url) {
  var ParentID = "";

  var loc = new String(document.location);
  loc = loc.toLowerCase()

  var pattern = /[\/\\](\w{2}\d{4})[\/\\](\w{2}\d{4})/;
  var result = loc.match(pattern);
  if (result != null) {
    ParentID = result[1];
  }

  if (loc.substring(0, 4) == "http") {  // can connect online, or already online
    if (url.indexOf("ParentID=") < 0)
      window.open(url + "&ParentID=" + ParentID, "Test");
    else
      window.open(url, "Test");
  }
  else {
    if (confirm("You need to be online to proceed. Would you like to continue?")) {
      if (url.indexOf("ParentID=") < 0)
        window.open(url + "&ParentID=" + ParentID, "Test");
      else
        window.open(url, "Test");
    }
  }
}

