var fenetre = null;

function choisirPhoto(nomchamp, id_photo, id_offre) {
   if (fenetre && !fenetre.closed) fenetre.close();
   
   fenetre = window.open("choix_photo.php?id_off=" + id_offre + "&id_photo=" + id_photo , "fenPhoto", "width=400,height=200,resizable=1");
   if (!fenetre.opener) fenetre.opener = self;
}

function confirmer_supp(text){
	var choix;
	choix = confirm('Voulez vous vraiment supprimer le projet :'+ text +' ?');
	if (choix == true) { return true; }
    else { return false; }
}

function confirmer_maj(nomform){
	var choix;
	choix = confirm('Voulez vous vraiment mettre à jour le projet?');
	if (choix == true) { document.forms[nomform].submit(); }
    else { return false; }
}

function confirmer_aj(nomform){
	var choix;
	choix = confirm('Voulez vous vraiment ajouter le projet ?');
	if (choix == true) { document.forms[nomform].submit(); }
    //else { return false; }
}

function exec_form(nomform){
	document.forms[nomform].submit();
}

var fenetre = null;
function popup_choixPhoto(id_projet, id_photo){

   if (fenetre && !fenetre.closed) fenetre.close();
   fenetre = window.open("choix_photo.php?ID_PR=" + id_projet + "&ID_PH=" + id_photo , "fenPhoto", "width=400,height=200,resizable=1");
   if (!fenetre.opener) fenetre.opener = self;
}

function popup_affichePhoto(id_projet, id_photo){

   if (fenetre && !fenetre.closed) fenetre.close();
   fenetre = window.open("popup_affichePhoto.php?ID_PR=" + id_projet + "&ID_PH=" + id_photo , "fenPhoto", "width=820,height=650,resizable=1");
   if (!fenetre.opener) fenetre.opener = self;
}

function choix_statut(nomform){
	var ObjChantierSelect;
	var ObjStatutSelect;
	ObjChantierSelect = document.forms[nomform].chantier;
	ObjStatutSelect = document.forms[nomform].statu;
	if(ObjStatutSelect.options[ObjStatutSelect.selectedIndex].value==1) ObjChantierSelect.disabled=false;
	if(ObjStatutSelect.options[ObjStatutSelect.selectedIndex].value==2) { ObjChantierSelect.selectedIndex=0; ObjChantierSelect.disabled=true;	}
}
