// JavaScript Document


var IE6 = false, IE7 = false,
 FIREFOX2  = false, FIREFOX  = false,
 NETSCAPE7 = false, NETSCAPE = false,
 OPERA9 = false, OPERA = false,
 AUTRE = false;
var strChUserAgent = navigator.userAgent;
var intSplitStart = strChUserAgent.indexOf("(",0);
var intSplitEnd = strChUserAgent.indexOf(")",0);
var strChStart = strChUserAgent.substring(0,intSplitStart);
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
var strChEnd = strChUserAgent.substring(strChEnd);

if(strChMid.indexOf("MSIE 7") != -1)
 IE7 = true;
else if(strChMid.indexOf("MSIE 6") != -1)
 IE6 = true;
else if(strChEnd.indexOf("Firefox/2") != -1)
 FIREFOX2 = true;
else if(strChEnd.indexOf("Firefox") != -1)
 FIREFOX = true;
else if(strChEnd.indexOf("Netscape/7") != -1)
 NETSCAPE7 = true;
else if(strChEnd.indexOf("Netscape") != -1)
 NETSCAPE = true;
else if(strChStart.indexOf("Opera/9") != -1)
 OPERA9 = true;
else if(strChStart.indexOf("Opera") != -1)
 OPERA = true;
else
 AUTRE = true;

/*****************************/
/* 		VOTE SUR OBJET		 */
/*****************************/
function createRequestObjectReponse() {
	var ro;
	ro = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
	return ro;
}
var httpReponse = createRequestObjectReponse();

function getXhr(){
					var xhr = null;
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr = new XMLHttpRequest();
	else if(window.ActiveXObject){ // Internet Explorer
	   try {
				xhr = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			}
	}
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   xhr = false;
	}
	return xhr
}
function showNote()
{
	//document.getElementById("note_link").style.display="none";
	document.getElementById("note_moyenne").style.display="block";
}

function HideNote(objetId,note)
{
	var xhr = getXhr()
    xhr.onreadystatechange = function(){
        // On ne fait quelque chose que si on a tout reçu et que le serveur est ok
        if(xhr.readyState == 4 && xhr.status == 200){
 			document.getElementById("note_moyenne").innerHTML = xhr.responseText;
        }
    }
    xhr.open("GET","/_ajax/noteObjet.cfm?objetId="+objetId+"&note=" + note,true);
    xhr.send(null);
}
function AddNote(objetId)
{
	var note = document.getElementById("notes").value;
	var xhr = getXhr()
    xhr.onreadystatechange = function(){
        // On ne fait quelque chose que si on a tout reçu et que le serveur est ok
        if(xhr.readyState == 4 && xhr.status == 200){
 			document.getElementById("note_moyenne").innerHTML = xhr.responseText;
        }
    }
    xhr.open("GET","/_ajax/noteObjet.cfm?objetId=" + objetId + "&add=1&note=" + note,true);
    xhr.send(null);
    //document.getElementById("note_link").innerHTML = ""
    setTimeout(function(){HideNote(objetId,note)}, 2000);
}
/*****************************/
/* ROLLOVERS SUR LES BOUTONS */
/*****************************/
function rollBouton(id,num) {
	//alert(id + num);
	if (num == null) {
		// cas où on a plusieurs id identiques, on ajoute un numéro à la fin
		document.getElementById(id).src = '/_images/boutons/roll_' + id + '.gif';
	} else {
		document.getElementById(id+num).src = '/_images/boutons/roll_' + id + '.gif';
	}
}
function rollOutBouton(id,num) {

	if (num == null) {
		// cas où on a plusieurs id identiques, on ajoute un numéro à la fin
		document.getElementById(id).src = '/_images/boutons/normal_' + id + '.gif';
	} else {
		document.getElementById(id+num).src = '/_images/boutons/normal_' + id + '.gif';
	}
}



