イベントリスナを追加・削除する(旧IE対応)。
var addEvent,
removeEvent;
if (typeof window.addEventListener === 'function') {
addEvent = function (el, type, fn) { el.addEventListener(type, fn, false); };
removeEvent = function (el, type, fn) { el.removeEventListener(type, fn, false); };
} else if (typeof document.attachEvent === 'function') {
addEvent = function (el, type, fn) { el.attachEvent('on' + type, fn); };
removeEvent = function (el, type, fn) { el.detachEvent('on' + type, fn); };
} else {
addEvent = function (el, type, fn) { el['on' + type] = fn; };
removeEvent = function (el, type, fn) { el['on' + type] = null; };
}