<%
/******************************************************************************
 * Copyright (c) 2000-2013 E-DEAL
 *
 * E-DEAL S.A.
 * 41, rue Périer
 * 92120 Montrougesi
 * France
 *
 * T: +33 (0)1 73 03 29 80
 * F: +33 (0)1 73 01 69 77
 * http://www.e-deal.com
 * 
 * La diffusion de ce code source sous quelque forme que ce soit sans
 * l'autorisation de E-DEAL est interdite.
 *
 * Vous êtes autorisés à modifier ce code source uniquement pour votre usage
 * propre et sous réserve que les mentions de copyright demeurent intactes.
 *
 * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou
 * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour
 * responsable des dommages pouvant résulter de l'utilisation de ce code
 * source.
 ******************************************************************************/
 %>
<%@ page session="true" %>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="com.edeal.frontline.Utils" %>
<%@ page import="com.edeal.frontline.SalesInvestBean" %>
<%@ page import="com.edeal.frontline.FieldNotInitializedException" %>
<%@ page import="com.edeal.frontline.FrontlineException" %>
<%@ page import="com.edeal.frontline.BasicBean" %>
<%@ page import="com.edeal.frontline.EnterpriseBean" %>
<%@ page import="com.edeal.frontline.custom.Photo_Bean" %>
<%@ page import="java.util.Vector" %>
<%@ page import="com.edeal.frontline.helper.ContextHelper" %>
<%@ page import="com.edeal.frontline.helper.custom.EnterpriseHelper" %>
<%@ page import="com.edeal.frontline.helper.custom.FlTaskHelper" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.EnterpriseBean" id="Enterprise" scope="request"/>

<script language="javascript">
	//http://u-project2.umanis.com/view.php?id=41725 Affichage nom société
	document.title = '<fl:getProperty name="Enterprise" property="EntTriName_" alt=""/>';
	
	function refreshCarteFID(){
		_grid__CARTEFID_js_.render();
	}
	
	function deleteMarkedCa_ID(Ca_ID) {
		if (confirm('<fl:getMessage code="MF1B6" alt="Etes-vous sûr de vouloir supprimer cette carte?" js="true"/>')) {
			doAjax('<fl:webapp/>/delete_carteFID.fl?id='+Ca_ID , waitNrefreshCarteFID_);
		}
	}
	
	function deleteCarteFID(){
		var firstCard = document.getElementById("carte1").value;
		if (firstCard!=""){
			var args = '&Ca_NumeroCarte='+firstCard;		
			var lastCard = document.getElementById("carte2").value;
			if(lastCard!="") args+='&LastRef='+lastCard;
			if (confirm('<fl:getMessage code="MF1B5" alt="Etes-vous sûr de vouloir supprimer ces cartes?" js="true"/>')) {
				doAjax('<fl:webapp/>/delete_carteFID.fl?='+args , waitNrefreshCarteFID_);
			}
		}
	}

	function waitNrefreshCarteFID_(arrIndex) {
		if (eDealXmlhttpArr[arrIndex].readyState == 4) {	
			hideWaiting();
			refreshCarteFID();
		}
	}
	
</script>

<%
	final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
	FlRequest flRequest = new FlRequest(request);
	FlContext context = flRequest.getContext();
	DataDictionary dico = context.getDataDictionary();
	String objID = dico.getTable("rad", "Ent").getID();

	boolean hasDoubloon = false;
	if(flRequest.getAttribute("HasDoubloon") != null) {
		hasDoubloon = (Boolean)flRequest.getAttribute("HasDoubloon");	
	}
	
	
	Vector<String> listFieldsForDbl = (Vector)flRequest.getAttribute("matchCodeFields");
	// If no match code fields is undefined
	if (listFieldsForDbl == null) {
		listFieldsForDbl = new Vector<String>();
	}
	//Vector matchCodeTemplates = (Vector)flRequest.getAttribute("matchCodeTemplates");
	Vector<String> fieldDisplay = (Vector)flRequest.getAttribute("fieldDisplay");
	if (fieldDisplay == null) {
		fieldDisplay = new Vector<String>();
	}
	Vector<Integer> seuils = (Vector)flRequest.getAttribute("seuils");
	boolean isCreation = true;
	String entId = null;
	try {
		entId = Enterprise.getID();
		isCreation = false;
	} catch(FieldNotInitializedException fnie) {
	}
	String titreEntreprise = "Tiers";
	String typOrganisation = null;
	boolean isAssociation = false;
	boolean isResto = false;
	boolean isHotel = false;
	boolean isPartenaire = false;
	boolean isCabaudit = false;
	boolean isJournaliste = false;
	boolean isPresta = false;
	boolean isFournisseurRef = false;

	Boolean afficherDansCatalogue = true;
	try {
		typOrganisation = Enterprise.getEntTyeID();
		if(typOrganisation != null){
			titreEntreprise = (String) dico.getRefDisp("EntTyeID", typOrganisation);
			isAssociation = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ASSO"));
			if(typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "RESTO"))) {
				isResto = true;	
			}
			if(typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "HOTEL")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "RESTO"))) {
				isHotel = true;	
			}
			isPartenaire = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "PART"));
			isCabaudit = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "AUDIT"));
			isJournaliste = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "JOURN"));
			isPresta = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "PRESTA"));
			//Mantis 31819
			isFournisseurRef = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "FRS"));
		}
	} catch (FieldNotInitializedException e) {}
	
	// JSA Yellow Pages integation
	if (flRequest.getAttribute("__YPBean__") != null) {

		BasicBean bean = (BasicBean)flRequest.getAttribute("__YPBean__");
		
		if (bean != null) {
			request.setAttribute("Enterprise", (EnterpriseBean)bean);
			Enterprise = (EnterpriseBean)bean;
			try {
				String pPhone = Enterprise.getEntPhone();
				if (!pPhone.startsWith("+33")) {
					//pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ",pPhone);
					pPhone = Utils.formatPhone("?? ?? ?? ?? ??", pPhone);		
					Enterprise.setEntPhone(pPhone);
				}
			} catch (FieldNotInitializedException e) {
			}		
		}
		flRequest.removeAttribute("__YPBean__");
	} else if (flRequest.getAttribute("__Address__Enterprise") != null || session.getAttribute("__Address__Enterprise") != null) {

		BasicBean bean = (BasicBean)flRequest.getAttribute("__Address__Enterprise");
		if (bean == null) 
			bean = (BasicBean)session.getAttribute("__Address__Enterprise");
	
		if (bean != null) {
			
			request.setAttribute("Enterprise", (EnterpriseBean)bean);
			Enterprise=(EnterpriseBean)bean;
			try {
				String pPhone = Enterprise.getEntPhone();
				if (!pPhone.startsWith("+33")) {
					//pPhone = Utils.formatPhone("+33 (?)? ?? ?? ?? ?? ",pPhone);
					pPhone = Utils.formatPhone("?? ?? ?? ?? ??", pPhone);		
					Enterprise.setEntPhone(pPhone);
				}
			} catch (FieldNotInitializedException e) {	
			}	
		}
		flRequest.removeAttribute("__Address__Enterprise");
	}
	String id = null;
	try {
		id = Enterprise.getID();
	} catch (FieldNotInitializedException fnie) {
	}
	
	boolean isCreate = id == null;
	
	String actionSave = null;
	
	if (isCreate) {
		actionSave="/save_enterprise.fl";
	} else {
		actionSave="/save_enterprise.fl";
	}
	
	logger.debug("isCreate: " + isCreate);
	logger.debug("Save action: " + actionSave);
	
	String entFRCtrCode = null;
	try {
		entFRCtrCode = dico.getRefIdByCode("EntCtrID", "FR");
	} catch (Exception e) {
	}	
	
	String entCtrID = null;
	String entCtrCode = null;
	try {
		entCtrID = Enterprise.getEntCtrID();
		entCtrCode = dico.getRefCode("EntCtrID", entCtrID);
	} catch (Exception e) {
		Enterprise.setEntCtrID(entFRCtrCode);
	}

	
	String entIntraVAT;
	try {
		entIntraVAT = Enterprise.getEntIntraVAT();
	} catch (FieldNotInitializedException e) {
		entIntraVAT = "";
	}
	
	String entRatach = null;
	try {
		entRatach = (String)Enterprise.getCustomProperty("EntRatachHotelID_");
	} catch (FieldNotInitializedException e){
	}
	
	
 	String typoStructID = null;
	try {
		typoStructID = (String)Enterprise.getCustomProperty("EntTypoStructure_");
	} catch (FieldNotInitializedException e){
		typoStructID = "";
	}
	
	String departID;
	try {
		departID = dico.getRefIdByCode("EntTypoStructure_", "DEPARTEMENTALE");
	} catch (FrontlineException e) {
		departID = "";
	}
	
	String departMultiID;
	try {
		departMultiID = dico.getRefIdByCode("EntTypoStructure_", "MULTI");
	} catch (FrontlineException e) {
		departMultiID = "";
	}
	
	String regionID;
	try {
		regionID = dico.getRefIdByCode("EntTypoStructure_", "REGIONAL");
	} catch (FrontlineException e) {
		regionID = "";
	}
	
	String paysID;
	try {
		paysID = dico.getRefIdByCode("EntTypoStructure_", "PAYS");
	} catch (FrontlineException e) {
		paysID = "";
	}
	String codePays = null;
	String codeRegion = null; 
	String regiondedepartementID = null;
	String paysderegionID = null;
	
	String entregionID = null;
	try {
		entregionID = (String) Enterprise.getCustomProperty("EntRegionID_");
	} catch (FieldNotInitializedException e) {
	}
	
	String entdepartementID = null;
	try {
		entdepartementID = (String) Enterprise.getCustomProperty("EntDepartmentID_");
	} catch (FieldNotInitializedException e) {
	}

	if(entregionID != null) {
		codePays = (String)dico.getRefDisp("Rg_", "Te2", entregionID);
		if(codePays != null) {
			try {
				paysderegionID = (String) dico.getRefIdByCode("EntCtrID", codePays);
				if (paysderegionID != null) {
					Enterprise.setEntCtrID(paysderegionID);	
				}
			} catch (FrontlineException e) {
			}
		} else {
			Enterprise.setEntCtrID(null);
		}
	} 
	
	if(entdepartementID != null ) {
		codeRegion = (String)dico.getRefDisp("Dp_", "Te2", entdepartementID);
		if(codeRegion != null) {
			try {
				regiondedepartementID = (String) dico.getRefIdByCode("EntRegionID_", codeRegion);
				if (regiondedepartementID != null) {
					Enterprise.setCustomProperty("EntRegionID_", regiondedepartementID);	
				}
			} catch (FrontlineException e) {
			}
			if (regiondedepartementID != null) {
				codePays = (String)dico.getRefDisp("Rg_", "Te2", regiondedepartementID);
			}
			if(codePays != null) {
				try {
					paysderegionID = (String) dico.getRefIdByCode("EntCtrID", codePays);
					if (paysderegionID != null) {					
						Enterprise.setEntCtrID(paysderegionID);
					}
				} catch (FrontlineException e) {
				}
			}	
		} else {
			Enterprise.setCustomProperty("EntRegionID_", null);
			Enterprise.setEntCtrID(null);
		}
	}
	
