// COST860 JavaScript routines

var searchInputColor = 'black', searchMsgColor = 'gray', searchMsg = 'Search for:';

function init() {window.focus()}
// default init() function: Bring window on top

function RBover(element) {
  window.status = element.title;
  element.style.cursor = navigator.appVersion.indexOf('MSIE')>=0 ? 'hand' : 'pointer';
// for (name in element) if (!confirm(name + ' = ' + element.name)) break;
}  // function RBover()

function RBout(element) {
  window.status = '';
//  element.style.cursor = 'auto';
}  // function RBout()

function RBclick(element) {
  location.href = element.title;
}  // function RBclick()


function submitSearchForm(method) {
// submit the search form

  var ok = true; // true if ok to call search.asp, else false

  var form=document.forms.form1, field=form.query, search=field.value;
  if (field.style.color!=searchInputColor) {
    alert('You must select the Search field and specify the word(s) to search for');
    field.focus();
    return;
  } // if (!search>' ')
  if (search=='' || /^ *$/.test(search)) {
    alert('You must specify the word(s) to search for');
    field.focus();
    return;
  } // if (!search>' ')
  form.docs.value = method;
  if (ok)
    form.submit();
  else
    alert('You have submitted the search form to searh for\n  "'
      + search + '"\nwith multiple words/phrases combined with "' + method
      + '".\n\nHowever, the search facility is not yet implemented.');
} // function submitSearchForm()

function onfocusSearch(field) {
  if (field.style.color!=searchInputColor) {
    field.style.color=searchInputColor;
    field.value = '';
  } // if (field.style.color!=searchInputColor)
} // function onfocusSearch()


function onblurSearch(field) {
  if (field.value=='') {
    field.style.color=searchMsgColor;
    field.value = searchMsg;
  } // if (field.style.color!=searchInputColor)
} // function onblurSearch()
