﻿//function that swaps the images with their corresponding _ovr image on mouse over/out
//if you want to use this function, only add class="iSwap" to your img tag and you have it working
function SwapMe() {
    $(".iSwap").mouseover(function() {
        var src = $(this).attr("src");
        var pieces = $(this).attr("src").split("/");
        //+ "_ovr.png"
        var lastPiece = pieces[pieces.length - 1];
        var lastPieceParts = lastPiece.split(".");
        var replacedSrc = src.replace(lastPiece, lastPieceParts[0] + "_ovr." + lastPieceParts[1]);
        $(this).attr("src", replacedSrc);
    }).mouseout(function() {
        var src = $(this).attr("src").replace("_ovr", "");
        $(this).attr("src", src);
    });
}
