/* ****************************************************************** */
function at_show_aux(parent,child) {
var p = document.getElementById(parent);
var c = document.getElementById(child );
var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;
for (; p; p = p.offsetParent) {
  top  += p.offsetTop;
  left += p.offsetLeft;
  }
c.style.position   = "absolute";

//Beg iManPro Hack

//divleft = document.getElementById(parent).offsetLeft;
//divtop  = document.getElementById(c["at_div"]).offsetTop;
//top  = top-divtop;
//left = divleft;
//alert(top); alert(divtop); alert(left);
//end iManPro Hack

c.style.top        = (top+(c["at_tpx"]*1))  +'px';
c.style.left       = (left+(c["at_lpx"]*1)) +'px';
c.style.display    = "";
}
// ***** at_show *****
function at_show(tpx,lpx) {
var p = document.getElementById(this["at_parent"]);
var c = document.getElementById(this["at_child" ]);
at_show_aux(p.id,c.id);
clearTimeout(c["at_timeout"]);
}
// ***** at_hide *****
function at_hide() {
var p = document.getElementById(this["at_parent"]);
var c = document.getElementById(this["at_child" ]);
c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.display = 'none'", 100);
}
// ***** at_click *****
function at_click() {
var p = document.getElementById(this["at_parent"]);
var c = document.getElementById(this["at_child" ]);
if (c.style.display != "none") at_show_aux(p.id, c.id); else c.style.display = "none";
  return false;
}
function at_attach(parent,child,showtype,position,cursor,tpx,lpx,div) {
var p = document.getElementById(parent);
var c = document.getElementById(child);
p["at_parent"]     = p.id;     c["at_parent"]     = p.id;
p["at_child"]      = c.id;     c["at_child"]      = c.id;
p["at_position"]   = position; c["at_position"]   = position;
c.style.position   = "absolute";
c.style.display    = "none";
c.style.zIndex     = "5000"; 
c["at_tpx"]=tpx; c["at_lpx"]=lpx; c["at_div"]=div; 
if (cursor != undefined) p.style.cursor = cursor;
switch (showtype) {
  case "click":
   p.onclick     = at_click; p.onmouseout  = at_hide;
   c.onmouseover = at_show; c.onmouseout  = at_hide;
   break;
  case "hover":
   p.onmouseover = at_show; p.onmouseout  = at_hide;
   c.onmouseover = at_show; c.onmouseout  = at_hide;
   break;
  }
}


function getXMLHttp() {
var xmlHttp
try {
  //Firefox, Opera 8.0+, Safari
  xmlHttp = new XMLHttpRequest();
  }
  catch(e) {
    //Internet Explorer
    try {
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e) {
      try {
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e){
      //alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
return xmlHttp;
}

function makeReqA(div) {
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function(){
  if(xmlHttp.readyState == 4) {
    HandleResponse(xmlHttp.responseText,div);
    }
  } 
xmlHttp.open("GET", "/alert.pl", true); 
xmlHttp.send(null);
}
function makeReqB(div) {
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function(){
  if(xmlHttp.readyState == 4) {
    HandleResponse(xmlHttp.responseText,div);
    }
  } 
xmlHttp.open("GET", "/auc.pl", true); 
xmlHttp.send(null);
}

function HandleResponse(response,div) {
document.getElementById(div).innerHTML = response;
}
