
var testInc = 0;
var slogansInc = 0;

function sloganSlideshow()
{
	$('div#home-tagline p.slide').fadeOut(1000, function() {sloganTextChange($(this));});
}

function testSlideshow()
{
	$('div#testimonials > div').fadeOut(1000, function() {testTextChange($(this));});
}

function sloganTextChange(element)
{
	$('div#home-tagline > div.tagline > p.shadow-2').html(slogans[slogansInc]);
	$('div#home-tagline > div.tagline > p.front-2').html(slogans[slogansInc]);
	if (slogansInc == (slogans.length-1)) slogansInc = 0;
	else slogansInc++;
	element.fadeIn(1000);
}

function testTextChange(element)
{
	$('div#testimonials p#testimonial-message').html(testimonials[testInc][0]);
	$('div#testimonials p#testimonial-company').html(testimonials[testInc][1]);
	if (testInc == (testimonials.length-1)) testInc = 0;
	else testInc++;
	element.fadeIn(1000);
}


$(function() {
	sloganSlideshow();
	testSlideshow();
});

$(document).ready(function() {
	$('ul#nav > li').mouseover(function() {$(this).addClass('over');});
	$('ul#nav > li').mouseout(function() {$(this).removeClass('over');});

//	$('.third-nav').mouseover(function() {$(this).fadeTo(500, .5);});
//	$('.third-nav').mouseout(function() {$(this).fadeTo(500, 1);});
	
	setInterval('sloganSlideshow()', 5000);
	setInterval('testSlideshow()', 7000);

	$('a').each(function(){
		if ($(this).attr('href').indexOf('http') != -1 && $(this).attr('href').indexOf('dsautomation.com') == -1)
		{
//			if ($(this).html().indexOf('<img') == -1)
///				$(this).html($(this).html() + '<img src="/staging/cms/images/newwin.gif" alt="Opens a New Window" />');
			$(this).click(function() {
				var newWin = window.open($(this).attr('href'));
				newWin.focus();
				return false;
			});
		}
	});
});

