
$(document).ready(function() {
  if (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32") {
    $('#top-menu li.active').pngFix();
    $('#top-menu li:not(.active)').hover(function() {
      $(this).addClass("hover");
      $(this).pngFix();
    }, function() {
      $(this).pngUnFix();
      $(this).removeClass("hover");
    });
  }
});

(function($) {
  jQuery.fn.pngFix = function() {
    $(this).find("*").andSelf().each(function() {
      if ($(this).css('background-image-back') != "none")
        $(this).css('background-image', $(this).css('background-image-back'));
      var bgIMG = $(this).css('background-image');
      if(bgIMG.indexOf(".png") != -1) {
        $(this).css('background-image-back', bgIMG);
        var iebg = bgIMG.split('url("')[1].split('")')[0];
        $(this).css('background-image', 'none');
        $(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
      }
    });
    return jQuery;
  },
  jQuery.fn.pngUnFix = function() {
    $(this).find("*").andSelf().each(function() {
      $(this).get(0).runtimeStyle.filter = "";
    });
    return jQuery;
  }
})(jQuery);
