// JavaScript Document
//Left Portion of Banner Gallery
$(document).ready(function() {		
	
	//Execute the slideShow
	slideShow();
	slideShow2();

});

function slideShow() {

	$('#galleryLeft a').css({opacity: 0.0});
	$('#galleryLeft a:first').css({opacity: 1.0});
	$('#galleryLeft .caption').css({opacity: 0.8});
	$('#galleryLeft .caption').css({ width: $('#galleryLeft a').find('img').css('width') });
    if ($('#galleryLeft a:first').find('img').length>0) {
        $('#galleryLeft .content').html($('#galleryLeft a:first').find('img').attr('rel'))
	.animate({ opacity: 0.8 }, 400);
    }
	
	setInterval('gallery()',6000);
}

function gallery() {
	var current = ($('#galleryLeft a.show')?  $('#galleryLeft a.show') : $('#galleryLeft a:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#galleryLeft a:first') :current.next()) : $('#galleryLeft a:first'));	
	var caption = next.find('img').attr('rel');	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	$('#galleryLeft .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	$('#galleryLeft .caption').animate({opacity: 0.8},100 ).animate({height: '50px'},500 );
	$('#galleryLeft .content').html(caption);
}

//Right Portion of Banner Gallery
function slideShow2() {
	$('#galleryRight a').css({opacity: 0.0});
	$('#galleryRight a:first').css({opacity: 1.0});
	$('#galleryRight .caption').css({opacity: 0.8});
	$('#galleryRight .caption').css({ width: $('#galleryRight a').find('img').css('width') });

	if ($('#galleryRight a:first').find('img').length>0) {
        $('#galleryRight .content').html($('#galleryRight a:first').find('img').attr('rel'))
	.animate({ opacity: 0.8 }, 400);
    }
	
    
	setInterval('gallery2()',6000);
}
function gallery2() { 
	var current = ($('#galleryRight a.show')?  $('#galleryRight a.show') : $('#galleryRight a:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#galleryRight a:first') :current.next()) : $('#galleryRight a:first'));	
	var caption = next.find('img').attr('rel');	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 0);
	current.animate({opacity: 0.0}, 0)
	.removeClass('show');
	$('#galleryRight .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:0 });	
	$('#galleryRight .caption').animate({opacity: 0.8},0 ).animate({height: '50px'},0 );
	$('#galleryRight .content').html(caption);
}