// 	String entPhotoID_ = null;
// 	/*
// 	String po_LienPhotoExt = null;
// 	String po_LienPhotoInt = null;
// 	*/
// 	String po_apercuPhotoID = null;
// 	Photo_Bean entPhoto = null;

// 	try {
// 		entPhotoID_ = (String)Enterprise.getCustomProperty("EntPhotoID_");
// 	} catch (FieldNotInitializedException e) {
// 	}
	
// 	if (entPhotoID_ != null) {
// 		try {
// 			entPhoto = new Photo_Bean(entPhotoID_,context);
// 		} catch (FrontlineException e) {
// 		}
// 	}
	
// 	if(entPhoto != null) {
// 		try {
// 			po_apercuPhotoID = (String)entPhoto.getPo_Apercu();
// 		} catch (FieldNotInitializedException fne) {
// 			/*
// 			try {
// 				po_LienPhotoInt = (String)entPhoto.getPo_LienPhoto();
// 			} catch (FieldNotInitializedException fnie) {
// 			}
// 			try {
// 				po_LienPhotoExt = (String)entPhoto.getPo_LienPhotoExt();
// 			} catch (FieldNotInitializedException fnie) {
// 			}
// 			*/
// 		}
// 	}

	String entPhotoID_ = null;
	String po_apercuPhotoID = null;
	Photo_Bean entPhoto = null;
	String entPhoto2ID_ = null;
	Photo_Bean entPhoto2 = null;
	String po_apercuPhoto2ID = null;
	String nomPhotoGuide1 = "";
	String nomPhotoGuide2 = "";
	
	try {
		entPhotoID_ = (String)Enterprise.getCustomProperty("EntPhotoID_");
	} catch (FieldNotInitializedException e) {}
	
	if (entPhotoID_ != null) {
		try {
			entPhoto = new Photo_Bean(entPhotoID_,context);
			nomPhotoGuide1 = entPhoto.getPo_NomPhoto();
		} catch (FrontlineException e) {}
	}
	
	if(entPhoto != null) {
		try {
			po_apercuPhotoID = (String)entPhoto.getPo_Apercu();
		} catch (FieldNotInitializedException fne) {}
	}
	
	try {
		entPhoto2ID_ = (String)Enterprise.getCustomProperty("EntPhoto2ID_");
	} catch (FieldNotInitializedException e) {}
	
	if (entPhoto2ID_ != null) {
		try {
			entPhoto2 = new Photo_Bean(entPhoto2ID_,context);
			nomPhotoGuide2 = entPhoto2.getPo_NomPhoto();
		} catch (FrontlineException e) {}
	}
	
	if(entPhoto2ID_!= null) {
		try {
			po_apercuPhoto2ID = (String)entPhoto2.getPo_Apercu();
		} catch (FieldNotInitializedException fne) {}
	}
	
	
	
	String siret = null;
	    
    try {
    	siret = Enterprise.getEntSiret();
    	Enterprise.setEntSiren(siret.substring(0, 10));
    } catch (Exception e) {
    } 
 
    // Initialiser l'adresse mail de facturation si elle n'existe pas au momant de la création par l'adresse mail principale
    if(id==null){
	    String mail = null;
	    try {
	    	mail = (String) Enterprise.getCustomProperty("EntMail_");
	    	if(mail!=null)
	    		Enterprise.setCustomProperty("EntBillingMail_",mail);
	    } catch (Exception e) {
	    } 
    }
    String paysid = "";
   if(id == null){
    try {
    	paysid = (String) Enterprise.getEntCtrID();
    	Enterprise.setCustomProperty("EntPaysStruct_",paysid);
    } catch (Exception e) {
    } 
   }
   
   
   boolean DISPLAY_PLAQUES = false;
	try {
		if(typOrganisation != null){
		DISPLAY_PLAQUES = typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) ||
		typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "HOTEL")) ||
		typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "INSOLIT")) ||
		typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "MAISON")) ||
		typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "AUBERGE"));
		}
	} catch (FieldNotInitializedException e) {}
	
	if(isCreation){
		try {
			Enterprise.setCustomProperty("EntPlaqueCosseRiz_",new Integer(0));
	    	Enterprise.setCustomProperty("EntPlaqueAlu_",new Integer(0));
	    } catch (FrontlineException e) {
	    } 
	}else{
		try {
			Enterprise.getCustomProperty("EntPlaqueCosseRiz_");
		} catch (FieldNotInitializedException fnie) {
			Enterprise.setCustomProperty("EntPlaqueCosseRiz_",new Integer(0));
		} 
		
		try {
			Enterprise.getCustomProperty("EntPlaqueAlu_");
		} catch (FieldNotInitializedException fnie) {
			Enterprise.setCustomProperty("EntPlaqueAlu_",new Integer(0));
		}
	}
