


function popup_gant() {
	$('valider_gant').href = 'gant.php?nr='+$('nr_gant').value;
	popup = new lightbox($('valider_gant'));
	popup.activate();
}

function valider_form_gant() {
	if ($('nom').value == '' || $('prenom').value == '' || $('tel').value == '' || $('email').value == '') {
		alert("ERREUR : Tous les champs sont obligatoires.");
		return false;
	} else if ($('has_gant').checked == false) {
		alert("ERREUR : Vous devez certifier disposer du gant.");
		return false;
	} else {
		return true;
	}
}

function valider_form_contact() {
	if ($('nom').value == '' || $('prenom').value == '' || $('tel').value == '' || $('email').value == '' || $('message').value == '') {
		alert("ERREUR : Tous les champs sont obligatoires.");
		return false;
	} else {
		return true;
	}
}

function position() {
	if (window.innerWidth) {
		winHeight = window.innerHeight;
		winWidth = window.innerWidth;
	} else if (document.documentElement.offsetWidth) {
		winHeight = document.documentElement.offsetHeight;
		winWidth = document.documentElement.offsetWidth;
	} else if (document.body.offsetWidth) {
		winHeight = document.body.offsetHeight;
		winWidth = document.body.offsetWidth;
	} else {
		winHeight = 65535;
		winWidth = 65535;
	}
	if(winHeight < 710) {
		$('container').style.top = 0;
		$('container').style.marginTop = 0;
	} else {
		$('container').style.top = '50%';
		$('container').style.marginTop = '-355px';
	}
	if(winWidth < 950) {
		$('container').style.left = 0;
		$('container').style.marginLeft = 0;
	} else {
		$('container').style.left = '50%';
		$('container').style.marginLeft = '-475px';
	}
}

function closePopup() {
	if (window.top.lightbox) window.top.lightbox.prototype.deactivate();
	else window.location = 'http://www.servicesattitude.fr/';
}

Event.observe(window, 'load', function () {
	if ($('cahri')) {
		$('cahri').innerHTML = '<img src="images/cahri.gif" alt="Cahri" />';
		$('cahri').style.display = 'inline';
	}
	if($('container') != undefined) {
		position();
		Event.observe(window, 'resize', position, false);
	}
}, false);