xSwap = function(name){	this.name = name;	this.images = {};	this.restoresrc = null;	this.nest = "undefined";};xSwap.prototype.add = function(state,src){	this.images[state] = new Image();	this.images[state].src = src;};xSwap.prototype.swap = function(state){	var img = this.getImage();	this.restoresrc = img.src;	img.src = this.images[state].src;};xSwap.prototype.restore = function(){	if(this.restoresrc){		this.getImage().src = this.restoresrc;		this.restoresrc = null;	}};xSwap.prototype.getImage = function(){// Private	if(document.layers && this.nest == "undefined") this.nest = this.getLayer();	if(document.layers && this.nest != false){		return this.nest.document.images[this.name];	}else{		return document.images[this.name];	}};xSwap.prototype.getLayer = function(root){// Private	var i, k, layer, found = false;	if(!root) root = window;	for(i = 0; i < root.document.layers.length; i++){		layer = root.document.layers[i];		for(k = 0; k < layer.document.images.length; k++){			if(layer.document.images[k].name == this.name){				return layer;			}		}		if(layer.document.layers.length) found = this.getLayer(layer);		if(found) return found;	}	return false;};