var currentImage;
var currentIndex = -1;
var interval;
function showImage(index){
    if(index < $('#bigPic img').length){
    	var indexImage = $('#bigPic img')[index]
        if(currentImage){   
        	if(currentImage != indexImage ){
                $(currentImage).css('z-index',2);
                clearTimeout(myTimer);
                $(currentImage).fadeOut(700, function() {
				    myTimer = setTimeout("showNext()", 10000);
				    $(this).css({'display':'none','z-index':1})
				});
            }
        }
        $(indexImage).css({'display':'block', 'opacity':1});
        currentImage = indexImage;
        currentIndex = index;
    }
}

var t=2;
$('aside .testimonial').children('p').hide();
$('aside .testimonial').children('p#t1').show();

function showNext(){
    var len = $('#bigPic img').length;
    var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
    showImage(next);
	if(t==1) {
		$('aside .testimonial').children('p#t1').fadeOut('fast');
		$('aside .testimonial').children('p#t2').delay(500).fadeIn('slow');
		t=2;
	} else{
		if(t==2){
			$('aside .testimonial').children('p#t2').fadeOut('fast');
			$('aside .testimonial').children('p#t1').delay(500).fadeIn('slow');
			t=1;
		};
		
	};
}

var myTimer;


$(document).ready(function() {
    myTimer = setTimeout("showNext()", 10000);
	showNext(); //loads first image

});



