﻿var oq;

window.onload = wOnLoad;

function wOnLoad (e) {
  oq = document.getElementById ("frmQ");
  if (oq) {
    oq.onkeypress = qOnKey;
    oq.onfocus = qOnFocus;
    oq.onblur = qOnBlur;
  }

  if (oq) {
    ShowDeafult ();
  }
  
  btn = document.getElementById ("srchBtn");
  if (btn) {
    btn.onclick = frmSubmit;
  }
}

function frmSubmit () {
  var f = document.getElementById ("searchForm")
  if (entered) {
    f.submit ();
  }
}

function qOnKey (e) {
  entered = true;
}

function qOnFocus (e) {
  if (oq) {
    if (!entered) {
      oq.value = "";
    }
    oq.style.color = "#000";
  }
}
function qOnBlur (e) {
  if (!entered && oq) {
    ShowDeafult ();
  }
}

function ShowDeafult () {
  if (oq.value == "") {
    oq.value = srchDefaultText; //"Search:";
    oq.style.color = "#777";
  }
}


