function xpreviewAdvice(adviceid, divsection) { http.open('get', '../html/advicelist.php?' + 'ajaxPreviewAdvice=1' + '&adviceid='+adviceid + '&divsection='+divsection); http.onreadystatechange = handleResponse; http.send(null); } function showdiv(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; } var adviceid = child.substring(child.indexOf('prnt')+5, child.length) xpreviewAdvice(adviceid, child); c.style.position = "absolute"; c.style.top = top +'px'; c.style.left = left+'px'; c.style.visibility = "visible"; }