I'm working on a map that changes the linked image based on where the mouse is hovering/what is selected. The hovering and selection for the INTL part of the map are working correctly but when you select the North America part of the map, it refuses to reselect the INTL part. If anyone know how to fix this I would really love the input. This is my first time working with image maps and I've found it a bit confusing. Thanks!
$(document).ready(function () {
var $a = 15;
var $b = 15;
$('#north').on("mouseenter", function () {
if ($('#mapimg').attr('src') === 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP.png') $('#mapimg').attr('src', 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP_NA.png');
if ($('#mapimg').attr('src') === 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP_INT.png') $('#mapimg').attr('src', 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP_NA.png');
});
$('#north').on("mouseleave", function () {
if ($('#mapimg').attr('src') === 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP_NA.png') $('#mapimg').attr('src', 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP.png');
});
$('#intl').on("mouseenter", function () {
if ($('#mapimg').attr('src') === 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP.png') $('#mapimg').attr('src', 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP_INT.png');
});
$('#intl').on("mouseleave", function () {
if ($('#mapimg').attr('src') === 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP_INT.png') $('#mapimg').attr('src', 'http://pinnacleint.com/new/wp-content/uploads/2014/09/MAP.png');
});
$('#intl').on("click", function () {
$('.intlogo').css({"opacity":"1"});
$('.northlogo').css({"opacity":".3"});
var $a = 10;
var $b = 5;
if ($a > $b) {$('#intl').off("mouseleave");}
else if($a < $b){$('#intl').on("mouseleave");}
else{
$('#north').on("mouseleave");
$('#intl').on("mouseleave");
}
});
$('#north').on("click", function () {
$('.intlogo').css({"opacity":".3"});
$('.northlogo').css({"opacity":"1"});
var $a = 5;
var $b = 10;
if ($a < $b){$('#north').off("mouseleave");}
else if ($a > $b) {$('#north').on("mouseleave");}
else{
$('#north').on("mouseleave");
$('#intl').on("mouseleave");
}
});
});