3 function oilsNextId() {
4 return 'oils_'+ (oilsRptID++);
7 function oilsRptNextParam() {
8 return '::PARAM'+ (oilsRptID2++);
11 function oilsRptResetParams() {
15 function nodeText(id) {
17 return $(id).innerHTML;
21 function print_tabs(t) {
23 for (var j = 0; j < t; j++ ) { r = r + " "; }
28 function oilsRptDebug() {
29 _debug("\n-------------------------------------\n");
30 _debug(oilsRpt.toString());
31 _debug("\n-------------------------------------\n");
32 if(!oilsRptDebugEnabled) return;
33 if(!oilsRptDebugWindow)
34 oilsRptDebugWindow = window.open('','Debug','resizable,width=700,height=500,scrollbars=1');
36 oilsRptDebugWindow.document.body.innerHTML = oilsRpt.toHTMLString();
39 /* pretty print JSON */
40 function formatJSON(s) {
41 var r = ''; var t = 0;
43 if (s[i] == '{' || s[i] == '[' ) {
44 r = r + s[i] + "\n" + print_tabs(++t);
45 } else if (s[i] == '}' || s[i] == ']') {
46 t--; r = r + "\n" + print_tabs(t) + s[i];
47 } else if (s[i] == ',') {
48 r = r + s[i] + "\n" + print_tabs(t);
57 function print_tabs_html(t) {
59 for (var j = 0; j < t; j++ ) { r = r + " "; }
63 function formatJSONHTML(s) {
64 var r = ''; var t = 0;
66 if (s[i] == '{' || s[i] == '[') {
67 r = r + s[i] + "<br/>" + print_tabs_html(++t);
68 } else if (s[i] == '}' || s[i] == ']') {
69 t--; r = r + "<br/>" + print_tabs_html(t) + s[i];
70 } else if (s[i] == ',') {
72 r = r + "<br/>" + print_tabs_html(t);
80 function setMousePos(e) {
83 oilsPageXMid = parseInt(window.innerHeight / 2);
84 oilsPageYMid = parseInt(window.innerWidth / 2);
87 function buildFloatingDiv(div, width) {
88 var left = parseInt((window.innerWidth / 2) - (width/2));
90 var dbot = oilsMouseY + div.clientHeight;
91 if( dbot > window.innerHeight ) {
92 top = oilsMouseY - div.clientHeight - 10;
94 div.setAttribute('style', 'left:'+left+'px; top:'+top+'px; width:'+width+'px');
98 function mergeObjects( src, obj ) {
100 if( typeof obj[i] == 'string' ) {
103 if(src[i]) mergeObjects(src[i], obj[i]);
104 else src[i] = obj[i];
110 /* scours the doc for elements with IDs. When it finds one,
111 it grabs the dom node and sets a reference to the node at DOM[id]; */
112 function oilsRptIdObjects(node) {
113 if(!node) node = document.documentElement;
114 if( node.nodeType != 1 ) return;
115 var id = node.getAttribute('id');
116 if( id ) eval("DOM."+id+"=$('"+id+"');");
117 var children = node.childNodes;
118 for( var c = 0; c < children.length; c++ )
119 oilsRptIdObjects(children[c]);
123 function oilsRptObjectKeys(obj) {
125 for( var i in obj ) k.push(i);