%>
<script type="text/javascript" language="javascript">
	//var fieldsList = new Array;
	var fieldsList = {};
	var seuilcert = <%= (seuils != null && !seuils.isEmpty()) ? seuils.get(0) : null %>;

	function doCheckSiret(siret) {
		if (siret != "") {
		    var errTxt = '<fl:getMessage code="M80A0" alt="Siret Incorrect" js="true"/>';
	
		    if (siret.length != 14) {
				window.alert(errTxt + '. <fl:getMessage code="M80A1" alt="Le Siret doit avoir 14 chiffres" js="true"/>.');
		    	return false;
		    }
		      
		    if (isNaN(siret)) {
		    	alert('<fl:getMessage code="M80A2" alt="Le Siret doit être numérique" js="true"/>');
		    	return false;
		    } 
	
		    var estValide = true;
	
			// Donc le SIRET est un numérique à 14 chiffres 
			// Les 9 premiers chiffres sont ceux du SIREN , les 4 suivants 
			// correspondent au numéro d'établissement 
			// et enfin le dernier chiffre est une clef. 
		   	var somme = 0; 
		   	for (var cpt = 0; cpt<siret.length; cpt++) { 
		   		var tmpChar = siret.charAt(cpt);
		   		var tmpSomme = parseInt(tmpChar);
		        
		        if (cpt % 2 == 0) { // Les positions impaires sont multiplié par 2
		    	    tmpSomme *= 2;
		         
		        	if (tmpSomme > 9) { 
		        		tmpSomme -= 9;    // Si le résultat est supérieur à 9, on lui soustrait 9
		        	} 
		        } 
			        
				somme += tmpSomme;
		    }
		      
			if (somme % 10 != 0) {
				window.alert(errTxt);
		        estValide = false;
			}   
			doCalculateEntIntraVAT();
			return estValide;
		}
	} 	

	//chercher sociÃ©tÃ© avec siren
	function searchSociete() {
		var f = window.document.forms[0];
		
		if (f && f.elements['EntCorpName']) {
			entCorpName = f.elements['EntCorpName'].value;
		} 
		if (f && f.elements['EntSiret']) {
			siren = f.elements['EntSiret'].value;
		} 
		if (f && f.elements['EntZip']) {
			entZip = f.elements['EntZip'].value;
		} 
		
		if (siren != '') {
			if (siren.length > 9) {
				try {
					siren = siren.substring(0,9);
				} catch(e) {
				}
			}
			window.open('http://www.societe.com/cgi-bin/recherche?rncs=' + siren);
		} else if (entCorpName != '' || entZip != '') {
			if (entZip != '') {
				entZip = entZip.substring(0,2);
			}
			window.open('http://www.societe.com/cgi-bin/liste?nom=' + entCorpName + '&dep=' + entZip);
		} else {
			window.open('http://www.societe.com');
		}
	}
	
