function resize_adframe(awidth,aheight)
{ document.getElementById("adframe").height=aheight;
  document.getElementById("adframe").width=awidth;
}

function ClickCount(a,b)
{ var x=new Image();
  x.src = "/clickcount.php?a="+a+"&b="+b;
}

function setCookie(name, value, expires, path, domain, secure)
{ document.cookie= name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

/* Getcookie(): Get the value of the specified cookie: return null if cookie does not exist.
 */
function getCookie(name)
{ var dc = "; " + document.cookie + ";";
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1)
    return null;
  else
    begin += 2;
  var end = dc.indexOf(";", begin);
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain)
{ if (getCookie(name))
  { document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

<!--* The menu below was inspired by the Revenge of the Menubar menu by Mike Hall *-->
<!--* See http://www.brainjar.com *-->
var activeButton = null;

function buttonMouseover(event) {

  var button;

  if (window.event)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  button.blur();

  if (button == activeButton)
    return false;

  if (activeButton != null)
    resetButton(activeButton);

  depressButton(button);
  activeButton = button;
}

function depressButton(button) {

  var x, y;

  // Update the button's style class to make it look depressed.

  button.className = "menuButtonActive";

  if(!button.menu) 
    return;

  // Position the associated drop down menu under the button and show it.

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;

  // For IE, adjust position.

  if (window.event) {
    x += button.offsetParent.clientLeft-2;
    y += button.offsetParent.clientTop-2;
  }

  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";
}

function resetButton(button) {

  button.className = "";

  if (button.menu != null) {
    button.menu.style.visibility = "hidden";
  }
}

function buttonOrMenuMouseout(event) {

  var el;

  if (activeButton == null)
    return;

  // Find the element the mouse is moving to.

  if (window.event)
    el = window.event.toElement;
  else if (event.relatedTarget != null)
      el = (event.relatedTarget.tagName ? event.relatedTarget : event.relatedTarget.parentNode);

  // If the element is not part of a menu, reset the active button.

  if (!el || ((el.className != "menu") && (el.parentNode.className != "menu"))) {
    resetButton(activeButton);
    activeButton = null;
  }
}

function getPageOffsetLeft(el) {

  // Return the x coordinate of an element relative to the page.

  var x = el.offsetLeft;
  if (el.offsetParent != null)
    x += getPageOffsetLeft(el.offsetParent);

  return x;
}

function getPageOffsetTop(el) {

  // Return the x coordinate of an element relative to the page.

  var y = el.offsetTop;
  if (el.offsetParent != null)
    y += getPageOffsetTop(el.offsetParent);

  return y;
}

var mu_ready = false;
function menuinit()
{ if(mu_ready) return;
  if(!document.childNodes) return;
  var menu = document.getElementById("mainmenu");
  for(var i=0; i<menu.childNodes.length; i++)
  { el = menu.childNodes[i];
    if(el.tagName == "A")
    { el.onmouseover = buttonMouseover;
      el.onmouseout = buttonOrMenuMouseout;
      var sub = el.name;
      if(sub)
      { mlist = eval(sub.replace("Btn","Menu"));
	el.menu = document.createElement('div');
	el.menu.className = "menu";
	for(j=0; j<mlist.length; j++)
	{ if(mlist[j][0] != "")
	  { line = document.createElement('a');
	    txt = document.createTextNode(mlist[j][1]);
	    line.appendChild(txt);
	    line.href = mlist[j][0];
	    el.menu.appendChild(line);
	  }
	  else /* menu line */
	  { diva = document.createElement('div');
	    diva.className = "menuItemSep";
	    el.menu.appendChild(diva);
	  }
	}
	document.body.appendChild(el.menu);
        el.menu.onmouseout = buttonOrMenuMouseout;

	// Fix IE hover problem by setting an explicit width on first item of
	// the menu.

	if (window.event)
	{ w = el.menu.firstChild.offsetWidth;
	  el.menu.firstChild.style.width = w + "px";
	  dw = el.menu.firstChild.offsetWidth - w;
	  w -= dw;
	  el.menu.firstChild.style.width = w + "px";
	}

      }
    }
  }
  mu_ready=true;
}

function LoadPage(url, callback)
{ if( typeof XMLHttpRequest == "undefined" ) 
    XMLHttpRequest = function() {
  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
  try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
  throw new Error( "This browser does not support XMLHttpRequest." )
  };
  var request =  new XMLHttpRequest();
  request.open("GET", url, true); /* delaypage must be a global var */
  request.onreadystatechange = function() 
  { if (request.readyState == 4 && request.status == 200) /* done = 4, ok = 200 */
    { if (request.responseText) 
        callback(request.responseText);
    };
  }
  request.send(null);
}

function help()
{ LoadPage("/help.htm",dynamo9);
}

function dynamo9(dytext)
{ var target=document.getElementById("helpdiva");
  target.innerHTML = dytext;
}
