function main()
{
        var m;
        // (name, URL, target)
         // drop-down for menu item nr. 1              COUNTY GOVERNMENT
        //        menuname,width,left
        m = menue("m1", 230,130);
	  m.addLink("County Gov. Services Directory", "http://www.co.dutchess.ny.us/CountyGov/Services/CountyGovServDir.htm","");
        m.addLink("All Services Directory", "http://www.co.dutchess.ny.us/CountyGov/AllServices.htm","");
        m.addLink("e_Government Services", "http://www.co.dutchess.ny.us/CountyGov/EGov/DCegov.htm","");
        m.addLink("County Executive", "http://www.co.dutchess.ny.us/CountyGov/Departments/CountyExecutive/CEIndex.htm","");
        m.addLink("Legislature", "http://www.co.dutchess.ny.us/CountyGov/Departments/Legislature/CLindex.htm","");
        m.addLink("Departments", "http://www.co.dutchess.ny.us/CountyGov/Departments/DeptDepartments.htm","");
        m.addLink("About County Government", "http://www.co.dutchess.ny.us/CountyGov/AboutDC/DCoverview.htm","");
        m.addLink("Bidding Opportunities", "http://www.co.dutchess.ny.us/CountyGov/Departments/CentralServices/CSBiddingRFP.htm","");
        m.addLink("Calendar of Events", "http://www.co.dutchess.ny.us/CountyGov/Cal_Events/DCcalofevents.htm","");
        m.addLink("GIS in Dutchess County", "http://www.co.dutchess.ny.us/CountyGov/14450.htm","");
     	m.addLink("County Hotline Numbers", "http://www.co.dutchess.ny.us/Hotline.htm","");
	m.addLink("County News/Press Releases", "http://www.co.dutchess.ny.us/CountyGov/News_PressRel/DCnews.htm","");
        m.addLink("Employment Opportunities", "http://www.co.dutchess.ny.us/CountyGov/Departments/Personnel/PSExamAnnouncements.htm","");
        m.addLink("Emergency Services", "http://www.co.dutchess.ny.us/CountyGov/EmergencyServices/EmergencyServicesIndex.htm","");
        m.addLink("Holiday Schedule", "http://www.co.dutchess.ny.us/CountyGov/Holidays/CalCountyHolidays.htm","");
        m.addLink("On-line Forms", "http://www.co.dutchess.ny.us/CountyGov/Forms/DCforms.htm","");
        m.addLink("Publications & Maps", "http://www.co.dutchess.ny.us/CountyGov/Departments/Planning/PLpublications.htm","");
        m.addLink("County Fees & Fee Schedules", "http://www.co.dutchess.ny.us/CountyGov/Fees/FeesIndex.htm","");
        m.addLink("Frequently Asked Questions", "http://www.co.dutchess.ny.us/CountyGov/AllFAQs.htm","");

        m.write();
// ***// drop-down for menu item nr. 2          MUNICIPALITIES
 
        m = menue("m2", 230, 261);
        m.addLink("Municipality Information & Links", "http://www.co.dutchess.ny.us/Municipalities/MUNtownstable.htm");
        m.addLink("Assessors", "http://www.co.dutchess.ny.us/CountyGov/Departments/RealPropertyTax/RPassessors.htm","");
        m.addLink("Census Data", "http://www.co.dutchess.ny.us/Municipalities/MUNcensusdata.asp","");
        m.addLink("Demographic Information", "http://www.co.dutchess.ny.us/Municipalities/MUNindex.htm","");
        m.addLink("Historians", "http://www.co.dutchess.ny.us/Municipalities/MUNhistorians.htm","");
        m.addLink("Major Development Projects", "http://www.co.dutchess.ny.us/CountyGov/Departments/Planning/PLpublications.htm","");
        m.addLink("Responsibilities of Municipal Boards", "http://www.co.dutchess.ny.us/CountyGov/Departments/Planning/PLBoardResp.htm","");
        m.addLink("Municipal Tax Collectors", "http://www.co.dutchess.ny.us/CountyGov/Departments/RealPropertyTax/RPtc.htm","");
        m.addLink("City, Town & Village Courts", "http://www.co.dutchess.ny.us/Municipalities/MUNcourts.htm","");

        m.write();
// ***// drop-down for menu item nr. 3            BUSINESS
 
        m = menue("m3", 260, 359);
        m.addLink("Agriculture", "http://www.co.dutchess.ny.us/Business/Agriculture/BUSagrindex.htm","");
        m.addLink("Bidding & RFP Opportunities", "http://www.co.dutchess.ny.us/Countygov/Departments/CentralServices/CSbiddingrfp.htm","");
        m.addLink("Business Groups & Chambers of Commerce", "http://www.co.dutchess.ny.us/Business/BUSChambers.htm","");
        m.addLink("Consumer Affairs", "http://www.co.dutchess.ny.us/Countygov/Departments/ConsumerAffairs/CFindex.htm","");
        m.addLink("Dutchess County EDC", "http://www.thinkdutchess.com/","target=_blank");
        m.addLink("Economic Development", "http://www.co.dutchess.ny.us/Business/EconomicDevelopment/BUSedindex.htm","");
        m.addLink("Major Employers", "http://www.thinkdutchess.com/dutchess-county-data/leading-employers.html","target=_blank");
        m.addLink("Telecommunication Services/Providers", "http://www.thinkdutchess.com/telecommunications/services-providers.html","target=_blank");

            m.write();
// ***// drop-down for menu item nr. 4           SCHOOLS
 
        m = menue("m4", 280, 434);
        m.addLink("Education Information", "http://www.co.dutchess.ny.us/Schools/SCHindex.htm","");
        m.addLink("Elementary & Secondary Schools", "http://www.co.dutchess.ny.us/Schools/SCHesschools.htm","");
        m.addLink("Private & Parochial Schools", "http://www.co.dutchess.ny.us/Schools/SCHprivateschools.htm","");
        m.addLink("BOCES", "http://www.dcboces.org/index.php", "target=_blank");
	  m.addLink("BOCES Adult Education", "http://www.dcboces.org/adults/","target=_blank");
	  m.addLink("Marist College Adult Education", "http://www.marist.edu/gce/olc/", "target=_blank");
        m.addLink("Colleges", "http://www.co.dutchess.ny.us/Schools/SCHcolleges.htm","");
        m.addLink("Distance Learning", "http://www.co.dutchess.ny.us/Schools/SCHdlearning.htm","");
        m.addLink("School Tax Collectors by School District","http://www.co.dutchess.ny.us/CountyGov/Departments/RealPropertyTax/RPschooltc.htm","");
        m.addLink("NYS Education Department", "http://www.nysed.gov/","target=_blank");
        m.addLink("NYS Curriculum, Instruction & Instructional Technology", "http://www.emsc.nysed.gov/ciai/home.html","target=_blank");
        m.write();
        
 // ***// drop-down for menu item nr. 5      TOURISM
 
        m = menue("m5", 260, 496);
        m.addLink("Directions", "http://www.dutchesstourism.com/mapsdirections.asp#here","target=_blank");
        m.addLink("History of Dutchess County", "http://www.co.dutchess.ny.us/Tourism/History/HistIndex.htm","");
        m.addLink("DC Tourism Bureau", "http://www.dutchesstourism.com/","target=_blank");
	  m.addLink("Hudson River Valley National Heritage Area", "http://www.hudsonrivervalley.com/","target=_blank");
        m.addLink("Visitor Information Centers", "http://www.co.dutchess.ny.us/Tourism/VisitCenters/VisitIndex.htm","");
        m.addLink("Culture & Performing Arts", "http://www.co.dutchess.ny.us/Tourism/Culture/CultIndex.htm","");
        m.addLink("Mid-Hudson Civic Center", "http://www.midhudsonciviccenter.com/","target=_blank");
	  m.addLink("Hudson Valley Renegades", "http://www.hvrenegades.com/","target=_blank");
	  m.addLink("Dutchess County Fair", "http://www.dutchessfair.com/html/dutchess_county_fair.html","target=_blank");
	  m.addLink("Farm Markets", "http://www.dutchesstourism.com/farm.asp","target=_blank");
        m.addLink("Gardens", "http://www.dutchesstourism.com/gardens.asp","target=_blank");
        m.addLink("Genealogy", "http://www.co.dutchess.ny.us/Tourism/Genealogy/GeneIndex.htm","");
        m.addLink("Golf Courses", "http://www.dutchesstourism.com/golf.asp","target=_blank");
        m.addLink("Hiking", "http://www.dutchesstourism.com/hiking.asp","target=_blank");
        m.addLink("Historic Sites & Museums", "http://www.dutchesstourism.com/historic.asp","target=_blank");
        m.addLink("County Parks", "http://www.co.dutchess.ny.us/CountyGov/Departments/DPW-Parks/PPindex.htm","");
        m.addLink("Non-County Parks", "http://www.dutchesstourism.com/parks.asp","target=_blank");
        m.addLink("Tours", "http://www.co.dutchess.ny.us/Tourism/Tours/ToursIndex.htm","");
        m.write();

        
        
// ***// drop-down for menu item nr. 6         COMMUNITY
 
        m = menue("m6", 205, 567);
        m.addLink("Community Service Agencies", "http://www.co.dutchess.ny.us/Community/CommunityServices/CSagencies.htm","");
        m.addLink("Emergency Services", "http://www.co.dutchess.ny.us/CountyGov/EmergencyServices/EmergencyServicesIndex.htm","");
        m.addLink("Environment/Land Preservation", "http://www.co.dutchess.ny.us/Community/ELPindex.htm","");
        m.addLink("Health Care & Hospitals", "http://www.co.dutchess.ny.us/Community/HealthCareandHospitals/HCIndex.htm","");
        m.addLink("Housing", "http://www.co.dutchess.ny.us/CountyGov/Departments/Planning/PLHousing.htm","");
        m.addLink("Libraries", "http://www.co.dutchess.ny.us/Community/Libraries/LIBindex.htm","");
        m.addLink("Telephone/Cellular Companies", "http://www.co.dutchess.ny.us/Community/PhoneCell.htm","");
        m.addLink("Utility & Cable Companies", "http://www.co.dutchess.ny.us/Community/UtilityCable.htm",""); 
        m.addLink("Senior Citizen Services", "http://www.co.dutchess.ny.us/CountyGov/Departments/Aging/AGIndex.htm","");
        m.addLink("Victims' Resources and Services", "http://www.co.dutchess.ny.us/Community/VictimServices.htm","");
        m.addLink("Volunteer Opportunities in Dutchess County", "http://www.co.dutchess.ny.us/Community/VolOpportunities.htm","");
        m.addLink("Youth Services", "http://www.co.dutchess.ny.us/CountyGov/Departments/YouthBureau/YBindex.htm","");
        m.write();
       
  
  // ***// drop-down for menu item nr. 7         ELECTED OFFICIALS
  
        m = menue("m7", 120, 655);
        m.addLink("County Executive", "http://www.co.dutchess.ny.us/CountyGov/Departments/CountyExecutive/CEIndex.htm","");
        m.addLink("County Legislators", "http://www.co.dutchess.ny.us/CountyGov/Departments/Legislature/CLlegislators.htm","");
        m.addLink("Comptroller", "http://www.co.dutchess.ny.us/CountyGov/Departments/Comptroller/COindex.htm","");
        m.addLink("County Clerk", "http://www.co.dutchess.ny.us/CountyGov/Departments/CountyClerk/CCindex.htm","");
        m.addLink("District Attorney", "http://www.co.dutchess.ny.us/CountyGov/Departments/DistrictAttorney/DAindex.htm","");
        m.addLink("Sheriff", "http://www.co.dutchess.ny.us/CountyGov/Departments/Sheriff/SHindex.htm","");
	  m.addLink("Municipal", "http://www.co.dutchess.ny.us/ElectedOfficials/ELMunElectedOffs.htm","");
        m.addLink("State", "http://www.co.dutchess.ny.us/ElectedOfficials/ELStateElectedOffs1.htm","");
        m.addLink("Federal", "http://www.co.dutchess.ny.us/ElectedOfficials/ELFedElectedOffs1.htm","");
        m.write();
        
// ***

        OK = true;
}




