function OpenCenterPopUp(){	
	var Left=window.screen.width/2-175;
	var Top=window.screen.height/2-175;
	var Configuration="'toolbar=no, menubar=no, location=no, directories=no, status=no, resizeable=no, width=425, height=350, left=" + Left + ", top=" + Top;
	window.open('pop_famille.php','Famille',Configuration);
}

function delete_partner(id_partner, type_partner){
	if(confirm("Confirmez vous la suppression de ce partenaire?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_partner' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='id_partner' value='"+id_partner+"'>");
		document.write("<input type='hidden' name='type_partner' value='"+type_partner+"'>");
		document.write("<input type='hidden' name='step' value='del_partner'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_partner.submit();
	}
}

function delete_produit_partner(id_produit, id_partner, type_partner){
	if(confirm("Confirmez vous la suppression de ce produit?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_produit' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='id_produit' value='"+id_produit+"'>");
		document.write("<input type='hidden' name='id_partner' value='"+id_partner+"'>");
		document.write("<input type='hidden' name='type_partner' value='"+type_partner+"'>");
		document.write("<input type='hidden' name='step' value='del_produit'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_produit.submit();
	}
}

function delete_news(id_news){
	if(confirm("Confirmez vous la suppression de cette news?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_news' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='id_news' value='"+id_news+"'>");
		document.write("<input type='hidden' name='step' value='del_news'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_news.submit();
	}
}

function delete_ref(type,lettre,ref_bot,ref_fr){
	if(confirm("Confirmez vous la suppression de cette référence?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_ref' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='del_lettre' value='"+lettre+"'>");
		document.write("<input type='hidden' name='del_type' value='"+type+"'>");
		document.write("<input type='hidden' name='del_bot' value='"+ref_bot+"'>");
		document.write("<input type='hidden' name='del_ref_fr' value='"+ref_fr+"'>");
		document.write("<input type='hidden' name='step' value='del_ref'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_ref.submit();
	}
}

function delete_pic(type,lettre,ref_bot,ref_fr,num_pic){
	if(confirm("Confirmez vous la suppression de cette image?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_pic' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='del_lettre' value='"+lettre+"'>");
		document.write("<input type='hidden' name='del_type' value='"+type+"'>");
		document.write("<input type='hidden' name='del_bot' value='"+ref_bot+"'>");
		document.write("<input type='hidden' name='del_ref_fr' value='"+ref_fr+"'>");
		document.write("<input type='hidden' name='del_num_pic' value='"+num_pic+"'>");
		document.write("<input type='hidden' name='step' value='del_pic'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_pic.submit();
	}
}

function modif_famille(){
	document.frm_up_famille.elements["txt_up_famille"].value=document.frm_up_famille.slct_up_fam_bot.value;
	document.frm_up_famille.elements["id_fam"].value=document.frm_up_famille.slct_up_fam_bot.value;
}

function Check_frm_add_famille(f){
	if(f.txt_famille.value==""){
		alert("Merci de saisir le nom de la famille a ajouter.");
		f.txt_famille.focus();
		return false;
	}
	return true;
}

function Check_frm_up_famille(f){
	if(f.slct_up_fam_bot.value==""){
		alert("Merci de selectionner la famille a modifier.");
		f.slct_up_fam_bot.focus();
		return false;
	}
	if(f.txt_up_famille.value==""){
		alert("Merci de saisir la modification du nom de la famille.");
		f.txt_up_famille.focus();
		return false;
	}
	return true;
}

function Check_frm_del_famille(f){
	if(f.slct_del_fam_bot.value==""){
		alert("Merci de selectionner la famille a supprimer.");
		f.slct_del_fam_bot.focus();
		return false;
	}
	return true;
}

function Check_frm_contact(f){
	if(f.frm_contact_nom.value==""){
		alert("Merci de saisir votre nom.");
		f.frm_contact_nom.focus();
		return false;
	}
	if(f.frm_contact_pnom.value==""){
		alert("Merci de saisir votre prenom.");
		f.frm_contact_pnom.focus();
		return false;
	}
	if(f.frm_contact_email.value==""){
		alert("Merci de saisir votre adresse email.");
		f.frm_contact_email.focus();
		return false;
	}
	var x = f.frm_contact_email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(x))
	{
		alert("L'adresse email n'est pas correcte (ie. xxx@xxx.xx)");
		f.frm_contact_email.focus();
		return false;
	}
	if(f.frm_contact_msg.value==""){
		alert("Merci de saisir votre message.");
		f.frm_contact_msg.focus();
		return false;
	}
	return true;
}

function Check_frm_news(f){
	if(f.txt_titre_news_fr.value==""){
		alert("Merci de saisir le titre de la news.");
		f.txt_titre_news_fr.focus();
		return false;
	}
	if(f.txt_texte_news_fr.value==""){
		alert("Merci de saisir le texte de la news.");
		f.txt_titre_news_fr.focus();
		return false;
	}
	return true;
}

function Check_frm_partner_institu(f){
	if(f.txt_nom_partner.value==""){
		alert("Merci de saisir le nom du partenaire.");
		f.txt_nom_partner.focus();
		return false;
	}
	if(f.txt_lien_partner.value==""){
		alert("Merci de saisir le lien vers le site du partenaire.");
		f.txt_lien_partner.focus();
		return false;
	}
	return true;
}

function Check_frm_partner_product(f){
	if(f.txt_nom_partner.value==""){
		alert("Merci de saisir le nom du producteur.");
		f.txt_nom_partner.focus();
		return false;
	}
	return true;
}

function delete_producteur(id_partner, type_partner){
	if(confirm("Confirmez vous la suppression de ce producteur?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_partner' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='id_partner' value='"+id_partner+"'>");
		document.write("<input type='hidden' name='type_partner' value='"+type_partner+"'>");
		document.write("<input type='hidden' name='step' value='del_partner'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_partner.submit();
	}
}

function delete_extrait(id_extrait, uri, id_ref_prod){
	if(confirm("Confirmez vous la suppression de cet extrait?")){
		document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
		document.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
		document.write("<html><head></head><body>");
		document.write("<form name='frm_del_extrait' method='post' action='../commun/action_db.php'>");
		document.write("<input type='hidden' name='id_extrait' value='"+id_extrait+"'>");
		document.write("<input type='hidden' name='uri' value='"+uri+"'>");
		document.write("<input type='hidden' name='id_ref_prod' value='"+id_ref_prod+"'>");
		document.write("<input type='hidden' name='step' value='del_extrait'>");
		document.write("</form>");
		document.write("</body></html>");
		document.close();
		document.frm_del_extrait.submit();
	}
}

function Check_frm_produit_institu(f){
	if(f.txt_nom_produit.value==""){
		alert("Merci de saisir le nom du produit.");
		f.txt_nom_produit.focus();
		return false;
	}
	return true;
}

