// JavaScript Document


			function bgdiapo() {

				var body = document.getElementsByTagName('body')[0];

				

				// CONFIGURATION

				body.diapoliste = [

					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image6.jpg',

					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image7.jpg',
					
					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image8.jpg',
					
					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image9.jpg',
					
					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image10.jpg',
					
					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image11.jpg',
					
					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image12.jpg',

					'http://www.ccvmr.com/lephare/wp-content/themes/lephare/images/background/image13.jpg' // ...

				];

				body.diapotemps = 25; // secondes entre les images

				body.diapofondu = 0,5; // secondes de fondu

				body.diapoopacitycoeff = 1; // entre 0 et 1, permet de limiter le niveau de visibilité des images

				// CONFIGURATION

				

				var bgdiv = function(ctn) {

					var d = document.createElement('div');

					d.grad = 0;

					d.style.position = 'absolute';

					d.style.width = '100%';

					d.style.zIndex = -100;

					d.style.top = 0;

					d.style.left = 0;

					d.style.backgroundColor = 'transparent';

					d.style.backgroundRepeat = 'no-repeat';

					d.style.backgroundAttachment = 'fixed';

					d.style.backgroundPosition = 'top center';

					d.style.filter = 'alpha(opacity=0)';

					d.style.opacity = 0;

					d.style.height = ctn.offsetHeight + 'px';

					ctn.appendChild(d);

					return d;

				}

				

				var divs = document.getElementsByTagName('div');

				body.bgdd = [];

				

				body.bgdd.push(bgdiv(body));

				body.bgdd.push(bgdiv(body));

				

				body.bgdi = Math.floor(body.diapoliste.length * Math.random());

				body.bgda = false;

				

				body.diapochanger = function() {

					this.bgda = !this.bgda;

					this.bgdd[this.bgda ? 1 : 0].style.backgroundImage = 'url(\'' + this.diapoliste[this.bgdi] + '\')';

					var body = this;

					// Le font actif apparait

					this.fnda = window.setInterval(

						function() {

							if(body.bgdd[body.bgda ? 1 : 0].grad >= 1) {

								window.clearInterval(body.fnda);

								return;

							}

							body.bgdd[body.bgda ? 1 : 0].grad += 0.01;

							body.bgdd[body.bgda ? 1 : 0].style.opacity = body.bgdd[body.bgda ? 1 : 0].grad * body.diapoopacitycoeff;

							body.bgdd[body.bgda ? 1 : 0].style.filter = 'alpha(opacity=' + (100 * body.bgdd[body.bgda ? 1 : 0].grad * body.diapoopacitycoeff) + ')';

						},

						10 * this.diapofondu

					);

					

					// Le font inactif disparait

					this.fndi = window.setInterval(

						function() {

							if(body.bgdd[body.bgda ? 0 : 1].grad <= 0) {

								window.clearInterval(body.fndi);

								return;

							}

							body.bgdd[body.bgda ? 0 : 1].grad -= 0.01;

							body.bgdd[body.bgda ? 0 : 1].style.opacity = body.bgdd[body.bgda ? 0 : 1].grad * body.diapoopacitycoeff;

							body.bgdd[body.bgda ? 0 : 1].style.filter = 'alpha(opacity=' + (100 * body.bgdd[body.bgda ? 0 : 1].grad * body.diapoopacitycoeff) + ')';

						},

						10 * this.diapofondu

					);

					

					var oi = this.bgdi;

					while(this.bgdi == oi) this.bgdi = Math.floor(this.diapoliste.length * Math.random());

					window.setTimeout(function(){body.diapochanger();}, this.diapotemps * 1000);

				}

				

				body.diapochanger();

			}
