var SiteConnect = SiteConnect || {};

SiteConnect.SlideShow = {
	init: function() {
		if ( $('#jsslideshow li').length <= 1 ) return;
		setInterval( "SiteConnect.SlideShow.slideSwitch()", 5000 );
	},
	
	slideSwitch: function() {
		var $active = $('#jsslideshow li.active');
		
		if ( $active.length == 0 ) $active = $('#jsslideshow li:last');
		
		var $next =  $active.next().length ? $active.next() : $('#jsslideshow li:first');
		
		$active.addClass('last-active');
		
		$next.css({opacity: 0.0})
				.addClass('active')
				.animate({opacity: 1.0}, 1000, function() {
						$active.removeClass('active last-active');
						});
	}
}


SiteConnect.Forms = {
	init: function() {
	    $('.clear-on-focus').focus( function() {
			if ( this.value == this.title )
				this.value = '';
	    });
	}
}


SiteConnect.Links = {
	init: function() {
		$('A[rel="external"]').click( function() {
			window.open( $(this).attr('href') );
			return false;
		});
	}
}


$(document).ready(function() {
						SiteConnect.SlideShow.init();
						SiteConnect.Forms.init();
						SiteConnect.Links.init();
					});