function facture(i){
	w=window.open("","fenetre","toolbar=no,resizable=yes,width=600,height=800,top=10,left=10");
	w.location.href="facture.php?id_paiement="+i;
}
function facture_client(i){
	w=window.open("","fenetre","toolbar=no,resizable=yes,width=600,height=800,top=10,left=10");
	w.location.href="facture_client.php?id_paiement="+i;
}
function payer(i){
	w=window.open("","fenetre","toolbar=no,resizable=yes,width=350,height=150,top=10,left=10");
	w.location.href="payer.php?id_paiement="+i;
}
function new_paiement(i){
	w=window.open("","fenetre","toolbar=no,resizable=yes,width=450,height=200,top=10,left=10");
	w.location.href="new_paiement.php?id_projet="+i;
}
function lexique(){
		z=window.open('alphabet.php','fenetre','toolbar=no,scrollbars=yes,width=750,height=500,top=10,left=10 resizable=yes');	
}
function sup_article(i){
reponse=confirm("La suppression est irréversible,\r Confirmez-vous cette action ?");
	if(reponse){
		z=window.open('../admin/sup_article.php?id_article='+i+'','fenetre','toolbar=no,scrollbars=no,width=200,height=100,top=10,left=10 resizable=yes');	
	}
}
function pay_cheque(){
	alert("Votre bon de commande est en cours d'édition et vous sera fournit au format PDF,\n merci de l'imprimer et de nous l'envoyer à l'adresse indiquée.");
	w=window.open("","fenetre","toolbar=no,resizable=yes,width=600,height=800,top=10,left=10");
	w.location.href="paiement_cheque.php?id_annonce="+document.form2.id_annonce.value+"&id_projet="+document.form2.id_projet.value+"&montant="+document.form2.montant.value;
}
function bandeau(s) {
	a = s.substring (1, s.length) + s.substring (0, 1);
    news.innerHTML= a;
    window.setTimeout ("bandeau('" + a + "')", 200);
}

function verif_ut(){
	if(document.form1.nom_ut.value==""){
		document.form1.nom_ut.focus();
		document.form1.nom_ut.style.background="red";
		document.form1.prenom_ut.style.background="";
		document.form1.mail_ut.style.background="";
		document.form1.tel.style.background="";
		alert("le nom est un champ obligatoire");
		return false;
	}
	if(document.form1.prenom_ut.value==""){
		document.form1.prenom_ut.focus();
		document.form1.nom_ut.style.background="";
		document.form1.prenom_ut.style.background="red";
		document.form1.mail_ut.style.background="";
		document.form1.tel.style.background="";;
		alert("le prénom est un champ obligatoire");
		return false;
	}
	if(document.form1.mail_ut.value==""){
		document.form1.mail_ut.focus();
		document.form1.nom_ut.style.background="";
		document.form1.prenom_ut.style.background="";
		document.form1.mail_ut.style.background="red";
		document.form1.tel.style.background="";
		alert("l'adresse mail est un champ obligatoire");
		return false;
	}
	if(document.form1.mail_ut.value.indexOf('@')==-1){
		document.form1.mail_ut.focus();
		document.form1.nom_ut.style.background="";
		document.form1.prenom_ut.style.background="";
		document.form1.mail_ut.style.background="red";
		document.form1.tel.style.background="";
		alert("l'adresse mail est invalide");
		return false;
	}
	if(document.form1.tel.value==""){
		document.form1.tel.focus();
		document.form1.nom_ut.style.background="";
		document.form1.prenom_ut.style.background="";
		document.form1.mail_ut.style.background="";
		document.form1.tel.style.background="red";
		alert("le numéro de téléphone est un champ obligatoire");
		return false;
	}

}
function preview(i){
	w=window.open("","fenetre","toolbar=no,scrollbars=yes,resizable=yes,width=800,height=500,top=10,left=10");
	w.location.href="../pages/article.php?id_article="+i;
}

function lire_article(i){
	w=window.open("","fenetre","toolbar=no,scrollbars=no,resizable=yes,width=800,height=500,top=10,left=10");
	w.location.href="article.php?id_article="+i;
}

