//fonction de vérification de l'email et des champs page contact.
function verif(email) 
{
	var arobase = email.indexOf("@")
	var point = email.lastIndexOf(".")
	if (document.contact.sender_name.value=="" || document.contact.sender_surname.value=="" || document.contact.message.value=="")
		{
			alert("Veuillez remplir tous les champs marqués d'une étoile");
			return false;
		}
	else 
	{ 
		if((arobase < 2)||(point + 2 > email.length)||(point < arobase+2)) 
		{ 
		alert("Cet Email est erroné !");
		return false; 
		}
		else
		{
			return true;
		}
	}
}
//fonction de vérification de la mailing liste.
function verifmailing(email) {
	var arobase = email.indexOf("@");
	var point = email.lastIndexOf(".");
	if((arobase < 2)||(point + 2 > email.length)||(point < arobase+2)) 
	{
		alert('Email Incorrect !');
		return false;
	}
	else
	{
		return true;
	}
}

// fonction pour agrandir les photos
function affichemaxi(chemin,popup_height,popup_width,titre)
{
	if (!titre) titre="Agrandissement photo";
	var html = '<HTML><HEAD><TITLE>'+titre+'</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><IMG SRC="'+chemin+'") onclick="window.close()" style="cursor:pointer"></BODY></HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,height='+popup_height+',width='+popup_width );
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close();
}

// Fonction qui ouvre une popup
function ouvre_popup(page,taille)
{
	window.open(page,'info','top=200,left=200,' + taille + ',resizable=no,scrollbars=yes,fullscreen=no');
}

function addFav()
{
	if (document.all)
	{
		window.external.AddFavorite(location.href, document.title);
	}
	else
	{
		alert('Vous pouvez faire CTRL + D pour ajouter cette page dans vos signets, ou favoris.')
	}
}

<!-- fonction pour verif moteur de recherche
function verif_moteur()
{
	if (document.moteurrecherche.moteur_recherche.value=="")
	{
		alert("Veuillez préciser votre recherche");
		return false;
	}
	else
	{
		return true;
	}
}

<!-- Fonction de vérification formulaire
function verif_devis(email)
{
	var arobase = email.indexOf("@")
	var point = email.lastIndexOf(".")
	if((arobase < 2)||(point + 2 > email.length)||(point < arobase+2)) 
	{ 
		alert("Cet Email est erroné !");
		return false; 
	}
	else 
	{ 
		if (document.devis.nom.value=="" || document.devis.prenom.value=="" || document.devis.adresse.value=="" || document.devis.ville.value=="" || document.devis.cp.value=="")
		{
			alert("Veuillez remplir tous les champs marqués d'une étoile");
			return false;
		}
		else
		{
			return true;
		}
	}
}



function lightbox_video(video, largeur, hauteur)
{
	
	var objBody = document.getElementsByTagName("body").item(0);
	
	// create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
	var objOverlay = document.createElement("div");
	objOverlay.setAttribute('id','overlay');
	objOverlay.onclick = function () {hideLightboxvideo(); return false;}
	objOverlay.style.display = 'none';
	objOverlay.style.position = 'absolute';
	objOverlay.style.top = '0';
	objOverlay.style.left = '0';
	objOverlay.style.zIndex = '90';
 	objOverlay.style.width = '100%';
	objBody.insertBefore(objOverlay, objBody.firstChild);
	
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();

	// preload and create loader image
	var imgPreloader = new Image();
	
	imgPreloader.src = loadingImage;

	// create lightbox div, same note about styles as above
	var objLightbox = document.createElement("div");
	objLightbox.setAttribute('id','lightbox');
	objLightbox.style.display = 'none';
	objLightbox.style.position = 'absolute';
	objLightbox.style.zIndex = '100';	
	objBody.insertBefore(objLightbox, objOverlay.nextSibling);
	


	var objDiv = document.createElement("object");
	objDiv.setAttribute('width', largeur);
	objDiv.setAttribute('height', hauteur);
	
	var objDiv2 = document.createElement("param");
	objDiv2.setAttribute('name', 'movie');
	objDiv2.setAttribute('value', video);
	objDiv.appendChild(objDiv2);
	
	var objDiv3 = document.createElement("param");
	objDiv3.setAttribute('name', 'quality');
	objDiv3.setAttribute('value', 'high');
	objDiv.appendChild(objDiv3);
	
	var objDiv5 = document.createElement("param");
	objDiv5.setAttribute('name', 'wmode');
	objDiv5.setAttribute('value', 'transparent');
	objDiv.appendChild(objDiv5);
	
	var objDiv4 = document.createElement("embed");
	objDiv4.setAttribute('src', video);
	objDiv4.setAttribute('quality', 'high');
	objDiv4.setAttribute('width', largeur);
	objDiv4.setAttribute('height', hauteur);
	objLightbox.appendChild(objDiv4);
			
	//objLightbox.appendChild(objDiv);	
	
		// create details div, a container for the caption and keyboard message
	var objLightboxDetails = document.createElement("div");
	objLightboxDetails.setAttribute('id','lightboxDetails');
	objLightbox.appendChild(objLightboxDetails);

	
		// create caption
	var objCaption = document.createElement("div");
	objCaption.setAttribute('id','lightboxCaption');
	objCaption.style.display = 'none';
	objLightboxDetails.appendChild(objCaption);

	
	// create keyboard message
	var objKeyboardMsg = document.createElement("div");
	objKeyboardMsg.setAttribute('id','keyboardMsg');
	objKeyboardMsg.innerHTML = '<a href="#" onclick="hideLightboxvideo(); return false;">Cliquez ici pour fermer</a>';
	objLightboxDetails.appendChild(objKeyboardMsg);
	
	
	showLightboxvideo(largeur, hauteur);	
}



function showLightboxvideo(largeur, hauteur)
{
	// prep objects
	var objOverlay = document.getElementById('overlay');
	var objLightbox = document.getElementById('lightbox');
	var objCaption = document.getElementById('lightboxCaption');
	var objImage = document.getElementById('lightboxImage');
	var objLoadingImage = document.getElementById('loadingImage');
	var objLightboxDetails = document.getElementById('lightboxDetails');

	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - hauteur) / 2);
	var lightboxLeft = (arrayPageSize[0] - 20 - largeur) / 2;
	
	objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
	objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
		
		
	objLightbox.style.display = "block";
	objOverlay.style.display = "block";
	arrayPageSize = getPageSize();
	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objCaption.style.display = "block";
	
	// set height of Overlay to take up whole page and show
	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objOverlay.style.display = 'block';
		
	objLightboxDetails.style.display = "block";	
	objLightboxDetails.style.width = largeur + 'px';
		
	// Hide select boxes as they will 'peek' through the image in IE
	selects = document.getElementsByTagName("select");
    for (i = 0; i != selects.length; i++) {
        selects[i].style.visibility = "hidden";
    }	
	

	
}



//
// hideLightbox()
//
function hideLightboxvideo()
{
	// get objects
	objOverlay = document.getElementById('overlay');

	objLightbox = document.getElementById('lightbox');

	// hide lightbox and overlay
	objOverlay.style.display = 'none';
	objLightbox.style.display = 'none';
	objLightbox.innerHTML="";

	// make select boxes visible
	selects = document.getElementsByTagName("select");
    for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}

	// disable keypress listener
	document.onkeypress = '';
}
