var renderedMenu = wendigo.MenuBuilder.getRenderedMenu({
        "id" : "menu1",
        // either a single class, or an array of classes; the 
        // index corresponds to the nest level of the menu
        "menuClass" : ["_hopeMenu"],
        // either a single class, or an array of classes; the 
        // index corresponds to the nest level of the menu item
        "menuItemClass" : null,
        // either a single direction string, or an array of 
        // direction strings; the index corresponds to the 
        // nest level of the menu
        "displayDirection" : "",
        // either a single offset, or an array of offset; the 
        // index corresponds to the nest level of the menu
        "subOffset" : null,
        // if creators are being used, the above 
        // properties are ignored
        // the following are either a single creator 
        // functions, or an array of functions; the index 
        // corresponds to the nest level of the menu
        "menuCreator" : [
            function() {
                var html = jwyre.create("<ul class='menutop' style='overflow: visible'></ul>");
                return html;
            },
            function() {
                var html = jwyre.create("<ul style='overflow: hidden; margin-top: -2px;'></ul>");
                return html;
            }
        ],
        "subMenuDisplayer" : [
            function() {},
            function(_init) {
                var html = _init.html;
                var x = _init.x;
                var y = _init.y;
                var mItem = _init.menuItem;
        
                var parent = jwyre.element("#" + mItem._id);
                jwyre.append(parent, html);
                var dims = jwyre.dimensions(html);
                jwyre.style(html, "height", "0px");
                grow();
        
                function grow() {
                    var ctr = 0;
					function _() {
                        if (ctr > dims.height) {
                            finish();
                             return;
                        }
                        jwyre.style(html, "height", ctr + "px");
                        ctr += 6;		
                        window.setTimeout(_, 2);
					}
					_();
                }
                function finish() {
                    var ctr = 0;
					function _() {
						if (ctr > 1) {
						    jwyre.style(html, "height", dims.height + "px");
						    return;
						}
						var h = dims.height + (Math.sin(ctr * Math.PI) * 10);    
						ctr += .03;                                         
						jwyre.style(html, "height", h + "px");						
	                    window.setTimeout(_, 2);    
					}
					_();
                }
            }
        ],
        "menuItemCreator" : 
            function(_init) {
                var html = jwyre.create(
                    "<li id='"+_init.id+"'>" +
                     "<a href='"+_init.link+"'><span>"+_init.name+"</span></a>"+
                    "</li>");
				    	
                return html;
            }                    
        });
		
		function isIn(link, menu) {
			if (menu.link == link) {
				return true;
			}
			
			for (var i = 0; i < menu.subMenu.length; i++) {
				var sMenu = menu.subMenu[i];
				var is = isIn(link, sMenu);
				if (is) {
					return true;
				}
			}
			return false;
		}
		
        wendigo.MenuLoader.loadMenu("1289837842192", function(menu) {
            renderedMenu.loadData(menu);
            jwyre.append("#horiz-menu", renderedMenu.getHtml());
			
			var link = window.location.href;
			for (var i = 0; i < menu.subMenu.length; i++) {
				var sMenu = menu.subMenu[i];
				if (isIn(link, sMenu)) {
					$("a[href='" + sMenu.link + "']").parent().attr("class", "active");
					return;
				}
			}
        });

