
  /* home.js - home page specific code
  ========================================================================================================================= */ 

  /* slideshow related 
     ================= */  
  var autoTransitionDelays = [ 5000, 6000, 5000, 7000, 4000 ];
  var autoTransitionIndex = 0;

  var autoTransitionHandle = setTimeout( autoTransition, autoTransitionDelays[ autoTransitionIndex ] );

  function autoTransition()
  {
    try
    {
      if( autoTransitionIndex >= this.irisSlides.drawers.length - 1 ) autoTransitionIndex = 0;
      else autoTransitionIndex++;

      this.irisSlides.drawers[ autoTransitionIndex ].toggle();

      autoTransitionHandle = setTimeout( autoTransition, autoTransitionDelays[ autoTransitionIndex ] );
    }
    catch ( e ) { }
  }

  function nextSlide()
  {
    clearTimeout( autoTransitionHandle );
    autoTransition();
  }

  function firstSlide()
  {
    if( autoTransitionIndex != 0 ) autoTransitionIndex = this.irisSlides.drawers.length ;
    nextSlide();
  }

  function resetAutoTransition( index )
  {
    autoTransitionIndex = index;
    clearTimeout( autoTransitionHandle );
    autoTransitionHandle = setTimeout( autoTransition, autoTransitionDelays[ autoTransitionIndex ] );
  }
  
  
  
  /* email signup 
     ============ */  
  function submitEmail()
  {
    var email = document.getElementById( 'email' ).value;
    if( email.indexOf( '@' ) == -1 || email.indexOf( '.' ) == -1 ) { alert( 'Email address is invalid.' ) }
    else { window.open( '/signup/add-email.php?email=' + email, '_blank', 'width=615,height=450,menubar=no,toolbar=no,location=no,directories=no,status=yes,resizable=yes,scrollbars=yes' ); }
  }

  function popupSignup()
  {
    window.open( '/signup/', '_blank', 'width=615,height=450,menubar=no,toolbar=no,location=no,directories=no,status=yes,resizable=yes,scrollbars=yes' );
  }
