// Simple JavaScript Rotating Banner Using jQuery
// www.mclelun.com
var vCurrent = 0;
var vTotal = 0;
var vDuration = 5000;
var intInterval = 0;
var vGo = 1;

jQuery(document).ready(function() {	
	vTotal = $(".jqb_slides").children().size() -1;
	$(".jqb_info").text($(".jqb_slide").children().children().attr("title"));	
	intInterval = setInterval(fnLoop, vDuration);
});

function fnChange(){
	clearInterval(intInterval);
	intInterval = setInterval(fnLoop, vDuration);
	fnLoop();
}

function fnLoop(){
	if(vGo == 1){
		vCurrent == vTotal ? vCurrent = 0 : vCurrent++;
	} else {
		vCurrent == 0 ? vCurrent = vTotal : vCurrent--;
	}
		
	$("#jqb_object").find(".jqb_slide").each(function(i) { 
		if(i == vCurrent){
			$(".jqb_info").text($(this).children().children().attr("title"));
			$(this).animate({ opacity: 'show' }, 1500);
		} else {
			$(this).animate({ opacity: 'hide' }, 1500);
		}
	});
}






