
function TSDynamicMenu(iname) {
          this.bgcolor = "8000FF";
        this.fgcolor = "FF80FF";
        this.lnkcolor = "FF80FF";
        this.lnkdeco = "none";
        this.hovcolor = "FF80FF";
        this.hovbkg = "8080FF";
        this.fontSize = ["12pt", "11pt"];
        this.fontFamily = "Elementary SF Black, 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.cincychildrenunlimited.com/","Home");



ofestMenu.items[1] = new TSDynamicMenuItem(ofestMenu, "", "Information" );
ofestMenu.items[1].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/schedule.html", "Daily Schedule");
ofestMenu.items[1].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/goals.html", "Center Goals");
ofestMenu.items[1].subitems[2] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/service.html", "Range of Service");
ofestMenu.items[1].subitems[3] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/ratio.html", "Child Staff Ratio");
ofestMenu.items[1].subitems[4] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/nutrition.html", "Nutrition Policy");
ofestMenu.items[1].subitems[5] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/fees.html", "Center Fees");
ofestMenu.items[1].subitems[6] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/summercamp.html", "Summer Camp");

ofestMenu.items[2] = new TSDynamicMenuItem(ofestMenu, "", "Contact Us");
ofestMenu.items[2].subitems[0] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/directions.html", "Directions");
ofestMenu.items[2].subitems[1] = new TSDynamicMenuItem(ofestMenu, "http://www.cincychildrenunlimited.com/contact.html", "Phone/Email");







document.write(ofestMenu.build());