function verifmail(email){
	var erreur = 0;
	var arob,ptmail;
	arob = email.value.indexOf('@');
	if(arob < 2){
		erreur = 1;
	}
	else{
	ptmail = email.value.indexOf('.', arob+1);
		if(ptmail < arob+2){
			erreur = 1;
		}
		else if(email.value.length < ptmail+3){
		erreur = 1;
		}
	}
	if(erreur == 1){
		return false;
	}
	else{
		return true;
	}
}

function ValidDeconnexion() {
if(confirm("you have a selection in progress, are you sure to quit ?")) {
		document.location="/login/deconnexion.asp";	
	}
}

function ValidInscription() {
	var Message = "";
	if (document.FormInscription.nom.value=="") {
		Message += "- Last name\n";
	}
	if (document.FormInscription.prenom.value=="") {
		Message += "- First name\n";
	}
	if (document.FormInscription.societe.value=="") {
		Message += "- Company\n";
	}
	if (document.FormInscription.fonction.value=="") {
		Message += "- Title\n";
	}
	if (document.FormInscription.adresse1.value=="") {
		Message += "- Address\n";
	}
	if (document.FormInscription.cp.value=="") {
		Message += "- Zip code\n";
	}
	if (document.FormInscription.ville.value=="") {
		Message += "- City\n";
	}
	if (document.FormInscription.telephone.value=="") {
		Message += "- Phone number\n";
	}
	if(verifmail(document.FormInscription.email) == false) {
		Message += "- Email\n ";
	}
	if(document.FormInscription.password.value.length<6) {
		Message += "- Password (6 characters minimum)\n ";
	}
	if (Message != ""){
		alert("The following information is required :\n" + Message);
		return false;
	}else {
		document.FormInscription.action="/login/submit_inscription.asp";
		return true;
	  }
}

function ValidRecuperation() {
	var Message = "";
	if(verifmail(document.FormRecuperation.email) == false) {
		Message += "-  email\n ";
	}
	if (Message != ""){
		alert("the following information is required :\n" + Message);
	}else {
		document.FormRecuperation.action="/login/submit_recuperation.asp";
		document.FormRecuperation.submit();
	  }
}

function ValidLogin() {
	var Message = "";
	if (document.FormLogin.password.value=="") {
		Message += "- password\n";
	}
	if(verifmail(document.FormLogin.email) == false) {
		Message += "- email\n ";
	}
	if (Message != ""){
		alert("the following information is required :\n" + Message);
	}else {
		document.FormLogin.action="/login/login.asp";
		document.FormLogin.submit();
	  }
}

function AddPhoto() {
	//alert("la photo a été ajoutée à votre sélection");
}

function AddReportage() {
	//alert("le reportage a été ajouté à votre sélection");
}

function validctc() {
	if (document.Fctc.nom.value.length < 1)
		{alert("Last Name required");
                document.Fctc.nom.focus()}

	else if (document.Fctc.prenom.value.length < 1)
		{alert("First Name required");
			 document.Fctc.prenom.focus()}
				  					  				  
	else if (document.Fctc.email.value.length < 1)
		{alert("email required");
			 document.Fctc.email.focus()}
			 
	else if (document.Fctc.message.value.length < 10)
		{alert("message required");
			 document.Fctc.message.focus()}
	  
	else document.Fctc.submit();
}

function UpdateSearchPhotoHP() {
	document.FormPhoto.action="default.asp";
	document.FormPhoto.submit();
}

function UpdateSearchPhoto() {
	document.FormPhoto.action="phototheque.asp";
	document.FormPhoto.submit();
}

function ValidSearchPhoto() {
	document.FormPhoto.action="liste_photos.asp";
	document.FormPhoto.submit();
}
