﻿function openImage (img) { 	 	 	theurl = "openImage.php?img=" + img; 	thename = "OpenImage"; 	thefeatures = 'scrollbars=0,width=300,height=300,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  }   function openCP () { 	 	 	theurl = "presse.php"; 	thename = "OpenCPresse"; 	thefeatures = 'scrollbars=1,width=550,height=400,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  }  function openNews () { 	 	 	theurl = "newsletter.php"; 	thename = "OpenN"; 	thefeatures = 'scrollbars=1,width=550,height=400,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  }  function openInfoL () { 	 	 	theurl = "infoslegales.php"; 	thename = "OpenIL"; 	thefeatures = 'scrollbars=1,width=550,height=400,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  }  function openBioJC () { 	 	 	theurl = "bio_canetti.php"; 	thename = "OpenBIJC"; 	thefeatures = 'scrollbars=1,width=550,height=400,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  }   function openCGV () { 	 	 	theurl = "infoscgv.php"; 	thename = "openCGV"; 	thefeatures = 'scrollbars=1,width=650,height=400,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  } function openArtiste () { 	 	 	theurl = "artiste.php"; 	thename = "Openart"; 	thefeatures = 'scrollbars=1,width=550,height=400,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures);	  } // recharge une page apres select form liste function load_actu(url, ancre, varname) { 	 	i = document.leform.id_actu.selectedIndex; 	id = document.leform.id_actu.options[i].value; 	 	document.location.href = url+"&"+varname+"="+id+ancre; }  function load_rencontre(url, ancre, varname) { 	 	i = document.leform2.id_rencontre.selectedIndex; 	id = document.leform2.id_rencontre.options[i].value; 	 	document.location.href = url+"&"+varname+"="+id+ancre; }  function del_prod(id_prod) { 	 	var del = false; 	del = self.confirm('Dernier avertissement avant supression'); 	if (del) 		document.location.href = "panier_del.php?id_prod="+id_prod; }  function load_page() { 	 	i = document.leform.label.selectedIndex; 	id = document.leform.label.options[i].value; 	if (i != 0) 		document.location.href = id; }  function openBio (id_bio) { 	 	theurl = "bio_detail.php?id_bio=" + id_bio; 	thename = "bio"; 	thefeatures = 'scrollbars=1,width=550,height=470,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures); }   function HelpPage() { 	 	theurl = "aide.php"; 	thename = "helppage"; 	thefeatures = 'scrollbars=1,width=560,height=450,toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures); }   function imprime() { 	if (window.print)     	window.print();     else     	alert('Votre navigateur ne supporte pas cette fonction\rUtilisez le bouton \'Imprimer\' du menu \'Fichier\' de votre navigateur.'); }   function RollOnTop(imageName) { 	 	document.images[imageName].src = "images/top_on.gif"; 	 }  function RollOutTop(imageName) { 	 	document.images[imageName].src = "images/top_off.gif"; 	 }  function RollOn(imageName, src_on) { 	 	document.images[imageName].src = "images/"+src_on; 	 }  function RollOut(imageName, src_off) { 	 	document.images[imageName].src = "images/"+src_off; 	 }      // open window pour modifier cat et sous-cat lors de l'ajout d'un user function openWin (theurl, width, height, parent) { 	 	openwin = true; 	 	// recup id_rub si theurl == user_cat_modify.php 	 	if (theurl == "user_cat_modify.php" &&  parent == 0) { 		 		i = document.leform.id_cat.selectedIndex; 		id_cat = document.leform.id_cat.options[i].value; 		 		theurl = theurl+"?id_cat="+id_cat; 		//alert(theurl); 	 	} else if (theurl == "user_cat_modify.php" &&  parent == 1) { 		 		i = document.leform.id_scat.selectedIndex; 		 		if (i == 0) 			openwin = false; 		 		id_scat = document.leform.id_scat.options[i].value; 		 		theurl = theurl+"?id_cat="+id_scat; 		//alert(theurl); 	 	} else if (theurl == "user_cat_add.php" && parent == 1) { 		 		i = document.leform.id_cat.selectedIndex; 		id_parent = document.leform.id_cat.options[i].value; 		 		theurl = theurl+"?id_parent="+id_parent; 		 	} 	 	thename = "page"; 	thefeatures = 'scrollbars=1,width='+width+',height='+height+',toolbar=no,location=no,status=yes,menubar=no,resizable=yes'; 	 	if (openwin) 		window.open(theurl,thename,thefeatures); }    function loadPays () { 	 	i = document.leform.id_nationalite.selectedIndex; 	y = document.leform.id_pays.selectedIndex; 	if (y == 0) 		document.leform.id_pays.selectedIndex = i; 	 }   function ConfirmAndGo (page, intitule) { 	 	var del = false; 	del = self.confirm('Dernier avertissement avant supression '+intitule); 	if (del) 		document.location.href = page; }              function focusWin() { 	window.focus(); }  function printFormat(page_format) { 	 	if (page_format == "paysage") { 		window.resizeTo (900, 550); 		document.images.print_format.src = "../images/print_paysage.gif"; 	} else { 		window.resizeTo (645, 670); 		document.images.print_format.src = "../images/print_portrait.gif"; 	} }   function Trash (page, intitule) { 	 	var del = false; 	del = self.confirm('Dernier avertissement avant supression '+intitule); 	if (del) 		document.location.href = page; }    function coche() { 	var nb_element = document.forms[2].length; 	for (i = 0; i < nb_element; i++) { 		if (document.forms[2].elements[i].type == "checkbox") 			document.forms[2].elements[i].checked = true; 	} } 	 function decoche() { 	var nb_element = document.forms[2].length; 	for (i = 0; i < nb_element; i++) { 		if (document.forms[2].elements[i].type == "checkbox") 			document.forms[2].elements[i].checked = false; 	} }  function openClient(theurl) { 	 	thename = "modifysociete"; 	thefeatures = 'scrollbars=0,width=420,height=500,toolbar=no,location=no,status=no,menubar=no,resizable=yes'; 	window.open(theurl,thename,thefeatures); }   function showTTC(affiche) { 	 	// si affiche = 1, alors alert 	// sinon, simple return 	 	ht = document.leform.ht_facture.value; 	 	// remplace virgule par point ds montant ht 	out = ","; // replace this 	add = "."; // with this 	temp = "" + ht; // temporary holder 	 	while (temp.indexOf(out)>-1) { 		pos= temp.indexOf(out); 		temp = "" + (temp.substring(0, pos) + add +  		temp.substring((pos + out.length), temp.length)); 	} 	 	document.leform.ht_facture.value = temp; 	ht = temp; 	 	ht = ht * 2; 	ht = ht /2; 	 	tva = ht*0.196; 	// calcule de la TVA 	ttc = ht + ht*0.196; 	 	// concversion de ttc en string pour formatage decimale 	ttc = ttc.toString(); 	//alert(ttc); 	 	// formatage des decimales + 2 apres la virgule 	dot_pos = ttc.indexOf("."); 	 	if (dot_pos != -1) 		ttc = ttc.substring (0, dot_pos+3) 	 	if (affiche == 1) 		alert ("\nMontant HT : "+ht+" euro(s)\n\nMontant TVA : "+tva+" euro(s)\n\nMontant TTC : "+ttc+" euro(s)\n"); 	else 		return ttc; }  function calculeSolde() { 	 	ttc = parseFloat(showTTC(0)); 	ttc = ttc/2; 	ttc = ttc*2; 	 	//alert(ttc); 	 	acpte1 = document.leform.acompte1_facture.value; 	acpte2 = document.leform.acompte2_facture.value; 	 	if (acpte1.length > 0) 		acpte1 = parseFloat(document.leform.acompte1_facture.value); 	else 		acpte1 = 0; 	 	if (acpte2.length > 0) 		acpte2 = parseFloat(document.leform.acompte2_facture.value); 	else 		acpte2 = 0; 	 	total_acpte = acpte1+acpte2;  	 	//alert(total_acpte); 	 	solde = ttc-total_acpte; 	 	document.leform.solde_facture.value = solde; }  function checkPeriode() { 	 	i_debut = document.leform.periode_debut.selectedIndex; 	periode_debut = document.leform.periode_debut.options[i_debut].value; 	 	 	i_fin = document.leform.periode_fin.selectedIndex; 	periode_fin = document.leform.periode_fin.options[i_fin].value; 	 	if (i_fin < i_debut) {		 		document.leform.periode_debut.focus(); 		return false; 	} }  function changePeriode (etat) { 	 	if (etat == "prev") 		valeure = -1; 	else 		valeure = 1; 	 	i_debut = document.leform.periode_debut.selectedIndex; 	i_fin = document.leform.periode_fin.selectedIndex; 	 	document.leform.periode_debut.selectedIndex = i_debut + valeure; 	document.leform.periode_fin.selectedIndex = i_fin + valeure; 	 	document.leform.submit(); }  // ################################### // FONCTIONS DE LA PAGE AJOUT FACTURE  function openProjet(theurl, die) { 			 	thename = "modifysociete"; 	thefeatures = 'scrollbars=0,width=420,height=500,toolbar=no,location=no,status=no,menubar=no,resizable=yes'; 	 	if (die != "die") { 	 		i = document.leform.id_projet.selectedIndex; 		id_projet = document.leform.id_projet.options[i].value; 		 		y = document.leform.id_societe_tmp.selectedIndex; 		id_societe_tmp = document.leform.id_societe_tmp.options[y].value; 		 	} else { 		 		id_projet = 0; 		y = document.leform.id_societe_tmp.selectedIndex; 		id_societe_tmp = document.leform.id_societe_tmp.options[y].value; 	} 	 	theurl = theurl + "?ow=1&id_projet=" + id_projet + "&id_societe_tmp=" + id_societe_tmp ; 	 	window.open(theurl,thename,thefeatures); }  function modifProjet(theurl) { 	 	//theurl = "client_modify.php"; 	thename = "modifysociete"; 	thefeatures = 'scrollbars=0,width=420,height=500,toolbar=no,location=no,status=no,menubar=no,resizable=yes'; 	 	 	y = document.leform.id_societe_tmp.selectedIndex; 	id_societe = document.leform.id_societe_tmp.options[y].value; 	 	theurl = theurl + "?ow=1&id_societe_tmp=" + id_societe ; 	 	window.open(theurl,thename,thefeatures); }    function ChangeClient() { 	 	i = document.leform.id_societe_tmp.selectedIndex; 	id = document.leform.id_societe_tmp.options[i].value; 	 	 }  // ######################################### // FONCTIONS DE LA PAGE MODIFICATION FACTURE   // ################################### // FONCTIONS DE LA PAGE REPORT  function loadProject(page) { 	 	i = document.leform_proj.id_projet.selectedIndex; 	id = document.leform_proj.id_projet.options[i].value; 	document.location.href = page + "&id_projet=" + id; 	 	return false; }  // ################################### // FONCTIONS DE LA PAGE ANNUAIRE DES INTERVENANTS function showNotes (id_intervenant_tmp) { 	 	theURL = "intervenant_shownotes.php?id_intervenant_tmp=" + id_intervenant_tmp; 	winName = "Notes"; 	features = "scrollbars=1,width=450,height=350,toolbar=no,location=no,status=yes,menubar=no,resizable=yes"; 	 	window.open(theURL,winName,features); }  function showNotesSociete (id_societe_tmp) { 	 	theURL = "societe_shownotes.php?id_societe_tmp=" + id_societe_tmp; 	winName = "Notes"; 	features = "scrollbars=1,width=450,height=250,toolbar=no,location=no,status=no,menubar=no,resizable=yes"; 	 	window.open(theURL,winName,features); }   // ################################### // FONCTIONS DE LA PAGE ASSO USER & PROJETS // definition des var permettant d'afficher les layers if (document.all) { layerRef = '.all["'; styleRef = '"].style';} /* IE */ else if (document.layers) { layerRef = '.layers["'; styleRef = '"]';} /* Netscape 4 */ else if (document.getElementById) { layerRef = '.getElementById("'; styleRef = '").style';} /* Netscape 6 */   function HideLayer (LayerName) { 	eval('document' + layerRef + LayerName + styleRef + '.visibility="hidden"');	 }  function ShowLayer (LayerName) { 	eval('document' + layerRef + LayerName + styleRef + '.visibility="visible"');	 }  function ShowLayer_Modify (LayerName, id_groupe, id_intervenant, id_societe, abrev_intervenant, nom_intervenant, prenom_intervenant, email_intervenant, pwd_intervenant, actif_intervenant, mobile_intervenant, tel_intervenant) { 	 	eval('document' + layerRef + LayerName + styleRef + '.visibility="visible"'); 	 	document.leform01.id_intervenant_tmp.value = id_intervenant; 	 	// nb de id_societe ds le menu deroulant 	nb_list = document.leform01.id_societe_list.length; 	 	// select de la societe 	for (i=0; i<nb_list; i++) { 		 		valeur = document.leform01.id_societe_list.options[i].value; 		 		if (valeur == id_societe) { 			document.leform01.id_societe_list.options[i].selected=true; 		} 	} 	 	// nb de id_societe ds le menu deroulant 	nb_list_groupe = document.leform01.id_groupe_list.length; 	 	// select du groupe 	for (i=0; i<nb_list_groupe; i++) { 		 		valeur = document.leform01.id_groupe_list.options[i].value; 		 		if (valeur == id_groupe) { 			document.leform01.id_groupe_list.options[i].selected=true; 		} 	} 	 	document.leform01.abrev_intervenant.value = abrev_intervenant; 	document.leform01.nom_intervenant.value = nom_intervenant; 	document.leform01.prenom_intervenant.value = prenom_intervenant; 	document.leform01.email_intervenant.value = email_intervenant; 	document.leform01.pwd_intervenant.value = pwd_intervenant; 	document.leform01.pwd2_intervenant.value = pwd_intervenant; 	document.leform01.mobile_intervenant.value = mobile_intervenant; 	document.leform01.tel_intervenant.value = tel_intervenant; 	 	if (actif_intervenant == "true") 		document.leform01.actif_intervenant.checked = true; 	else 		document.leform01.actif_intervenant.checked = false; 		 } 
