var EventHelpers = new function () { var me = this; var safariTimer; var isSafari = /WebKit/i.test(navigator.userAgent); /** * Adds an event to the document. Examples of usage: * me.addEvent(window, "load", myFunction); * me.addEvent(docunent, "keydown", keyPressedFunc); * me.addEvent(document, "keyup", keyPressFunc); * * @author Scott Andrew - http://www.scottandrew.com/weblog/articles/cbs-events * @author John Resig - http://ejohn.org/projects/flexible-javascript-events/ * @param {Object} obj - a javascript object. * @param {String} evType - an event to attach to the object. * @param {Function} fn - the function that is attached to the event. */ me.addEvent = function (obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, false); } else if (obj.attachEvent){ obj['e'+evType+fn] = fn; obj[evType+fn] = function() { obj["e"+evType+fn]( self.event ); } obj.attachEvent( "on"+evType, obj[evType+fn] ); } } /** * Removes an event that is attached to a javascript object. * * @author Scott Andrew - http://www.scottandrew.com/weblog/articles/cbs-events * @author John Resig - http://ejohn.org/projects/flexible-javascript-events/ * @param {Object} obj - a javascript object. * @param {String} evType - an event attached to the object. * @param {Function} fn - the function that is called when the event fires. */ me.removeEvent = function (obj, evType, fn){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, false); } else if (obj.detachEvent){ try { obj.detachEvent("on"+evType, obj[evType+fn]); obj[evType+fn] = null; obj["e" + evType + fn] = null; } catch (ex) { // do nothing; } } } function removeEventAttribute(obj, beginName) { var attributes = obj.attributes; for (var i=0; i<\/script>'); var script = document.getElementById("__ie_onload"); me.addEvent(script, 'readystatechange', me.runPageLoadEvents); /*@end @*/ } init(); }