/* (c) 2007 - now() Ondrej Zara, 1.7 */ var OZ = { $:function(x) { return typeof(x) == "string" ? document.getElementById(x) : x; }, select: function(x) { return document.querySelectorAll(x); }, opera:!!window.opera, ie:!!document.attachEvent && !window.opera, gecko:!!document.getAnonymousElementByAttribute, webkit:!!navigator.userAgent.match(/webkit/i), khtml:!!navigator.userAgent.match(/khtml/i) || !!navigator.userAgent.match(/konqueror/i), Event:{ _id:0, _byName:{}, _byID:{}, add:function(elm,event,cb) { var id = OZ.Event._id++; var element = OZ.$(elm); var fnc = (element && element.attachEvent ? function() { return cb.apply(element,arguments); } : cb); var rec = [element,event,fnc]; var parts = event.split(" "); while (parts.length) { var e = parts.pop(); if (element) { if (element.addEventListener) { element.addEventListener(e,fnc,false); } else if (element.attachEvent) { element.attachEvent("on"+e,fnc); } } if (!(e in OZ.Event._byName)) { OZ.Event._byName[e] = {}; } OZ.Event._byName[e][id] = rec; } OZ.Event._byID[id] = rec; return id; }, remove:function(id) { var rec = OZ.Event._byID[id]; if (!rec) { return; } var elm = rec[0]; var parts = rec[1].split(" "); while (parts.length) { var e = parts.pop(); if (elm) { if (elm.removeEventListener) { elm.removeEventListener(e,rec[2],false); } else if (elm.detachEvent) { elm.detachEvent("on"+e,rec[2]); } } delete OZ.Event._byName[e][id]; } delete OZ.Event._byID[id]; }, stop:function(e) { e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; }, prevent:function(e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; }, target:function(e) { return e.target || e.srcElement; } }, Class:function() { var c = function() { var init = arguments.callee.prototype.init; if (init) { init.apply(this,arguments); } }; c.implement = function(parent) { for (var p in parent.prototype) { this.prototype[p] = parent.prototype[p]; } return this; }; c.extend = function(parent) { var tmp = function(){}; tmp.prototype = parent.prototype; this.prototype = new tmp(); this.prototype.constructor = this; return this; }; c.prototype.bind = function(fnc) { return fnc.bind(this); }; c.prototype.dispatch = function(type, data) { var obj = { type:type, target:this, timeStamp:(new Date()).getTime(), data:data } var tocall = []; var list = OZ.Event._byName[type]; for (var id in list) { var item = list[id]; if (!item[0] || item[0] == this) { tocall.push(item[2]); } } var len = tocall.length; for (var i=0;i-1;i--) { if (i in this && this[i] === item) { return i; } } return -1; } } if (!Array.lastIndexOf) { Array.lastIndexOf = function(obj, item, from) { return Array.prototype.lastIndexOf.call(obj, item, from); } } if (!Array.prototype.forEach) { Array.prototype.forEach = function(cb, _this) { var len = this.length; for (var i=0;i