function stripPhoneNo(phoneNo) {
	if (phoneNo == '') {
		return '';
	}
	
	// We have to strip the extraneous characters from the phone to make it work properly
	var finalPhone = '';
	var haveParan = false;
	
	for (var cnt = 0; cnt < phoneNo.length; cnt++) {
		var charPhoneNo = phoneNo.charAt(cnt);
		if (charPhoneNo == '(') {
			haveParan = true;
			continue;
		}
		
		if (charPhoneNo == ')') {
			haveParan = false;
			continue;
		}
		
		if (haveParan) {
			continue;
		}
			
		switch (charPhoneNo) {
		case '+':
		case '.':
		case ' ':
			continue;
		}
		
		finalPhone += charPhoneNo;
	}
	
	return finalPhone;
}
<% if (hasDoubloon) { %>
	$(function() {
		<% for (String field : listFieldsForDbl) { %>
		 $('#<%= field %>').bind('change', function() {
	  		checkDoublon('<%= field %>', $('#<%= field %>').val());
		});
		<% } %>
	
	});
<% } %> 	

	function checkDoublon(field, value){
		<% if (isCreation) { %>
			checkArrayValue(field, value);
		<% } else { %>
			updateArrayValues();
		<% } %>
		var jsonstring = JSON.stringify(fieldsList);

		var data = {};
		data.objID = '<%= objID %>';
		<% if (Utils.isEmpty(id)) {
			} else { %>
			data.id = '<%= id %>';
		<% } %>
		
		data.notDoublon = $("#notDoublon").val();
		data.fieldsList = jsonstring;
		
		$.ajax({
			data: data,
			url: "<fl:webapp/>/find_double.fl",
			timeout: 20000,
			contentType: "application/json;charset=utf-8",
			dataType: 'json',
			async: true,
			success: function (data) {
				if (data.status == 0) {
					return;
				} else {
					data.objID = '<%= objID %>';
					namePopup = "doublonPopup";
					urlPopup = "<fl:webapp/>/open_popup_doublon.fl";
					openAjaxPopup(namePopup, urlPopup, data);
				}
			},
            error:function (xhr, ajaxOptions, thrownError){
                    //alert(xhr.status);
                    //alert(thrownError);
            }    
	 	});
	}
	
	function updateArrayValues() {
		//fieldsList = new Array;
		fieldsList = {};
		<% for (String field : listFieldsForDbl) { %>
			if ($("#<%= field %>").val() == undefined) {
				fieldsList['<%= field %>'] = '';
			} else {	
				fieldsList['<%= field %>'] = $("#<%= field %>").val();
			}	
		<% } %>
	};
	
	function checkArrayValue(field, value) {
		fieldsList[field] = value;
	};
	
	function isNotDoublon(id, poids){
		$("#tr_" + id.toString()).hide();
		$("#notDoublon").val($("#notDoublon").val() + id + '#'+ poids + ';');
	}
	function openObjPopup(id){
		window.open('<fl:webapp/>/read_enterprise.fl?id='+id, 'Enterprise', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=1024,height=768');
	}
	
	function openAjaxPopup(namePopup, urlPopup, jsonResponse){
		var cmp = 0;
		jQuery.openPopupLayer({
			name: namePopup,
			width: "auto",
			height: "auto",
			url: urlPopup,
			cache: true,
			success: function () {
				$("#doublon_content").append("<thead><tr valign=\"top\">" +
								"<th width='5px'>&nbsp;</th>" +
								<% for (String fieldDisp : fieldDisplay) { %>
								"<th><%= fieldDisp %></th>" +
								<% } %>
							"</tr></thead>");
				$.each(jsonResponse.doublons, function(i, doublon) {
					var str = $("#notDoublon").val();
					if (str.indexOf(doublon.id) > -1) {
					} else {
						cmp++;
						var lignCssClass = (i%2 == 0) ? "even" : "odd"; 
						var content = "<tr id=\"tr_" + doublon.id.toString() + "\" class=\"" + lignCssClass + " bean\" ";
						var poidsColor = "";
						if (doublon.poids >= seuilcert) {
							poidsColor = "background-color: #F2D5D9;";
						} else {
							poidsColor = "background-color: #FBFAC8;";
						}
						content += ">" +
									"<td width=\"20px\" class=\"\" style=\"" + poidsColor + "\">" +
										"<a href=\"javascript:openObjPopup('" + doublon.id + "')\"><img title=\"Voir\" alt=\"Voir\" src=\"<fl:webapp/>/icons/ico/zoom.gif\"></a> " +
										"<a href=\"javascript:doMerge('" + doublon.id + "')\"><img title=\"Fusionner\" alt=\"Fusionner\" src=\"<fl:webapp/>/icons/fusion.gif\"></a> " +
										"<a href=\"javascript:isNotDoublon('" + doublon.id + "','" + doublon.poids + "')\"><img title=\"Enregistrer en non-doublon\" alt=\"Enregistrer en non-doublon\" src=\"<fl:webapp/>/icons/ico/supprimer.gif\"></a>" +
									"</td>" +
									<% for (String field : listFieldsForDbl) { %>
									"<td class=\"dataValue\">" + doublon.<%= field %> + "</td>" +
									<% } %>
								"</tr>";									
					 	$("#doublon_content").append(content);
				 	}
				});	
		    },
	        error: function () {
				//alert("Erreur lors de l'ouverture de la popup !");
		    }
		});
	}
	
function doYellowPage() {
	var f = window.document.forms[0];
	var phone = "";
	if (f && f.elements['EntPhone']) {
		phone = f.elements['EntPhone'].value;
	} 
	phone = stripPhoneNo(phone);
	if (phone == '') {
		alert('<fl:getMessage code="M60F9" alt="Une recherche sur l\'annuaire inversÃ© Amabis ne peut Ãªtre lancÃ©e si aucun numÃ©ro de tÃ©lÃ©phone n\'a Ã©tÃ© fourni." js="true"/>');				
	} else {
		//window.parent.location = "<fl:webapp/>/check_phone_enterprise.fl?id=<%=id%>&type=Enterprise&EntPhone=" + phone;
		//doAjax('<fl:webapp/>/check_phone_enterprise.fl?id=<%=id%>&EntPhone=' + phone + '&type=Enterprise');
		presentFieldsValue();
		f.action = '<fl:link url="<%= \"/check_phone_enterprise.fl?id=\" + ( id != null ? id : \"\") %>"/>' + '&EntPhone=' + phone + '&type=Enterprise';
		doExitConf = false;
		f.submit();
	}
}

function doMerge(id) {
	var f = document.forms[0];
	f.action = "<fl:webapp/>/save_merge_enterprise.fl?objMasterID=" + id;
	f.submit();
}

function doCalculateEntIntraVAT() {
	var f = document.forms[0];
	var entSiret = f.EntSiret.value;
	var entSiren = entSiret.length > 9 ? entSiret.substring(0, 9) : '';
	var entCtrID = f.EntCtrID.options[f.EntCtrID.selectedIndex].value;
	if (entSiren != '') {
		doAjax('<fl:webapp/>/do_calculate_entintravat.fl?EntSiren=' + entSiren + '&EntCtrID=' + entCtrID);
	}
}

function doDisplayEntIntraVAT() {
	if ('<%= entFRCtrCode %>' == $("#EntCtrID").val()) {
		//FR
		$("#EntIntraVAT").attr("disabled", true);
		$("#EntIntraVAT").attr("readonly", true);
		$("#EntIntraVAT").addClass("transRead");
		doCalculateEntIntraVAT();
	} else {
		$("#EntIntraVAT").removeAttr("disabled");
		$("#EntIntraVAT").removeAttr("readonly");
		$("#EntIntraVAT").removeAttr("onfocus");
		$("#EntIntraVAT").removeClass("transRead");
	}
}

function doEntTypoStructure_Change() {	
	doRefreshEnterprise();
}

function doEntCtrID_Change() {	
	doRefreshEnterprise();
}

function doEntRegionID_Change() {	
	doRefreshEnterprise();
}

function doEntSiret_Change() {
	doRefreshEnterprise();
}

function doEntSiret_Change_() {
	formatSiret();
	doRefreshEnterprise();
}

function doEntMail_Change() {	
	doRefreshEnterprise();
} 

function doEntDepartmentID_Change() {	
	doRefreshEnterprise();
}

function doRefreshEnterprise() {		
	var f = document.forms[0];
	f.action = "<fl:webapp/>/refresh_enterprise_custom.fl";
	f.submit();
}

function doEntTyeChange() {
	doRefreshEnterprise();
}

function doOnLoad() {
	<% //if ( typOrganisation!= null && !(typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "HOTEL"))) ) {
		//Enterprise.setCustomProperty("EntRatachHotelID_", null);
		//entRatach = null;
	%>
	// vider ent rattach
	//var f = document.forms[0];
	//f.EntRatachHotelID_ = '';
	//f.lblEntRatachHotelID_ = '';
	<% //} %>
}



function loadRegion(ctrID) {
	if (ctrID == undefined || ctrID == null || ctrID == '') {
		$("#EntRegionID_").html("<option value=''>&nbsp;</option>");
		$("#EntRegionID_").width($("#div_EntRegionID_").width());
		return;
	}
	$.getJSON("<fl:webapp/>/get_enterprise_regions.fl?ctrID=" + ctrID, function(data) {
		if (data != null) {
			var optContent = "<option value=''>&nbsp;</option>";
			for (var i = 0; i < data.length; i++) {
				var optValue = data[i].value;
				var optText = data[i].text;
				optContent += "<option"
				if (optValue == '<%=entCtrID%>') {
					optContent += " selected";
				}	
				optContent += " value='" + optValue + "'>" + optText + "</option>"
			}
			$("#EntRegionID_").html(optContent);
			$("#EntRegionID_").width($("#div_EntRegionID_").width());//For IE7
		}	
	});
}
	
function loadDepartment(rg_ID) {
	if (rg_ID == undefined || rg_ID == null || rg_ID == '') {
		$("#EntDepartmentID_").html("<option value=''>&nbsp;</option>");
		$("#EntDepartmentID_").width($("#div_EntDepartmentID_").width());
		return;
	}
	$.getJSON("<fl:webapp/>/get_enterprise_departments.fl?rg_ID=" + rg_ID, function(data) {
		if (data != null) {
			var optContent = "<option value=''>&nbsp;</option>";
			for (var i = 0; i < data.length; i++) {
				var optValue = data[i].value;
				var optText = data[i].text;
				optContent += "<option"
				if (optValue == '<%=entregionID%>') {
					optContent += " selected";
				}	
				optContent += " value='" + optValue + "'>" + optText + "</option>"
			}
			$("#EntDepartmentID_").html(optContent);
			$("#EntDepartmentID_").width($("#div_EntDepartmentID_").width());//For IE7
		}
	});
}

 function doSubmit() {
		var f = document.forms[0];
		var filter = /^[0-9-+() ]+$/;
		if (f.EntMail_){
			var entmailVal = f.EntMail_.value;
			
			if (entmailVal != null && entmailVal.length > 0){
				if (!checkEmail(entmailVal)){ 
					alert('<fl:getMessage code="LF188" alt="Veuillez vérifier votre adresse mail principal." js="true"/>');
					f.EntMail_.focus();
					return false;
				}
			}
		}
	
		if (f.EntSecondMail_){
			var entmailVal = f.EntSecondMail_.value;
			if (entmailVal != null && entmailVal.length > 0){
				if (!checkEmail(entmailVal)){ 
					alert('<fl:getMessage code="LF189" alt="Veuillez vérifier votre adresse mail secondaire." js="true"/>');
					f.EntSecondMail_.focus();
					return false;
				}
			}
		}
		
		
		<%--
		if(f.EntWeb) {
			var entwebVal = f.EntWeb.value;
			if(entwebVal != null && entwebVal.length > 0){
				if(!checkUrl(entwebVal)) {
					alert('<fl:getMessage code="L6633" alt="Veuillez vérifier l\\\'adresse de votre site web." js="true"/>');
					f.EntWeb.focus();
					return false;
				}
			}
		}
		--%>
		if(f.EntPhone) {
				/* doEpureTel(f.EntPhone, f.EntPhone, f.EntCtrID); 
				var res = doFormatTel(f.EntPhone, '<fl:getMessage code="L30B8" alt="Saisie du téléphone" js="true"/> :', f.EntCtrID);
				if(res==false){
					return false;
				} */
				
			var entphoneVal = f.EntPhone.value;
			if(entphoneVal != null && entphoneVal.length > 0){
				if(!filter.test(entphoneVal)) {
					alert('<fl:getMessage code="MF08C" alt="Veuillez vérifier le numéro de téléphone principal." js="true"/>');
					f.EntPhone.focus();
					return false;
				}
			}
		}
		
		if(f.EntSecondPhone_) {
			var entsecondphoneVal = f.EntSecondPhone_.value;
			if(entsecondphoneVal != null && entsecondphoneVal.length > 0){			
				if(!filter.test(entsecondphoneVal)) {
					alert('<fl:getMessage code="MF08D" alt="Veuillez vérifier le numéro de téléphone secondaire." js="true"/>');
					f.EntSecondPhone_.focus();
					return false;
				}
			}
		}
		
		if(f.EntFax) {
			/* doEpureTel(f.EntFax, f.EntFax, f.EntCtrID); 
			doFormatTel(f.EntFax, '<fl:getMessage code="L30B9" alt="Saisie du fax" js="true"/> :', f.EntCtrID); */
			var entfaxVal = f.EntFax.value;
			if(entfaxVal != null && entfaxVal.length > 0){
				if(!filter.test(entfaxVal)) {
					alert('<fl:getMessage code="MF08E" alt="Veuillez vérifier le fax." js="true"/>');
					f.EntFax.focus();
					return false;
				}
			}
		}
		
		try{
		f.EntPhotoID_.value = $("#EntPhotoID_").val();
		}catch(erreur){
			
		}
		
		
	return true;
}

	

function CarteFidCallback(arrIndex){
	if (eDealXmlhttpArr[arrIndex].readyState == 4) {	
		hideWaiting();
	}
}


function formatSiret(){
	var siretVal =  $("#EntSiret").val();
	siretVal = siretVal.replace(/ /g, "");
	siretVal = siretVal.replace(/[a-z]/g, "");
	if(siretVal.length == 14 ){
		$("#EntSiret").val(siretVal);
	}
	else{
		if(siretVal.length > 14){
			alert('<fl:getMessage code="MF1C6" alt="le champ Siret ne doit pas dépasser 14 chiffres numériques !" js="true"/>');
		}
		else{
			alert('<fl:getMessage code="MF1C7" alt="le champ Siret ne doit pas contenir moins de 14 chiffres numériques !" js="true"/>');
		}
		$("#EntSiret").val("");
		$("#EntSiret").focus();
	}
}
</script>

<fl:form action="<%= actionSave %>" bean="Enterprise">
	
	<input type="hidden" name="notDoublon" id="notDoublon" value="">
	<%-- Mantis 29438: mauvais pays 
		
		<% if(typoStructID.equalsIgnoreCase(departID)) { 
		if(regiondedepartementID != null) {	%>
	 	<input type="hidden" name="EntRegionID_" value="<%=regiondedepartementID%>">
		<%} else {%> 
		<input type="hidden" name="EntRegionID_" value="">
		<%}
		
		if(paysderegionID != null) {%>
	 	<input type="hidden" name="EntCtrID" value="<%=paysderegionID%>">
		<%} else {%> 
		<input type="hidden" name="EntCtrID" value="">
		<%}%>
	<%} %>
	<% if(typoStructID.equalsIgnoreCase(regionID)) { 
		if(paysderegionID != null) {%>
	 	<input type="hidden" name="EntCtrID" value="<%=paysderegionID%>">
		<%} %>
	<%} %>
	
	<% if(typoStructID.equalsIgnoreCase(paysID)) { %>
		
	 	<input type="hidden" name="EntCtrID" value="<%=paysid%>">
		
	<% } %>
	
	<% if(typoStructID.equalsIgnoreCase(departMultiID)) { %>
  
	 	 	<input type="hidden" name="EntCtrID" value="<%=paysid%>">
	
	<%} %> --%>
	
	<% %>
	<fl:bigTabs objectTitle="<%=titreEntreprise%>" listTitle="<%= Utils.getMessage(session, \"L30A2\", \"Liste des entreprises\") %>" ou="<%= \"edit_enterprise.fl\" + (id != null ? \"?id=\" + id : \"\")%>" >
		<table class="container" cellpadding="0">
			<%-- 
			<tr>
				<td colspan="5">
					<table class="container" cellpadding="0">
						<tr class="fieldline">
							<td class="labelTitreFiche">
								<fl:label field="EntCorpName" labelClassName="titreFiche"/>
							</td>
							<td class="fieldTitreFiche">
								<fl:input property="EntCorpName" mandatoryMsgCode="M3001" onblur="if (this.form.EntAcronym.value == '') this.form.EntAcronym.value = this.value;"/>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr><td colspan="5" class="ligne_separation"/></tr>--%>
			<tr>
				<td class="column2">
					<%-- begin : Adresse --%>
					<table class="container" cellpadding="0">
						<tr class="fieldline">
							<td class="dataLabel"><fl:label field="EntDispName_" labelClassName="titreFiche"/></td>
							<td class="dataValue"><fl:input property="EntDispName_" mandatoryMsgCode="FF253" onblur="if (this.form.EntAcronym && this.form.EntAcronym.value == '') this.form.EntAcronym.value = this.value;"/></td>
						</tr>
						<fl:fieldEdit property="EntNomGuide_" mandatoryMsgCode="MF1BF"/>
						<fl:fieldEdit property="EntCorpName" mandatoryMsgCode="M3001"/>
						<% if(!isAssociation && !isResto && !isPartenaire && !isCabaudit && !isJournaliste && !isPresta){ %>
							<%-- <fl:fieldEdit property="EntHotelID_" alt=""/> --%>
						<% } %>

						<% if( entRatach != null || (typOrganisation!= null && (typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "ETAB")) || typOrganisation.equals((String)dico.getRefIdByCode("EntTyeID", "HOTEL")))) ) {	%>	
							<fl:fieldEdit property="EntRatachHotelID_" />
						<% } %>			

						<fl:fieldEdit property="EntTriName_"/>
						<fl:fieldEdit property="EntWihpid_"/>
						<fl:fieldEdit property="EntCode_"/>
						<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="LF002" alt="Adresse Postale"/>
						</td>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<tr class="fieldline">
							<td class="dataLabel"><fl:getMessage code="FF1D0" alt="Numéro/Nature/Libellé Voie"/></td>
							<td class="dataValue"><div class="fieldTable" >
									<table class="fieldTable" cellpadding="0">
										<tr>
											<td style="width: 20%">
												<fl:input property="EntVoieNum_" width="80%"/>
											</td>
											<td style="width: 30%">
												<%-- <fl:input property="EntNatureVoieID_" mandatoryMsgCode="MF075" width="auto"/> --%>
												<fl:input property="EntNatureVoieID_" alt="" width="90%"/>
											</td>
											<td style="width: 50%">
												<%-- <fl:input property="EntLblVoie_" mandatoryMsgCode="MF076" /> --%>
												<fl:input property="EntLblVoie_" width="100%" />
											</td>
										</tr>
									</table>
							</div>
							</td>
						</tr>
						<fl:fieldEdit property="EntGeoCplt_" alt="" />
						<fl:fieldEdit property="EntPtRmCourrier_" alt="" />
						<fl:fieldEdit property="EntBP_"/>
						<fl:fieldEdit property="EntLieuDit_" alt="" />
						<tr class="fieldline">
							<td class="dataLabel"><fl:getMessage code="FF096" alt="Code Postal/Ville"/></td>
							<td class="dataValue"><div class="fieldTable" >
									<table class="fieldTable" cellpadding="0">
										<tr>
											<td style="width: 20%">
												<!--  <input class="input text" type="text" id="EntZip" name="EntZip" value="<fl:getProperty name="Enterprise" property="EntZip" alt=""/>" size="4" style="width: auto;"/> -->