function verif(){
	if(document.form1.titre.value==""){
		alert("le titre est un champ obligatoire");
		return false;			
	}
	if(document.form1.commentaire.value==""){
		alert("l'article est un champ obligatoire");
		return false;			
	}
}
function consulter_projet(i){
	w=window.open('consulter_projet.php?id_projet='+i+'','fenetre','toolbar=no,scrollbars=yes,width=680,height=600,top=10,left=10 resizable=yes');	
}
function consulter(i,j){
	w=window.open('','fenetre','toolbar=no,scrollbars=yes,width=680,height=600,top=10,left=10 resizable=yes');
	w.location.href="../client/"+j+"/"+i;	
}
function envoyer(i,j){
	w=window.open('envoyer.php?id_projet='+i+'&user='+j+'','fenetre','toolbar=no,scrollbars=yes,width=400,height=200,top=10,left=10 resizable=yes');	
}
function supprimer_document(i,j){
reponse=confirm("La suppression est irréversible,\r Confirmez-vous cette action ?");
	if(reponse){
		w=window.open('supprimer_document.php?document='+i+'&user='+j+'','fenetre','toolbar=no,scrollbars=yes,width=400,height=200,top=10,left=10 resizable=yes');	
	}
}

function montre(id) {
var d = document.getElementById(id);
	for (var i = 0; i<=30; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
function affiche_album(i){
	w=window.open('affiche_album.php?id_annonce='+i+'','fenetre','toolbar=no,scrollbars=yes,width=680,height=600,top=10,left=10 resizable=yes');	
}
function zoom(i){
	w=window.open('','fenetre','toolbar=no,scrollbars=no,resizable=yes,width=640,height=480,top=10,left=10');
	w.location.href="zoom.php?image="+i;
	body.style.filter="alpha(opacity=40)";
	body.style.opacity = 0.50;
	body.style.MozOpacity = 0.50;
	body.style.KhtmlOpacity = 0.50
}
function init(){
	body.style.filter="alpha(opacity=100)";
	body.style.opacity = 1;
	body.style.MozOpacity = 1;
	body.style.KhtmlOpacity = 1;
}
//effet sur image
function effet(i){
i.style.filter="alpha(opacity=50)";
i.style.opacity = 0.50;
i.style.MozOpacity = 0.50;
i.style.KhtmlOpacity = 0.50;
}
function sortie(i){
i.style.filter="alpha(opacity=100)";
i.style.opacity = 1;
i.style.MozOpacity = 1;
i.style.KhtmlOpacity = 1;
}
function supprimer2(i){
reponse=confirm("La suppression est irréversible,\r Confirmez-vous cette action ?");
if(reponse){
	w=window.open('../admin/sup_annonce.php?id_annonce='+i+'','fenetre','toolbar=no,scrollbars=no,width=300,height=150,top=10,left=10 resizable=no');	
}
}
function valider(i){
	w=window.open('valide_annonce.php?id_annonce='+i+'','fenetre','toolbar=no,scrollbars=no,width=300,height=150,top=10,left=10 resizable=no');	
}
function supprimer(i){
reponse=confirm("La suppression est irréversible,\r Confirmez-vous cette action ?");
if(reponse){
	w=window.open('sup_annonce.php?id_annonce='+i+'','fenetre','toolbar=no,scrollbars=no,width=300,height=150,top=10,left=10 resizable=no');	
}
}
function modif_annonce(i){
	w=window.open('../admin/modif_annonce.php?id_annonce='+i+'','fenetre','toolbar=no,scrollbars=yes,width=800,height=700,top=10,left=10 resizable=yes');	
}
function remember(i){
	if(i){
		w=window.open('pages/remember.php','fenetre','toolbar=no,scrollbars=no,resizable=no,top=10,left=10,height=170,width=450');
	}else{
		w=window.open('remember.php','fenetre','toolbar=no,scrollbars=no,resizable=no,top=10,left=10,height=170,width=450');
	}
}
function verif_inscription(){
	if(document.form1.nom.value==""){
		alert("le nom est un champ obligatoire");
		document.form1.nom.style.background="#CCFFFF";
		document.form1.nom.focus();
		return false;			
	}
	if(document.form1.prenom.value==""){
		alert("le prénom est un champ obligatoire");
		document.form1.prenom.style.background="#CCFFFF";
		document.form1.prenom.focus();
		return false;			
	}
	if(document.form1.adresse.value==""){
		alert("l'adresse est un champ obligatoire");
		document.form1.adresse.style.background="#CCFFFF";
		document.form1.adresse.focus();
		return false;
	}
	if(document.form1.ville.value==""){
		alert("la ville est un champ obligatoire");
		document.form1.ville.style.background="#CCFFFF";
		document.form1.ville.focus();
		return false;
	}
	if(document.form1.code_postal.value==""){
		alert("le code postal est un champ obligatoire");
		document.form1.code_postal.style.background="#CCFFFF";
		document.form1.code_postal.focus();
		return false;
	}
	if(isNaN(document.form1.code_postal.value)){
		alert("Le format du code_postal n'est pas valide");
		document.form1.code_postal.style.background="#CCFFFF";
		document.form1.code_postal.focus();
		return false;
	}
	if(document.form1.tel.value=="" && document.form1.tel_portable.value==""){
		alert("Il faut au moins un numéro de téléphone");
		document.form1.tel_portable.focus();
		return false;
	}
	if(isNaN(document.form1.tel.value)){
		alert("Le format du numéro de téléphone n'est pas valide");
		document.form1.tel.style.background="#CCFFFF";
		document.form1.tel.focus();
		return false;
	}
	if(isNaN(document.form1.tel_portable.value)){
		alert("Le format du numéro de téléphone n'est pas valide");
		document.form1.tel_portable.style.background="#CCFFFF";
		document.form1.tel_portable.focus();
		return false;
	}
	if(document.form1.mail.value!=document.form1.mail2.value){
		alert("Les deux adresses mails ne sont pas identiques");
		document.form1.mail.style.background="#CCFFFF";
		document.form1.mail2.style.background="#CCFFFF";
		document.form1.mail.focus();
	}
		if(document.form1.mail.value==""){
		document.form1.mail_ut.focus();
		document.form1.mail.style.background="#CCFFFF";
		alert("l'adresse mail est un champ obligatoire");
		return false;
	}
	if(document.form1.mail.value.indexOf('@')==-1){
		document.form1.mail_ut.focus();
		document.form1.mail.style.background="#CCFFFF";
		alert("l'adresse mail est invalide");
		return false;
	}	
	if(document.form1.cgv.checked==false){
		alert("l'acceptation des conditions générales de vente est obligatoire");
		return false;
	}
}
function cgu(){
	w=window.open("../pages/cgv.pdf","fenetre","toolbar=no,width=800,height=600,resizable=yes,scrollbars=yes,top=10,left=10");
}


function verif_etude(){
	if(document.form1.descriptif.value==""){
		alert("le descriptif est un champ obligatoire");
		document.form1.descriptif.style.background="#CCFFFF";
		document.form1.descriptif.focus();
		return false;
	}
	if(document.form1.mois.value==""){
		alert("le mois est un champ obligatoire");
		document.form1.mois.style.background="#CCFFFF";
		document.form1.mois.focus();
		return false;
	}
	if(isNaN(document.form1.mois.value)){
		alert("Le format du mois n'est pas valide");
		document.form1.mois.style.background="#CCFFFF";
		document.form1.mois.focus();
		return false;
	}
	if(document.form1.annee.value==""){
		alert("l'année est un champ obligatoire");
		document.form1.annee.style.background="#CCFFFF";
		document.form1.annee.focus();
		return false;
	}
	if(isNaN(document.form1.annee.value)){
		alert("Le format de l'année n'est pas valide");
		document.form1.annee.style.background="#CCFFFF";
		document.form1.annee.focus();
		return false;
	}

	if(d1-d2>0){
		alert("la Date de début d'activité ne peut être antérieure à la date d'aujourd'hui");
		document.form1.annee.style.background="#CCFFFF";
		document.form1.mois.style.background="#CCFFFF";
		document.form1.mois.focus();
		return false;
	}

	if(document.form1.adresse.value==""){
		alert("l'adresse est un champ obligatoire");
		document.form1.adresse.style.background="#CCFFFF";
		document.form1.adresse.focus();
		return false;
	}
	if(document.form1.ville.value==""){
		alert("la ville est un champ obligatoire");
		document.form1.ville.style.background="#CCFFFF";
		document.form1.ville.focus();
		return false;
	}
	if(document.form1.code_postal.value==""){
		alert("le code postal est un champ obligatoire");
		document.form1.code_postal.style.background="#CCFFFF";
		document.form1.code_postal.focus();
		return false;
	}
	if(isNaN(document.form1.code_postal.value)){
		alert("Le format du code_postal n'est pas valide");
		document.form1.code_postal.style.background="#CCFFFF";
		document.form1.code_postal.focus();
		return false;
	}
	if(document.form1.surface.value==""){
		alert("la surface est un champ obligatoire");
		document.form1.surface.style.background="#CCFFFF";
		document.form1.surface.focus();
		return false;
	}
	if(isNaN(document.form1.surface.value)){
		alert("Le format de la surface n'est pas valide");
		document.form1.surface.style.background="#CCFFFF";
		document.form1.surface.focus();
		return false;
	}
	if(isNaN(document.form1.nbre_salaries.value)){
		alert("Le format du nombre de salariés n'est pas valide");
		document.form1.nbre_salaries.style.background="#CCFFFF";
		document.form1.nbre_salaries.focus();
		return false;
	}
	if(document.form1.nbre_salaries.value==""){
		alert("le nombre de salariés est un champ obligatoire");
		document.form1.nbre_salaries.style.background="#CCFFFF";
		document.form1.nbre_salaries.focus();
		return false;
	}
	if(document.form1.secteur.value==0){
		alert("le secteur d'activité est un champ obligatoire");
		document.form1.secteur.style.background="#CCFFFF";
		document.form1.secteur.focus();
		return false;
	}
}

function init2(){
hauteur=document.all.def.offsetHeight;
h=0;
loop=true;
}

function defile(){
	if(Math.abs(h)<hauteur){
		h-=2;
	}else{
		h=0;
	}
	if(loop==true){
	document.all.def.style.top=h;
	}
	setTimeout("defile()",100);
}
function stop(){
loop=false;
}
function go(){
loop=true;
}
function ouvrir(){
	w=window.open("","fenetre","toolbar=no,scrollbars=no,resizable=yes,width=700,height=280,top=10,left=10");
	w.location.href="presentation.php";
}
function navigation()
{
        if(document.f.url.value!="Vide");
	{
		document.location.href=document.f.url.value;
	}
}

function montrer(i){
	info.innerHTML="<img src='images/"+i+".png'>";
	info.style.left=event.x+document.body.scrollLeft-150;
	info.style.top=event.y+document.body.scrollTop;
	info.style.visibility="visible";
}
function cacher(){
info.style.visibility="hidden";
}
function verif_user(){
	if(document.form1.nom_user.value==""){
		document.form1.nom_user.focus();
		document.form1.nom_user.style.background="red";
		document.form1.prenom_user.style.background="";
		document.form1.mail_user.style.background="";
		document.form1.tel.style.background="";
		alert("le nom est un champ obligatoire");
		return false;
	}
	if(document.form1.prenom_user.value==""){
		document.form1.prenom_user.focus();
		document.form1.nom_user.style.background="";
		document.form1.prenom_user.style.background="red";
		document.form1.mail_user.style.background="";
		document.form1.tel.style.background="";;
		alert("le prénom est un champ obligatoire");
		return false;
	}
	if(document.form1.mail_user.value==""){
		document.form1.mail_user.focus();
		document.form1.nom_user.style.background="";
		document.form1.prenom_user.style.background="";
		document.form1.mail_us.style.background="red";
		document.form1.tel.style.background="";
		alert("l'adresse mail est un champ obligatoire");
		return false;
	}
	if(document.form1.mail_user.value.indexOf('@')==-1){
		document.form1.mail_user.focus();
		document.form1.nom_user.style.background="";
		document.form1.prenom_user.style.background="";
		document.form1.mail_user.style.background="red";
		document.form1.tel.style.background="";
		alert("l'adresse mail est invalide");
		return false;
	}
	if(document.form1.tel.value==""){
		document.form1.tel.focus();
		document.form1.nom_user.style.background="";
		document.form1.prenom_user.style.background="";
		document.form1.mail_user.style.background="";
		document.form1.tel.style.background="red";
		alert("le numéro de téléphone est un champ obligatoire");
		return false;
	}

}
