//******************************************************
//
// Javascriptove funkcie pouzivane v aplikacii PTI
//
//******************************************************

var datePickerWindow;

function GetDate(ctrlName, language)
{
  // otvorim okno s kalendarom, ale zabezpecim, aby sa otvorilo iba jedno
  if (datePickerWindow == null || datePickerWindow.closed)
  {
    datePickerWindow = window.open("datepicker.aspx?formName=" + document.forms[0].name + "&ctrlName=" + ctrlName + "&lang=" + language, "", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=210,height=230");
  }
}

function SetDate(formName, ctrlName, value)
{
  if (window.opener.document.forms[formName] != null)
  {
    if (window.opener.document.forms[formName].elements[ctrlName] != null)
    {
      window.opener.document.forms[formName].elements[ctrlName].value = value;
    }
  }
}

function DatePickerClose()
{
  window.close();
}

//function CheckWindow()
//{
//  if (datePickerWindow != null)
//  {
//    datePickerWindow.close();
//  }
//}

function SetControlVisibility(ctrlName, value)
{
  var ctrlRef;

  if ((ctrlRef = window.document.all(ctrlName)) != null)
  {
    if (value)
    {
      ctrlRef.style.visibility = "visible";
    }
    else
    {
      alert("Hide: " + ctrlName);
      ctrlRef.style.visibility = "hidden";
    }
  }
  else
  {
    alert("Control not found");
  }
}