<%-- 												<fl:input property="EntZip" mandatoryMsgCode="MF074" width="auto"/> --%>
                                                     <fl:input property="EntZip" width="80%"/>
											</td>
											<td class="bigFieldPart">
												<!-- <input class="input text" type="text" maxlength="50" id="EntCity" onblur="this.value = checkString(this.value, 'upper');" name="EntCity" value="<fl:getProperty name="Enterprise" property="EntCity" alt=""/>" style="width:100%" /> -->
<%-- 												<fl:input property="EntCity" mandatoryMsgCode="MF073"/> --%>
                                                       <fl:input property="EntCity" width="100%"/>
											</td>
										</tr>
									</table>
								</div></td>
						</tr>
						<% if(typoStructID.equalsIgnoreCase(departID) || typoStructID.equalsIgnoreCase(regionID) || typoStructID.equalsIgnoreCase(paysID) || typoStructID.equalsIgnoreCase(departMultiID)) { %>
						<fl:fieldEdit property="EntCtrID"/>
						<%} else {%>
						<% if(!isPartenaire){ %>
							<fl:fieldEdit property="EntCtrID" alt="" mandatoryMsgCode="MF06F"/>
						<%}%>
						<%} %>
						<% if(isPartenaire){ %>
						<fl:fieldEdit property="EntCtrID" alt="" onchange="loadRegion(this.value);" mandatoryMsgCode="MF06F"/>
						<fl:fieldEdit property="EntRegionID_" alt="" onchange="loadDepartment(this.value);"/>
						<fl:fieldEdit property="EntDepartmentID_" alt=""/>
						<% } %> 
						<%--
						<tr class="fieldline">
							<td class="dataLabel" rowspan="5">
								<fl:getMessage code="F2012" alt="Adresse"/>&nbsp;
								<fl:addressNormalisation bean="Enterprise" operation="edit" 
								addressStatusField="EntAddressStatus" getAddressMethod="getAddress" setAddressMethod="setAddress" getStatusMethod="getAddressNormalisationStatus" 
								setStatusMethod="setAddressNormalisationStatus" 
								returnUrl="/edit_enterprise.fl"/>
							</td>
							<td class="dataValue">
								<fl:input property="EntAd1"/>
							</td>
						</tr>
						<tr class="fieldline">
							<td class="dataValue">
								<fl:input property="EntAd2"/>
							</td>
						</tr>
						<tr class="fieldline">
							<td class="dataValue">
								<fl:input property="EntAd3"/>
							</td>
						</tr>
						<tr class="fieldline">						
							<td class="dataValue">
								<div class="fieldTable" >
									<table class="fieldTable" cellpadding="0">
										<tr>
											<td class="smallFieldPart">
												<input class="input text" type="text" id="EntZip" name="EntZip" value="<fl:getProperty name="Enterprise" property="EntZip" alt=""/>" size="4" style="width: auto;"/>
											</td>
											<td class="bigFieldPart">
												<input class="input text" type="text" maxlength="50" id="EntCity" onblur="this.value = checkString(this.value, 'upper');" name="EntCity" value="<fl:getProperty name="Enterprise" property="EntCity" alt=""/>" style="width:100%" />
											</td>
										</tr>
									</table>
								</div>
							</td>
						</tr>
						<tr class="fieldline">
							<td class="dataValue"><fl:input property="EntCtrID"/><input type="hidden" name="country" value="<%= entCtrID --%><%--</td>
						</tr>
					</table>
						
					 --%>
					<table class="container" >
						<tr><td colspan="5" class="ligne_separation"/></tr>		
