// JScript File
//*********************************************************************
//  GridSingleCheck                                                 //*
//*********************************************************************
function GridSingleCheck(gridname,checkbox)
{
  if (!checkbox.checked)
    return;

  index = checkbox.id.indexOf(gridname);
  if (index != -1)
  {
    var childList = document.getElementById(checkbox.id.substr(0,index + gridname.length)).getElementsByTagName("input");
    for (wsub = 0;wsub < childList.length;wsub++)
    {
      var inputfield = childList[wsub];
      if ((inputfield.type == "checkbox")
      &&  (inputfield.id != checkbox.id)
      &&  (inputfield.checked == true))
        inputfield.checked = false;      
    }
  }
}
//*********************************************************************
//  NewWindow                                                         *
//*********************************************************************
function NewWindow(url)
{
  window.open(url,
              "_blank",
              "resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes");
  return;
}
//*********************************************************************
//  ForcePostBack                                                   //*
//*********************************************************************
function ForcePostBack(id,returnValue)
{
  __doPostBack(id, returnValue);
}
//*********************************************************************
//  ToggleDiv                                                       //*
//*********************************************************************
function ToggleDiv(ctrl)
{
  var target = document.getElementById( ctrl.id + '_target');
  var stateholder = document.getElementById( ctrl.id + '_displaystate');
  if (target.style.display == "block")
  {
    target.style.display = "none";
    stateholder.value = "none";
    ctrl.value = "+";
  }
  else
  {
    target.style.display = "block";
    stateholder.value = "block";
    ctrl.value = "-";
    var selectCtrls = target.getElementsByTagName("select")
    if (selectCtrls.length > 0)
    {
      for (wsub = 0;wsub < selectCtrls.length;wsub++)
      {    
        SizeListBoxToParent(selectCtrls[wsub]);
      }
    }
  }
}
//*********************************************************************
//  SizeListBoxToParent                                             //*
//*********************************************************************
function SizeListBoxToParent(list)
{
  if (list != null)
  {
    if (list.clientWidth < list.parentNode.clientWidth)
     list.style.width = list.parentNode.clientWidth;
  }
}
