$(function() {
  $('#home-slideshow').cycle({
    fx: 'fade',
    speed: 700,
    timeout: 3500,
    pager: '#home-slideshow-nav',
    pagerAnchorBuilder: function(idx, slide) { 
      return '<a href="#"><span>'+(idx+1)+'</span></a>'; 
    } 
  });
  
 $("#contact-form").validate();			
 
 $('.lightbox').lightBox({fixedNavigation:false});

  $('.current-comic').hover(function(){
    $(".caption", this).stop().animate({top:'0px'},{queue:false,duration:160});
  }, function() {
    $(".caption", this).stop().animate({top:'345px'},{queue:false,duration:160});
  });
    
 // Change the image of hoverable images
 $(".imgover").hover( function() {
     var hoverImg = HoverImgOf($(this).attr("src"));
     $(this).attr("src", hoverImg);
   }, function() {
     var normalImg = NormalImgOf($(this).attr("src"));
     $(this).attr("src", normalImg);
   }
 );

});

function HoverImgOf(filename)
{
 var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
 return filename.replace(re, "$1_o.$2");
}
function NormalImgOf(filename)
{
 var re = new RegExp("(.+)_o\\.(gif|png|jpg)", "g");
 return filename.replace(re, "$1.$2");
}
