function JMenu(a){this._validate_members=function(a){if(typeof a!="object")return!1;for(var b in a)if(b!="text"&&b!="url"&&b!="items"&&b!="onclick"&&b!="style")return!1;return typeof a.text=="undefined"||typeof a.url=="undefined"?!1:!0};if(typeof a!="object")return this.menus={},this;for(var b in a){if(typeof a[b]!="object")return alert("Error: Expecting object. Found "+typeof a[b]),null;this._validate_members(a[b])||alert("Menus contains invalid members.")}this.menus=a;return this}
JMenu.prototype.drawMenu=function(a){var b="",a=typeof a=="object"?a:this.menus;if(typeof this.depth=="undefined")this.depth=1;this.depth==1&&(b+="<ul>");for(var c in a)b=b+'<li class="JMenuItem'+(this.depth>1?" jml"+this.depth:"")+'"><a href="'+a[c].url+'" class="JMenuLink"'+(typeof a[c].onclick!="undefined"?' onclick="'+a[c].onclick+'"':"")+(typeof a[c].style!="undefined"?' style="'+a[c].style+'"':"")+">"+a[c].text+"</a>",typeof a[c].items!="undefined"&&(this.depth++,b+="<ul>",b+=this.drawMenu(a[c].items),
b+="</ul>",this.depth--),b+="</li>";this.depth==1&&(b+="</ul>");this.depth==1&&document.write(b);return this.depth>1?b:this};JMenu.prototype.addItem=function(a,b){if(typeof b!="object")return this;this._validate_members(b)&&(this.menus[a]=b);return this};JMenu.prototype.removeItem=function(a){typeof this.menus[a]!="undefined"&&delete this.menus[a];return this};

