$(document).ready(function(){

	splitted_url		=	window.location.href.split( "/" );
	server_url			=	splitted_url[0]+"/"+splitted_url[1]+"/"+splitted_url[2];
	page_with_ext		=	splitted_url[ ( splitted_url.length - 1 ) ];
	current_ext			=	page_with_ext.substr( page_with_ext.indexOf(".") ).toLowerCase(); 
	current_page		=	page_with_ext.substr( 0, page_with_ext.indexOf(".") );

	$("#fil_arianne li:last a").map( function(){
		$(this).html( $("h1").html() );
		$("#fil_arianne span").remove();
	});

	if ( "structures" == splitted_url[3] ) {
		$("#showEquipe").click( function(){
			$(".detail_CTC_STR").parent().parent().toggle();
			return false;
		});
		if (  "afficher_68" == current_page ) {
			$(".service_CTC_STR").hover( function(){
				$(this).css({
					"text-decoration":		"underline"
				});
			}, function (){
				$(this).css({
					"text-decoration":		"none"
				});
			});
			$(".service_CTC_STR").click( function(){
				$(this).parent().parent().children("."+$(this).attr("id")).toggle();
			});
		}
		$(".nom_CTC_STR").parent().parent().hover( function(){
		}, function(){
			$(this).hide();
		});
		$(".nom_CTC_STR").css({
			"cursor":					"default"
		});
		curBG				=	"";
		$(".nom_CTC_STR").hover( function(){
			curBG				=	$(this).css("background");
			$(this).css({
				"background":			"#C1B0A6",
				"color":				"#ffffff"
			});
			$(this).parent().children(".detail_CTC_STR").toggle();
		}, function(){
			$(this).css({
				"background":			curBG,
				"color":				"#797573"
			});
			$(this).parent().children(".detail_CTC_STR").toggle();
		});
		$(".detail_CTC_STR").hover( function(){
			$(this).show();
		}, function(){
			$(this).hide();
		});
	}

	if( $("textarea[name=aee_introduction]").html() )
	{
		$("textarea[name=aee_introduction]").height( 128 );
	}

	if ( splitted_url[3].substr( 0, 22 ) == "missions_transversales" ) {
		$(".subLink").map( function() {
			$("#subLinks").append( $(this) );
		});
		if ( $("#subLinks").html() != null ) {
			$(".subLink:last").css({
				"border-right":		"none"
			});
		} else {
			$(".subLink").css({
				"border-top":		"0",
				"border-right":		"1px solid #CACACA"
			});
		}
	}

	switch( current_page )
	{
		case "index":
			$("#zoomsur").height( $("#zoomsur").parent().height() );
			$(".previewinfos").height( $(".previewinfos").parent().height() );
			break;
		case "association":
			$("#searchConvention").click( function() {
				// centre			=	$("#listing_centre").val();
				ra				=	$("#listing_raAnnee").val();
				partenaire		=	$("#partenaires").val();
				/*
				if ( centre == "Toutes" ) {
					centre			=	"";
				}
				*/
				if ( ra == "Année" ) {
					ra			=	"";
				}
				if ( partenaire == "Partenaire..." ) {
					partenaire			=	"";
				}				
				newUrl					=	"association/Conventions/s"+ "-a"+ ra +"-p"+ partenaire +".html";
				window.location.href	=	newUrl;
				return false;
			});
			$("#searchRa").click( function() {
				ra				=	$("#listing_ra").val();
				if ( ra == "Tous" ) {
					ra			=	"";
				}
				newUrl					=	"association/rapports_d_activites/a"+ ra +".html";
				window.location.href	=	newUrl;
				return false;
			});
			break;
		case "docs":
			$("#firstlisting li.dir span.fileName").click( function(){
				isOnRoot		=	( $(this).parent().attr( "class" ).search( /myClass_10/ ) == -1 );
				title			=	"";
				if( isOnRoot )
				{
					title			+=	$(this).parent().attr( "title" );
				}
				title			+=	"/"+$(this).html();
				$("#firstlisting li[title="+( title )+"]").toggle();
			});
			$("#secondlisting li.dir span.fileName").click( function(){
				isOnRoot		=	( $(this).parent().attr( "class" ).search( /myClass_10/ ) == -1 );
				title			=	"";
				if( isOnRoot )
				{
					title			+=	$(this).parent().attr( "title" );
				}
				title			+=	"/"+$(this).html();
				$("#secondlisting li[title="+( title )+"]").toggle();
			});
			$(".fileName").css( "cursor",			"pointer" );
			break;
		case "document":
			$("#firstlisting li.dir span.fileName").click( function(){
				isOnRoot		=	( $(this).parent().attr( "class" ).search( /myClass_10/ ) == -1 );
				title			=	"";
				if( isOnRoot )
				{
					title			+=	$(this).parent().attr( "title" );
				}
				title			+=	"/"+$(this).html();
				$("#firstlisting li[title="+( title )+"]").toggle();
			});
			$("#secondlisting li.dir span.fileName").click( function(){
				isOnRoot		=	( $(this).parent().attr( "class" ).search( /myClass_10/ ) == -1 );
				title			=	"";
				if( isOnRoot )
				{
					title			+=	$(this).parent().attr( "title" );
				}
				title			+=	"/"+$(this).html();
				$("#secondlisting li[title="+( title )+"]").toggle();
			});
			$(".fileName").css( "cursor",			"pointer" );
			break;
		case "le_saviez_vous":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "les_evenements":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "faireundon":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "dons_en_nature":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "adherer":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
		case "publications":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "contact_association":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
		case "lettre_d_informations":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "presentation":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "organisation":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "les_acteurs":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "activites":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
		case "collectif_associations":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "faire_un_legs":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "devenir_benevole":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "encarts_anoter":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "encarts_appel":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "encarts_contact_presse":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "encarts_presentation":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "encarts_publications":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "encarts_zoom":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "le_mouvement":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "partenaires":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "projet_associatif":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "historique":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		case "mentions_legales":
			CKEDITOR.replace( 'lsv_contenu',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js"
			});
			CKFinder.SetupCKEditor( CKEditor, { BasePath : "/libs/ckfinder/", RememberLastFolder : false } ) ;
			break;
		
		
		
		case "rubrique_cleo":
			/*
			CKEDITOR.replace( 'txt_evenement',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js",
				contentsCss:			"/css/style_main.css"
			});
			CKEDITOR.replace( 'txt_zoomSur',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js",
				contentsCss:			"/css/style_main.css"
			});
			CKEDITOR.replace( 'txt_actualites',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js",
				contentsCss:			"/css/style_main.css"
			});
			CKEDITOR.replace( 'txt_vieCentres',
			{
				customConfig:			server_url+"/libs/ckeditor/config.js",
				contentsCss:			"/css/style_main.css"
			});
			*/
			/*
			*/
			break;
		default:
			if( current_ext === ".pdf" || current_ext === ".doc" || current_ext === ".xls" )
			{
				// Création du SWF Upload
//#####

swfu = new SWFUpload({
	// Backend Settings
	upload_url:						server_url+"/upload.php",
	post_params:					{
		/*"var":					"value"*/
	},

	// File Upload Settings
	file_size_limit:				"10 MB",
	file_types:						"*.jpg;*.jpeg;*.png;*.gif",
	file_types_description:			"Images",
	file_upload_limit:				"0",

	// Event Handler Settings - these functions as defined in Handlers.js
	//  The handlers are not part of SWFUpload but are part of my website and control how
	//  my website reacts to the SWFUpload events.
	file_queue_error_handler:		fileQueueError,
	file_dialog_complete_handler:	fileDialogComplete,
	upload_progress_handler:		uploadProgress,
	upload_error_handler:			uploadError,
	upload_success_handler:			uploadSuccess,
	upload_complete_handler:		uploadComplete,

	// Button Settings
	button_image_url:				server_url+"/media/img/magnifier.png",
	button_placeholder_id:			"spanButtonPlaceholder",
	button_width:					214,
	button_height:					18,
	button_text:					"<span class=\"button\">Choisissez une image <span class=\"buttonSmall\">(10 MB Max)</span></span>",
	button_text_style:				".button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; color: #606060; } .buttonSmall { font-size: 10pt; }",
	button_text_top_padding:		0,
	button_text_left_padding:		18,
	button_window_mode:				SWFUpload.WINDOW_MODE.TRANSPARENT,
	button_cursor:					SWFUpload.CURSOR.HAND,

	// Flash Settings
	flash_url:						server_url+"/media/swf/swfupload.swf",

	custom_settings:				{
		upload_target:					"divFileProgressContainer"
	},

	// Debug Settings
	debug:							false
});



//#####
				// Création du datePicker
				$("input[name='doc_date']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});

			}else if( ( splitted_url[3] == "admin" && current_page == "rubrique" ) ){

				$(".rub_ordre").blur( function(){
					$.ajax({
						type: "post",
						async: true,
						url: "/admin/rubrique/insere.html",
						data: { "rub_ordre": $(this).val(), "rub_id": $(this).parent().parent().children("td").children(".rub_id").html(), "action": "changeOrdre" },
						success: function(res){
						}
					});
				});
				$(".rub_ordre").keypress( function( e ){
					if( e.which == 13 )
					{
						$(this).blur();
					}
				});

			}else if( ( splitted_url[3] == "admin" && current_page == "direction_et_service" ) ){

				$(".editable").map( function(){
					$(this).parent().append( "<input type=\"text\" name=\"dir_"+$(this).attr( "id" )+"\" value=\""+$(this).html()+"\" class=\"generated\" />" );
				});
				$(".editable").click( function(){
					$("input[name=dir_" +$(this).attr("id")+ "]" ).val( $(this).html() );
					$("input[name=dir_" +$(this).attr("id")+ "]" ).show();
					$("input[name=dir_" +$(this).attr("id")+ "]" ).focus();
					$(this).hide();
				});
				$(".generated").blur( function(){
					$.ajax({
						type: "post",
						async: true,
						url: "/admin/direction_et_service/ajouter.html",
						data: { "dir_id": $(this).attr("name").replace( "dir_id_", "" ), "dir_libelle": $(this).val() },
						success: function(res){
							$("#id_"+res).html( $("input[name=dir_id_"+res+"]").val() );
							$("#id_"+res).show();
							$("input[name=dir_id_"+res+"]").hide();
						}
					});
				});
				$(".generated").keypress( function( e ){
					if( e.which == 13 )
					{
						$(this).blur();
					}
				});

			}else if( ( splitted_url[4] == "agenda" ) && ( current_page.substr( 0, 8 ) == "modifier" || current_page.substr( 0, 13 ) == "modifierVideo" || current_page == "ajouter" || current_page == "ajouter_video" ) ){

				// Création du datePicker
				$("input[name='agd_dateDebut']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});

				// Création du datePicker
				$("input[name='agd_dateFin']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});

			}else if( ( splitted_url[4] == "rubrique" ) && ( current_page.substr( 0, 8 ) == "modifier" || current_page.substr( 0, 13 ) == "modifierVideo" || current_page == "ajouter" || current_page == "ajouter_video" ) ){

// Création du SWF Upload
//#####

swfu = new SWFUpload({
	// Backend Settings
	upload_url:						server_url+"/upload.php",
	post_params:					{
		/*"var":					"value"*/
	},

	// File Upload Settings
	file_size_limit:				"10 MB",
	file_types:						"*.jpg;*.jpeg;*.png;*.gif",
	file_types_description:			"Images",
	file_upload_limit:				"0",

	// Event Handler Settings - these functions as defined in Handlers.js
	//  The handlers are not part of SWFUpload but are part of my website and control how
	//  my website reacts to the SWFUpload events.
	file_queue_error_handler:		fileQueueError,
	file_dialog_complete_handler:	fileDialogComplete,
	upload_progress_handler:		uploadProgress,
	upload_error_handler:			uploadError,
	upload_success_handler:			uploadSuccess,
	upload_complete_handler:		uploadComplete,

	// Button Settings
	button_image_url:				server_url+"/media/img/magnifier.png",
	button_placeholder_id:			"spanButtonPlaceholder",
	button_width:					214,
	button_height:					18,
	button_text:					"<span class=\"button\">Choisissez une image <span class=\"buttonSmall\">(10 MB Max)</span></span>",
	button_text_style:				".button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; color: #606060; } .buttonSmall { font-size: 10pt; }",
	button_text_top_padding:		0,
	button_text_left_padding:		18,
	button_window_mode:				SWFUpload.WINDOW_MODE.TRANSPARENT,
	button_cursor:					SWFUpload.CURSOR.HAND,

	// Flash Settings
	flash_url:						server_url+"/media/swf/swfupload.swf",

	custom_settings:				{
		upload_target:					"divFileProgressContainer"
	},

	// Debug Settings
	debug:							false
});



//#####
			}else if( ( splitted_url[4] == "actualite" || splitted_url[4] == "evenement" || splitted_url[4] == "communique" || splitted_url[4] == "edito" ) && ( current_page.substr( 0, 8 ) == "modifier" || current_page.substr( 0, 13 ) == "modifierVideo" || current_page == "ajouter" || current_page == "ajouter_video" ) ){

// Création du SWF Upload
//#####

swfu = new SWFUpload({
	// Backend Settings
	upload_url:						server_url+"/upload.php",
	post_params:					{
		/*"var":					"value"*/
	},

	// File Upload Settings
	file_size_limit:				"10 MB",
	file_types:						"*.jpg;*.jpeg;*.png;*.gif",
	file_types_description:			"Images",
	file_upload_limit:				"0",

	// Event Handler Settings - these functions as defined in Handlers.js
	//  The handlers are not part of SWFUpload but are part of my website and control how
	//  my website reacts to the SWFUpload events.
	file_queue_error_handler:		fileQueueError,
	file_dialog_complete_handler:	fileDialogComplete,
	upload_progress_handler:		uploadProgress,
	upload_error_handler:			uploadError,
	upload_success_handler:			uploadSuccess,
	upload_complete_handler:		uploadComplete,

	// Button Settings
	button_image_url:				server_url+"/media/img/magnifier.png",
	button_placeholder_id:			"spanButtonPlaceholder",
	button_width:					214,
	button_height:					18,
	button_text:					"<span class=\"button\">Choisissez une image <span class=\"buttonSmall\">(10 MB Max)</span></span>",
	button_text_style:				".button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; color: #606060; } .buttonSmall { font-size: 10pt; }",
	button_text_top_padding:		0,
	button_text_left_padding:		18,
	button_window_mode:				SWFUpload.WINDOW_MODE.TRANSPARENT,
	button_cursor:					SWFUpload.CURSOR.HAND,

	// Flash Settings
	flash_url:						server_url+"/media/swf/swfupload.swf",

	custom_settings:				{
		upload_target:					"divFileProgressContainer"
	},

	// Debug Settings
	debug:							false
});

if ( current_page != "ajouter_video" && current_page.substr( 0, 13 ) != "modifierVideo" ) {

swfu2 = new SWFUpload({
	// Backend Settings
	upload_url:						server_url+"/upload.php",
	post_params:					{
		/*"var":					"value"*/
	},

	// File Upload Settings
	file_size_limit:				"10 MB",
	file_types:						"*.*",
	file_types_description:			"Tous types de fichier",
	file_upload_limit:				"0",

	// Event Handler Settings - these functions as defined in Handlers.js
	//  The handlers are not part of SWFUpload but are part of my website and control how
	//  my website reacts to the SWFUpload events.
	file_queue_error_handler:		fileQueueError,
	file_dialog_complete_handler:	fileDialogComplete,
	upload_progress_handler:		uploadProgress,
	upload_error_handler:			uploadError,
	upload_success_handler:			uploadSuccess2,
	upload_complete_handler:		uploadComplete,

	// Button Settings
	button_image_url:				server_url+"/media/img/magnifier.png",
	button_placeholder_id:			"spanButtonPlaceholder2",
	button_width:					320,
	button_height:					18,
	button_text:					"<span class=\"button\">Choisissez un fichier <span class=\"buttonSmall\">(10 MB Max)</span></span>",
	button_text_style:				".button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; color: #606060; } .buttonSmall { font-size: 10pt; }",
	button_text_top_padding:		0,
	button_text_left_padding:		18,
	button_window_mode:				SWFUpload.WINDOW_MODE.TRANSPARENT,
	button_cursor:					SWFUpload.CURSOR.HAND,

	// Flash Settings
	flash_url:						server_url+"/media/swf/swfupload.swf",

	custom_settings:				{
		upload_target:					"divFileProgressContainer2"
	},

	// Debug Settings
	debug:							false
});

}

//#####
				// Création du datePicker
				$("input[name='aee_date']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});
			}else if( splitted_url[4] == "emploi" && ( current_page.substr( 0, 8 ) == "modifier" || current_page.substr( 0, 13 ) == "modifierVideo" || current_page == "ajouter" || current_page == "ajouter_video" ) ){
				$("select[name=emp_typeContrat]").change( function(){
					// N° du CDI : 1
					CDI					=	1;
					if( $(this).val() == CDI )
					{
						$("input[name=emp_dureeContrat]").attr( "readonly", "readonly" );
						$("input[name=emp_dureeContrat]").val( "" );
						$("input[name=emp_dureeContrat]").css( "visibility", "hidden" );
					}else{
						$("input[name=emp_dureeContrat]").attr( "readonly", "" );
						$("input[name=emp_dureeContrat]").val( "" );
						$("input[name=emp_dureeContrat]").css( "visibility", "visible" );
					}
				});
				$("select[name=emp_typeTemps]").change( function(){
					// N° du Temps partiel : 2
					tempsPartiel				=	2;
					if( $(this).val() == tempsPartiel )
					{
						$("input[name=emp_dureeTemps]").attr( "readonly", "readonly" );
						$("input[name=emp_dureeTemps]").val( "" );
						$("input[name=emp_dureeTemps]").css( "visibility", "hidden" );
					}else{
						$("input[name=emp_dureeTemps]").attr( "readonly", "" );
						$("input[name=emp_dureeTemps]").val( "" );
						$("input[name=emp_dureeTemps]").css( "visibility", "visible" );
					}
				});
				// Création du datePicker
				$("input[name='emp_dateExpiration']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});
			}else if( splitted_url[4] == "formation" && ( current_page.substr( 0, 8 ) == "modifier" || current_page.substr( 0, 13 ) == "modifierVideo" || current_page == "ajouter" || current_page == "ajouter_video" ) ){
				// Création du datePicker
				$("input[name='frm_dateExpiration']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});
				$("input[name='frm_date']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});
			}else if( splitted_url[4] == "structure" && ( current_page.substr( 0, 8 ) == "modifier" || current_page.substr( 0, 13 ) == "modifierVideo" || current_page == "ajouter" || current_page == "ajouter_video" ) ){

// Création du SWF Upload
//#####

swfu = new SWFUpload({
	// Backend Settings
	upload_url:						server_url+"/upload.php",
	post_params:					{
		/*"var":					"value"*/
	},

	// File Upload Settings
	file_size_limit:				"10 MB",
	file_types:						"*.jpg;*.jpeg;*.png;*.gif",
	file_types_description:			"Images",
	file_upload_limit:				"0",

	// Event Handler Settings - these functions as defined in Handlers.js
	//  The handlers are not part of SWFUpload but are part of my website and control how
	//  my website reacts to the SWFUpload events.
	file_queue_error_handler:		fileQueueError,
	file_dialog_complete_handler:	fileDialogComplete,
	upload_progress_handler:		uploadProgress,
	upload_error_handler:			uploadError,
	upload_success_handler:			uploadSuccess,
	upload_complete_handler:		uploadComplete,

	// Button Settings
	button_image_url:				server_url+"/media/img/magnifier.png",
	button_placeholder_id:			"spanButtonPlaceholder",
	button_width:					214,
	button_height:					18,
	button_text:					"<span class=\"button\">Choisissez une image <span class=\"buttonSmall\">(10 MB Max)</span></span>",
	button_text_style:				".button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; color: #606060; } .buttonSmall { font-size: 10pt; }",
	button_text_top_padding:		0,
	button_text_left_padding:		18,
	button_window_mode:				SWFUpload.WINDOW_MODE.TRANSPARENT,
	button_cursor:					SWFUpload.CURSOR.HAND,

	// Flash Settings
	flash_url:						server_url+"/media/swf/swfupload.swf",

	custom_settings:				{
		upload_target:					"divFileProgressContainer"
	},

	// Debug Settings
	debug:							false
});


//#####
				// Création du datePicker
				$("input[name='str_dateCreation']").datepicker({
					dateFormat:			"dd/mm/yy",
					constrainInput:		true
				});

			}
			break;
	}


	//####
//####


$("#lsv_contenu").children().map( function(){
	alert( $(this).html() );
});


//####
	//####


	$(".shadow").map( function(){
		size				=	8;
		parentObject		=	$("."+$(this).attr( "class" ).replace( "shadow", "" ).replace( " ", "" )+":not(.shadow)" );
		$(this).width( parseInt( parentObject.width() ) + (size*2) + "px" );
		$(this).height( parseInt( parentObject.height() ) + (size*2) + "px" );
		$(this).addClass( "border_radius" );
		mTop				=	parseInt( $(this).css( "margin-top" ) )		- size+1	+ "px ";
		mRight				=	parseInt( $(this).css( "margin-right" ) )				+ "px ";
		mBottom				=	parseInt( $(this).css( "margin-bottom" ) )				+ "px ";
		mLeft				=	parseInt( $(this).css( "margin-left" ) )	- size+1	+ "px ";
		$(this).css({
			"background":		"#000000",
			"border":			"0px",
			"margin":			mTop+" "+mRight+" "+mBottom+" "+mLeft,
			"z-index":			parseInt( parentObject.css( "z-index" ) ) - 1,
			"filter":			"alpha(opacity=50)",
			"-moz-opacity":		"0.5",
			"opacity":			"0.5",
			"position":			"absolute"
		});

	});
	$("input[type=text]").map( function(){
		if( !$(this).attr( "readonly" ) && !$(this).attr( "disabled" ) && $(this).attr( "class" ).search( /generated/ ) == -1 && $(this).attr( "class" ).search( /input/ ) == -1 )
		{
			$(this).attr( "label", $(this).val() );
			$(this).click( function(){
				if( $(this).val() == $(this).attr( "label" ) )
				{
					$(this).val( "" );
				}
			});
			$(this).blur( function(){
				if( $(this).val().trim() == "" )
				{
					$(this).val( $(this).attr( "label" ) );
				}
			});
		}
	});
	$("span[class^=mapPos_]").map( function(){
		$(this).css({
			"position":			"absolute"
		});
		$(this).html( "<span class=\"HG\"></span><span class=\"HC\"></span><span class=\"HD\"></span><span class=\"CG\"></span><span class=\"CC\"></span><span class=\"CD\"></span><span class=\"BG\"></span><span class=\"BC\"></span><span class=\"BD\"></span>" );
		$(this).children( "span" ).css({
			"color":			"#ffffff",
			"position":			"absolute",
			"margin":			"0",
			"width":			"100px",
			"text-align":		"left"
		});
		$(this).children( "span.HG" ).css( "margin",	"-1px 0 0 -1px" );
		$(this).children( "span.HC" ).css( "margin",	"-1px 0 0 0" );
		$(this).children( "span.HD" ).css( "margin",	"-1px 0 0 1px" );
		$(this).children( "span.CG" ).css( "margin",	"0 0 0 -1px" );
		$(this).children( "span.CC" ).css( "margin",	"0 0 0 0" );
		$(this).children( "span.CD" ).css( "margin",	"0 0 0 1px" );
		$(this).children( "span.BG" ).css( "margin",	"1px 0 0 -1px" );
		$(this).children( "span.BC" ).css( "margin",	"1px 0 0 0" );
		$(this).children( "span.BD" ).css( "margin",	"1px 0 0 1px" );
		$(this).children( "span" ).html( $( "#"+$(this).attr( "class" ) ).html() );
	});
	if( $("#page").height() < $("#bandeau").height() )
	{
		$("#content").height( parseInt( $("#bandeau").height() ) - 128 + "px" );
	}else{
		$("#bandeau").height( $("#page").height() );
	}
    
    $("#aSubLinks").click(function() {
      $("#subLinks").show();  	 
    });

	 $("#aSubLinks").dblclick(function() {
      $("#subLinks").hide();  	 
    });
	
	$('.listing_onglet').find("a."+current_page).addClass("a_active");

});

