/*
author: patrik_bergman@yahoo.com
creates a simple dropdown menu object

parentImg is a temporary feature, to be improved */

function MenuObj(id, left, top, width, height, visibility, zIndex, clip, bgColor, background, htmlContent, contentResize, parentImg, parentLayer) {
  	this.inheritFrom = LayerDynObj;
  	this.inheritFrom(id, left, top, width, height, visibility, zIndex, clip, bgColor, background, htmlContent, contentResize);
	
	this.isActive = false;
 	this.elm.onmouseover 	=  MenuObj_setActive;
	this.elm.onmouseout 	=  MenuObj_preHide;
	this.timeout = null;
	
	this.parentImg 		= parentImg;
	this.parentLayer	= parentLayer; //used to reach parent image in ns4
}

function MenuObj_setActive(){
	this.parent.isActive = true;
}

function MenuObj_show() {
	this.isActive = true;
	this.css.visibility = (nav.ns4)? "show" : "visible";
}

function MenuObj_hide() {
	if (!this.isActive) {
		//extra line, temp feat. to switch off right nav buts.
		//swapImage(this.parentImg+0, this.parentImg, this.parentLayer);
		this.css.visibility = (nav.ns4)? "hide" : "hidden";
		clearTimeout(this.timeout);
	}	
}

function MenuObj_preHide() {
	if (this.elm != null) {
		this.isActive = false;
		this.timeout = setTimeout(this.obj+".hide()",70);
	}	
	else { 
		this.parent.isActive = false;
		this.parent.timeout =  setTimeout(this.parent.obj+".hide()",70);
	}	
}

MenuObj.prototype.show 			= MenuObj_show;
MenuObj.prototype.hide 			= MenuObj_hide;
MenuObj.prototype.preHide 		= MenuObj_preHide;
MenuObj.prototype.moveTo 		= LayerDynObj.prototype.moveTo;
MenuObj.prototype.moveBy 		= LayerDynObj.prototype.moveBy;
MenuObj.prototype.writeHtml 	= LayerDynObj.prototype.writeHtml;
MenuObj.prototype.changeClip 	= LayerDynObj.prototype.changeClip;
MenuObj.prototype.resizeTo 		= LayerDynObj.prototype.resizeTo;
MenuObj.prototype.resizeBy 		= LayerDynObj.prototype.resizeBy;
MenuObj.prototype.changeZIndex 	= LayerDynObj.prototype.changeZIndex;

