jQuery(document).ready(function($){
var shape = $('.map-shape');
shape.hover(function() {
var self = $(this), id = self.attr('id');
getStrippedId(id);
$(newId).show();
}, function() {
var self = $(this), id = self.attr('id');
getStrippedId(id);
$(newId).hide();
});
function getStrippedId(value) {
// split id's between underscores var string = value.split('_');
// remove last element in array string.pop();
// join elements back into string with underscore var joined = string.join('_');
// add # infront of string newId = '#' + joined;
return newId;
}
});