function MapReplace(div,options){
	this.div=(typeof div=="string") ? document.getElementById(div) : div;
	if(!this.div) return null;
	this.image=this.div.getElementsByTagName("img")[0];
	this.imageDefault=this.image.src;
	this.options=options;
}

MapReplace.prototype.init=function(){
	var self=this;
	var maps=this.div.getElementsByTagName("area");
	var preloadImages=[];
	for(var i=0,len=maps.length; i<len; i++){
		maps[i].onmouseover=function(){
			self.swap(this.getAttribute("name")+".gif");
		}
		maps[i].onmouseout=function(){
			self.restore();
		}

		// preload
		preloadImages.push(new Image().src=this.imageDir+maps[i].getAttribute("name")+".gif");
	}
}

MapReplace.prototype.restore=function(){
	this.image.src=this.imageDefault;
}

MapReplace.prototype.swap=function(newImage){
	if(newImage){
		this.image.src=this.options.imageDir+newImage;
	}
}


