George,
The whole issue is the fact that your accordion container is hidden when you are trying to add the measure widget to it. The best workaround for this is to not create the measure widget until the accordian is shown (be sure to remove the other locations of code where you were adding the measure widget before):
function showhideleg() {
var legwin = document.getElementById("rightPane");
if (ishidden == "TRUE") {
legwin.style.visibility = "visible";
registry.byId("accord").selectChild("legendPane", true);
ishidden = "FALSE";
if(!measurement){
measurement = new Measurement({
map: map,
defaultLengthUnit: "esriFeet"
}, "measureDiv");
measurement.startup();
}
} else {
$("#rightPane").toggle();
}
}