/* ---------------------------------------------------------------
	TINY MCE
 --------------------------------------------------------------- */
function affichageTinyMce() {
	
	// TINYMCE
	/*
	tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		entity_encoding : "raw",
		plugins : "paste,fullscreen,style",
theme_advanced_buttons1:"styleprops,bold,italic,underline,justifyleft,justifycenter,justifyright,justifyfull,formatselect,removeformat,undo,forecolor,fullscreen,code,link",
		theme_advanced_buttons2:"",
		theme_advanced_buttons3:"",
		theme_advanced_toolbar_location : "top"
	});
	// TINYMCE - ASTUCE IMPORTANTE
	$('#mySubmitButton').click(function() {
		var content = tinyMCE.activeEditor.getContent(); // get the content
		$('#contenu').val(content); // put it in the textarea
	});
*/


	// TINYMCE
	tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		entity_encoding : "raw",
		plugins : "paste,fullscreen,style",
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontsizeselect,|,forecolor,backcolor",
		theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,code,hr,removeformat,|,sub,sup,|,charmap,|,fullscreen",
		theme_advanced_buttons3 : "",
		theme_advanced_buttons4 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true
	});
	// TINYMCE - ASTUCE IMPORTANTE
	$('#mySubmitButton').click(function() {
		var content = tinyMCE.activeEditor.getContent(); // get the content
		$('#contenu').val(content); // put it in the textarea
	});
	
}
/* ---------------------------------------------------------------
	GESTION DES FORMULAIRE
 --------------------------------------------------------------- */
function gestionFormulaire(idFormulaire) {
	// AFFICHAGE DU FORMULAIRE
	$("#" + idFormulaire).fadeIn('slow');
	
	// FOCUS SUR LE PREMIER ELEMENT
	$("#" + idFormulaire + " :text:visible:enabled:first").focus();
	
	// SURVOL DES BOUTONS des boutons
	$("#submit input").each(function(){ survolBouton(this); });			
}
function gestionFormulaireSlide(idFormulaire) {
	// AFFICHAGE DU FORMULAIRE
	$("#" + idFormulaire).slideDown('slow');
	
	// FOCUS SUR LE PREMIER ELEMENT
	$("#" + idFormulaire + " :text:visible:enabled:first").focus();	
}
function gestionFormulaire2(idFormulaire) {
	// AFFICHAGE DU FORMULAIRE
	$("#" + idFormulaire).fadeIn('slow');
	
	// FOCUS SUR LE PREMIER ELEMENT
	$("#" + idFormulaire + " :text:visible:enabled:first").focus();	
}
/* ---------------------------------------------------------------
	REGLES FORMULAIRES
 --------------------------------------------------------------- */
function regleFormulaire() {
	
	var traitement = $('#traitement').attr('value');
	
	jQuery.validator.addMethod('verificationApple', function(id_apple) {
		   var postURL = "ajax/admin_roman/verification_apple.php";
		   $.ajax({
			   cache:false,
				async:false,
				type: "POST",
				data: "id_apple=" + id_apple + "&traitement=" + traitement,
				url: postURL, dataType: 'json',
				success: function(json) {
					result = (json.message_retour == '0') ? true : false;
				}//,
				//complete: function(json){
				//	var messageAlerte = json.message_alerte;
				//}
			});
			return result;
		}, 'Identifiant déjà utilisé !');

}
/* ---------------------------------------------------------------
	SURVOL DES BOUTONS
 --------------------------------------------------------------- */
function survolBouton(idBouton) {
	$(idBouton).hover(
		function(){
		// Affichage du fonds
			$(idBouton).attr("style","background-position: left bottom;");					
		},
		function(){
			$(idBouton).attr("style","background-position: left top;");					
		}
	);
}
/* ---------------------------------------------------------------
	BOUTONS DU MENU PRINCIPAL
 --------------------------------------------------------------- */
function boutonMenu(idBouton) {
	// Gestion du menu
	$('#menu_principal a').each( function(noeud){ $(this).removeAttr("style");	});
	$('#menu_principal li a span').each( function(noeud){ $(this).removeAttr("style");	});
	$('#menu_principal a').each( function(noeud){ $(this).focus(function() { $(this).blur(); } );	});
	$('#menu_' + idBouton).attr("style", "background-position: left bottom;color:#FFFFFF;");
	$('#menu_' + idBouton + ' span').attr("style", "top:65px;");
}
/* ---------------------------------------------------------------
	GESTION DES ANCRES
 --------------------------------------------------------------- */
function gestionAncre(idAncre) {
	$(idAncre).attr('onclick', 'return false');
	$(idAncre).focus(function() { $(idAncre).blur(); } );
}
/* ---------------------------------------------------------------
	MESSAGES
 --------------------------------------------------------------- */
function affichageMessage(statut , message){
	// Nettoyage de la zone
	$("#zone_message p").html('');
	$("#zone_message p").removeClass()
	// Insertion du message
	$("#zone_message p").html(message);
	// Affichage du message
	$("#zone_message p").fadeIn('normal');
	// Mise en forme css
	$("#zone_message p").addClass(statut);
	
	// Effacement du message le cas échéant
	if(statut == 'success') setTimeout('$("#zone_message p").fadeOut("slow")', 10000);
}
function affichageMessageCourt(monElement, message){
	// Affichage du message
	$("#" + monElement + " p.titre_form span").html(message);
	$("#" + monElement + " p.titre_form span").fadeIn('normal');
	// Effacement du message
	//setTimeout('$("#zone_message p").fadeOut("slow")', 10000);
}
/* ---------------------------------------------------------------
	FONCTIONS A LANCER LORS DU CHARGEMENT DE LA PAGE
 --------------------------------------------------------------- */
$(document).ready(function(){


});
// -------------------------------------------------------------