
var j = jQuery.noConflict();
j(document).ready(function($){
	
    // Mktg Banner
	$('#banner')
		.addClass('mktg-banner-widget')
		.append('<div id="pager-btns"></div>')
		.append('<div id="up-next">Up next: <a href="#" id="next-title">'+ $('#banner li:first-child h4').text() +'</a></div>');
	$('#banner ul')
		.addClass('imageRotation')
		.cycle({
			fx: 'scrollHorz',
			timeout: 9000,
			speed: 1000,
			pager: '#pager-btns',
			before: function(){
				$('#up-next').fadeOut(200);
			},
			after: function(curr,next){
				var title = $(next).next().attr('title') || $(next).siblings().first().attr('title');
				$('#next-title').text(title);
				$('#up-next').fadeIn(200);
			}
		});
	$('#next-title').click(function(e){
		$('#banner ul').cycle('next');
		e.preventDefault();
	});
	
	// Pager Button Tooltips
	var t = 0;
	$('#next-title').text($('#banner li:eq(1) h4').text());
	$('#banner ul li').each(function(){
		var title = $('h4',this).text();
		$(this).attr('title',title);
		$('#pager-btns a').eq(t).attr('title',title);
		t++;
	});
	$('#pager-btns a').tooltip({
		effect: 'fade',
		offset: [-2,0]
	});
	
	// Events
	$('#events-widget').inc247events({
		items: 3,
		style: 'compact',
		linkText: 'View All &raquo;'
	});
	
	// Sponsor Carousel
	   $('#sponsorCarousel ul').incSponsorCarousel({
	        items: 5,
			showButtons: false,
	        timer: false,
	        width: 670
	    });
	
	// Sponsor Box
	$('#sponsors ul').incSponsorBox();

	// Clickable Logo
    $('body').addClickableLogo({
        name: 'Connecticut Association for Home Care',
        url: 'http://www.cahch.org'
    });
    
});

