// Simple JavaScript Rotating Banner Using jQuery
// www.mclelun.com
var vCurrent = 0;
var vTotal = 0;
var vDuration = 5000;
var intInterval = 0;
var vGo = 1;

$(function() {
	vTotal = $(".jqb_slides").children().size() -1;
	$(".jqb_info").text($(".jqb_slide").children().children().attr("title"));	
	intInterval = setInterval(fnLoop, vDuration);
		
	$('#subCase').hide();
	$('#menu .subCase').click(function(e) {
		e.preventDefault();
		$('#subCase').slideToggle('normal');
    });
});

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--;
	}
		
	$("#splash").find(".jqb_slide").each(function(i) { 
		if(i == vCurrent){
			$(".jqb_info").text($(this).children().children().attr("title"));
			$(this).animate({ opacity: 'show', height: 'show' }, 800);
		} else {
			$(this).animate({ opacity: 'hide', height: 'hide' }, 800);
		}
	});
}






