var total = 0;
var selectedIndex = 0;
var nextIndex = 1;
var fadeSpeed = 750;
var displayTime = 7000;

$(window).load(function ()
{
	
	total = $("#fadingimages > ul > li").length;
	
	$("#fadingimages ul li:eq("+selectedIndex+")").css("display","block" ).css("z-index","2");
    setInterval("fadeimg();", displayTime);
});

function fadeimg()
{
	
		
	$("#fadingimages ul li:eq("+selectedIndex+")").css("display","block" ).css("z-index","2");
	$("#fadingimages ul li:eq("+nextIndex+")").css("display","block" ).css("z-index","1");
	
	$("#fadingimages ul li:eq("+selectedIndex+")").fadeOut(fadeSpeed);
	$("#fadingimages ul li:eq("+nextIndex+")").fadeIn(fadeSpeed).css("z-index","1");
	
	incCount();
}

function incCount()
{
	if(nextIndex < (total -1))
	{
		
		nextIndex++;
	}
	else
	{
		nextIndex = 0;
	}
	if(selectedIndex < (total-1))
	{
		
		selectedIndex++;
	}
	else
	{
		selectedIndex = 0;
	}
}

var curTest = 0;
var fcontent = Array();
fcontent[0]='<div style="display:none"><i>"Winning a W&sup3; Award has given us a sense of accomplishment and pride. We can now call ourselves award winning.</i><br /><span  style="color:#ea7945;">George Butiri, Owner<br />Two Martinis Productions, North Olmsted, OH</span></div>';
fcontent[1]='<div style="display:none"><i>"It is great to have this as an achievement and give to our clients as validation that we do great work...It reinforces their decision to hire us as a creative agency.</i><br /><span  style="color:#ea7945;">Tom Koller, Creative Director<br />Imagine Creative Group, Inc., Chicago, IL</span></div>';
fcontent[2]='<div style="display:none"><i>"The W&sup3; Award verifies the high quality of work that we do.</i><br /><span  style="color:#ea7945;">Allen Hopkins, Graphic Designer<br />Los Alamos National Lab, Los Alamos, NM  87545</span></div>';
fcontent[3]='<div style="display:none"><i>"Winning has meant a high level of recognition in the field, both for our firm and our clients.</i><br /><span  style="color:#ea7945;">Kelly Campbell, President/CEO<br />Liqui-Site Designs, Inc., Brooklyn, NY</span></div>';

$(document).ready(function()
{
    
    $("#testbox").html(fcontent[0]);
    $("#testbox").children().fadeIn(1000);
    setInterval('changeTest()', 7000);
});

function changeTest()
{
    curTest++;
    if(curTest == fcontent.length)
    {
        curTest = 0;
    }
    $("#testbox").children().fadeOut();
    $("#testbox").html("");
    $("#testbox").html(fcontent[curTest]);
    $("#testbox").children().fadeIn(1000);
    
    
    //alert(fcontent.length);
}

