$(function() {
	$('ul.liste li a').click(function() {
		$("#photo_container").attr("src", this.href)
		$("ul.liste a").removeClass("hover")
		$(this).addClass("hover")
		return false;
	})
})
var gallery= {
	moveWidth:21,
	pos:0,
	move_right:function(){
		this.pos++
		this.move();
	},
	move_left:function(){
		this.pos--
		this.move();
	},
	move_begin:function() {
		this.pos = 0
		this.move();
	},
	move_end:function() {
		this.pos = 999
		this.move();
	},
	moveToId:function(id) {
		$("ul.liste a").removeClass("hover")
		$('ul.liste li a#gallery_'+id).addClass("hover")
		$("#photo_container").attr("src", $('ul.liste li a#gallery_'+id).attr("href"))
	},
	move:function() {
		var img_count = $('ul.liste li').length - 16;
		this.pos = Math.min(img_count, this.pos)
		this.pos = Math.max(0, this.pos)
		$("div#nav_photo ul.liste").animate({left:"-"+(this.pos*this.moveWidth)+"px"}, 500 );	
	}
}
function viderChamp(champAVider, valeurDefaut){
	if(document.getElementById(champAVider).value == valeurDefaut) {
		document.getElementById(champAVider).value = "";
	}
}
function remplirChamp(champARemplir, valeurDefaut){
	if(document.getElementById(champARemplir).value == "") {
		document.getElementById(champARemplir).value = valeurDefaut;
	}
}

