/**
 * jQuery Cycle Plug-in - Option Reference
 *
 * @link http://jquery.malsup.com/cycle/options.html
 */
 
var is_iPad = navigator.userAgent.match(/iPad/i) != null;
 
$(document).ready(function($) {
	if (!is_iPad)	{
		$('#section-0b-teaser').cycle({
			fx: 'scrollDown',
			pause: false,
			random: false,
			timeout: 7000,
			autostop: 6,				// stop after two complete cycles of the three slides - stops on video
			autostopCount: 6,
			speed: 400,
			width: '648px',
			before: function(){		// make sure video stops when slide transitions
				var obj = $(this);
				if(!$("obj" + ":contains('iframe')"))	{
					$('#section-0b-teaser').cycle('pause');
				}
			},
			height: '366px'
		});
	} else {
		// just show slide with video since cycle doesn't work right on iPad
		$('#section-0b-video').siblings('div').hide();
	}
	$('#section-1 .r-col-top div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-1 .r-col-top a.read_more_next', 
		prev: '#section-1 .r-col-top a.read_more_back',
		timeout: 0 
	});

	// Tmp
	$('#section-1 .l-col-l div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-1 .l-col-l a.read_more_next', 
		prev: '#section-1 .l-col-l a.read_more_back',
		timeout: 0 
	});

	// Tmp
	$('#section-2 .l-col-l div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-2 .l-col-l a.read_more_next', 
		prev: '#section-2 .l-col-l a.read_more_back',
		timeout: 0 
	});
	
	$('#section-2 .r-col-mid div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-2 .r-col-mid a.read_more_next', 
		prev: '#section-2 .r-col-mid a.read_more_back',
		timeout: 0 
	});
	
	$('#section-3 .l-col-r div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-3 .l-col-r a.read_more_next', 
		prev: '#section-3 .l-col-r a.read_more_back',
		timeout: 0 
	});
	
	$('#section-4 .l-col-l div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-4 .l-col-l a.read_more_next', 
		prev: '#section-4 .l-col-l a.read_more_back',
		timeout: 0 
	});

	$('#section-4 .l-col-r div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-4 .l-col-r a.read_more_next', 
		prev: '#section-4 .l-col-r a.read_more_back',
		timeout: 0 
	});

	$('#section-4 .r-col-top div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-4 .r-col-top a.read_more_next', 
		prev: '#section-4 .r-col-top a.read_more_back',
		timeout: 0	 
	});

	$('#section-4 .r-col-mid div.read_more').cycle({ 
		fx: 'fade', 
		speed: 300,
		next: '#section-4 .r-col-mid a.read_more_next', 
		prev: '#section-4 .r-col-mid a.read_more_back',
		timeout: 0	 
	});
});

