function OpenPane(hdnPaneID_ID, hdnSubPaneID_ID)
{
  // if there's an accordion on the page, open the pane set in the query string, if any
  var elt = document.getElementById('ctl00_ctl00_mainContent_PH_mainContent_lCol_PH_apHeading0_header');
  if (elt != null)
  {
    // parse request string
    qs();
    var paneID = qsParm['PaneID'];
    var subPaneID = qsParm['SubPaneID'];
    // if values not present, check hidden fields as well: could be there due to URL rerouting
    if (paneID == undefined) paneID = document.getElementById(hdnPaneID_ID).value;
    if (subPaneID == undefined) subPaneID = document.getElementById(hdnSubPaneID_ID).value;
    // see if PaneID has been sent through the request string
    if (paneID != '')
    {
      var acc = elt.parentNode;
      var behavior = acc.AccordionBehavior;
      if (behavior == undefined)
      {
        // this was an attempt to use the accordion extender instead, but for IE it too will be NULL :{
        // left here to show how to get the accordion extender, which might come in useful one day
//        var accExtenderID = elt.previousSibling.id.replace('_ClientState', '');
//        // CANNOT use document.getElementById() here: always returns NULL
//        // var accExtender = document.getElementById(accExtenderID);
//        var accExtender = $find(accExtenderID);
      }
      else
      {
        behavior.set_SelectedIndex(paneID);
        var pane = behavior.get_Pane(paneID);
        // need pane.content here; "content" is the property of the object "pane" that gives us the actual DOM element
        scroll(0, getY(pane.content) - 250); // the "250" is somewhat arbitrary: we are coming too far down, though
      }
      // what about SubPaneID?
      if (subPaneID != '')
      {
        var subElt = document.getElementById('ctl00_ctl00_mainContent_PH_mainContent_lCol_PH_apHeading' + paneID + '_content_apHeading0_header');
        if (subElt != null)
        {
          var subAcc = subElt.parentNode;
          var subBehavior = subAcc.AccordionBehavior;
          if (subBehavior != undefined)
          {
            subBehavior.set_SelectedIndex(subPaneID);
            var subPane = subBehavior.get_Pane(subPaneID);
            scroll(0, getY(subPane.content) - 250); // the "250" is somewhat arbitrary: we are coming too far down, though
          }
        }
      }
    }
  }
}

function SwitchFieldType(passWord_ID)
{
  var elt = document.getElementById(passWord_ID);
  var newElt = document.createElement('input');
  newElt.type = 'password';
  elt.parentNode.replaceChild(newElt, elt);
  newElt.setAttribute('id', 'inputPasswordField');
  newElt.setAttribute('class', 'inputField');
  newElt.setAttribute('className', 'inputField');
  // SET HANDLER FOR "BLUR" EVENT
  newElt.onblur = StorePassword;
  // three different ways of setting the focus, to try and cater for all browsers!
  newElt.focus();
  newElt.hasFocus = true;
  window.tempElm = newElt;
  setTimeout("tempElm.hasFocus=true;tempElm.focus();", 1);
}

function StorePassword()
{
  // store password in a hidden field that can be reached on the server
  var hdnElt = document.getElementById(hdnPassword_ID);
  var visibleElt = document.getElementById('inputPasswordField');
  hdnElt.value = visibleElt.value;
}

function SiteSearchClientClicked(imgLoadingSiteSearch_ID, lblMessage_ID)
{
  var loadingImg = null, message = null;
  loadingImg = document.getElementById(imgLoadingSiteSearch_ID);
  message = document.getElementById(lblMessage_ID);
  loadingImg.setAttribute('class', 'loadingImage visible');
  loadingImg.setAttribute('className', 'loadingImage visible');
  // clear message, if any
  if (message != null)
  {
    // it's the first child, in fact
    message.firstChild.nodeValue = "";
  }
}
