var frm;
var i=0;

// Heinle's function for retrieving a cookie.
function getCookie(name) {
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    }
  }
  return null;
}

// An adaptation of Dorcht's function for setting a cookie.
function setCookie ( name, value, expires, path, domain, secure ) {
  if (domain == null) domain = ".brasscraft.com";
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path ) +
  ((domain == null) ? "" : "; domain=" + domain ) +
  ((secure == null) ? "" : "; secure");
}

function rowColor() {
  if (i % 2 == 0)
    document.write('<TR BGCOLOR="#ffffff">');
  else
    document.write('<TR BGCOLOR="#eeeeee">');
  i = i + 1
}

function replaceCharacter(inputString, searchChar, newChar) {
  var newString = "";
  var x;
  for ( x = 0; x < inputString.length; x++ ) {
    if (inputString.charAt(x)==searchChar)
      newString+=newChar;
    else
      newString+=inputString.charAt(x);
  }
  return newString;
}  // end of replaceCharacter ()

function mOverAndOut(evt) {
    var e = (window.event) ? window.event : evt;
    var CurrSource;
    var imgType;
    var EventType = e.type;
    if (EventType.toLowerCase() == "mouseover" )
        imgType = "+";
    else
        imgType = "-";
    uMe = e.srcElement ? e.srcElement : e.target;
    CurrSource = uMe.src;
    uMe.src = CurrSource.substring(0, CurrSource.length - 5) + imgType + ".gif";
}



function openDbRelativeURL( url, target ){
  //Check we have a target window;
  target = (target == null ) ? window : target;
  //Work out the path of the database;
  path = location.pathname.split('.nsf')[0] + '.nsf/';
  target.location.href = path + url;
}

function trim(str) {
  str = str.replace(/^\s*/, '').replace(/\s*$/, '');
  return str;
}  // end of trim()

function returnFalse(s){
  //guess the field if not supplied
  s = (s == null) ? document.forms[0].Query : s;
  //if you want to do the search, use this line
  doSearch(s);
  //this line should always be here!!
  return false;
}

function noenter(e, funcName, value) {
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13) {
          if (funcName != null) eval(funcName);
          return false;
     }
     else
          return true;
}

function highRow(currentRow) {
if (window.location.href.indexOf(currentRow)>0)
    document.write('<TR BGCOLOR="ivory">');
else
    document.write('<TR>');
}