var OK = false;
if(document.layers)
{
        window.captureEvents(Event.MOUSEUP);
        window.onmouseup=hide_all;
}
else
{
        document.onmouseup=hide_all;
	
}




function show_layer(x)
{
       // if (OK)
        {
                if(document.layers) document.layers[x].visibility="show";
                if (document.all) document.all[x].style.visibility="visible";
                if ((document.getElementById)&& (!document.all))  document.getElementById(x).style.visibility="visible";
        }
}
function hide_layer(x)
{
       // if (OK)
        //alert("in hide_layer "+x)
         
       {
                if(document.layers)                      
                           document.layers[x].visibility="hide";
       //            alert(document.all)         
                if (document.all) document.all[x].style.visibility="hidden";
      //          alert("after problem")
                if ((document.getElementById)&& (!document.all)) document.getElementById(x).style.visibility="hidden";
        }
}
function show_layer_last(x)
{
        if (OK)
        {
                if(document.layers)
                        document.layers[x].visibility="hide";
                else
                        document.all[x].style.visibility="hidden";
        }
}

function do_menu(x)
{
   //     alert("in do_menu " +x) 
        hide_all();
        show_layer(x);
}
function do_menu_last(x)
{
        hide_all();
        show_layer_last(x);
}

function hide_all()
{
        for (n=1; n<=7; n++)
        {
        
         eval("hide_layer('m"+n+"')");
        }
}

