			$(function() {
				
				$(window).scroll(function() {
					if($(this).scrollTop() != 0) {
						$('#toTop').fadeIn();	
					} else {
						$('#toTop').fadeOut();
					}
				});
				$('#toTop').click(function() {
					$('body,html').animate({scrollTop:0},800);
				});	
			});
			$(document).ready(function() {
				 //slideOutTab pour feedback
				 $(function(){
					$('.slide-out-div').tabSlideOut({
						tabHandle: '.handle',                     //class of the element that will become your tab
						tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
						speed: 300,                               //speed of animation
						action: 'click',                          //options: 'click' or 'hover', action to trigger animation
						topPos: '10%',                          //position from the top/ use if tabLocation is left or right
						leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
						fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
					});
				});
				//select all the a tag with name equal to modal
				$('a[name=modal]').click(function(e) {
					//Cancel the link behavior
					e.preventDefault();
					//Get the A tag
					var id = $(this).attr('href');
				
					//Get the screen height and width
					var maskHeight = $(document).height();
					var maskWidth = $(window).width();
				
					//Set heigth and width to mask to fill up the whole screen
					$('#mask').css({'width':maskWidth,'height':maskHeight});
					
					//transition effect		
					$('#mask').fadeIn(1000);	
					$('#mask').fadeTo("slow",0.8);	
				
					//Get the window height and width
					var winH = $(window).height();
					var winW = $(window).width();
						  
					//Set the popup window to center
					$(id).css('top',  winH/2-$(id).height()/2);
					$(id).css('left', winW/2-$(id).width()/2);
				
					//transition effect
					$(id).fadeIn(2000); 
				
				});
				//if close button is clicked
				$('.window .close').click(function (e) {
					//Cancel the link behavior
					e.preventDefault();
					
					$('#mask').hide();
					$('.window').hide();
				});		
				//if mask is clicked
				$('#mask').click(function () {
					$(this).hide();
					$('.window').hide();
				});
				$('.tobounce').effect("bounce", { direction:'left', times:3 }, 300);
				$('a[title]').qtip({
					position: { target: 'mouse', corner: { tooltip: 'rightMiddle' } },
					style: { name: 'cream', tip: true } 
				});
				$('area[alt]').qtip({
					position: { target: 'mouse', corner: { tooltip: 'rightMiddle' } },
					style: { name: 'cream', tip: true } 
				});
				$('img[alt].interrogation').qtip({
					position: { target: 'mouse', corner: { tooltip: 'leftBottom' } },
					style: { name: 'green', tip: true } 
				});
				$('.tobounce').hover(function () {
					$(this).effect("bounce", { direction:'left', times:3 }, 300);
				});
				$('#litterature').accordion({
					active: false,
					clearStyle: true,
					header: 'h1.litterature',
					autoHeight: false,
					event: 'mouseover',
					collapsible: true,
					navigation:true
				});
					$('#sub_litterature_fr').accordion({
						active: false,
						clearStyle: true,
						header: 'a.sub_litterature_fr',
						autoHeight: true,
						event: 'mouseover',
						collapsible: false,
						navigation:true
					});
					$('#sub_litterature_ar').accordion({
						active: false,
						clearStyle: true,
						header: 'a.sub_litterature_ar',
						autoHeight: true,
						event: 'mouseover',
						collapsible: false,
						navigation:true
					});
				$('#scientifique').accordion({
					active: false,
					clearStyle: true,
					header: 'h1.scientifique',
					autoHeight: false,
					event: 'mouseover',
					collapsible: true,
					navigation:true
				});
				
				
				// au chargement de la page on désactive les accordéons
				$('#scolaire').accordion( 'activate' , false );
				$('#scientifique').accordion( 'activate' , false );
				$('#litterature').accordion( 'activate' , false );
				
				// pour #scolaire, on remplace le sous menu par le nom de la ville ou de l'école
				city = '';
				school = '';
				textChooseCityFr = $('#choice_city_fr').text();
				textChooseCityAr = $('#choice_city_ar').text();
				function selectSchoolCity(lang){
					$('#city_'+lang+' > a').bind('click', function() {
						if (!($(this).hasClass('ok'))){
							$('#choice_city_'+lang).replaceWith($(this));
							$('#city_'+lang).addClass('clear');
							$($(this)).toggleClass('ok');
							$($(this)).prepend('<span class="icon i_24 yes"></span>');
							//redirige vers la page demandée
							city = $(this).text();
							if((city != '')){
								if(lang == 'fr'){
									$.ajax({
									   type: "GET",
									   url: "getSchoolsFr.php?id_city="+$(this).attr('id'),
									   dataType: "text",
									   success: function(msg){
											$("#choice_school_fr").show();
											$("#school_fr").empty();
											$("#school_fr").append(msg);
									   }
									});
								}else if (lang == 'ar'){
									$.ajax({
									   type: "GET",
									   url: "getSchoolsAr.php?id_city="+$(this).attr('id'),
									   dataType: "text",
									   success: function(msg){
											$("#choice_school_ar").show();
											$("#school_ar").empty();
											$("#school_ar").append(msg);
									   }
									});
								}
							}
						}else{
								
								$('#city_'+lang).removeClass('clear');
								$('#city_'+lang).prepend($(this));
								
								link = $('<a></a>');
								link.attr('id','choice_city_'+lang);
								if(lang == 'fr'){
									link.text(textChooseCityFr);
								}else if(lang == 'ar'){
									link.text(textChooseCityAr);
								}
								
								$('#sub_scolaire_'+lang+'_li').prepend(link);
								$("#choice_school_"+lang).hide();
								$("#school_"+lang).empty();
								$($(this)).toggleClass('ok', false);
								$('.icon.i_24.yes').remove();
						}
						return(false);
					});
				}
				selectSchoolCity('fr');
				selectSchoolCity('ar');
				// augmente l'opacité du menu en cours, désactive les autres et diminue leur opacité
				// acc_a : l'accordéon en cours, b: le plus proche, c: le plus éloigné
				function accordionSelect(acc_a, acc_b, acc_c){
					$(acc_a).bind('mouseenter', function() {
						$(acc_b).fadeTo('fast', 0.3);
						$(acc_c).fadeTo('fast', 0.3);
						$(acc_b).accordion( 'activate' , false );
						$(acc_c).accordion( 'activate' , false );
					});
					
					$(acc_a).bind('mouseleave', function() {
						$(this).accordion( 'activate' , false );
						$(acc_b).accordion( 'activate' , false );
						$(acc_c).accordion( 'activate' , false );
						
						$(this).fadeTo('fast', 1);
						$(acc_b).fadeTo('fast', 1);
						$(acc_c).fadeTo('fast', 1);
					});
				}
				accordionSelect('#scolaire', '#litterature', '#scientifique');
				accordionSelect('#scientifique', '#litterature', '#scolaire');
				accordionSelect('#litterature', '#scolaire', '#scientifique');
				
				// augmente l'opacité du demi menu en cours, diminue l'opacité de l'autre
				function opacSemiButton(acc_a){
					$(acc_a + ' .semi_acc_box_top').bind('mouseenter', function() {
						$(this).fadeTo('slow', 1);
						$(acc_a + ' .semi_acc_box_bottom').fadeTo('fast', 0.7);
					});
					$(acc_a + ' .semi_acc_box_top').bind('mouseleave', function() {
						$(this).fadeTo('slow', 1);
						$(acc_a + ' .semi_acc_box_bottom').fadeTo('slow', 1);
					});
					
					
					$(acc_a + ' .semi_acc_box_bottom').bind('mouseenter', function() {
						$(this).fadeTo('slow', 1);
						$(acc_a + ' .semi_acc_box_top').fadeTo('fast', 0.7);
					});
					$(acc_a + ' .semi_acc_box_bottom').bind('mouseleave', function() {
						$(this).fadeTo('slow', 1);
						$(acc_a + ' .semi_acc_box_top').fadeTo('slow', 1);
					});
				}
				opacSemiButton('#scolaire');
				opacSemiButton('#scientifique');
				opacSemiButton('#litterature');
				
				
				
				//recherche
				if ($('#search input:text').val() != ''){
						$('.multi_search').hide();
					}
				$('#search_field').live({
					focus:function(){
						if ($(this).val() == ''){
							$('.multi_search').fadeTo('slow', 0.3);
						}
						else $('.multi_search').fadeOut();
					},
					keyup:function(){
						if ($(this).val() == ''){
							$('.multi_search').fadeTo('slow', 0.3);
						}
						else $('.multi_search').hide();
						// pour réduire le logo
						$('.search_form').addClass('small');
						$('#logo a').addClass('small');
					}
				});
				// pour ie...
				$('.multi_search').bind({
					click:function(){
						$('#search_field').focus();
					}
				});
				
				
				//menu deroulant
				$('#menu_nav li').hover(
					function() {
						//show
						$('ul', this).slideDown(200);
						$('ul', this).addClass('hover');
					}, 
					function() {
						//hide
						$('ul', this).slideUp(100);
						$('ul', this).removeClass('hover');
					}
				);

				// initialise le diaporama des banners
				$(".diaporama").diaporama({
					animationSpeed: "slow",
					delay:4,
					controls:false,
					hoverStop:true
				});
				
				
			});

