ApartmentMenu.prototype=new Accordion(null, -1);
function ApartmentMenu(htmlList, expandNodeID){
	if(!ApartmentMenu.allMenus){
		ApartmentMenu.allMenus=new Array();
	}
	this.removeClass(htmlList, "unscripted");
	Accordion.call(this, htmlList, -1);
	var toExpand=null;
	var matcher=/^(http[s]?:\/\/[^\/]+)?\/[^\/]+\/([^\/]+)(\/|$)/;
	for(var i=0; i<this.listItems.length; i++){
		var theList=this.listItems[i];
		if(theList){
			for(var j=0; j<theList.childNodes.length; j++){
				var listItem=theList.childNodes[j];
				if(listItem.nodeType==1){
					var ankor=this.getFirstRealChild(listItem, "A");
					YAHOO.util.Event.addListener(ankor, "click", this.itemClickListener, this);
					if(expandNodeID){
						var matchez=ankor.href.match(matcher);
						if(matchez[2]==expandNodeID){
							toExpand=this.listHeadings[i];
						}
					}
				}
			}
		}
	}
	if(toExpand){
		this.handleClick(toExpand);
	}
	ApartmentMenu.allMenus.push(this);
}

ApartmentMenu.prototype.expand=function(itemNo){
	// close any other open menus
	for(var i=0; i<ApartmentMenu.allMenus.length; i++){
		if(ApartmentMenu.allMenus[i] != this){
			var victim=ApartmentMenu.allMenus[i];
			if(victim.currentItem>-1){
				victim.contract(victim.currentItem);
				victim.currentItem=-1;
			}
		}
	}
	Accordion.prototype.expand.call(this, itemNo);
}

ApartmentMenu.prototype.itemClickListener=function(ev, menu){
	YAHOO.util.Event.stopEvent(ev);
	window.location=this.href;
}