(function(){ function teAddEventListener(elem, evt, func, capture) { capture = capture || false; if (elem.addEventListener) elem.addEventListener(evt, func, capture); else elem.attachEvent('on'+evt, func); return func; } // Function from: http://www.robertnyman.com/index.php?p=256 function getElementsByClassName(className, tag, elm) { var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)"); var tag = tag || "*"; var elm = elm || document; var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag); var returnElements = []; var current; var length = elements.length; for (var i=0; i