function openCalendar(src) { var o = previousObj(src); if (o == null) try { o = childObj(previousObj(parentObj(parentObj(src)))); } catch (e) {} if (o == null) return; var pos = clientPos(src); var width = 200; var height = 240; var left = pos.left + src.offsetWidth - width; var top = pos.top + src.offsetHeight; var url = "../common/calendar/calendar.jsp" + qs() + nv("id", o.id) + nv("type", o.className == "datetime" || o.size == 16) + param("value", o); var oi = obj("icalendar"); oi.style.left = left + "px"; oi.style.top = top + "px"; oi.style.width = width + "px"; oi.style.height = height + "px"; oi.src = url; }
function closeCalendar() { var oi = obj("icalendar"); oi.style.left = 0; oi.style.top = 0; oi.style.width = 0; oi.style.height = 0; oi.src = ""; }
function pickCalendar(id, val) { value(id, val); closeCalendar(); }
document.write('<iframe id="icalendar" width="0" height="0" frameborder="0" scrolling="no" style="position:absolute;z-index:999;"></iframe>');

function clientPos(e) { var d = document.documentElement; with (e.getBoundingClientRect()) { return { left : left + d.scrollLeft, top : top + d.scrollTop }; } }
function offsetPos(e) { var x = 0, y = 0; while(e) { x += e.offsetLeft; y += e.offsetTop; e = e.offsetParent; } return { left : x, top : y }; }
