
function makeActiveThumb(element){
	$('.thumbnail-strip .thumb').removeClass('current');
	element.addClass('current');
	element.removeClass('hover');
}

function showArmyGallery(){
	$('#gallery-both').css('display','none');
	$('#both-strip').css('display','none');
	
	$('#gallery-navy').css('display','none');
	$('#navy-strip').css('display','none');
	
	$('#army-strip').css('display','block');
	$('#gallery-army').css('display','block');
	$('#gallery-army').jCarouselLite({
        btnNext: '.next',
        btnPrev: '.prev',
        start:0,
        visible: 1,
        btnGo:['#army01-thumb','#army02-thumb','#army03-thumb','#army04-thumb','#army05-thumb','#army06-thumb','#army07-thumb','#army08-thumb','#army09-thumb','#army10-thumb'],
        afterEnd: function(item) {
			$('#photo-title').html(item.children(":first").attr('alt'));
		}
    });
}

function showBothGallery(){
	$('#gallery-army').css('display','none');
	$('#army-strip').css('display','none');
	
	$('#gallery-navy').css('display','none');
	$('#navy-strip').css('display','none');
	
	$('#both-strip').css('display','block');
	$('#gallery-both').css('display','block');
	
	$('#gallery-both').jCarouselLite({
		btnNext: '.next',
        btnPrev: '.prev',
        start: 0,
        visible: 1,
        btnGo:['#both01-thumb','#both02-thumb','#both03-thumb','#both04-thumb','#both05-thumb','#both07-thumb','#both08-thumb','#both09-thumb','#both10-thumb','#both11-thumb','#both12-thumb'],
        afterEnd: function(item) {
			$('#photo-title').html(item.children(":first").attr('alt'));
		}
    });
	$('#gallery-both').css('height','277px');
	$('#gallery-both').css('width','416px');
}

function showNavyGallery(){
	$('#gallery-army').css('display','none');
	$('#army-strip').css('display','none');
	
	$('#gallery-both').css('display','none');
	$('#both-strip').css('display','none');
	
	$('#navy-strip').css('display','block');
	$('#gallery-navy').css('display','block');
	$('#gallery-navy').jCarouselLite({
		btnNext: '.next',
        btnPrev: '.prev',
        start: 0,
        visible: 1,
        btnGo:['#navy01-thumb','#navy02-thumb','#navy03-thumb','#navy04-thumb','#navy05-thumb','#navy06-thumb','#navy07-thumb','#navy08-thumb'],
        afterEnd: function(item) {
			$('#photo-title').html(item.children(":first").attr('alt'));
		}
    });
}

$('document').ready(function(){
	
	$('#photo-filter').bind('change',function(e){
		if($(this).val() == 'army'){
			showArmyGallery();
		}else if($(this).val() == 'navy'){
			showNavyGallery();
		}else{
			showBothGallery();
		}
	});
	
	/****************************
	 * Photo Gallery Thumbstrip *
	 ****************************/
	$('.thumbnail-strip .thumb').bind('click',function(e){
		makeActiveThumb($(this));
	});
	
	$('.thumbnail-strip .thumb').bind('mouseenter',function(e){
		if($(this).hasClass('current') == false){
			$(this).addClass('hover');
		}
	});
	
	$('.thumbnail-strip .thumb').bind('mouseleave',function(e){
		if($(this).hasClass('current') == false){
			$(this).removeClass('hover');
		}
	});
	
});