var ma_Event = { add: function(obj, etype, fp, cap) { cap = cap || false; if (obj.addEventListener) obj.addEventListener(etype, fp, cap); else if (obj.attachEvent) obj.attachEvent("on" + etype, fp); }, remove: function(obj, etype, fp, cap) { cap = cap || false; if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap); else if (obj.detachEvent) obj.detachEvent("on" + etype, fp); }, DOMit: function(e) { e = e? e: window.event; e.tgt = e.srcElement? e.srcElement: e.target; if (!e.preventDefault) e.preventDefault = function () { return false; } if (!e.stopPropagation) e.stopPropagation = function () { if (window.event) window.event.cancelBubble = true; } return e; } } // arguments: image id, rotation speed, path to images (optional), // new (optional) arguments: for transitions, mouse events and random rotation function ma_Rotate(id, speed, path, bTrans, bMouse, bRand) { var imgObj = document.getElementById(id); if (!imgObj) { // in case name, not id attached to image imgObj = document.images[id]; if (!imgObj) return; imgObj.id = id; } this.id = id; this.speed = speed || 4500; // default speed of rotation this.path = path || ""; this.bRand = bRand; this.ctr = 0; this.timer = 0; this.imgs = []; this._setupLink(imgObj, bMouse); this.bTrans = bTrans && typeof imgObj.filters != 'undefined'; var index = ma_Rotate.col.length; ma_Rotate.col[index] = this; this.animString = "ma_Rotate.col[" + index + "]"; } ma_Rotate.col = []; // hold instances ma_Rotate.resumeDelay = 400; // onmouseout resume rotation after delay // mouse events pause/resume ma_Rotate.prototype._setupLink = function(imgObj, bMouse) { if ( imgObj.parentNode && imgObj.parentNode.tagName.toLowerCase() == 'a' ) { var parentLink = this.parentLink = imgObj.parentNode; if (bMouse) { ma_Event.add(parentLink, 'mouseover', ma_Rotate.pause); ma_Event.add(parentLink, 'mouseout', ma_Rotate.resume); } } } // so instance can be retrieved by id (as well as by looping through col) ma_Rotate.getInstanceById = function(id) { var len = ma_Rotate.col.length, obj; for (var i=0; i