  var ns4 = (document.layers)? true:false;
  var ie4 = (document.all && !document.getElementById)? true:false;
  var ie = (document.all) ? true : false;
var DHTML = (document.getElementById || document.all || document.layers);

function showObject(obj) {
	var x = new getObj(objId);
	x.style.visibility = 'visible';
}
function hideObject(objId) {
	var x = new getObj(objId);
	x.style.visibility = 'hidden';
}
function invi(objId, flag) {
	if (!DHTML) return;
	var x = new getObj(objId);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}
function getObj(name) {
  if (document.getElementById) {
  	this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
  }
  else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
  }
  else if (document.layers) {
		this.obj = getObjNN4(document,name);
		this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}
function windowOpen(url, name, width, height) {
  newWin = window.open(url, name, "width="+width+",height="+height+",scrollbars=1");
  newWin.focus();
}
function updateContent(id, msg) {
  if (ie4) document.all[id].innerHTML = msg;
  else if (ns4 && document.layers[id]) {
    document.layers[id].document.open();
    document.layers[id].document.write(msg);
    document.layers[id].document.close();
  }
  else {
  	element = document.getElementById(id);
  	if (element != null) element.innerHTML = msg;
  }
}
function updateStyle(id,x,y,color) {
  if (ie) {
    obj = eval('document.all.'+id);
    obj.style.pixelTop = y;
    obj.style.pixelLeft = x;
    obj.style.color = color;
  }
  else {
    obj = document.getElementById(id);
		if (obj != null) {
	    obj.style.top = y +"px";
	    obj.style.left = x + "px";
	    obj.style.color = color;
	  }
  }
}
function rndnumber(max){
  var randscript = -1;
  while (randscript < 0 || randscript > max || isNaN(randscript)){
    randscript = parseInt(Math.random()*(max+1));
  }
  return randscript;
}
function imgOn(obj) {
  if (ns4) img = eval('document.daemon.document.'+obj);
  else if (ie) img = eval('document.all.'+obj);
  else img = document.getElementById(obj);
  mouseon = "/images/"+obj+"_a.gif";
  img.src = mouseon;
}
function imgOff(obj) {
  if (ns4) img = eval('document.daemon.document.'+obj);
  else if (ie) img = eval('document.all.'+obj);
  else img = document.getElementById(obj);
  mouseoff = "/images/"+obj+".gif";
  img.src = mouseoff;
}

