/***
* ModTree - Module-Based PHP Framework
* (c) Sebastian Bojanowski ( sbojanowski (at) gmail (dot) com )
* Image Rollover Script
***/
var Rollover = { init : function() { this.items = new Array();}, addImage : function(objectId,imageSrc,rolloverSrc) { this.items.push(new Rollover.RolloverItem(objectId,imageSrc,rolloverSrc));}, getObject : function(destObject) { if (typeof destObject == 'object')
return destObject; else
return document.getElementById(destObject);}, swap : function(destObject) { var object = this.getObject(destObject),itemIndex; if ((itemIndex = this.getItemIndex(object.id)) != null)
object.src = this.items[itemIndex].getRolloverSrc();}, restore : function(destObject) { var object = this.getObject(destObject),itemIndex; if ((itemIndex = this.getItemIndex(object.id)) != null)
object.src = this.items[itemIndex].getImageSrc();}, getItemCount : function() { return this.items.length;}, getItemIndex : function(objectId) { var index = 0,found = null; while (!found && index<this.getItemCount()) { if (objectId == this.items[index].getId())
found = index; index++;}
return found;}
}
Rollover.RolloverItem = function(objectId,imageSrc,rolloverSrc) { this.objectId = objectId; this.imageSrc = imageSrc; this.rolloverSrc = rolloverSrc; this.preloadedImage = new Image(); this.preloadedImage.src = imageSrc;}
Rollover.RolloverItem.prototype = { getId : function() { return this.objectId;}, getImageSrc : function() { return this.imageSrc;}, getRolloverSrc : function() { return this.rolloverSrc;}
}
Rollover.init(); 