$(function(){

  Cufon.replace("#home-intro");

  //remove the margin on every third show using
  //we have to use jquery because pure css won't work in internet derpslorer
  
  $("ul.shows-index li:nth-child(3n+3)").css({marginRight: '0 !important'});
  
  //slideshow
  
  if($("#slider-images img").size() > 1){  
    $("#slider-images").cycle({
      timeout: 0,
      next: "#next-slide",
      prev: "#prev-slide"
    });
  }
  
  /* Jquery Tools overlay programmatic call */
  
  if($(".launch-overlay").size()){

    $(".launch-overlay").overlay();
  }
  
  /* Video media element */
  
  if($("video").size()){
    
    if(	navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i)){
    	    var video = new MediaElementPlayer("video", {
    	        success: function (video) {
    	            $(".video-overlay .close").live("click", function(){
    	                video.pause();
    	            });
                }
    	    });
    	} else {
    	    var video = new MediaElementPlayer("video", { 
    	        mode: 'shim', 
    	        success: function (video) {
    	            $(".video-overlay .close").live("click", function(){
    	                video.pause();
    	            });
                }
            });
        }
  }
  
  //hover effect for shows in index
  $("ul#shows-index li a").hover(
    
    //wax on
    function(){
  
      $(this).stop().animate({marginTop: '-4px'}, 200);
      
    },
    
    //wax off
    function(){

      $(this).stop().animate({marginTop: '0'}, 100);
        
    }
  );
});

