// Copyright At Hand Creations

var bub=bubo=bubt=0;
var clkMeId=0;
var clk_img="../i/click00";
var gto="goto.htm?";
var onld="";
var isIE=document.all&&!window.opera;
var isSf=!isIE && document.childNodes && !navigator.taintEnabled;

var bgHCol="#C3D0AF";
var HCol="#FFC040"
var tabHCol='#CCCC6C';

clk_dnD=new Image();
clk_dnD.src=clk_img+"1.gif";
clk_dnL=new Image();
clk_dnL.src=clk_img+"3.gif";

function wrCookie(n,v) {
  var e="; expires=Thu,01-"+(v?"May-20":"Jan-19")+"70 00:00:01 GMT";
  if(n.charAt(0)==".")
  {
    n=n.substr(1);
    e='';
  }
  document.cookie=n+"="+v+e+"; path=/";
  return rdCookie(n)==v; 
}

function rdCookie(n) {
  var v=document.cookie.split(';');
  var i=0;
  while(i<v.length)
  {
    var j=v[i].indexOf(n+"=");
    if(!j||(j>0&&v[i].charAt(j-1)==" ")) return v[i].substr(j+n.length+1);
    i++; 
  }
  return '';
}

function xGo(a,n,t) {
  var w=window.open(gto+t+"@"+a,n);
  w.focus();
  return false;
}

function ClkI(i,c) {
  document.images["cm"+i].src=clk_img+c+".gif";
  return false; 
}

function ClkMe(c,k) {
  var i="ClkI("+clkMeId+",";
  k=k?2:0;
  document.write('<A HREF="go.htm" ONCLICK="'+c+';return false" ONFOCUS="this.blur()" ONMOUSEDOWN="return '+i+(k+1)+')" ONMOUSEOVER="return noHref()" ONMOUSEOUT="'+i+k+')" ONMOUSEUP="'+i+k+')"><IMG ID="cm'+clkMeId+'" SRC="'+clk_img+k+'.gif" STYLE="vertical-align:text-bottom" WIDTH=88 HEIGHT=21 BORDER=0></A>');
  clkMeId++;
}

function noHref() { setTimeout("window.status=''",1);return false }

function sTab(i,v) {
  var d=document.getElementById(i);
  if(v==i) d.style.display='block';
  else
  {
    d.style.display='none';
    d=document.getElementById("t_"+i);
    d.style.backgroundColor="";
  }
}
function chgTab(t,v) {
  while(t)
  {
    var i=t.indexOf(",");
    if(i<0) i=t.length;
    sTab(t.substr(0,i),v);
    t=t.substr(i+1);
  }
  return true;
}


function docEle() {
  var d=document.compatMode;
  return (d && d!="BackCompat")? document.documentElement:document.body;
}

function absX(o) {
  var l=0;
  do l+=o.offsetLeft; while(o=o.offsetParent);
  return l;
}

function absY(o) {
  var l=0;
  do l+=o.offsetTop; while(o=o.offsetParent);
  return l;
}

function getBubPosX(obj) {
  var s=window.pageXOffset;
  var w=window.innerWidth;
  var t=absX(obj)+(obj.offsetWidth+bub.offsetWidth)/2;
  if(isIE)
  {
    w=docEle();
    s=w.scrollLeft;
    w=w.lientWidth;
  }
  w+=s-21;
  if(t>w) t=w;
  t-=bub.offsetWidth; 
  return t<s? s:t;  
}

function getBubPosY(obj) {
  var s=isIE? docEle().scrollTop : window.pageYOffset;
  var t=absY(obj)-bub.offsetHeight-4;
  return t<s? t+bub.offsetHeight+obj.offsetHeight+8:t;  
}

function showBub(t,e) {
  if(window.event) event.cancelBubble=true;
  else if(e.stopPropagation) e.stopPropagation();

  if(t.bg) t.style.backgroundColor=bgHCol;
  else t.style.color=HCol;
  
  if(bub) bub.style.visibility="hidden";
  bub=0;
  if(t.bDiv.charAt(0)=='#') return false;
  bub=document.getElementById(t.bDiv);
  with(bub.style)
  {
    left=getBubPosX(t);
    top=getBubPosY(t);
    visibility="visible";
  }
  return true;
}

function hideBub(t,e) {
  var c=window.event;
  c=c?c.toElement:e.relatedTarget;
  while(c)
  {
    if(c==t) return;
    c=c.parentNode;
  }

  if(t.bg)
  {
    var d=t.bDiv;
    t.style.backgroundColor=(d.charAt(0)=='#' && document.getElementById(d.substr(1)).style.display!='none')?tabHCol:"";
  }
  else t.style.color="";
 
  if(bubo==bub) clearTimeout(bubt);
  if(bubo) bubo.style.visibility='hidden';
  bubo=bub; 
  bubt=setTimeout("if(bubo) bubo.style.visibility='hidden';bubo=0",224);
}

function retf() {this.blur();return noHref()};

function dragdrop(e) {
  if(e&&e.stopPropagation) e.stopPropagation();
  return false;
}

function initAll() {
  var a=document.getElementsByTagName("a")
  var i=0;
  while(i<a.length)
  {
    var h=decodeURIComponent(String(a[i].href));
    var p=h.indexOf("[");
    if(++p)
    {
      var t=a[i];
      var q=h.indexOf("]");
      var s=location.search;
      var l=s.indexOf("#");
      if(l>=0) s=s.substr(0,l);
      t.bg=0;
      if(h.charAt(p)=="*")
      {
       t.bg=1;
       p++;
      }
      t.onmouseover=function(e){return showBub(this,e)};
      t.onmouseout=function(e){hideBub(this,e)};
      t.onfocus=retf;
      t.bDiv=h.substr(p,q-p);
      h=h.substr(q+1);
      q=h.indexOf("?");
      if(q>0)
      {
       s+=h.substr(q+1);
       h=h.substr(0,q);
      }
      if(t.bDiv.charAt(0)=='#')
      {
        h=t.href;
        q=h.indexOf('[');
        h=h.substr(0,q);
      }
      else if(h.charAt(0)=="*")      
      {
        t.go=h.substr(1);
        t.onclick=function() { location.replace(this.go);return false }
        h="go.htm";
      }
      else if(!h)
      {
        t.onmousedown=t.onclick=retf;
        h="go.htm?";
      }
      if(h.indexOf('#')<0) h+=s;
      t.href=h;
    }
    i++;
  }
  
  if(window.addEventListener) window.addEventListener("dragdrop",dragdrop,false);
  else docEle().ondragover=dragdrop;

  eval(onld);
}

window.onload=initAll;

