function ApartmentMap(node, imageMap){
	this.current=null;
	this.defaultItem=null;
	this.list=node;
	this.map=imageMap;
	this.lookup=new Object();
	var item=null;
	var matcher=/^(http[s]?:\/\/[^\/]+)?\/[^\/]+\/([^\/]+)(\/|$)/;
	var matches=null;
	var out=this.formMouseoutClosure();
	for(var i=0; i<node.childNodes.length; i++){
		if(node.childNodes[i].nodeType!=3 && node.childNodes[i].nodeName=="LI"){
			item=node.childNodes[i];
			item.style.display="none";
			this.lookup[this.getAttrValue(item, "class")]=item;
		}
	}
	for(var i=0; i<imageMap.childNodes.length; i++){
		if(imageMap.childNodes[i].nodeType!=3 && imageMap.childNodes[i].nodeName=="AREA"){
			item=imageMap.childNodes[i];
			matches=item.href.match(matcher);
			if(matches!=null){
				item.onmouseover=this.formMouseoverClosure(matches[2]);
				item.onmouseout=out;
			}
		}
	}
	if(typeof ApartmentMenu!="undefined"){
		// hook into the menu
		var self=this;
		var realExpander=ApartmentMenu.prototype.expand;
		ApartmentMenu.prototype.expand=function(itemNo){
			realExpander.call(this, itemNo);
			var linq=this.getFirstRealChild(this.listHeadings[itemNo], "A");
			matches=linq.href.match(matcher);
			if(matches!=null){
				self.show(matches[2], true);
			}
		}
	}
}

ApartmentMap.prototype.getAttrValue=function(node, attr){
	if(typeof node.attributes.getNamedItem=="undefined"){
		for(var i=0; i<node.attributes.length; i++){
			if(node.attributes[i].nodeName.toLowerCase()==attr){
				return node.attributes[i].nodeValue;
			}
		}
	}else{
		return node.attributes.getNamedItem(attr).value;
	}
}

ApartmentMap.prototype.show=function(id, setDefault){
	if(typeof this.lookup[id]=="undefined"){
		return;
	}
	if(this.defaultItem){
		this.lookup[this.defaultItem].style.display="none";
	}
	if(setDefault){
		this.defaultItem=id;
		this.hide();
	}else{
		this.current=id;
		this.lookup[id].style.display="";
	}
}

ApartmentMap.prototype.hide=function(){
	if(this.current){
		this.lookup[this.current].style.display="none";
	}
	this.current=null;
	if(this.defaultItem){
		this.lookup[this.defaultItem].style.display="";
	}
}

ApartmentMap.prototype.formMouseoverClosure=function(id){
	var self=this;
	var handler=function(){
		self.show(id, false);
	}
	return handler;
}

ApartmentMap.prototype.formMouseoutClosure=function(){
	var self=this;
	var handler=function(){
		self.hide();
	}
	return handler;
}