$(function() {
    $(".tabItem").mouseover(function() {
        changeImage($(this), true, false);
    }).mouseout(function() {
        changeImage($(this), false, false);
    });
});
function changeImage(self, enable, force) {
    if (!self.hasClass("On") || force) {
        var itemImage = self.children("img").first();
        var imgSrc = itemImage.attr("src");
        if (enable) {
            if (imgSrc.indexOf("Off") != -1)
                imgSrc = imgSrc.replace("Off", "On");
        }
        else {
            if (imgSrc.indexOf("On") != -1)
                imgSrc = imgSrc.replace("On", "Off");
        }
        itemImage.attr("src", imgSrc);
    }
}
function setCurrentTab(index) {
    var currTab = $($(".tabItem")[index]);
    changeImage(currTab, true, true);
    currTab.addClass("On");
}
