

function TSDynamicMenu(iname) {
        this.bgcolor = "004000";
        this.fgcolor = "FFFF00";
        this.lnkcolor = "FFFF00";
        this.lnkdeco = "none";
        this.hovcolor = "FFFF00";
        this.hovbkg = "004000";
        this.fontSize = ["9pt", "8pt"];
        this.fontFamily = "Verdana, sans-serif";
        this.orientation = "horizontal";
        this.name = (iname) ? iname : "tsdynnav";                // make sure it is unique??

        this.items = new Array();                // array of TSDynamicMenuItem

        this.build = function () {
                if (this.orientation == "horizontal") {
                        var outHTML = this.putStyle();
                        outHTML += '<center><table id="' + this.name + '" border="0" cellpadding="0" cellspacing="0"><tr>'

                        for (var idx=0; idx<this.items.length; idx++) {
                                outHTML += '<td align="center"><ul>';
                                outHTML += this.items[idx].build();
                                outHTML += '</ul></td>';
                        }
                        outHTML += '</tr>        </table></center>';
                } else {
                        // vertical logic
                        outhtml = "NOT YET DEFINED";
                }
                return outHTML;
        }

        this.putStyle = function() {
                var outHTML = "<style>"

                outHTML += '#' + this.name + ' a {        text-decoration: ' + this.lnkdeco + '; color: ' + this.lnkcolor + '; }';

                outHTML += '#' + this.name + ', #' + this.name + ' ul {font-size: ' + this.fontSize[0] + '; font-family: ' + this.fontFamily + ';' +
                                                                ' list-style: none; margin-left: 1em; width: 15em; padding: 0;}';

                outHTML += '#' + this.name + ' li {width: 15em; padding: 2px; margin-bottom: 11px; line-height: 1.5em; position: relative; ' +
                                                                'background: #' + this.bgcolor + '; color: #' + this.fgcolor + ';}';

                outHTML += '#' + this.name + ' li li {font-size: ' + this.fontSize[1] + '; width: 11.3em; margin: 0;         padding: 4px; line-height: 1.2;' +
                                                                ' border-bottom: 1pt silver solid; }';

                outHTML += '#' + this.name + ', #' + this.name + '  ul { }';

                outHTML += '#' + this.name + ' li:hover, #' + this.name + ' li.ieHover {cursor: pointer; color: #' + this.hovcolor + ';' +
                                                                ' background: #' + this.hovbkg + '; }';

                outHTML += '#' + this.name + ' li ul, #' + this.name + ' li:hover ul ul, #' + this.name + ' li:hover ul ul ul, ' +
                                                        '#' + this.name + ' li:hover ul ul ul ul, #' + this.name + ' li.ieHover ul ul, #' + this.name + ' li.ieHover ul ul ul, ' +
                                                        '#' + this.name + ' li.ieHover ul ul ul ul {position: absolute; left: -999em; top: 0px; }';

                outHTML += '#' + this.name + ' #' + this.name + ' li:hover ul, #' + this.name + ' ul li:hover ul, #' + this.name + ' ul ul li:hover ul, ' +
                                                        '#' + this.name + ' ul ul ul li:hover ul, #' + this.name + ' li.ieHover ul, #' + this.name + ' ul li.ieHover ul, ' +
                                                        '#' + this.name + ' ul ul li.ieHover ul, #' + this.name + ' ul ul ul li.ieHover ul ' +
                                                        '{ left: 0.5em; top: 1.8em; }';

                /*                outHTML += '#' + this.name + ' '
                ****/
                outHTML += "</style>";
                return outHTML;
        }
};

