function togglePortfolioThumb(e) {
  e = $(e);
  if (e.hasClass('inactive')) {
    e.removeClass('inactive');
  } else {
    e.addClass('inactive');
  }
}

function swapMenuImage(e) {
  e = $(e);
}

function isiPhone(){
    return (
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPad") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}

$(document).ready(function() {
  if (!isiPhone()) {
    // iOS decives don't really need hover and sometimes they simulate it
    // by requiring a double-tap. That is dumb.  
    $('.portfolio-thumb.inactive').hover(
      function() { 
        togglePortfolioThumb(this);
      }
    );
    
    $('div#menu ul li a img').mouseover(function() {
      var src = $(this).attr("src").match(/[^\.]+/) + "-selected.png";
      $(this).attr("src", src);
    });
    
    $('div#menu ul li a img').mouseout(function() {
      var src = $(this).attr("src").replace("-selected","");
      $(this).attr("src",src);
    });
  }
});
