// arguments: image id, rotation speed, path to images (optional), // new (optional) arguments: for transitions, mouse events and random rotation function dw_Rotator(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 = dw_Rotator.col.length; dw_Rotator.col[index] = this; this.animString = "dw_Rotator.col[" + index + "]"; } dw_Rotator.col = []; // hold instances dw_Rotator.resumeDelay = 400; // onmouseout resume rotation after delay // mouse events pause/resume dw_Rotator.prototype._setupLink = function(imgObj, bMouse) { if ( imgObj.parentNode && imgObj.parentNode.tagName.toLowerCase() == 'a' ) { var parentLink = this.parentLink = imgObj.parentNode; if (bMouse) { dw_Event.add(parentLink, 'mouseover', dw_Rotator.pause); dw_Event.add(parentLink, 'mouseout', dw_Rotator.resume); } } } // so instance can be retrieved by id (as well as by looping through col) dw_Rotator.getInstanceById = function(id) { var len = dw_Rotator.col.length, obj; for (var i=0; i