/* +++++++++++++++++++++++++++++++++++++++ */

function addLink(name, url, target)
{
        // doesnt work in ie
        // this.linkarray.push(new Array(name, url));
        // this looks ugly, but works
        this.linkarray = this.linkarray.concat(new Array(new Array(name, url, target)));  
      
}
function addSeparator()
{
        // doesnt work in ie
        // this.linkarray.push("SEPARATOR")
        // this works
        this.linkarray = this.linkarray.concat(new Array("SEPARATOR"));
}
function writeMenue()
{
        var str = "";
         str += '\n<div id="'+this.name+'" style="position: absolute; z-index: 0; top: 90px; left: '+this.leftPosition+'px; visibility: hide; visibility: hidden">  \n';
        str += '<table bgcolor="'+this.border+'" cellspacing="0" cellpadding="0" border="0">\n';
        str += '<tr><td>\n';
        str += '<table background="" cellspacing="1" cellpadding="0" border="0" width="'+this.width+'">\n';

        // links schreiben
        for (i=0; i<this.linkarray.length; i++)
        {
                str += '        <tr>\n';
                if (this.linkarray[i]=="SEPARATOR")
                {
                        str += '<td  bgcolor="'+this.border+'"></td>\n';
                }
                else
                {
                         str += '               <td onmouseover="this.style.backgroundColor=\''+this.overcolor+'\'"\n';
//                         str += '               onclick="location.href=\''+this.linkarray[i][1]+'\'"\n';
// with this lcoation.href in when the link is clicked to open in a new window (target=_blank) the new window opened
// but the new page also displayed in the parent window,       Z
                         str += '               onmouseout="this.style.backgroundColor=\''+this.bgcolor+'\'" bgcolor="'+this.bgcolor+'"><ilayer><layer\n';
                         str += '               width="'+this.width+'" onMouseover="this.bgColor=\''+this.overcolor+'\'\;" \n';
                         str += '               onMouseout="this.bgColor=\''+this.bgcolor+'\';">&nbsp;<a href="'+this.linkarray[i][1]+'" ' +this.linkarray[i][2]+'                                       \n';
                         str += '               class="link9ptburg">'+this.linkarray[i][0]+'</a>&nbsp;</layer></ilayer></td> \n';
                }
                 str += '        </tr>\n';
        }
//alert(str);
        str += '</table>\n';
        str += '</td></tr>\n';
        str += '</table>\n';
        str +='</div>\n\n';

        // uncomment the next two lines to get debugging information
        // alert(this.linkarray.join("\n"));
        // alert(str);
        document.write(str);
}
function menue(name, width, leftPosition)
{
        this.border = "#800000";                 // maroon
        this.overcolor = "#ffe9cd";             // medium beige color 
//     this.bgcolor = "#fff4e5";                  //  light beige color
        this.bgcolor = "#ffffff";                     // white
        this.name = name;
        this.width = width;
        this.leftPosition = leftPosition;
        this.linkarray = new Array();
        this.write = writeMenue;
        this.addLink = addLink;
        this.addSeparator = addSeparator;
        return this
}

// this code does not get executed CM.
function bka_writestyle(code, menu_code) {  
          alert("in bka_writestyle")         
if (menu_code == code) {
            document.write ('<span style="color : #ff0000;">');
        } else {
            document.write ('<span>');
        }
}


