var iact = new Image(10,10);
iact.src = "/bp/images/blues2.gif";
var inact = new Image(10,10);
inact.src = "/bp/images/blues1.gif";
function img_act(imgName){document[imgName].src=iact.src;}
function img_inact(imgName){document[imgName].src=inact.src;}

function setLongCookie(name,value,hours)
{ var exp=new Date();
  exp.setHours(exp.getHours()+hours);
  document.cookie=name+"="+escape(value)+"; path=/; expires="+exp.toGMTString()+";"
}

function setCookie(name, value)
{if (getCookie(name) != value)
	 document.cookie = name + "=" + escape(value) + "; path=/;"
}

function getCookie(name)
{ var search = name+"="
  if (document.cookie.length > 0)
  { offset = document.cookie.indexOf( search)
    if (offset != -1)
    { offset += search.length
      end = document.cookie.indexOf(";", offset)
      if (end == -1) end = document.cookie.length
      return unescape( document.cookie.substring( offset, end))
    }
  }
  return null;
}

function selectOptionByVal(dd,val)
{ try {var opt=dd.options;
	if (val != "None")
	{ var valU=val;
    if (typeof valU == "string") valU=valU.toUpperCase();
		for (i=0; i < opt.length; i++)
		if ((opt[i].value.toUpperCase() == valU) ||
					(opt[i].text.toUpperCase() == valU))
			{ opt[i].selected=true;
				return;
			}
	}} catch(e) {}
}

function getSelectedVal(dd)
{ return dd.options[dd.selectedIndex].value;
}

function getSelectedText(dd)
{ return dd.options[dd.selectedIndex].text;
}

function openWindow(param,name,w,h)
{ var tm = (new Date()).getTime();
  var s=window.location.href;

  if (param.indexOf("http") != 0
   && param.indexOf("/") != 0)
  { var i = s.indexOf("?");
    if (i > 0) s = s.substring(0,s.indexOf("?") + 1);
    else s = s + "?";
  }
  else
    s = "";
//  alert (s);
  s = s + param + "&tm=" + tm;
  var win= window.open( s, name,
  "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes," +
  "resizable=yes,copyhistory=yes,width="+w+",height="+h);
}

function refrSelf()
{ window.focus();
	document.theForm.submit();
}

function textCounter(f,c,m)
{ var a = 0;
  var s = f.value;
	for (var i = 0; i < s.length; i++)
	{ if (s.substring(i, i + 1) == '\n')
			a += 2;
	}
  if (m - s.length - a < 0) 
    f.value = s.substring(0, s.length-1);
	c.value = m - s.length - a;
}