$(document).ready(function(){
  if($('.link a img').length) {
    $('.link a img').hover(
      function(){
        this.src = this.src.replace(/(_[0-9][0-9])?.png$/,"_hov.png");
      },

      function(){
        this.src = this.src.replace("_hov.png",".png");
      }
    );

    $('.link a img').mousedown(
      function(){
        this.src = this.src.replace("_hov.png","_act.png");
      }
    );
  }

  $('#indexedsearch .searchbox-button').hover(
    function(){
      this.src = this.src.replace(".png","_hov.png");
    },

    function(){
      this.src = this.src.replace("_hov.png",".png");
    }
  );

/*
  if($('#tx_indexedsearch .tx-indexedsearch-searchbox-button').length) {
    $('#tx_indexedsearch .tx-indexedsearch-searchbox-button').hover(
      function(){
        this.src = this.src.replace(".png","_hov.png");
      },

      function(){
        this.src = this.src.replace("_hov.png",".png");
      }
    );
  }
*/

  if($('#tipafriend .submit').length) {
    $('#tipafriend .submit').hover(
      function(){
        this.src = this.src.replace(".png","_hov.png");
      },

      function(){
      this.src = this.src.replace("_hov.png",".png");
      }
    );

    $('#tipafriend .submit').mousedown(
      function(){
        this.src = this.src.replace("_hov.png","_act.png");
      }
    );
  }


  $('.mailformplus_contactform input.button').hover(
    function(){
      this.src = this.src.replace(".png","_hov.png");
    },

    function(){
      this.src = this.src.replace("_hov.png",".png");
    }
  );

  if ( $('.tx-sksimplegallery-pi1').length ){
    $.each($('.tx-sksimplegallery-pi1 .single a'), function() {
      var parts = $(this).attr('href').split('&');
      var parts2 = parts[1].split('=');
      $(this).attr('href', decodeURIComponent(parts2[1]));
      $(this).attr('onclick','');
    }); 

    $('.tx-sksimplegallery-pi1 .single a').lightBox({fixedNavigation:false});
  }
});
