var js_enumeration_creation_echec_global = "";
var js_enumeration_creation_suppression_confirmation = "";
var js_enumeration_creation_suppression_enumere = "";
var js_enumeration_suppression_fils_et_mere = "";
var js_enumeration_creation_echec_ajout = "";

	function verifierFomulaireCreationEnumere(action)
	{
		var fr = document.forms[0].elements['fr'].value;
		var type = document.forms[0].elements['enum_type'].value;
		var idVantive = document.forms[0].elements['id_vantive'].value;

		bool = true;
		
		if(fr == "")
			bool = false;
			
		if(type == -1)
			bool = false;
			
		//if(idVantive == 0)
		//	bool = false;
			
		if(bool == false)
		{
			alert(js_enumeration_creation_echec_global);
			return false;
		}
		
		OnSubmit(action);
	}
	
	function supprimerEnumereFils(action, id)
	{
		if(confirm(js_enumeration_creation_suppression_confirmation))
		{
			initChamp('idEnumereASupprimer', id);
			OnSubmitWithAjax(action);
		}
	}
	

	function ajouterEnumere2(action, typeEnum)
	{
	 
		isOk = true;
		
		var type = document.forms[0].elements['enum_type'].value;
		var modeCreation = document.forms[0].elements['modeInit'].value;
	   
		if(type == -1) 
		{
			alert(js_enumeration_creation_echec_type);
			return false;
		}
		
		 
		if(type == "bannette_entite" || type == "bannette_type") 
		{
			alert(type + " : " + js_enumeration_creation_echec_association);
			return false;
		}
		
		
		if(type == "bannette niveau 1" || type == "bannette niveau 2") 
		{
			alert(type + " : Veuillez enregistrer l'énuméré avant de définir le type et l'entité");
			return false;
		}
		
		
		if(type == "spécialités" && modeCreation != "true") 
		{
			alert(type + " : Enuméré non standard, Veuillez enregistrer l'énuméré avant de définir les metiers et les bannettes associées");
			return false;
		}
		
		initChamp('typeEnumAAjouter', typeEnum);
		OnSubmitWithAjax(action);		
	}
	function supprimerEnumere(action)
	{
		if(confirm(js_enumeration_creation_suppression_enumere))
		{
			OnSubmit(action);
		}
	}