/*********************************************************************************************************************************/
/* DOCUMENT READY CALLS **********************************************************************************************************/
/*********************************************************************************************************************************/

$(document).ready(function(){
	
	/* EXTERNAL LINKS start ***********************************************************/
	$('a[rel="external"]').click(function(){
		this.target = "_blank";
	});
	/* EXTERNAL LINKS end *************************************************************/
	
	/* SLIDESHOW start ***************************************************************/
	setInterval( "slideSwitch()", 5000 );
	setInterval( "adSwitch()", 4000 );
	/* SLIDESHOW end *****************************************************************/

}); //close document.ready

/*********************************************************************************************************************************/
/* DOCUMENT READY FUNCTIONS ******************************************************************************************************/
/*********************************************************************************************************************************/

/* SLIDESHOW function start *********************************************************/
function slideSwitch() {
	var $active = $('#specials li.active');

	if ( $active.length == 0 ) $active = $('#specials li:last');

	var $next = $active.next('li').length ? $active.next()
			: $('#specials li:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 500, function() {
			 $active.removeClass('active last-active');
	});

}
function adSwitch() {
	var $active = $('#link-parts-services a span.active');

	if ( $active.length == 0 ) $active = $('#link-parts-services a span:last');

	var $next = $active.next('span').length ? $active.next()
			: $('#link-parts-services a span:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 500, function() {
			 $active.removeClass('active last-active');
	});

}
/* SLIDESHOW function end ***********************************************************/