// JavaScript Document

function validerFormContact() {
		var msg = "";
		var ok = 0;
		
		if (document.forms['contact'].nom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre nom.\n";
		}
		if (document.forms['contact'].prenom.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre prénom.\n";
		}
		if (document.forms['contact'].add.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre adresse.\n";
		}
		if (document.forms['contact'].cp.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre code postal.\n";
		}
		if (document.forms['contact'].ville.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre ville.\n";
		}
		if (document.forms['contact'].tel.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre téléphone.\n";
		}
		if (document.forms['contact'].email.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre email.\n";
		}
		if (document.forms['contact'].message.value == "") {
			ok = 1;
			msg += "Vous n'avez pas saisi votre message.\n";
		}
						
		if (ok == 1) {
			alert(msg);
			return true;
		}
		else {
			document.forms['contact'].submit();
		}
}

/* FONCTIONS DEROULEMENT DES ONGLETS OU NOUS TROUVER  */
	
var i = new Array();
i[1] ="false";
i[2] ="false";
i[3] ="false";
/* fonction globale */
function deroule2(a, b) {
	nom = 'para'+a;
	if (i[a] == "false") {
		timer = 1;
		speed = 0.8;
		for (j=0; j<100; j++) {
			window.setTimeout("augmente(nom)", timer/speed);
			timer ++;
		}
		b.style.background = "url(../images/puce-liste-noirb.gif)";
		b.style.backgroundRepeat = 'no-repeat';
		b.style.backgroundPosition = '-2px 0px';
		i[a] = "true";
	} else {
		for (k=0; k<100; k++) {
			window.setTimeout("reduit(nom)",timer/speed);
			timer ++;
		}
		b.style.background = "url(../images/puce-liste-noir.gif)";
		b.style.backgroundRepeat = 'no-repeat';
		b.style.backgroundPosition = 'top left';
		i[a] = "false";
	}
}

/* ouvrir l'onglet */
function augmente(a) {
	var hauteur = document.getElementById(nom).offsetHeight;
	hauteur ++;
	document.getElementById(nom).style.height = hauteur + 'px';
}
/* fermer l'onglet */
function reduit(a) {
	var hauteur = document.getElementById(nom).offsetHeight;
	hauteur --;
	document.getElementById(nom).style.height = hauteur + 'px';
}

function affiche(a, b) {
	document.getElementById('dispo-'+a).style.display = 'block';
	document.getElementById('lien'+a).className = 'actif';
	for(k=0; k<b; k++){
		if (k != a) {
			document.getElementById('dispo-'+k).style.display = 'none';
			document.getElementById('lien'+k).className = '';
		}
	}
	
}




//caroussel

// wait until document is fully scriptable
$(document).ready(function() {

	// select #flowplanes and make it scrollable. use circular and navigator plugins
	$("#flowpanes").scrollable({ vertical:true, circular: true, mousewheel: true }).autoscroll(7000).navigator({

		// select #flowtabs to be used as navigator
		navi: "#flowtabs",

		// select A tags inside the navigator to work as items (not direct children)
		naviItem: 'a',

		// assign "current" class name for the active A tag inside navigator
		activeClass: 'current',

		// make browser's back button work
		history: true

	});
});