/*****************************/
/* ROLLOVERS SUR LES ONGLETS */
/*****************************/
function rollOnglet(id) {
	document.getElementById(id).src = '/_images/onglets/' + id + '_roll.gif';
}
function rollOutOnglet(id) {
	document.getElementById(id).src = '/_images/onglets/' + id + '.gif';
}
function confirmContact(id)
{
	$("#demande_"+id).load("/_ajax/confirmcontact.cfm", {user_id: id, action: 'accept'}, function(){
		$("#bloc_contact").load("/_ajax/listecontactcommun.cfm");
	});
 	return false;
}
function refuseContact(id)
{
	$("#demande_"+id).load("/_ajax/confirmcontact.cfm", {user_id: id, action: 'refuse'});
	return false;
}
/*************************************/
/* 			CODE JQUERY 			 */
/*************************************/
$(document).ready(function(){
	jQuery.fn.extend({
	   findPos : function() {
	       obj = $(this).get(0);
	       var curleft = obj.offsetLeft || 0;
	       var curtop = obj.offsetTop || 0;
	       while (obj = obj.offsetParent) {
	                curleft += obj.offsetLeft
	                curtop += obj.offsetTop
	       }
	       return {x:curleft,y:curtop};
	   }
	});
	if (IE6 == false)
	{
		$('#erreur_profil_incomplet').center();
	}
	$("#close_erreur_profil_incomplet").bind("click", function(e){
	 	$("#erreur_profil_incomplet").hide("slow");
    });
	/*************************************/
	/*	 affichage du form de réponse	 */
	/*************************************/
	$("#bouton_repondre_message").bind("click", function(e){
	 	$("#bloc_reponse_message").show("slow");
    });
    $("#close_reponse_message").bind("click", function(e){
	 	$("#bloc_reponse_message").hide("slow");
    });



	/*************************************/
	/* LISTE DEROULANTE A CHOIX MULTIPLE */
	/*************************************/


	$(".select_multiple > li").hide("fast")
		.filter(".first_select")
		.show("fast");
	$(".first_select").bind("click", function(e){
	 	id = $(this).attr("id");
	 	id = id.replace("select_","");
		$("#"+id+" > li").slideToggle()
		.filter(".first_select")
		.show("fast");
    });

	/*************************************/
	/* 	   UPLOAD PHOTO USER_FRONT 		 */
	/*************************************/
    var button = $('#user_front_photo'), interval;
	$.ajax_upload(button,{
	action: '/_ajax/upload.cfm',
	name: 'myfile',
	onSubmit : function(file, ext){
		$("#loader").show("slow");
		// change button text, when user selects file
		button.text('Telechargement en cours');
		// If you want to allow uploading only 1 file at time,
		// you can disable upload button
		this.disable();
		// Uploding -> Uploading. -> Uploading...
		interval = window.setInterval(function(){
			var text = button.text();
				if (button.text().length < 13){
					button.text(button.text() + '.');
				} else {
					button.text('Telechargement en cours');
				}
			}, 200);
	},
	onComplete: function(file, response){
		var mesTests = response.split("|");

		var poids = mesTests[0];
		var extension = mesTests[1].toUpperCase();

		var erreur = "";
		var nbErreur = 0;
		if (poids >= 4000000)
		{
			erreur = erreur + "<li>La taille de votre photo ne doit pas ex&eacute;der 4 Mo</li>";
			nbErreur = nbErreur + 1;
		}
		if (extension <= "GIF" && extension <= "PNG" && extension <= "JPG" && extension <= "JPEG")
		{
			erreur = erreur + "<li>Votre photo doit &ecirc;tre au format : JPG, JPEG, GIF, PNG</li>";
			nbErreur = nbErreur + 1;
		}
		//alert(file);
		if (nbErreur == 0)
		{
			button.text('Choisir une photo');
			$("#gestion_photo").slideToggle("slow");
			$.post("/_ajax/resize.cfm", { imageName: file},function(data){
				$("#gestion_photo").html(data);
			});
			// Although plugins emulates hover effect automatically,
			// it doens't work when button is disabled
			window.clearInterval(interval);
			// enable upload button
			this.enable();
		}
		else
		{
			if ( IE6 == false)
		 	{
		 		$('#erreur_upload_photo').center();
		 	}
			$("#erreur_upload_photo").slideToggle("slow");
			$("#erreur_upload_photo").append("<ul>" + erreur + "</ul><img src=\"/_images/blocs/popup/bottom.jpg\" class=\"popup_bottom\" />");
			// Although plugins emulates hover effect automatically,
			// it doens't work when button is disabled
			window.clearInterval(interval);
			// enable upload button
			this.enable();
		}
	}
	});

	$("#close_erreur_upload_photo").bind("click", function(e){
	 	$("#erreur_upload_photo").slideToggle("slow");
	 	$("#erreur_upload_photo").html("<img src='/_images/pictos/close.jpg' alt='fermer' id='close_erreur_upload_photo' onclick='closeErrorPhoto();' />");
	 	button.text('Choisir une photo');
    });
	
	/*************************************/
	/* 	   		UPLOAD PHOTO BLOG		 */
	/*************************************/
    var button = $('#photo_blog'), interval;
	$.ajax_upload(button,{
	action: '/_ajax/upload_photo_blog.cfm',
	name: 'myfile',
	onSubmit : function(file, ext){
		$("#loader").show("slow");
		// change button text, when user selects file
		button.text('Telechargement en cours');
		// If you want to allow uploading only 1 file at time,
		// you can disable upload button
		this.disable();
		// Uploding -> Uploading. -> Uploading...
		interval = window.setInterval(function(){
			var text = button.text();
				if (button.text().length < 13){
					button.text(button.text() + '.');
				} else {
					button.text('Telechargement en cours');
				}
			}, 200);
	},
	onComplete: function(file, response){
		var mesTests = response.split("|");

		var poids = mesTests[0];
		var extension = mesTests[1].toUpperCase();

		var erreur = "";
		var nbErreur = 0;
		if (poids >= 4000000)
		{
			erreur = erreur + "<li>La taille de votre photo ne doit pas ex&eacute;der 4 Mo</li>";
			nbErreur = nbErreur + 1;
		}
		if (extension <= "GIF" && extension <= "PNG" && extension <= "JPG" && extension <= "JPEG")
		{
			erreur = erreur + "<li>Votre photo doit &ecirc;tre au format : JPG, JPEG, GIF, PNG</li>";
			nbErreur = nbErreur + 1;
		}
		//alert(file);
		if (nbErreur == 0)
		{
			button.text('Choisir une photo');
			$("#gestion_photo").slideToggle("slow");
			$.post("/_ajax/resize_blog.cfm", { imageName: file},function(data){
				$("#gestion_photo").html(data);
			});
			// Although plugins emulates hover effect automatically,
			// it doens't work when button is disabled
			window.clearInterval(interval);
			// enable upload button
			this.enable();
		}
		else
		{
			if ( IE6 == false)
		 	{
		 		$('#erreur_upload_photo').center();
		 	}
			$("#erreur_upload_photo").slideToggle("slow");
			$("#erreur_upload_photo").append("<ul>" + erreur + "</ul><img src=\"/_images/blocs/popup/bottom.jpg\" class=\"popup_bottom\" />");
			// Although plugins emulates hover effect automatically,
			// it doens't work when button is disabled
			window.clearInterval(interval);
			// enable upload button
			this.enable();
		}
	}
	});

	$("#close_erreur_upload_photo").bind("click", function(e){
	 	$("#erreur_upload_photo").slideToggle("slow");
	 	$("#erreur_upload_photo").html("<img src='/_images/pictos/close.jpg' alt='fermer' id='close_erreur_upload_photo' onclick='closeErrorPhoto();' />");
	 	button.text('Choisir une photo');
    });


	/*************************************/
	/* 	  	   UPLOAD DOCUMENT	 		 */
	/*************************************/
    var button = $('#document_upload'), interval;
	$.ajax_upload(button,{
	action: '/_ajax/upload_document.cfm',
	name: 'myfile',
	onSubmit : function(file, ext){
		// change button text, when user selects file
		button.html('Telechargement en cours<img src="/_images/pictos/ajax-loader.gif" alt="telechargement" />');
		// If you want to allow uploading only 1 file at time,
		// you can disable upload button
		this.disable();
		// Uploding -> Uploading. -> Uploading...
		interval = window.setInterval(function(){
			var text = button.text();
				if (button.text().length < 13){
					button.text(button.text() + '.');
				} else {
					button.html('Telechargement en cours<img src="/_images/pictos/ajax-loader.gif" alt="telechargement" />');
				}
			}, 200);
	},
	onComplete: function(file, response){
		var mesTests = response.split("|");
		var poids = mesTests[0];
		var fileName = mesTests[1];
		var extension = mesTests[2].toUpperCase();

		var erreur = "";
		var nbErreur = 0;
		if (poids >= 5000000)
		{
			erreur = erreur + "<li>La taille de votre document ne doit pas ex&eacute;der 5 Mo</li>";
			nbErreur = nbErreur + 1;
		}
		if (extension != "GIF" && extension != "PNG" && extension != "JPG" && extension != "JPEG" && extension != "XLS" && extension != "XLSX" && extension != "DOC" && extension != "DOCX" && extension != "PPT" && extension != "PPTX" && extension != "PDF" )
		{
			//console.log(extension);
			erreur = erreur + "<li>Votre document doit &ecirc;tre au format : JPG, JPEG, GIF, PNG, DOC, DOCX, XLS, XLSX, PPT, PPTX, PDF</li>";
			nbErreur = nbErreur + 1;
		}
		if (nbErreur == 0)
		{
			//Détéction de l'extension pour affichage picto
			var lePicto = "";
			switch (trim(extension))
			{
				case 'JPG' : lePicto = "jpg"; break;
				case 'GIF' : lePicto = "jpg"; break;
				case 'JPEG' : lePicto = "jpg"; break;
				case 'PNG' : lePicto = "jpg"; break;
				case 'DOC': lePicto = "word"; break;
				case 'DOCX' : lePicto = "word"; break;
				case 'XLS' : lePicto = "excel"; break;
				case 'XLSX' : lePicto = "excel"; break;
				case 'PPT' : lePicto = "powerpoint"; break;
				case 'PPTX' : lePicto = "powerpoint"; break;
				case 'PDF' : lePicto = "pdf"; break;
				default : lePicto = "";
			}
			button.text('Changer mon document');
			$("#document_name").html("<span class='document_file_name'><img src='/_images/pictos/" + lePicto + ".jpg' alt='' />" + fileName + "</span>");
			$("#document_fichier").val(fileName);
			window.clearInterval(interval);
			this.enable();
		}
		else
		{
			if ( IE6 == false)
		 	{
		 		$('#erreur_document_upload').center();
		 	}
			$("#erreur_document_upload").slideToggle("slow");
			$("#erreur_document_upload").append("<ul>" + erreur + "</ul><img src=\"/_images/blocs/popup/bottom.jpg\" class=\"popup_bottom\" />");
			window.clearInterval(interval);
			this.enable();
		}
	}
	});

	$("#close_erreur_document_upload").bind("click", function(e){
	 	$("#erreur_document_upload").slideToggle("slow");
	 	button.html('<img src="/_images/boutons/normal_ajouterLeDocument.gif" style="cursor: pointer;" alt="Ajouter le document" id="ajouterLeDocument1" onmouseover="rollBouton(\'ajouterLeDocument\',1);" onmouseout="rollOutBouton(\'ajouterLeDocument\',1);" />');
	 	window.clearInterval(interval);
			this.enable();
    });


	/*************************************/
	/* 			CADRER LA PHOTO 		 */
	/*************************************/
	$('#resizeMe').Resizable(
	{
		minWidth: 93,
		minHeight: 94,
		maxWidth: 93,
		maxHeight: 92,
		minTop: 1,
		minLeft: 1,
		maxRight: 400,
		maxBottom: 450,
		dragHandle: true,
		handlers: {
			se: '#resizeSE',
			e: '#resizeE',
			ne: '#resizeNE',
			n: '#resizeN',
			nw: '#resizeNW',
			w: '#resizeW',
			sw: '#resizeSW',
			s: '#resizeS'
		},
		onDragStop : function(size, position) {
			posResize = $('#resizeMe').findPos();
			posFond = $('#toberesize').findPos();
		}
	}
	)

	/*************************************/
	/* 		 INSCRIPTION NEWSLETTER		 */
	/*************************************/

    $("#valider_inscription_newsletter").click(function() {
		$('#form_newsletter').submit(function() {
			$.post('/_ajax/inscription_li.cfm',
			function(data)
			{
				$("#confirm_inscription_li").slideToggle("slow");
				$("#confirm_inscription_li").append(data);
			}
			);
			return false;
		});
	});
	$("#close_confirm_inscription_li").bind("click", function(e){
	 	$("#confirm_inscription_li").slideToggle("slow");
    });

	/*************************************/
	/* 		    TAGGAGE DOCUMENT     	 */
	/*************************************/
	$(".tag").mouseover( function() {
		id = $(this).attr("id");
		id = id.replace("tag_","");
		$("#punaise_" + id).fadeIn();
	} );
	$(".tag").mouseout( function() {
		id = $(this).attr("id");
		id = id.replace("tag_","");
		$("#punaise_" + id).fadeOut();
	} );
	$("#display_tag").mouseover( function() {
		$(".punaise").fadeIn();
		$(".punaise_legende").fadeIn();
	} );
	$("#display_tag").mouseout( function() {
		$(".punaise").fadeOut();
		$(".punaise_legende").fadeOut();
	} );



	$(".add_contact").bind("click", function(e){
		toClose = this.id;
		 $("#confirm_inscription_li").load("/_ajax/addcontact.cfm", {user_id: this.id}, function(){
		 	if ( IE6 == false)
		 	{
		 	$('#confirm_inscription_li').center();
		 	}
		 	$("#"+toClose).hide("slow");
		 	$("#confirm_inscription_li").slideToggle("slow");
		 });
	 	return false;
    });
    $(".accepter_contact").bind("click", function(e){
		id = this.id;
		id = id.replace("accepte_","");
		 $("#demande_"+id).load("/_ajax/confirmcontact.cfm", {user_id: id, action: 'accept'}, function(){
		 	$("#bloc_contact").load("/_ajax/listecontactcommun.cfm");
		 });
	 	return false;
    });
    $(".refuser_contact").bind("click", function(e){
		id = this.id;
		id = id.replace("refuse_","");
		$("#demande_"+id).load("/_ajax/confirmcontact.cfm", {user_id: id, action: 'refuse'});
	 	return false;
    });
    
    /*************************************/
	/* 		   	   MOT CLES     		 */
	/*************************************/

    $("#ok_keyword").bind("click", function(e){
		$.post('/_ajax/getMotClefId.cfm', { keyword: $("#motcles_choisis").val() },
		function(data)
		{
			var tableau = data.split('/');
			if (trim(tableau[0]) == "0")
			{
				$("#no_keyword").html("<span style='color: #FF0000;'>Ce mot cl&eacute; n'est pas dans notre dictionnaire");
			}
			else
			{
				$("#document_motscles").val($("#document_motscles").val() + ',' + trim(tableau[0]))
				$("#no_keyword").html("");
				$("#selected_keyword").append('<li id="keyword_'+trim(tableau[0])+'"><span class="delete_keyword" onclick="deleteKeyWord('+trim(tableau[0])+');" style="cursor: pointer; color: #FF0000; float: right;">X</span>'+tableau[1]+'</li>');
			}
			$("#motcles_choisis").val("");
		});
    });

    /*************************************/
	/* 	   AFFICHAGE INFO PRODUCTEUR 	 */
	/*************************************/
    $("#infoProducteur").bind("click", function(e){
    	$("#bloc_info_producteur").slideToggle("slow");
    	return false;
    });
    $("#close_info_producteur").bind("click", function(e){
    	$("#bloc_info_producteur").hide("slow");
    });

    /*************************************/
	/* 	  LIEN VIDEO AVANT PREMIERE		 	 */
	/*************************************/
    $(".lien_video_ap").bind("click", function(e){
    	var monId = $(this).attr("id");
    	if (monId == 'lien_curiosphere')
    	{
    		$("#lien_video_ap").slideToggle("slow");
    	}
    });
    $("#close_lien_video_ap").bind("click", function(e){
    	$("#lien_video_ap").hide("slow");
    });
	$("#close_popup_exclus_droit").bind("click", function(e){
    	$("#popup_exclus_droit").hide("slow");
    });


	/*************************************/
	/* 			  LIEN DESINSCRIPTION		 		 */
	/*************************************/
	if (IE6 == false)
	{
		$('#desinscription').center();
	}
	$(".desinscription").bind("click", function(e){
    	$("#desinscription").show("slow");
    	return false;
    });
    $("#close_desinscription").bind("click", function(e){
    	$("#desinscription").hide("slow");
    });
    $("#ok_desinscription").bind("click", function(e){
    	$("#desinscription").hide("slow");
    });
    /*************************************/
	/* 	  				ADMIN BLOG		 */
	/*************************************/
	/*************************************/
	/*			COMMENTAIRE		         */
	/*************************************/
    
	$(".commentaire_categ").bind("click", function(e){
    	id = this.id;
    	var tableau=id.split("_");
    	var idCateg = "";
    	var listIdBillet = "";
    	for (var i=0; i<tableau.length; i++) {
    		idCateg = tableau[0];
    		listIdBillet = tableau[1];
    	}
    	$(".titre_categ_"+idCateg).slideToggle("slow");
    	var splitId=listIdBillet.split("|");
    	for (var i=0; i<splitId.length; i++) {
    		if ($(".contributeur_categ_"+idCateg+"_"+splitId[i]).css('display') == "block")
	    	{
	    		$(".contributeur_categ_"+idCateg+"_"+splitId[i]).hide("slow");
	    	}
	    	if ($(".contenu_categ_"+idCateg+"_"+splitId[i]).css('display') == "block")
	    	{
	    		$(".contenu_categ_"+idCateg+"_"+splitId[i]).hide("slow");
	    	}
    	}
    });
    $(".commentaire_titre_billet").bind("click", function(e){
    	id = this.id;
    	id = id.replace("titre_categ_","");
    	$(".contributeur_categ_"+id).slideToggle("slow");
    	$(".contenu_categ_"+id).slideToggle("slow");
    });
    $(".comToApprouve").bind("click", function(e){
    	id = this.id;
    	if ($('.commentaire_titre_billet').css('display') == "block")
    	{
    		$(".commentaire_titre_billet").hide("slow");
    	}
    	if ($('.commentaire_titre_billet').css('display') == "block")
    	{
    		$(".commentaire_contributeur").hide("slow");
    	}
    	if ($('.commentaire_titre_billet').css('display') == "block")
    	{
    		$(".commentaire_contenu").hide("slow");
    	}
    	var tableau=id.split(",");
    	var tableau2="";
    	var categId = "";
    	var billetId = "";
    	var commentId = "";
		for (var i=0; i<tableau.length; i++) {
			var tableau2=tableau[i].split("/");
			categId = tableau2[0];
			billetId = tableau2[1];
			commentId = tableau2[2];
			if ($(".titre_categ_" + categId).css('display') == "none")
	    	{
	    		$(".titre_categ_" + categId).show("slow");
	    	}
	    	if ($(".contenu_categ_" + categId + "_" + billetId).css('display') == "none")
	    	{
	    		$(".contenu_categ_" + categId + "_" + billetId).show("slow");
	    	}
	    	if ($(".contributeur_categ_" + categId + "_" + billetId).css('display') == "none")
	    	{
	    		$(".contributeur_categ_" + categId + "_" + billetId).show("slow");
	    	}
		}
    });

    if ($('.deleteUser').size() > 0) {
		deleteContributeur();
	}
    if ($('.relanceUser').size() > 0) {
		relanceContributeur();
	}
    /*************************************/
	/* 				FIN ADMIN BLOG		 */
	/*************************************/
	
		
		$(".preview_commentaire").mouseover(
			function () {
				id = this.id;
				id = id.replace("preview_container_","");
				document.getElementById("preview_"+id).style.display = "block";
				//$("#preview_"+id).show("slow");
			}
	    );
	    $(".preview_commentaire").mouseout(
			function () {
				id = this.id;
				id = id.replace("preview_container_","");
				document.getElementById("preview_"+id).style.display = "none";
			}
	    );
	    
	    $("#lien_categ_categ_id_0").bind("click", function(e){
	    	if ($("#lien_categ_categ_id_0").attr("checked") == true)
	    	{
	    		$(".categ_lien_check").attr("checked",true);
	    		$("#label_tous_lien").html("<span style='font-weight: bold;'>Tout d&eacute;cocher</span>");
	    	}
	    	else
	    	{
	    		$(".categ_lien_check").attr("checked",false);
	    		$("#label_tous_lien").html("<span style='font-weight: bold;'>Toutes les rubriques</span> (apparaitra sur tous vos billets)");
	    	}
	    });
});
/*************************************/
/* 			FIN CODE JQUERY 		 */
/*************************************/

