// Kudos to http://www.haveamint.com/forum/viewtopic.php?pid=8153
// JG modified to generalize to multiple eventHandlers

function addEvent(func,funcName) {
	if(typeof window.addEventListener != 'undefined') {
		//.. gecko, safari, konqueror and standard
		window.addEventListener(funcName, func, false);
	}
    else if(typeof document.addEventListener != 'undefined') {
		//.. opera 7
		document.addEventListener(funcName, func, false);
    }
	else if(typeof window.attachEvent != 'undefined') {
         //.. win/ie
         window.attachEvent('on'+funcName, func);
     }
     //** remove this condition to degrade older browsers
     else {
         //.. mac/ie5 and anything else that gets this far

         //if there's an existing function
         if(typeof eval('window.on'+funcName) == 'function') {
             //store it
             var existing = eval('window.on'+funcName);

             //add new handler
             eval('window.on'+funcName) = function() {
                 //call existing function
                 existing();

                 //call new function
                 func;
             }
         }
         else {
             //setup new function
             eval('window.on'+funcName) = func;
         }
     }
}
