<!-- 
	$(document).ready(function() {				$('#site_editeur_stats_processing').click(function() {			$('#site_editeur_hidden').triggerHandler('click');		});			/* Mise à jour automatique de l'année dans le footer */		$("#footer span#year").text((new Date).getFullYear());
		$('.infobull').hide( );
		
		/* CSS */
		$( 'input[name=rubrique_4[]]' ).closest( '.rubrique' ).css( 'border', 'none' );
	
		/* RESET FORMULAIRE VALEUR DEFAUT */
		$( '#reset' ).click( function( ){
			$( this ).closest( 'form' ).find( 'input[type=text]' ).val( '' );
			$( this ).closest( 'form' ).find( 'textarea' ).val( '' );
			return false;
		});
		
		/* LIENS - NOUVEL ONGLET */
		$( 'a.newwindow' ).click( function( ){
			window.open( $( this).attr( 'href' ) );
			return false;
		});
		
		/* LIENS - MAILTO */
		$( 'a.mailto ').click( function( ){
			$( this ).hide();
		});
		
		/* FORMULAIRE RECHERCHE - CHECKBOX */
		$( '#recherche' ).find( "input[type='checkbox']" ).click( function( )
		{
			var sName = $( this ).attr( 'name' );
			/* Mise a part la dernière rubrique, on met en place le fonctionnement des Radios pour les Checkbox */
			if( sName != 'rubrique_4[]' ) {
				$( "input[name=" + sName + "]" ).each( function( )
				{
					$( this ).attr( 'checked', '' );
				});
				$( this ).attr( 'checked', 'checked' );
				_disabledCheckbox( sName, $( this ).val( ) );
			}
		});

		/* Applique au chargement _disabledCheckbox sur les Checkbox*/
		$( '#recherche' ).find( "input[type='checkbox']:checked" ).each( function( )
		{
			_disabledCheckbox( $( this ).attr( 'name' ), $( this ).val( ) );
		});
		
		/* Désactive les checkbox de la rubrique 3 et 4 si une option differente de celle ayant la valeur 4 dans la rubrique 2 est checked */
		function _disabledCheckbox( sName, iVal )
		{
			if( sName == 'rubrique_2[]' ) {
				if( iVal != 4 ) {
					$( "input[name=rubrique_3[]], input[name=rubrique_4[]] " ).each( function( ){
						$( this ).attr( 'checked', '' );
						$( this ).attr( 'disabled', 'disabled' );
					});
				}
				else {
					$( "input[name=rubrique_3[]], input[name=rubrique_4[]]" ).each( function( ){
						$( this ).attr( 'disabled', '' );
					});
				}
			}
			if( sName == 'rubrique_3[]' ) {
				if( iVal != 9 ) {
					$( "input[name=rubrique_4[]] " ).each( function( ) {
						if ( $( this ).val( ) == '13' || $( this ).val( ) == '14' ) {
							$( this ).attr( 'disabled', 'disabled' );
							$( this ).attr( 'checked', '' );
						}
						else {
							$( this ).attr( 'disabled', '' );
						}
					});
				}
				else {
					$( "input[name=rubrique_4[]]" ).each( function( ){
						
						if ( $( this ).val( ) == '15' || $( this ).val( ) == '16' ) {
							$( this ).attr( 'disabled', 'disabled' );
							$( this ).attr( 'checked', '' );
						}
						else {
							$( this ).attr( 'disabled', '' );
						}
					});
				}
			}
		}
		
		/* FONCTIONNALITES - SLIDE */
		/* Sur un seul */
		$( '.functionalities li span.children, .functionalities li span.fonctionnalite,' ).click( function( e )
		{
			var oLi = $( this ).closest( 'li' );
			oLi.children( '.functionalities' ).slideToggle( 'normal' );
			if ( oLi.children( '.children' ).hasClass( 'hidechildren' ) ||	oLi.children( '.children' ).hasClass( 'showchildren' ) ) {
				oLi.children( '.children' ).toggleClass( 'hidechildren' );
				oLi.children( '.children' ).toggleClass( 'showchildren' );
			}
				
			e.stopPropagation();
		});
		
		/* Sur tous */
		var bClickAllChildren 	= false;
		var sTypeSlide 			= 'slideDown';
		var bInverse 			= false;
		
		$( '#allchildren' ).click( function( ) {
			if ( ! bClickAllChildren ) {
				bClickAllChildren = true;
				
				$( this ).css( 'cursor', 'wait' );
				
				if ( sTypeSlide == 'slideDown' ) {
					$( this ).toggleClass( 'hidechildren' );
					$( this ).toggleClass( 'showchildren' );
					
					_slideAllOneByOne( sTypeSlide, $( '.functionalities li:has(.children.hidechildren)' ), $( this ) );
					sTypeSlide = 'slideUp';
				}
				else if ( sTypeSlide == 'slideUp' ) {
					$( this ).toggleClass( 'hidechildren' );
					$( this ).toggleClass( 'showchildren' );

					_slideAllOneByOne( sTypeSlide, $( '.functionalities li:has(.children.showchildren)' ), $( this ) );
					sTypeSlide = 'slideDown';
				}
			}
			else {
				bInverse = true;
			}
		});
		
		/* Fait apparaitre / disparaitre les elements les uns a la suite des autres et non tous en meme tps, sinon il y a un ralentissement */
		function _slideAllOneByOne( sTypeSlide, parent, btAllchildren, currentIndex )
		{
			if ( bInverse ) {
				bInverse = false;
				bClickAllChildren = false;
				btAllchildren.click( );
			}
			else {
				currentIndex = typeof( currentIndex ) === "undefined" ? 0 : currentIndex;

				if ( sTypeSlide == 'slideDown' ) {
					/* Passe a l'element suivant si celui-ci est est deja visible */
					if( parent.slice( currentIndex, currentIndex + 1 ).children( '.functionalities' ).css('display') != 'none' ) {
						parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).removeClass( 'hidechildren' );
						parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).addClass( 'showchildren' );
						currentIndex++;
						
					}
					
					oChildren = parent.slice( currentIndex, currentIndex + 1 ).children( '.functionalities' );
					if( oChildren.length > 0 ) {
						oChildren.slideDown( 'fast', function( ){
							parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).removeClass( 'hidechildren' );
							parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).addClass( 'showchildren' );
						
							currentIndex++;
							if ( currentIndex <  parent.length ) {
								_slideAllOneByOne( sTypeSlide, parent, btAllchildren, currentIndex );
							}
							else if ( currentIndex == parent.length ) {
								bClickAllChildren = false;
								btAllchildren.css( 'cursor', 'pointer' );
							}
						});
					}
					else {
						bClickAllChildren = false;
						btAllchildren.css( 'cursor', 'pointer' );
					}
					
				}
				else if ( sTypeSlide == 'slideUp' ){
					/* Passe a l'element suivant si celui-ci est est deja cache */
					if( parent.slice( currentIndex, currentIndex + 1 ).children( '.functionalities' ).css('display') != 'block' ) {
						parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).removeClass( 'showchildren' );
						parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).addClass( 'hidechildren' );
						currentIndex++;
					}
					
					oChildren = parent.slice( currentIndex, currentIndex + 1 ).children( '.functionalities' );
					if( oChildren.length > 0 ) {
						oChildren.slideUp( 'fast', function(){
							parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).removeClass( 'showchildren' );
							parent.slice( currentIndex, currentIndex + 1 ).children( '.children' ).addClass( 'hidechildren' );
						
							currentIndex++;
							if ( currentIndex <  parent.length ) {
								_slideAllOneByOne( sTypeSlide, parent, btAllchildren, currentIndex );
							}
							else if ( currentIndex == parent.length ) {
								bClickAllChildren = false;
								btAllchildren.css( 'cursor', 'pointer' );
							}
						});
					}
					else {
						bClickAllChildren = false;
						btAllchildren.css( 'cursor', 'pointer' );
					}
				}
			}
		}
		
		/* INFOBULL */
		/* Div de reference ( en position relative ) */
		var divRef = $( '#page' );
		//La coordonnee "e.pageX" etant basee sur les dimensions de l'ecran, on la base sur celle de la divRef
		var ecartRef = ( screen.availWidth - ( divRef.css( 'width' ).replace( 'px', '' ) ) ) / 2;
		
		var bHideInfobull = true;
		
		$( '.cible:has( .infobull )' ).mouseover( function( e )
		{
			var variables = { "infobulltextencode" : $(this).children('span').html() };
			var oContenuPointe = $(this);
			$.ajax({
				type: "POST",
				url: "/ajax/htmlentitydecode/format/json",
				data: variables,
				dataType: 'json',
				async: false,
				success: function ( msg ) {
					var sHtmlClose = '<div id="closeinfobull"><img src="/img/close.gif" title="Fermer l\'infobulle" alt="Fermer l\'infobulle" /></div>';
					if ($("#infobull").length)
						$("#infobull").html( sHtmlClose + msg.infobulltextdecode + sHtmlClose );
					else
						$("#content").prepend(
								'<div id="infobull">'
									+ sHtmlClose
									+ msg.infobulltextdecode
									+ sHtmlClose +
								'</div>');
				}
			});
		
			var xOffset = ecartRef + 23;
			var yOffset = 165;

			if ( $( this ).closest( '.functionalities' ).length > 0 || $( this ).closest( '#solutions' ).length > 0 ) {
				xOffset = e.pageX - ecartRef;
				yOffset = e.pageY + 11;
				$("#infobull").css( 'width', 'auto');
			}

			if ( $.browser.msie && $.browser.version < 7 ) {
				$("#infobull").css( 'top', yOffset + 'px' );
				$("#infobull").css( 'left', ( xOffset + 47 ) + 'px' );

				if ( $( this ).closest( '.functionalities' ).length > 0 ) {
					$("#infobull").css( 'width', 500 + 'px' );
					$("#infobull").css( 'left', xOffset + 'px' );
				}
				else {
					$("#infobull").css( 'width', 605 + 'px' );
				}
			}
			else {
				$("#infobull").css( 'top', yOffset + 'px' );
				$("#infobull").css( 'left', xOffset + 'px' );
			}

			$('#infobull').show( );
			bHideInfobull = false;
		});
		
		$( '#infobull' ).live("mouseover", function( e )
		{
			bHideInfobull = false;
		});	
				
		$( '#infobull' ).live("mouseout", function( e )
		{
			bHideInfobull = true;
			setTimeout( hideOrNotInfobull, 500 );
		});
		
		$( '.cible:has( .infobull )' ).mouseout( function( e )
		{
			bHideInfobull = true;
			setTimeout( hideOrNotInfobull, 500 );
		});
		$( '#closeinfobull img' ).live( 'click', function( ){
			bHideInfobull = true;
			$( '#infobull' ).hide( );
		});
		
		function hideOrNotInfobull( )
		{
			if( bHideInfobull ) {
				$('#infobull').fadeOut( 'slow', function( ){
					if( ! bHideInfobull ) {
						$('#infobull').fadeIn( 'normale');
					}
				} );
			}
		}
		
		/* BOUTON "EXPERIENCE" */
		$('.bt_exp').click( function( )
		{
			var id = $(this).attr('id');
			var split = id.split('_');
			
			window.location = '/progiciel/experience/reference/' + split[2];
		});
		
		$('.exp_title').click( function( )
		{
			$('.exp_content').hide( );
			if( $(this).prev( '.exp_fleche' ).hasClass( 'opened' ) ) {
				$(this).prev( '.exp_fleche' ).removeClass( 'opened' );
			}
			else {
				$( '.exp_fleche' ).removeClass( 'opened' );
				$(this).prev( '.exp_fleche' ).addClass( 'opened' );
				var id = $(this).attr('id');
				var split = id.split('_');
				$('#exp_content_' + split[2]).show( );
			}		
		});
		
		$('.cons_title').click( function( )
		{
			var id = $(this).attr('id');
			var split = id.split('_');
			
			$('.cons_content').hide();
			$('.cons_content_' + split[2]).show();
		});
		
		$('.cons_content').hide();
		$(".cons_contener .cons_content:first").show();

		/* ADMINNISTRATION */
		
		/* TOUS SUPPRIMER */
		$( '#selectAll' ).toggle(
			function( ){
				$( "input[type=checkbox]" ).not( 'input[name=isindependantes[]]' ).attr( 'checked', 'checked' );
				$( this ).text( 'Tout désélectionner' );
			},
			function( ){
				$( "input[type=checkbox]" ).not( 'input[name=isindependantes[]]' ).attr( 'checked', '' );
				$( this ).text( 'Tout sélectionner' );
			}
		);
		
		/* Lien d'ajout suivit d'une list -> modifie l'url en fonction de la selection */
		$.each( [ '#adduser', '#addprogiciel', '#addenvironnement', '#addexperience', '#addfonctionnalite', '#addconseil' ], function( i, id ){
			$( id ).click( function( ){
				if ( $( this ).siblings( 'select' ).length > 0 ) {
					$( this ).attr( 'href', stripAccents( $( this ).attr( 'href') + $( this ).siblings( 'select' ).val( ) ) );
				}
			});
		});
		
		$( '.actionselect a' ).click( function( ){
			$( this ).attr( 'href', $( this ).siblings( 'select' ).val() );
		});
		
		/* tinyMCE */
		if (typeof( tinyMCE ) !== 'undefined' ) {
			tinyMCE.init({
				// General options
				language: 'fr',
				mode : "textareas",
				theme : "advanced",
				plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
	
				// Theme options
				theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
				theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
				theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
				theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : true,
	
				// Example content CSS (should be your site CSS)
				content_css : "css/content.css",
	
				// Drop lists for link/image/media/template dialogs
				template_external_list_url : "lists/template_list.js",
				external_link_list_url : "lists/link_list.js",
				external_image_list_url : "lists/image_list.js",
				media_external_list_url : "lists/media_list.js",
	
				// Style formats
				style_formats : [
					{title : 'Bold text', inline : 'b'},
					{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
					{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
					{title : 'Example 1', inline : 'span', classes : 'example1'},
					{title : 'Example 2', inline : 'span', classes : 'example2'},
					{title : 'Table styles'},
					{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
				],
	
				// Replace values for the template plugin
				template_replace_values : {
					username : "Some User",
					staffid : "991234"
				}
			});
		}
		/* SELECTION DES FONCTIONNALITES */
		/* Pour une suppression */
		$( '.functionalities input[name="fonctionnalites[]"]' ).not( '.locked' ).click( function( e )
		{
			if ( $( this ).hasClass( 'locked' ) == false ) {
				toggleCheckInputChildren( $( this ), $( this ).attr( 'checked' ) );
			}
			else {
				return false;
			}
		});

		/* coche / décohe récurssivement les input et leur applique une class : locked */
		function toggleCheckInputChildren( oInput, bChecked )
		{
			var oChildren = oInput.closest( 'div' ).siblings( '.functionalities' ).find( 'input[name="fonctionnalites[]"]' );
			oChildren.each( function( ){
				if ( bChecked == true) {
					$( this ).attr( 'checked', bChecked ).addClass( 'locked' );
				}
				else {
					$( this ).attr( 'checked', bChecked ).removeClass( 'locked' );
				}
				toggleCheckInputChildren( $( this ), bChecked );
			});
		}

		/* Pour la selection / déselection d'une fonctionnalité parent */
		var sValPrevRadio = null;
		$( '.functionalities input[name="fonctionnaliteparent"]' ).click( function( e )
		{
			if ( sValPrevRadio == $( this ).val( ) ) {
				var bChecked = $( this ).attr( 'checked' ) == true ? false : true;
				$( this ).attr( 'checked', bChecked );
				sValPrevRadio = null;
			}
			else {
				sValPrevRadio = $( this ).val( );
			}
		});
		
		var bToSubmit = false;
		$( 'input[name="delete"]' ).click( function( ){
			if ( bToSubmit == false ) {
				oInput = $( this );
				jConfirm( 'Vous êtes sur le point de supprmier les éléments sélectionnés.', 'Suppression',  function( e ) {
					if ( e == true) {
						jConfirm( 'Souhaitez vous réellement supprimer les éléments sélectionnés?', 'Confirmation',  function( e ) {
							if ( e == true) {
								bToSubmit = true;
								oInput.click( );
							}
						});
					}
				});
				return false;
			}
		});
	});

	// Remplace les caractères accentués
	function stripAccents( chaine ) {
      var temp = chaine.replace( /[àâä]/gi, "a" );
      temp = temp.replace( /[éèêë]/gi, "e" );
      temp = temp.replace( /[îï]/gi, "i" );
      temp = temp.replace( /[ôö]/gi, "o" );
      temp = temp.replace( /[ùûü]/gi, "u" );
      return temp;
   }
  
//->