function deleteContributeur()
{
	
	$(".deleteUser").bind("click", function(e){
		var idToDelete = this.id;
		idToDelete = idToDelete.split("_");
		idToDelete = idToDelete[1];
		$("body").prepend("<div id='deleteRedacteurContainer'>Confirmer la suppression<br /><span class='confirmDeleteRedacteur' id='confirmDeleteRedacteur_" + idToDelete + "'>OUI</span> | <span class='annulDeleteRedacteur'>NON</span></div>");
		$("#deleteRedacteurContainer").center();
		$(".confirmDeleteRedacteur").bind("click", function(e){
			var idToConfirm = this.id;
			idToConfirm = idToConfirm.split("_");
			idToConfirm = idToConfirm[1];
			$.ajax({
				type	: "POST",
				url		: '/_blog/_admin/delete-redacteur.cfm',
				data	: "contributeur_id="  + idToConfirm,
				success: function(data) {
					window.location.href = "";
				}
			});
		});
		$(".annulDeleteRedacteur").bind("click", function(e){
			$("#deleteRedacteurContainer").remove();
		});
		return false;
    });
}
function relanceContributeur()
{
	
	$(".relanceUser").bind("click", function(e){
		var idToRelance = this.id;
		idToRelance = idToRelance.split("_");
		idToRelance = idToRelance[1];
		$("body").prepend("<div id='relanceRedacteurContainer'>confirmer l'envoi d'une nouvelle invitation &agrave; " + $("#contributeurPseudo_" + idToRelance).val() + "<br /><span class='confirmRelanceRedacteur' id='confirmRelanceRedacteur_" + idToRelance + "'>OUI</span> | <span class='annulRelanceRedacteur'>NON</span></div>");
		$("#relanceRedacteurContainer").center();
		$(".confirmRelanceRedacteur").bind("click", function(e){
			var idToConfirm = this.id;
			idToConfirm = idToConfirm.split("_");
			idToConfirm = idToConfirm[1];
			$.ajax({
				type	: "POST",
				url		: '/_blog/_admin/relance-redacteur.cfm',
				data	: "contributeur_id="  + idToConfirm,
				success: function(data) {
					window.location.href = "";
				}
			});
		});
		$(".annulRelanceRedacteur").bind("click", function(e){
			$("#relanceRedacteurContainer").remove();
		});
		return false;
    });
}

