// === Popup ========================================================================================================== function popupClickEvent(event) { window.open(this.href,'','width=600,height=500,scrollbars,resizable'); event.preventDefault ? event.preventDefault() : event.returnValue = false; //cancel click action } function applyPopups() { var aryPopups = getElementsByClassName(document, 'a', 'popup'); //place all instances of the class into an array for (var i = 0; i < aryPopups.length; i++) { // now add an event to each of the elements we have found addEvent(aryPopups[i], "click", popupClickEvent, false); } } // === Global Functions =============================================================================================== /* addEvent and removeEvent elimate the differences betweens browsers when attaching and removing events. The following addEvent function also allows us to use 'this' in IE in the functions that are called via event attaching. */ function addEvent( obj, type, fn ) { if (obj.addEventListener) obj.addEventListener( type, fn, false ); else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } obj.attachEvent( "on"+type, obj[type+fn] ); } } function removeEvent( obj, type, fn ) { if (obj.removeEventListener) obj.removeEventListener( type, fn, false ); else if (obj.detachEvent) { obj.detachEvent( "on"+type, obj[type+fn] ); obj[type+fn] = null; obj["e"+type+fn] = null; } } //retreives all classes with a certain name and places them in an array: function getElementsByClassName(oElm, strTagName, strClassName) { if(!oElm.getElementsByTagName) {return false; } //check for exisitence of getElementsByTagName var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/\-/g, "\\-"); var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)"); var oElement; for(var i=0; i