$(document).ready(function() {
   
   // initialize flash interaction for the region map
   initFlashRegionMap();
   
});

function initFlashRegionMap() {
    
    $('a.county-name').mouseover(function() {
       
       // get the county name from the rel of the a
       var county = $(this).attr('rel');
       
       // show the box in the flash
       activateBox(county);
        
    });
    
    $('a.county-name').mouseout(function() {
        
        // get the county name from the rel of the a
        var county = $(this).attr('rel');
        
        // hide the box in the flash
        deactivateBox(county);
        
    });
    
}

function activateBox(county) {
    getFlashMovie("regionMap").activateBox(county);
}

function deactivateBox(county) {
    getFlashMovie("regionMap").deactivateBox(county);
}

function getFlashMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}