<%-- 						<fl:fieldEdit property="EntPhone" mandatoryMsgCode="MF00B" format="phone"/> --%>
                        <fl:fieldEdit property="EntPhone" format="phone"/>
						<fl:fieldEdit property="EntSecondPhone_"/>
						<fl:fieldEdit property="EntFax"/>
<%-- 						<fl:fieldEdit property="EntMail_" mandatoryMsgCode="MF071"/> --%>
						<fl:fieldEdit property="EntMail_" onchange="doEntMail_Change();"/>
						<fl:fieldEdit property="EntSecondMail_" />
						<fl:fieldEdit property="EntBillingMail_" />
						<%-- Mantis 31710 --%>
						<%-- <%if(!isAssociation && !isPartenaire) {%>
						<fl:fieldEdit property="EntBillingMail_" mandatoryMsgCode="MF072"/>
						<fl:fieldEdit property="EntBillingMail_" />
						<%} %> --%>
						<fl:fieldEdit property="EntWeb"/>
						<% if(!isAssociation && !isPartenaire) { %>
						<%-- <% if (typOrganisation == null ) {%> --%>
						<tr><td colspan="5" class="ligne_separation"/></tr>		
						<fl:fieldEdit property="EntTyeID" except="ASSO;PART" mandatoryMsgCode="LF183" alt="" onchange="doEntTyeChange();"/>
						<%-- <%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%>
						<tr class="fieldline">
						<td id="EntTyeID_label" class="dataLabel"><fl:label code="FF03C" label="Type de Tiers"/></td>
						<td id="EntTyeID_value" class="dataValue">
						<div class="input text">
							<input id="EntTyeID" type="hidden" value="<%=typOrganisation%>" name="EntTyeID" >
							<input id="EntTyeIDVal" class="input text" value="<%=dico.getRefDisp(session, "EntTyeID", typOrganisation)%>" name="EntTyeIDVal" readonly>
						</div>
						</td>
						</tr>
						<%} %> --%>
						<%} %>
						<% if(!isAssociation && !isPartenaire && !isCabaudit && !isJournaliste && !isPresta) { %>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<fl:fieldEdit property="EntActsID_" />
						<!-- <fl:fieldEdit property="EntActsID_" mandatoryMsgCode="MF077"/> -->
						<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="LF004" alt="Structure Locale"/>
						</td>
						<tr><td colspan="5" class="ligne_separation"/></tr>
						
						<!-- Mantis 31819 -->
						<% if(isFournisseurRef){ %>
						<fl:fieldEdit property="EntStructureLocalID_" query="EntTyeID:RefVal = 'ASSO'"/>
						<%} else{%>
						
						<!-- Mantis 30806 -->
						<fl:fieldEdit property="EntStructureLocalID_" query="EntTyeID:RefVal = 'ASSO'" mandatoryMsgCode="MF132"/>	
						<%-- <fl:fieldEdit property="EntStructureLocalID_" query="EntTyeID:RefVal = 'ASSO'"/> --%>
						<%} %>
						<% } else if (isPartenaire) {%>
						<tr><td colspan="5" class="ligne_separation"/></tr>		
						<% if (typOrganisation == null ) {%>
							<fl:fieldEdit property="EntTyeID"/>
							<%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%>
							<tr class="fieldline">
							<td id="EntTyeID_label" class="dataLabel"><fl:label code="FF03C" label="Type de Tiers"/></td>
							<td id="EntTyeID_value" class="dataValue">
							<div class="input text">
								<input id="EntTyeID" type="hidden" value="<%=typOrganisation%>" name="EntTyeID" >
								<input id="EntTyeIDVal" class="input text" value="<%=dico.getRefDisp(session, "EntTyeID", typOrganisation)%>" name="EntTyeIDVal" readonly>
							</div>
							</td>
							</tr>
							
						<%} %>
						<%} %>
					</table>
				</td>
				<td class="separation"><div class="separation"></div></td>
				<td class="column2">
					<table class="container" cellpadding="0">
						<% if(isAssociation) { %>
						<% if( typOrganisation == null ) {%>
						<fl:fieldEdit property="EntTyeID"/>
						<%} else if ( (id != null && typOrganisation != null) || (id == null && typOrganisation != null)) {%>
						<tr class="fieldline">
						<td id="EntTyeID_label" class="dataLabel"><fl:label code="FF03C" label="Type de Tiers"/></td>
						<td id="EntTyeID_value" class="dataValue">
						<div class="input text">
							<input id="EntTyeID" type="hidden" value="<%=typOrganisation%>" name="EntTyeID" >
							<input id="EntTyeIDVal" class="input text" value="<%=dico.getRefDisp(session, "EntTyeID", typOrganisation)%>" name="EntTyeIDVal" readonly>
						</div>
						</td>
						</tr>
						<%} %>
						<%} %>
						<% if(!isAssociation && !isPartenaire && !isCabaudit && !isJournaliste && !isPresta) { %>
						
						<%-- 
						<tr class="fieldline">
						<td id="EntPhoto_label" class="dataLabel"><fl:label code="FF001" label="Photo"/></td>
						<td id="EntPhoto_value" class="dataValue">
						<%if(po_apercuPhotoID != null) { %>
							<img alt="" src='<fl:webapp/>/download?id=<%=po_apercuPhotoID%>' onclick="" height="250" width="400">
						<%}%>
						</td>
						</tr>
						
						<tr class="fieldline">
						<td id="EntPhotoID_" class="dataLabel"><fl:label code="FF001" label="Photo"/></td>
						<%if(po_apercuPhotoID != null) { %>
						<td id="EntPhotoID_" class="dataValue">
							<img alt="" src='<fl:webapp/>/download?id=<%=po_apercuPhotoID%>' onclick="" height="300" width="400">
							<fl:fieldRead property="EntPhotoID_" separator="<br>" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_photo_.fl\") %>"/>
						</td>
						<%} else {  %>
						<td class="dataValue">
							<fl:attach name="Apercu" colID="EntPhotoID_" multivalSeparator=";" edit="true" allowedExtensions="'jpg', 'jpeg', 'png', 'gif'" mandatory="false"/>
						</td>
						<%} %>
						</tr>
						--%>
						
						<tr class="fieldline">
						<td id="EntPhoto_label" class="dataLabel"><fl:label code="FF001" label="Photo"/></td>
						<td id="EntPhoto_value" class="dataValue">
						<table width="450px">
						<tr>
						<td style="text-align: center;"  width="225px"><span>Photo Guide 1 - <%= nomPhotoGuide1 %></span></td>
						<td style="text-align: center;"  width="225px"><span>Photo Guide 2 -  <%= nomPhotoGuide2 %></span></td>
						</tr>
						<tr>
						<td>
						<%if(po_apercuPhotoID != null) { %>
							<img alt="PhotoGuide1" src='<fl:webapp/>/download?id=<%=po_apercuPhotoID%>' onclick=""  width="200px">
						<%} %>
						</td>
						<td>
						<%if(po_apercuPhoto2ID != null) { %>
							<img alt="PhotoGuide2" src='<fl:webapp/>/download?id=<%=po_apercuPhoto2ID%>' onclick=""  width="200px">
						<%} %>
						</td>
						</tr>
						</table>
						</td>
					</tr>
					
					
						
						
						<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="L8267" alt="Localité"/>
						</td>
						<tr><td colspan="5" class="ligne_separation"/></tr>
						
						 <% if(isHotel){  %>	
						<fl:fieldEdit property="EntLocalityID_" mandatoryMsgCode="MF0E8" />
						<% } else{ %>
						<fl:fieldEdit property="EntLocalityID_"/>
						<%} %> 
						
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<fl:fieldEdit property="EntNextAuditDt_"/>
<%-- 						<fl:fieldRead property="EntCheNbID_"  alt=""/>					 --%>
<%-- 						<fl:fieldRead property="EntCocNbID_"  alt=""/> --%>
						<%if(isResto){ %>
						<fl:fieldEdit property="EntNbCouverts_"  alt=""/>
						<%} %>
						<fl:fieldEdit property="EntNbSeminaires_" />
						<fl:fieldEdit property="EntSemLivrGuide_"/>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<fl:fieldEdit property="EntRefLngID_"  alt=""/>
						<fl:fieldEdit property="EntSaisonnier_" mandatoryMsgCode="MF1BE" style="width : 15%" alt=""/>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="FF01F" alt="Classement étoile"/>
						</td>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<fl:fieldEdit property="EntStarClassID_"  alt=""/>
						<fl:fieldEdit property="EntNormStarDt_"/>
<%-- 						<fl:fieldRead property="EntReclassDate_"/> --%>
						
						<fl:fieldEdit property="EntAnx_" alt=""/>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
						<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="FF022" alt="PMS"/>
						</td>
							<tr><td colspan="5" class="ligne_separation"/></tr>	
						<fl:fieldEdit property="EntPmsID_"  alt=""/>
											
						<% if(DISPLAY_PLAQUES){ %>
						<tr><td colspan="5" class="ligne_separation"/></tr>	
<%-- 						<fl:fieldEdit property="EntPlaqueAlu_"  alt="" mandatoryMsgCode="MF1C1"/> --%>
<%-- 						<fl:fieldEdit property="EntPlaqueCosseRiz_"  alt="" mandatoryMsgCode="MF1C2"/> --%>
							<fl:fieldEdit property="EntPlaqueAlu_"  alt=""/>
							<fl:fieldEdit property="EntPlaqueCosseRiz_"  alt=""/>
						<% } %>
						
						<%} else if (isAssociation) {%>
						<td class="titreInterneSmalltabs" colspan="5">
						<fl:getMessage code="LF09E" alt="Association"/>
						</td>
						<fl:fieldEdit property="EntTypoStructure_" onchange="doEntTypoStructure_Change();" alt=""/> 	 
						<% if(typoStructID.equalsIgnoreCase(departID)) { %>
						<tr>
							<td class="titrePartie"><fl:getMessage code="FF01D" alt="Département Association"/></td>
						
							<td class="dataValue noPaddingLeft">
								<fl:input property="EntDepartmentID_" onchange="doEntDepartmentID_Change();" alt="" mandatoryMsgCode="MF06D"/>
							</td>
						</tr>
						<%-- <tr>
							<td class="titrePartie"><fl:getMessage code="FF01C" alt="Région Association"/></td>
						
							<td class="dataValue noPaddingLeft">
								<fl:input property="EntRegionID_" alt="" readOnly="true"/>
							</td>
						</tr> --%>
						 
						<%} else if (typoStructID.equalsIgnoreCase(regionID)) {%>
						<tr>
							<td class="titrePartie"><fl:getMessage code="FF01C" alt="Région Association"/></td>
						
							<td class="dataValue noPaddingLeft">
								<fl:input property="EntRegionID_" onchange="doEntRegionID_Change();" mandatoryMsgCode="MF06E"/> 
							</td>
						</tr>
						 
						<%} else if(typoStructID.equalsIgnoreCase(departMultiID)) { %>
						<fl:fieldEdit property="EntMultiDep_" type="list" alt=""/>
						<%-- <fl:fieldEdit property="EntDepMulti_" type="list" alt="" mandatoryMsgCode="MF06D"/> --%>
						
						<%} else if(typoStructID.equalsIgnoreCase(paysID)) {%>
						<fl:fieldEdit property="EntPaysStruct_" type="list" />			
						<%} %>
						<fl:fieldEdit property="EntAssoDissolDt_"/>
						<tr class="fieldline">
							<td class="labelTitreFiche">
								<fl:label field="EntEditListLogis_"/>
							</td>
							<td class="dataValue">
								<fl:input property="EntEditListLogis_"/>
							</td>
						</tr>	
						<tr class="fieldline">
							<td class="labelTitreFiche">
								<fl:label field="EntGenCotDevis_"/>
							</td>
							<td class="dataValue">
								<fl:input property="EntGenCotDevis_"/>
							</td>
						</tr>

						<%} else if (isPartenaire) {%>
<%-- 						<fl:fieldEdit property="EntPhotoID_"/> --%>
                            <fl:fieldEdit property="EntSousGrp_" />
							<tr><td colspan="5" class="ligne_separation"/></tr>	
							<fl:fieldEdit property="EntInterlocuteurID_" />
							<tr><td colspan="5" class="ligne_separation"/></tr>	
							<fl:fieldEdit property="EntPartenaireID" />
						<%} %>
					</table>
				</td>
			</tr>
		</table>
			<table class="container" cellpadding="0">
			<tr class="ligne_separation"><td></td></tr>
			<tr>
				<td class="titrePartie"><fl:getMessage code="L64B4" alt="Commentaires"/></td>
			</tr>
			<tr>
				<td class="dataValue noPaddingLeft">
					<fl:input property="EntNotes" style="width:100%" nodiv="false"/>
				</td>
			</tr>
			<tr class="ligne_separation"><td></td></tr>
			<tr class="ligne_separation_couleur"><td></td></tr>
			<tr class="ligne_separation"><td></td></tr>
		</table>
		<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
		<fl:smallTabs name="EnterpriseTabs">
		<%if(isPartenaire) {%>
		<%-- Infos Société --%>
			<fl:sTab id="infosoc" title="<%= Utils.getMessage(session, \"LF005\", false, true, \"Infos société\") %>">
			<table class="container" cellpadding="0">
			<tr>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="EntSiret" onchange="doEntSiret_Change_();" />
					<fl:fieldEdit property="EntSiren"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntRCS_"/>
					<fl:fieldEdit property="EntCodeAPE_"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntTVAIntracom_"/>
					<fl:fieldEdit property="EntComptaNum_"/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF00E" alt="Coordonnées GPS"/>
					</td>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntGPSX_"/>
					<fl:fieldEdit property="EntGPSY_"/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF1D6" alt="Coordonnées Bancaires FIL"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					 </td> 
					<fl:fieldEdit property="EntBanque_"/>
					<fl:fieldEdit property="EntIBAN_"/>
					<fl:fieldEdit property="EntBIC_"/>
					
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF1D7" alt="Coordonnées Bancaires LIS"/>
					</td>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					 </td> 
					<fl:fieldEdit property="EntBanqueLis_"/>
					<fl:fieldEdit property="EntIBANLis_"/>
					<fl:fieldEdit property="EntBICLis_"/>
				</table>
			</td>
			</tr>
			</table>
			</fl:sTab>
			
			<%-- Infos Partenaire --%>
			<fl:sTab id="infopart" title="<%= Utils.getMessage(session, \"LF12E\", false, true, \"Infos Partenaire\") %>">
			<table class="container" cellpadding="0">
			<tr>
			<td class="column2">
				<table class="data_column" cellpadding="0">
				<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF218" alt="Evaluation qualitative & quantitative"/>
				</td> <tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntNbrvistMois_"/>
					<fl:fieldEdit property="EntNbrvisitAn_"/>
					<fl:fieldEdit property="EntRepartNational_"/>
					<fl:fieldEdit property="EntDureemoyCon_"/>
					<fl:fieldEdit property="EntPagepluslues_"/>
					<fl:fieldEdit property="EntDatePortail_"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF219" alt="Evaluation économique"/>
				</td> <tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntCAautres_"/>
					<fl:fieldEdit property="EntTauxcomission_"/>
					<fl:fieldEdit property="EntCategoriehotel_"/>
					<fl:fieldEdit property="EntModEco_" alt=""/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF21A" alt="Evaluation Technique"/>
					</td>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntlgXML_"/>
					<fl:fieldEdit property="Entpasserelle_"/>
					<fl:fieldEdit property="EntFluxXML_"/>	 
					<fl:fieldEdit property="EntFreqMAJ_" alt=""/>
					
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="L2087" alt="Accès"/>
					</td>
					<fl:fieldEdit property="EntDistriLogin_"/>
					
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF21B" alt="Evaluation du contenu"/>
					</td>
					<fl:fieldEdit property="Entchainehotel_"/>
					<fl:fieldEdit property="EntchaineRef_" query="[[EntTyeID:RefVal = 'PART']]"/>
				</table>
			</td>
			</tr>
			</table>
			</fl:sTab>
		<%} else if(isAssociation) {%>
		<%-- Infos Société --%>
			<fl:sTab id="infosoc" title="<%= Utils.getMessage(session, \"LF005\", false, true, \"Infos société\") %>">
			<table class="container" cellpadding="0">
			<tr>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					
					<fl:fieldEdit property="EntSiret" onchange="doEntSiret_Change_();" />
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="EntSiren"/>
					<fl:fieldEdit property="EntRCS_"/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="EntCodeAPE_"/>
					<fl:fieldEdit property="EntTVAIntracom_"/>
					<fl:fieldEdit property="EntComptaNum_"/>
				</table>
			</td>
			</tr>
			</table>
			</fl:sTab>
		<%} else if(!isAssociation && !isPartenaire) {%>
		<%-- Infos Société --%>
			<fl:sTab id="infosoc" title="<%= Utils.getMessage(session, \"LF005\", false, true, \"Infos société\") %>">
			<table class="container" cellpadding="0">
			<tr>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="EntSiret" onchange="doEntSiret_Change_();" />
					<fl:fieldEdit property="EntSiren"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntRCS_"/>
					<fl:fieldEdit property="EntCodeAPE_"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntTVAIntracom_"/>
					<fl:fieldEdit property="EntComptaNum_"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntCA_"/>
					<fl:fieldEdit property="EntNbEmployees_"/>
					<fl:fieldEdit property="EntAtvID_" alt=""/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF00E" alt="Coordonnées GPS"/>
					</td>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldEdit property="EntGPSX_"/>
					<fl:fieldEdit property="EntGPSY_"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF1D6" alt="Coordonnées Bancaires FIL"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					 </td> 
					<fl:fieldRead property="EntBanque_"/>
					<fl:fieldRead property="EntIBAN_"/>
					<fl:fieldRead property="EntBIC_"/>
					
					<td class="titreInterneSmalltabs" colspan="5">
					<fl:getMessage code="LF1D7" alt="Coordonnées Bancaires LIS"/>
					</td>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					 </td> 
					<fl:fieldRead property="EntBanqueLis_"/>
					<fl:fieldRead property="EntIBANLis_"/>
					<fl:fieldRead property="EntBICLis_"/>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column3">
				<table class="data_column" cellpadding="0">
				<fl:fieldEdit property="EntLimitedResto_"/>
				<fl:fieldEdit property="EntMajGA_"/>
				<fl:fieldEdit property="EntTauxRFAFournisseur_"/>
				<fl:fieldEdit property="EntTauxRestrocessHot_"/>
				</table>
			</td>
			</tr>
			</table>
			</fl:sTab>
			<%-- Prestations --%>
			<%-- <fl:sTab id="prestasoc" title="<%= Utils.getMessage(session, \"LF006\", false, true, \"Prestations\") %>">
			<table class="container" cellpadding="0">
			<tr>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="EntThema_" type="list"/>
					<fl:fieldEdit property="EntBankCardID_" />
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<fl:fieldEdit property="EntSpokLngID_"/>
				</table>
			</td>
			</tr>
			</table>
			</fl:sTab> --%>
		<%} %>
			<fl:sTab id="ATTACHMENT" title="<%= Utils.getMessage(session, \"L201C\", \"Documents joints\") %>">
				<fl:attach name="Enterprise" colID="EntAttID" edit="true" />
			</fl:sTab>
		</fl:smallTabs>
	</fl:bigTabs>
</fl:form>
