var aDynSrch = new Array(); var currentDynSrch = null; function moveHistory(add) { var i = el("interval").value; add *= i; el("to").value = el("to").value * 1 + add; el("from").value = el("to").value * 1 - 144 * i; var from = new Date(el("from").value * 1000); var to = new Date(el("to").value * 1000); el("history").src = "?async=history&img=1&" + getElData("frmHistory"); } function getDynSrch(edt) { if (typeof(edt) == "string") edt = gfield(edt); if (!edt) return null; for (var i = 0; i < aDynSrch.length; i++) { if (aDynSrch[i].name == edt.name) { return aDynSrch[i]; } } var dso = new Object(); dso.name = edt.name; dso.oldvalue = ""; aDynSrch.push(dso); return dso; } function focusDynSrch(e) { if (!e) e = window.event; var edt = e.srcElement; var dso = getDynSrch(edt); dso.oldvalue = edt.value; edt.onkeyup=kuDynSrch; edt.onkeydown=kdDynSrch; edt.onblur = blurDynSrch; } function blurDynSrch(e) { if (!e) e = window.event; var edt = e.srcElement; var el = document.elementFromPoint(window.event.clientX, window.event.clientY); if (el) if (getParentID(el, "pmSearch")) return; hidepopup("pmSearch"); } function setDynSrch(sz) { if (!currentDynSrch) return; hidepopup("pmSearch"); var edt = currentDynSrch.name; var dso = getDynSrch(edt); dso.oldvalue = sz; currentDynSrch.value = sz; if (eval("typeof " + edt + "SearchSet == 'function'")) { eval(edt + "SearchSet(sz)"); } currentDynSrch.select(); currentDynSrch.focus(); } function tmrDynSrch(edt) { var dso = getDynSrch(edt); var fld = gfield(edt); if (eval("typeof " + edt + "Search == 'function'")) { var s = new Object(); s.result = false; s.search = fld.value; s.width = fld.offsetWidth; eval(edt + "Search(s)"); if (s.result === false) return; currentDynSrch = fld; var d = newDiv("pmSearch", getOffsetParentLeft(fld), getOffsetParentTop(fld) + fld.offsetHeight, s.width, 200); d.innerHTML = s.result; popupdiv(d, true); } } function kdDynSrch(e) { if (!e) e = window.event; var d = el("pmSearch"); if ((e.keyCode == 27) && (d) && (d.style.display == "block")) { cancelbubble(); } } function kuDynSrch(e) { if (!e) e = window.event; if (e.keyCode == 27) { if (hidepopup("pmSearch")) { cancelbubble(); } return; } var edt = e.srcElement; var dso = getDynSrch(edt); if (dso.oldvalue != edt.value) { hidepopup("pmSearch"); if (dso.timer) clearTimeout(dso.timer); dso.oldvalue = edt.value; dso.timer = setTimeout("tmrDynSrch('" + edt.name + "');", 500); } } function defBodyKU() { if (window.event.keyCode == 27) { cancelbubble(); if (editx(null)) return; if (hidePopup()) return; docmd("cancel"); } } function loadScript(id, src, onload) { if (el(id)) return true; // loaded var d = document.createElement("div"); d.id = id; document.body.appendChild(d); var scr = document.createElement("script"); scr.type = "text/javascript"; if (onload) { if (typeof(onload) == "function") { onload(); } else { scr.onreadystatechange = function () { if (this.readyState == 'loaded') { eval(onload);} } scr.onload = function () { eval(onload); }; } } scr.src = src; d.appendChild(scr); return false; } function newDiv(id, x, y, w, h) { var d; if (d = el(id)) { } else { d = document.createElement("div"); d.id = id; document.forms["frm"].appendChild(d); } d.style.position = "absolute"; d.style.padding = "2px"; d.style.left = x; d.style.top = y; d.style.width = w; d.style.height = h; d.style.border = "1px solid red" d.style.overflow = "auto"; d.style.display = "none"; d.style.backgroundColor = "#dddddd"; return d; } request = getRequest(); popups = new Array(); function dateonly(date) { return Math.floor((date * 1 + 10800) / 24 / 60 / 60) * 24 * 60 * 60 - 10800; } function el(sz) { return document.getElementById(sz); } function gfield(sz) { return document.forms["frm"][sz]; } function mov(el) { if ((el.style.backgroundColor == "whitesmoke") || (el.style.backgroundColor == "rgb(245, 245, 245)") || (el.style.backgroundColor == "")) { el.style.backgroundColor = '#ddddff'; } } function mot(el) { if ((el.style.backgroundColor == "rgb(221, 221, 255)") || (el.style.backgroundColor == "#ddddff")) { el.style.backgroundColor = 'WhiteSmoke'; } } function getRequest() { if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { return new XMLHttpRequest(); } } function docmd(c, p) { if (p != undefined) { document.forms["frm"].params.value = p; } document.forms["frm"].cmd.value = c; document.forms["frm"].submit(); } function myescape(sz) { return sz.replace(/\n/g, "%0A").replace(/&/g, "%26").replace(/\r/g,"").replace(/\+/g,"%2B").replace(/\t/g, "%09"); } function getFormData(frm, fields) { if (typeof(fields) == "string") { fields = fields.split(","); } if (fields == undefined) { var data = ""; for (i = 0; i < document.forms[frm].elements.length; i++) { if (document.forms[frm].elements[i].type == "checkbox") { if (document.forms[frm].elements[i].checked) v = 1; else v = 0; data += "&" + document.forms[frm].elements[i].name + "=" + v; } else { data += "&" + document.forms[frm].elements[i].name + "=" + myescape(document.forms[frm].elements[i].value); } } } else { try { var data = ""; var i = 0; for (i = 0; i < fields.length; i++) { if (!document.forms["frm"][fields[i]]) {alert("Unknown field: " + fields[i]); continue;} if (document.forms["frm"][fields[i]].type == "checkbox") { if (document.forms["frm"][fields[i]].checked) v = 1; else v = 0; data += "&" + document.forms[frm][fields[i]].name + "=" + v; } else { try { data += "&" + document.forms[frm][fields[i]].name + "=" + myescape(document.forms[frm][fields[i]].value); } catch (ex) { alert("Error fetching information for " + fields[i]); } } } } catch (ex) { alert("Error with field: " + fields[i] + " " + ex.getMessage()); } } return data; } function popupMonths(id, where) { var p = document.getElementById('pmmonths' + id); document.body.appendChild(p); if (!where) where = window.event.srcElement; popupdiv(p, false, where); } function popupYears(id, where) { var p = document.getElementById('pmyears' + id); document.body.appendChild(p); if (!where) where = window.event.srcElement; popupdiv(p, false, where); } function getChecked(name) { var result = ""; for (var i = 0; i < document.forms["frm"].length; i++) { if (document.forms["frm"][i].name.substr(0, name.length) == name) { if (document.forms["frm"][i].checked) { if (result != "") result += ","; result += document.forms["frm"][i].name.substr(name.length); } } } return result; } function field(name) { var f = gfield(name); if (f.type == "checkbox") if (f.checked) return "&" + name + "=1"; else return "&" + name + "=0"; return "&" + name + "=" + f.value; } var inSyncRequest = false; function showSrvInfo(content, show, func) { var div = document.getElementById("srvinfo"); window.status = content; if (div) { if (show) { div.innerHTML = content; div.style.display = "block"; if (inSyncRequest) func(); else setTimeout(function() {inSyncRequest = true; func(); inSyncRequest = false}, 0); } else { div.style.display = "none"; } } } function getParentID(el, pid) { if (el.id == pid) return true; while (el = el.parentElement) { if (el.id == pid) return true; } return false; } function requestGetRow(url) { var r = doRequest(url); if (r) { var temp = document.createElement("div"); temp.innerHTML = r; var newrow = temp.children[0].rows[0].cloneNode(true); temp.innerHTML = ""; return newrow; } return false; } function doRequest(url, debugresult, postdata) { var r = getRequest(); r.open("POST", url, false); if (postdata) { r.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); r.setRequestHeader("Content-length", postdata.length); r.send(postdata); } else r.send("-"); if ((r.readyState == 4) && (r.status == 200)) { if (debugresult) alert(r.responseText); showSrvInfo('', 0); return r.responseText; } else { if (r.status == 444) { alert(r.responseText); } else { alert("Error processing request to server: [" + r.status + "] " + r.statusText + "\n" + r.responseText); } showSrvInfo('', 0); return false; } } function cancelbubble() { if (event.preventDefault) event.preventDefault(); else event.returnValue = false; if (window.event) window.event.cancelBubble = true; } function asyncRequest(place, url, onend, noshowload, hideonerror) { var pos = document.getElementById(place); if (noshowload) { } else { pos.innerHTML = "
Loading data... |