/* jquery tip: to add an effect on all browsers BUT IE:
if(!$('.ie').length){
  //do something
}
*/

/* Read More */
/*
$(document).ready(function(){
  $('.textMore').hide();
  $('.fr .textMore').after('<p class="readmore"><a href="#">Suite &raquo;</a></p>');
  $('.en .textMore').after('<p class="readmore"><a href="#">Read More &raquo;</a></p>');

  $('div.text > p.readmore a').click(function(){
    $textMore = $(this).parents('.text').find('.textMore');

    if($textMore.length){
      if($('.ie').length){
        $textMore.show();
      }
      else{
        $textMore.css({opacity: '0'}).slideDown(250).fadeTo(500, 1);
      }

      $(this).parent().hide();
      return false;
    }
  });
});
*/

function slideSwitch() {
  var $active = $('#homeSlideShow div.active');
  if ( $active.length == 0 ) $active = $('#homeSlideShow div:last');
  var $next =  $active.next('div').length ? $active.next() : $('#homeSlideShow > div:first');
  $active.fadeOut('slow', function(){
    $active.removeClass('active');
  });
  $next.fadeIn('slow', function(){
    $next.addClass('active');
  });
}

jQuery(function($){
  $('#homeSlideNav a.next').click(function(){
    var $active = $('#homeSlideShow div.active');
    var $next =  $active.next('div').length ? $active.next() : $('#homeSlideShow > div:first');
    $active.fadeOut('slow', function(){
      $active.removeClass('active');
    });
    $next.fadeIn('slow', function(){
      $next.addClass('active');
    });
    $(this).blur();
    return false;
  });

  $('#homeSlideNav a.prev').click(function(){

    var $active = $('#homeSlideShow div.active');
    var $prev =  $active.prev('div').length ? $active.prev() : $('#homeSlideShow > div:last');
    $active.fadeOut('slow', function(){
      $active.removeClass('active');
    });
    $prev.fadeIn('slow', function(){
      $prev.addClass('active');
    });
    $(this).blur();
    return false;
  });

  $('.homeSlide').hover(function(){
    clearInterval(slideShow);
  }, function(){
    slideShow = setInterval( "slideSwitch()", 3500 );
  });
});
