function buttonMOvr(src, clrOver, clrText){
  src.style.cursor = 'hand';
  src.style.background = clrOver;
  src.style.color = clrText;
}

function buttonMOut(src, clrIn, clrText){
  src.style.cursor = 'default';
  src.style.background = clrIn;
  src.style.color = clrText;
}
function displayNewWindow(location) {
  today = new Date() 
  thisMinutes = today.getMinutes()
  thisSeconds = today.getSeconds()
  newWindow = window.open(location, 'newWin'+thisMinutes+thisSeconds, 'scrollbars=yes,resizable=yes');
  self.name = "mainWin" + thisMinutes + thisSeconds;
}
function setCookieExpiryPath(cookieName, cookieValue, expiryMonths, urlPath) {
  expireDate = new Date;
  expireDate.setMonth(expireDate.getMonth()+expiryMonths);
  document.cookie = cookieName + "=" + cookieValue + "; expires=" + expireDate.toGMTString() + "; path=" + urlPath;
}
function setIDCookie(url,name) {
  IDURL = '';
  if (url) {
    callingURL = url;
    if (callingURL.indexOf('?') != -1) {
      IDURL = callingURL.substring(callingURL.indexOf('?')+1, callingURL.length);
      setCookieExpiryPath(name, IDURL, 60, '/');
    }
  }
}
function cookieExists(cookieName) {
  thisCookie = document.cookie.split("; ");
  for (i=0; i<thisCookie.length; i++) {
    if (cookieName == thisCookie[i].split("=")[0]) {
      return true;
    }
  }
  return false;
}
function cookieVal(cookieName) {
  thisCookie = document.cookie.split("; ");
  for (i=0; i<thisCookie.length; i++) {
    if (cookieName == thisCookie[i].split("=")[0]) {
      return thisCookie[i].split("=")[1];
    }
  }
}
function cookieEquals(cookieName, cookieValue) {
  if (cookieValue == cookieVal(cookieName)) {
    return true;
  } else {
    return false;
  }
}
function rollbg(chosen, objectID) {
if (chosen == "roll") { document.getElementById(objectID).className="navRoll"; }
else { document.getElementById(objectID).className="navOver"; }
}
function getQueryField(fieldname) {
 query = unescape(window.location.search.substring(1));
 pairs = query.split("&");	
 value = null;
 for (var i=0;i<pairs.length;i++) {
  pos = pairs[i].indexOf('=');
  if (pos >= 0) {
   if (pairs[i].substring(0,pos) == fieldname) {
     value = pairs[i].substring(pos+1);
     break;
   }
  }
 }
 return value;
}
function setCookieExpiryDayPath(cookieName, cookieValue, expiryDays, urlPath) {
 expireDate = new Date;
 expireDate.setTime(expireDate.getTime() + expiryDays*24*60*60*1000);
 document.cookie = cookieName + "=" + cookieValue + "; expires=" + expireDate.toGMTString() + "; path=" + urlPath;
}

function setQueryToCookieField(fieldname, expiryDays) {
 value = getQueryField(fieldname);
 if (value != null) {
   setCookieExpiryDayPath(fieldname, value, expiryDays, '/');
 }
}
function cookieQueryEquals(fieldName, fieldValue) {
  value = getQueryField(fieldName);
  if ((value != null) && (value != fieldValue)) {
    return false;
  }
  if ((fieldValue == cookieVal(fieldName)) || (fieldValue == getQueryField(fieldName))) {
    return true;
  } else {
    return false;
  }
}