function TSDynamicMenuItem(iparent, iurl, ilabel, inewwin) {
        this.parent = iparent;
        this.url = iurl;
        this.label = ilabel
        this.newwin = (inewwin) ? inewwin : false;

        this.subitems = new Array();                // Array of TSDynamicMenuItem;

        this.build = function() {
                if (this.parent.orientation == "horizontal") {
                        var outHTML = "";
                        if (document.all) {
                                outHTML += '<li onmouseout=this.className=\"\"; onmouseover=this.className=\"ieHover\">';
                        } else {
                                outHTML += '<li>';
                        }
                        outHTML += (this.url == "") ? '' : (this.newwin) ? '<a href="' + this.url + '" target="_new">' : '<a href="' + this.url + '">';
                        outHTML += this.label;
                        outHTML += (this.url != "") ? '</a>' : '';
                        if (this.subitems.length > 0) {
                                outHTML += '<ul>';
                                for(var sidx=0; sidx< this.subitems.length; sidx++) {
                                        try {
                                                outHTML += this.subitems[sidx].build();
                                        } catch(err) {
                                                alert("ERROR: " + err + "\nprocessing [" + this.label + "] subitem [" + sidx + "]")
                                        }
                                }
                                outHTML += '</ul>';
                        }
                        outHTML += '</li>'
                } else {
                        // vertical logic here...
                }
                return outHTML;
        }
}

var ofestMenu = new TSDynamicMenu();

ofestMenu.items[0] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/main.html","Home");
ofestMenu.items[0].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/history.html", "History of Club");
ofestMenu.items[0].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/mission.html", "Mission Statement");
ofestMenu.items[0].subitems[2] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/photos.html","Photos Of Club");
ofestMenu.items[0].subitems[3] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/crest.html","Our Crest");
ofestMenu.items[0].subitems[4] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/president.html","President of the Club");
ofestMenu.items[0].subitems[5] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/echos.html","Echo Newsletter");
ofestMenu.items[0].subitems[6] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/contacts.html","Germania Contacts");

/***
ofestMenu.items[1] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/christkindlmarkt.html", "2008 Christkindlmarkt" );
ofestMenu.items[1].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/christkindlmarkt/chriskindlmarktdirection.html", "Christkindlmarkt Directions");
ofestMenu.items[1].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/lantern.html", "Children's Latern Parade");
ofestMenu.items[1].subitems[2] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/chriskindlmarkthours.html", "Christkindlmarkt Hours");
ofestMenu.items[1].subitems[3] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/chriskindlmarktentertainment.html", "Christkindlmarkt Entertainment");
ofestMenu.items[1].subitems[4] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/chriskindlmarktfood.html", "Christkindlmarkt Food");
ofestMenu.items[1].subitems[5] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/clubhousedinner.html", "Christkindlmarkt Club House Dinnners");
ofestMenu.items[1].subitems[6] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/pastry.html", "Christkindlmarkt Pastries");
ofestMenu.items[1].subitems[7] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/gluhwein.html", "Christkindlmarkt Drinks");
ofestMenu.items[1].subitems[8] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt/carriagerides.html", "Free Carriage Rides");
***/

ofestMenu.items[1] = new TSDynamicMenuItem(ofestMenu, "", "Major Events" );
ofestMenu.items[1].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/oktoberfest09/oktoberfest09.html", "Oktoberfest");
ofestMenu.items[1].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/christkindlmarkt09/christkindlmarkt09.html", "Christkindlmarkt");
ofestMenu.items[1].subitems[2] = new TSDynamicMenuItem(ofestMenu, "http://germaniasociety.com/volksmarch/volksmarch.pdf", "Volksmarch");

ofestMenu.items[2] = new TSDynamicMenuItem(ofestMenu, "", "Rentals and Directions");
ofestMenu.items[2].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/directions.html", "Directions to Germania Park");
ofestMenu.items[2].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/rentals/klubhaus.html", "Club House Rentals");
ofestMenu.items[2].subitems[2] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/rentals/pavillion.html", "Pavilion Rentals");

ofestMenu.items[3] = new TSDynamicMenuItem(ofestMenu, "","Calendars and Membership");
ofestMenu.items[3].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/event.html", "Germania Events");
ofestMenu.items[3].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/meeting.html", "Meeting Schedule");
ofestMenu.items[3].subitems[2] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/jagdhorn.html","Jagdhorn Appearance Schedule");
ofestMenu.items[3].subitems[3] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/membership.html","Membership Information");

ofestMenu.items[4] = new TSDynamicMenuItem(ofestMenu, "http://www.germaniasociety.com/site2007/links.html","Links");




document.write(ofestMenu.build());