$(document).ready(function() {
  $('.slideshow').cycle({
    fx: 'scrollHorz',
    timeout: 7000,
    next: '#next',
    prev: '#prev', 
    before: onBefore,
    after: onAfter,
	slideResize:false
  });

  $('#news').cycle({
    fx: 'turnDown',
    timeout: 8000,
    speed: 2000
  });
});

function onBefore() {
  $('.slide .item').stop().hide();
  $('.slide').hide();
  $('.slide h1').css({ "opacity":"0", "left":"50px"});
 // var bgcolor = $(this).attr('rel');
 // $('body').css('background-color', bgcolor);
}

function onAfter() {
  var current = '.' + $(this).attr('id');
  $(current).show().find('h1').animate({
    opacity: 1,
    left: '0'
  }, 1000, 'easeInOutCubic', function() {
    // Function after animation
  });
  $(current).find('.item').delay(200).fadeTo('slow', 1);
}