function addContact(toClose)
{
	$("#confirm_inscription_li").load("/_ajax/addcontact.cfm", {user_id: toClose}, function(){
		if (IE6 == false)
		{
		$('#confirm_inscription_li').center();
		}
		$("#"+toClose).hide("slow");
		$("#confirm_inscription_li").slideToggle("slow");
	});
 	return false;
}
function showExclu(siteName)
{
	$("#exclus_site_source").html(siteName);
	$("#popup_exclus_droit").slideToggle("slow");
}
function deleteKeyWord(id)
{
	$("#keyword_"+id).hide("slow");
	$.post('/_ajax/clearKeyword.cfm', { liste_id: $("#document_motscles").val(), keyword_to_delete : id },
	function(data)
	{
		$("#document_motscles").val(data);
	});

}
function closeErrorPhoto()
{
	$("#erreur_upload_photo").slideToggle("slow");
 	$("#erreur_upload_photo").html("<img src='/_images/pictos/close.jpg' alt='fermer' id='close_erreur_upload_photo' />");
 	button.text('Choisir une photo');
}
function slideMessage(id)
{
	if ( $("#slide_" + id).attr("src") == "/_images/blocs/bloc255_toggle_close.png")
	{
		$("#slide_" + id).attr("src","/_images/blocs/bloc255_toggle_open.png");
	}
	else
	{
		$("#slide_" + id).attr("src","/_images/blocs/bloc255_toggle_close.png");
	}

	$("#corps_" + id).slideToggle("slow");
}

function deconnexion()
{
	$.ajax({
	  url: "/_ajax/deconnexion.cfm"
	});
}
function connexion()
{
	$.ajax({
	  url: "/_ajax/connexion.cfm"
	});
}

function showNewComment(listId)
{
	alert(listId);
}
