var normalImg = "";
function setOver(tabImg) {
  normalImg = tabImg.src;
  var imgName = normalImg.substring(normalImg.lastIndexOf('.gif')-5,normalImg.length-4);
  if (imgName=='admin')
    tabImg.src = "admin_over.gif";
  else
    tabImg.src = "lookup_over.gif";
}
function hideOver(tabImg) {
  tabImg.src = normalImg;
}
function writeCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else
	    var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function getCookie(name)
{
  if (document.cookie)
  {
    var cookies=document.cookie.split(";");
    for (var i=0; i<cookies.length; i++)
    {
      var varName=(cookies[i].split("=")[0]);
      var varValue=(cookies[i].split("=")[1]);
      // the next 2 lines trim whitespaces (Netscape 7 problem)
      while (varName.charAt(0)==" ")
        varName=varName.substr(1,varName.length);
      // the escape() function will return URL encoded string.
      if (varName==name)
        return escape(varValue);
    }
  }
}
function selectOption(dd, v) {
  for(var i=0;i<dd.options.length;i++) {
    if (dd.options[i].value == v) {
      dd.selectedIndex = i;
      break;
    }
  }
  if (dd.options.length>0 && dd.selectedIndex == -1) // set to the first item if this item was not found
    dd.selectedIndex = 0;
}