var FroggGalerie = {
	nbPage : 1,
	pageActuelle : 0,
	init : function() {
		var nbImages = $('.uneImage').length;
		if(nbImages == 0) {
			$('#contenu').css('overflow','visible');
		}
		if (nbImages > 18) {
			this.pageActuelle = 0;
			this.nbPage = Math.ceil(nbImages / 18);
			this.masqueOuAfficheBouton();
		}
	},

	pageSuivante : function() {
//		alert($('#thePics').height());
//		alert($('#thePics').css('bottom'));
		if (this.pageActuelle + 1 < this.nbPage) {
			this.pageActuelle++;
			$('#thePics').stop(true,true);
			$('#thePics').animate( {
				'top' : (26-((117+26+5)*3)*this.pageActuelle)+'px'
			});
		}
		this.masqueOuAfficheBouton();
		return false;
	},
	pagePrecedente : function() {
//		alert($('#thePics').height());
//		alert($('#thePics').css('bottom'));
		if (this.pageActuelle > 0) {
			this.pageActuelle--;
			$('#thePics').stop(true,true);
			$('#thePics').animate( {
				'top' : (26-((117+26+5)*3)*this.pageActuelle)+'px'
			});
		}
		this.masqueOuAfficheBouton();
		return false;
	},
	masqueOuAfficheBouton : function() {
		if (this.nbPage > 1) {
			if (this.pageActuelle == this.nbPage-1) {
				$('#btNextPage').css('display', 'none');
			} else {
				$('#btNextPage').css('display', 'block');
			}

			if (this.pageActuelle > 0) {
				$('#btPrevPage').css('display', 'block');
			} else {
				$('#btPrevPage').css('display', 'none');
			}
		}
	}
};

var bool = false; 
var AolGalerie = {
		oldTaille : 455,
		init : function(){
			$('#btAgr').live('click',function(){
				AolGalerie.toggleOrdonnable();
			});
			$('#btAgr').css("display",($('.uneImage').length>18?"block":"none"));
		},
		toggleOrdonnable : function()
		{
			if(bool = !bool)
			{
				$('#btAgr').val('Reduire le contenu');
				//var nbPages = Math.ceil($('.uneImage').length / 18);
				$('#contenu').css('height','auto');
				$('#thePics').css('position','relative');
			}
			else
			{
				$('#btAgr').val('Agrandir le contenu');
				$('#thePics').css('position','absolute');
				$('#contenu').css('height',this.oldTaille+'px');
			}
		}
	};
