/*** Alternates row colors! ***/
$(document).ready(function(){
	$("tr:odd").css("background-color", "#eaeaea");
    $('.relatize').relatizeDate();

    $('#watch_button').click(function() { $.post('/site/watch', { email: $('#addy').attr('value') }, function(data)
      {
        if(data == 'true')
          $('#watcher').text("You've been added to our waiting list and will let you know when we enter the next round of invites.");
        else
        {
          if(!$('#watcher').hasClass('appended'))
          {
            $('#watcher').append('<br/>Please verify the format of your email address and try again.');
            $('#watcher').addClass('appended');
          }
        }
      }
    ); });

	/*** Homepage Slider ***/
	if($("#slider li").size() > 1) { /* If <li> items are more than 1, starts everything! */

		$("#slider").easySlider({
			/* 
				http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding 
			*/
			speed: 600, /* Sliding speed */
			auto: true, /* Auto slide */
			pause: 6000,
			vertical: false,
			prevId: 'prev-slide', /* Previous control button ID */
			nextId: 'next-slide', /* Next control button ID */
			continuous: true
		});
					
		/* Sets controls opacity to 0.2 by default */
		$("#prev-slide, #next-slide").css("opacity", 0.3);
		
		/* Controls - On hover */
		$("#prev-slide, #next-slide ").hover(
		  function () { 
			$(this).animate({ opacity: 1 }, { duration: 200 }); /* On hover, Show it completely */
		  }, 
		  function () {
			$(this).animate({ opacity: 0.3 }, { duration: 200 }); /* When mouse leave, resets the opacity to 0.2 */
		  }
		).click(
		  function () { 
			$(this).fadeOut(200).fadeIn(400); /* On click blinks the button */
		});

	}
});

