$(document).ready(function () {
    var ie6 = jQuery.browser.msie && jQuery.browser.version == "6.0";
    $(ie6 ? "span.btnhover" : "img.btnhover").each(function () {
        if(ie6) {
            this.hoverInFilter = this.style.filter.replace(".png", "_hover.png");
            this.hoverOutFilter = this.style.filter;
            if ($(this).hasClass("path")) this.style.filter = this.hoverOutFilter = this.hoverInFilter;
        } else {
            var srcArray = this.src.split(".");
            this.hoverInSrc = srcArray.slice(0, srcArray.length-1).join(".") + "_hover" + "." + srcArray[srcArray.length-1];
            this.hoverOutSrc = this.src;
            if ($(this).hasClass("path")) {
                this.src = this.hoverOutSrc = this.hoverInSrc;
            }}
            //preload images
        $("<img>").attr("src", this.hoverInSrc);
        
        
    }).hover(function () { // hover in
        if (ie6 && this.style.filter) {
            this.style.filter = this.hoverInFilter;
        } else {
            this.src = this.hoverInSrc;
        }
    }, function () { // hover out
        if (ie6 && this.style.filter) {
            this.style.filter = this.hoverOutFilter;
        }
        this.src = this.hoverOutSrc;
    })
});