[GIS] SelectFeature not working in OpenLayers

eventsjavascriptjqueryopenlayers-2openstreetmap

I'm still sort of new to openlayers, but I've been able to set up a map which reads in a KML, loops through the different regions contained therein, and draws those polygons on a vector layer overtop of an OSM layer. This all works fine until I try to add a control. All I want to do is trigger an function when the polygon is clicked. For testing purposes, right now I'm just trying to trigger an alert.
The applicable pieces of my code are below:

function onFeatureSelect(feature){
    alert("boom");
}

function onFeatureUnselect(feature){
    alert("unBoom");
}
var selectControl;
map = new OpenLayers.Map(divName, {
    controls: [new OpenLayers.Control.Navigation(), new OpenLayers.Control.LayerSwitcher(), new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.Attribution()],
    projection: googProj,
    units: 'm',
    maxResolution: 156543.0399,
    numZoomLevels: 10
});
var layerOSM = new OpenLayers.Layer.OSM();
map.addLayer(layerOSM);
var layerVector = new OpenLayers.Layer.Vector("KML Regions");

$.each(rPoly, function(){  //Looping through the data
    var feature_polygon = new OpenLayers.Feature.Vector( //We'll make a polygon from a linear ring object, which consists of points
new OpenLayers.Geometry.Polygon(new OpenLayers.Geometry.LinearRing(this)), {
        "rName": thisR
    }, {
        'fillColor': thisC,
        'strokeWidth': borderWidth,
        'strokeColor': borderColor,
        'fillOpacity': thisO
    });
    layerVector.addFeatures([feature_polygon]);
});

map.addLayer(layerVector);
selectControl = new OpenLayers.Control.SelectFeature(layerVector, {
    onSelect: onFeatureSelect,
    onUnselect: onFeatureUnselect
});
selectControl.activate();
map.addControl(selectControl);

Please remember that everything renders fine, I just can't get a function to fire when a polygon is clicked.
Any help would be GREATLY appreciated. I'm getting pretty frustrated since this should be something fairly easy to do.
Thanks.

UPDATE

When I try using getLeyersByName to get the "KML Regions" layer, it comes back empty. How is this possible since all of the polygons are visible? Could this be part of the issue?

UPDATE OF SHAME

What it actually turned out to be is that I had the loop creating the features on the layer running from a function and then I'd pass the fully rendered layer back. This was causing an error. So, in trying to simplify the code for the question, it seems like I fixed it if I would just paste it back in.
The code would have died anyway due to the calls being out of sorts, so I marked that answer as solving the problem. Thanks everyone.

Best Answer

Switch last 2 statements. Add to map first, then activate.