2
return !!(window.attachEvent && !window.opera);
6
return !!(window.opera);
9
function domGetStyleProp(node, jsname, cssname) {
10
if (jsname) return jsname;
11
if ((node.currentStyle)&&(node.currentStyle[cssname])) return node.currentStyle[cssname];
12
if ((document.defaultView)&&(document.defaultView.getComputedStyle)) {
13
var style = document.defaultView.getComputedStyle(node,null);
14
if (style) return style.getPropertyValue(cssname);
19
function domNodeSetText(node, text) {
20
var text_node = document.createTextNode(text);
21
if (node.firstChild) node.replaceChild(text_node, node.firstChild);
22
else node.appendChild(text_node);
25
function domHide(id) {
26
var node = document.getElementById(id);
27
if (node) node.style.display = "none";
31
function domShow(id, display) {
32
if (typeof display == "undefined") {
36
var node = document.getElementById(id);
37
if (node) node.style.display = display;
42
function cssSetClass(node, css_class) {
43
if (typeof node == "string")
44
node = document.getElementById(node);
47
node.className = css_class;
49
node.setAttribute("className", css_class);
50
node.setAttribute("class", css_class);
57
function cssSetProperty(css_class, prop, value) {
60
if (document.styleSheets[0].cssRules)
61
css = document.styleSheets[0].cssRules;
62
else // IE (Bad Billy and standards, part N)
63
css = document.styleSheets[0].rules;
65
for (i=0;i<css.length;i++) {
66
if (css[i].selectorText.toLowerCase()==css_class) {
67
css[i].style[prop]=value;
73
function cssHideClass(css_class) {
74
cssSetProperty(css_class, 'display', 'none');
77
function cssShowClass(css_class) {
78
cssSetProperty(css_class, 'display', 'inline');
81
function domGetValue(id) {
82
var node = document.getElementById(id);
88
function windowGetWidth() {
89
return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
92
function windowGetHeight() {
93
return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
96
function domAdjustGeometry(node, width, height, diminish) {
97
if (typeof diminish == "undefined") diminish = false;
101
if (!diminish) cur_value = node.offsetHeight;
102
if (cur_value < height) node.style.height = height + "px";
104
if (!diminish) cur_value = node.offsetWidth;
105
if (cur_value < width) node.style.width = width + "px";
109
function domGetMouseOffset(evt) {
110
if (evt.offsetX != null) return [ evt.offsetX, evt.offsetY ];
112
var obj = evt.target || evt.srcElement;
114
var top = 0, left = 0;
116
while (tmp.offsetParent) {
117
left += tmp.offsetLeft;
118
top += tmp.offsetTop;
119
tmp = tmp.offsetParent;
122
return [ evt.clientX - left, evt.clientY - top ];
125
function domGetEventTarget(event) {
126
if (typeof event.target != "undefined")
129
return event.srcElement;
132
function domGetEventPageOffset(ev) {
133
/* offset in the document */
134
if (typeof ev.pageX == "undefined")
135
return [ ev.x, ev.y ];
137
return [ ev.pageX, ev.pageY ];
140
function domGetEventLayerOffset(ev) {
141
/* offset in the target element */
142
if (typeof ev.layerX == "undefined")
143
return [ ev.offsetX, ev.offsetY ];
145
return [ ev.layerX, ev.layerY ];
149
function domGetScrollEventDelta(ev) {
152
if (ev.detail) { /* GECKO */
154
} else if (ev.wheelDelta) { /* IE/Opera */
155
delta = -ev.wheelDelta/40;
158
// Still, delta absolute value could vary depending on browser version
162
function domGetNodeOffset(obj) {
163
var curleft = curtop = 0;
164
if (obj.offsetParent) {
166
curleft += obj.offsetLeft;
167
curtop += obj.offsetTop;
168
} while (obj = obj.offsetParent);
170
alert("Can't calculate node position");
172
return [curleft,curtop];
175
function domGetNodeSize(obj) {
176
/* if ((document.defaultView)&&(document.defaultView.getComputedStyle)) {
177
var style = document.defaultView.getComputedStyle(obj,null);
179
var x = parseInt(style.getPropertyValue("width"),10);
180
var y = parseInt(style.getPropertyValue("height"),10);
181
if ((x>0)&&(y>0)) return [x,y];
184
// if (obj.clientWidth) return [obj.clientWidth, obj.clientHeight];
185
return [obj.offsetWidth, obj.offsetHeight];
189
function domAlignNode(node, border, default_x, default_y, resize) {
190
var width = windowGetWidth();
191
var height = windowGetHeight();
192
var size = domGetNodeSize(node);
196
var pos_x = default_x;
197
var pos_y = default_y;
199
if ((pos_x + size[0] + border) > width) {
200
var move = border + (pos_x + size[0]) - width;
202
if (pos_x > border) move = pos_x - border;
205
// Using 2/3 of the screen
206
size_x = (width - 2 * border) * 2 / 3;
207
move = pos_x - (border + (width - 2 * border) / 6);
212
if (move) pos_x -= move;
215
if ((pos_y + size[1] + border) > height) {
216
var move = border + (pos_y + size[1]) - height;
219
size_y = (height - 2 * border);
220
move = pos_y - border;
222
if (pos_y > border) move = pos_y - border;
227
if (move) pos_y -= move;
230
if ((size_x)||(size_y)) {
231
if (typeof resize == "function") resize(node, size_x, size_y);
233
if (size_x) node.style.width = size_x + "px";
234
if (size_y) node.style.height = size_y + "px";
238
node.style.left = pos_x + "px";
239
node.style.top = pos_y + "px";
241
// Checking if everything is in place
242
if ((!size_x)&&(!size_y)) {
243
var new_size = domGetNodeSize(node);
244
if ((new_size[0] != size[0])||(new_size[1] != size[1])) {
245
if (new_size[0] == size[0]) size_x = 0;
246
else size_x = size[0];
247
if (new_size[1] == size[1]) size_y = 0;
248
else size_y = size[1];
250
if (typeof resize == "function") resize(node, size_x, size_y);
252
if (size_x) node.style.width = size_x + "px";
253
if (size_y) node.style.height = size_y + "px";
259
function domSetMinHeight(node, height, extend, check_node) {
260
if (typeof node.corr_y == "undefined") {
261
if (domGetStyleProp(node, node.style.minHeight, "min-height"))
262
node.style.minHeight = height + "px";
264
node.style.height = height + "px";
266
if (check_node) node.corr_y = check_node.offsetHeight - height;
267
else node.corr_y = node.offsetHeight - height;
269
if (!node.corr_y) return;
270
else if ((!extend)&&(node.corr_y<0)) {
276
if (domGetStyleProp(node, node.style.minHeight, "min-height"))
277
node.style.minHeight = (height - node.corr_y) + "px";
279
node.style.height = (height - node.corr_y) + "px";
282
function domSetHeight(node, height, extend, check_node) {
283
if (typeof node.corr_y == "undefined") {
284
node.style.height = height + "px";
286
if (check_node) node.corr_y = check_node.offsetHeight - height;
287
else node.corr_y = node.offsetHeight - height;
289
if (!node.corr_y) return;
290
else if ((!extend)&&(node.corr_y<0)) {
296
node.style.height = (height - node.corr_y) + "px";
299
function domSetMinWidth(node, width, extend, check_node) {
300
if (typeof node.corr_x == "undefined") {
302
// In Opera/IE check returns true, but fails. With minHeight everything is OK
303
if ((Prototype.Browser.Gecko)&&(domGetStyleProp(node, node.style.minWidth, "min-width")))
304
node.style.minWidth = width + "px";
306
node.style.width = width + "px";
308
if (check_node) node.corr_x = check_node.offsetWidth - width;
309
else node.corr_x = node.offsetWidth - width;
311
if (!node.corr_x) return;
312
else if ((!extend)&&(node.corr_x<0)) {
318
if ((Prototype.Browser.Gecko)&&(domGetStyleProp(node, node.style.minWidth, "min-width")))
319
node.style.minWidth = (width - node.corr_x) + "px";
321
node.style.width = (width - node.corr_x) + "px";
324
function domSetWidth(node, width, extend, check_node) {
325
if (typeof node.corr_x == "undefined") {
326
node.style.width = width + "px";
328
if (check_node) node.corr_x = check_node.offsetWidth - width;
329
else node.corr_x = node.offsetWidth - width;
331
if (!node.corr_x) return;
332
else if ((!extend)&&(node.corr_x<0)) {
338
node.style.width = (width - node.corr_x) + "px";
342
function dateFormat(d) {
343
return (d.getUTCMonth()+1) + '/' + d.getUTCDate() + '/' + d.getUTCFullYear() + ' ' +
344
d.getUTCHours() + ':' + d.getUTCMinutes() + ':' + d.getUTCSeconds();
347
function eventCanceler(ev) {