$(document).ready(function(){

	var slides = new Array;
	slides[0] = '<h1>Hospitals</h1><p>Advantage Home Telehealth, Inc. offers a comprehensive technology and services solution to facilitate mobile, paperless, remote patient monitoring thereby improving overall patient health, peace of mind and ability to age in place, while lowering health costs from anywhere, anytime.<br/><br/><a href="/hospitals">Learn more &raquo;</a></p>';
	slides[1] = '<h1>Home Health/Hospice</h1><p>Advantage Home Telehealth, Inc. offers a comprehensive technology and services solution to facilitate mobile, paperless, remote patient monitoring thereby improving overall patient health, peace of mind and ability to age in place, while lowering healthcare costs from anywhere, anytime.<br/><br/><a href="/home-health-hospice">Learn more &raquo;</a></p>';
	slides[2] = '<h1>Health Plans</h1><p>Advantage Home Telehealth, Inc. offers a comprehensive mobile technology and services solution to facilitate an individual\'s chronic disease improvement and  wellness, thereby improving overall health, peace of mind and ability to age in place while lowering healthcare costs from anywhere, anytime.<br/><br/><a href="/health-plans">Learn more &raquo;</a></p>';
	slides[3] = '<h1>Self-Care</h1><p>Advantage Home Telehealth, Inc. offers a comprehensive mobile technology and services solution to facilitate an individual\'s wellness, and/or chronic disease monitoring thereby improving overall health, peace of mind and ability to age in place, while lowering healthcare costs from anywhere, anytime.<br/><br/><a href="/self-care">Learn more &raquo;</a></p>';
	slides[4] = '<h1>Corporate Wellness</h1><p>Advantage Home Telehealth, Inc. offers a comprehensive technology and services solution to facilitate mobile employee wellness and chronic disease monitoring thereby improving overall employee health, peace of mind and ability to age in place, while lowering health costs from anywhere, anytime.<br/><br/><a href="/corporate-wellness">Learn more &raquo;</a></p>';
	
	$('#carousel').jcarousel({
		initCallback: function(carousel) {
			// Pause & restart the carousel on mouse-enter/mouse-leave
			$('.slideshow')
				.mouseenter(function() {
					carousel.stopAuto();
				})
				.mouseleave(function() {
					carousel.startAuto();
				});
			// Bind the external controls
			$('.slideshow .navigation a')
				.click(function() {
			        carousel.scroll($.jcarousel.intval($(this).attr('href').replace('#','')));
			        return false;
			    });
		},
		// Show item animation
		itemVisibleInCallback: {
			// Fade out the old caption and remove control highlight.
			onBeforeAnimation: function(carousel, item, idx, state) {
				$('.slideshow .caption').fadeOut();
				$('.slideshow .navigation li').removeClass('current');
			},
			// Fade out the new caption and add the control highlight.
			onAfterAnimation:  function(carousel, item, idx, state) {
				$('.slideshow .caption').html(slides[((idx-1)%5)]).fadeIn();
				$('.slideshow .navigation li:eq('+((idx-1)%5)+')').addClass('current');
			}
		},
		wrap: 'circular',
		visible: 1,
		scroll: 1,
		auto: 5
	});
	
	// Remove dividing border from header nav secondary drop-downs.
	$('.header .navigation ul').find('li:last a').css('border', 'none');

});

