The code in custommenu is just used to assign images as icons to the menu items listed in the Basemap menu. You can view the code for custommenu.js by using either Firebug or Chrome Developer tools to inspect the scripts associated with the page. Here's a simple sample based off the code (without the custommenu) that shows how to populate a dropdown menu with basemaps.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Topographic Map</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.1/js/dojo/dijit/themes/claro/claro.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.esriScalebar{
padding: 20px 20px;
}
#map{
padding:0;
}
</style>
<script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.1"></script>
<script type="text/javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.dijit.BasemapGallery");
dojo.require("dijit.form.Button");
dojo.require("dijit.Menu");
dojo.require("esri.map");
var map;
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-122.46,"ymin":37.73,"xmax":-122.36,"ymax":37.77,"spatialReference":{"wkid":4326}});
map = new esri.Map("map",{
extent:esri.geometry.geographicToWebMercator(initExtent)
});
//Add the topographic layer to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);
dojo.connect(map, 'onLoad', function(theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
createBasemapGallery();
});
}
function createBasemapGallery() {
basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
});
dojo.connect(basemapGallery, 'onLoad', function () {
//BasemapGallery.startup isn't needed because we aren't using the default basemap, instead
dojo.forEach(basemapGallery.basemaps, function (basemap) {
//Add a menu item for each basemap, when the menu items are selected
dijit.byId('basemapMenu').addChild(new dijit.MenuItem({
label: basemap.title,
onClick: dojo.hitch(this, function () {
this.basemapGallery.select(basemap.id);
})
}));
});
});
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width: 100%; height: 100%; margin: 0;">
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="border:1px solid #000;padding:0;">
<div style="position:absolute; right:65px; top:10px; z-Index:99;">
<button id="dropdownButton" baseClass='medium button green' iconClass="basemapIcon" label="Basemaps" dojoType="dijit.form.DropDownButton">
<div dojoType="dijit.Menu" id="basemapMenu">
<!--The menu items are dynamically created using the basemap gallery layers-->
</div>
</button>
</div>
</div>
</div>
</body>
</html>