﻿// Called when the TextBox Control onFocus event fires.  Displays with a Watermark.
function GotFocus(textbox, defaultText) {
  textbox.style.color = '#000';
  textbox.style.backgroundColor = 'yellow';
  if (textbox.value == defaultText) {
    textbox.value = '';
  }
  textbox.select();
}

// Called when the Textbox Control onBlur event fires.  Displays with a Watermark.
function LostFocus(textbox, defaultText) {
  if (textbox.value == '' && defaultText != '') {
    textbox.value = defaultText;
    textbox.style.color = '#000';
    textbox.style.backgroundColor = '#b3b3b3';
  }
  else {
    textbox.style.color = '#b3b3b3';
    textbox.style.backgroundColor = '#fff';
  }
}

// Called to Show or Hide Text 
function ShowOrHideText(ImageName, ControlName, AltText) {
  var image = document.getElementById(ImageName);
  var ctrl = document.getElementById(ControlName);
  if (ctrl.style.display == "none")
    ctrl.style.display = "block";
  else
    ctrl.style.display = "none";
  if (image.src.endsWith("expand.jpg")) {
    image.src = "Images/collapse.jpg";
    image.alt = "Hide " + AltText + " Information";
  }
  else {
    image.src = "Images/expand.jpg";
    image.alt = "Show " + AltText + " Information";
  }
}

// Called to Navigate to an External Link
function ExternalNavigation(URL) { 
  javascript:window.open(URL);
}

// The Following Functions Work with Date And Time Selections
var backColor   // Holds BackColor value
var foreColor;  // Holds ForeColor value

function OnMouseOver(td) {
  backColor = td.style.backgroundColor;
  foreColor = td.style.color;
  td.style.backgroundColor = '#294E98';
  td.style.color = '#fff';
}
function OnMouseOut(td) {
  td.style.backgroundColor = backColor;
  td.style.color = foreColor;
}
function OnTimeClick(td, id) {
  var tb = document.getElementById(id);
  tb.value = td.innerText;
  $find("PCE").hidePopup();
}
function ShowCalendar(id) {
  var tb = document.getElementById(id);
  tb.focus();
}
function ShowTimePopup(id) {
  var tb = document.getElementById(id);
  tb.focus();
}
