<!--
// *** JQUERY ****

/*=========MENUS==========*/
jQuery(function() {    
    jQuery('.menu').hover(function(){
        jQuery(this).css('padding-left','20px');
        jQuery(this).stop().animate({fontSize: '16px'},{queue:false, duration:150});        
    },
        function(){
            jQuery(this).css('padding-left','10px');
            jQuery(this).stop().animate({fontSize: '12px'},{queue:false, duration:250});
    });     
});

function debug_ie6(t_div)
{
    var _height
    for(var i=0;i<t_div.length;i++)
    {
        _height = jQuery('#'+t_div[i]).height();
        jQuery('#'+t_div[i]+' .bgTransparent').css('height', _height);                    
    }
}


jQuery(function() {   
	jQuery('#playeur').hover(function(){ 
			jQuery('.infosClic').css('display','block');		  
		},function(){
			jQuery('.infosClic').css('display','none');
	});
});

/*=============TOOLTIP===============*/
jQuery(function () {    
    jQuery('.share').each(function()
   {
      var content = jQuery(this).find('span').html();
	  // on masque les span
	  jQuery(this).find('span').css('display','none');
      
        jQuery(this).qtip(
        {
            content: content,
            style: { 
                width: 100,
                background: '#000000',
                color: '#ffffff',
                fontSize: '11px',
                textAlign: 'center',
                border: {
                    width: 1,
                    /*radius: 8,*/
                    color: '#000000'
                },
                tip: 'bottomMiddle',
                name: 'dark'
            },
            position: {
                corner: {
                    target: 'topMiddle',
                    tooltip: 'bottomMiddle'
                }
            }
        });
    });    
});


/*=============ANIM LISTING RDV GMAP===============*/
jQuery(function () {    
    jQuery('.listGmap').hover(function(){
        jQuery(this).stop().animate({color: '#ffffff', backgroundColor: '#000000'}, {queue:false, duration:200});
    }, function(){
        jQuery(this).stop().animate({color: '#000000', backgroundColor: '#cccccc'}, {queue:false, duration:250});
    });
});


/*=============ANIM GALERIE MUSIQUE===============*/

jQuery(function () {    
    jQuery('.musique').hover(function(){
        if(!jQuery(this).hasClass('musiqueActiv')) {
            jQuery(this).stop().animate({color: '#ffffff', backgroundColor: '#000000'}, {queue:false, duration:200});
    }}, function(){
        if(!jQuery(this).hasClass('musiqueActiv')) {
            jQuery(this).stop().animate({color: '#000000', backgroundColor: '#cccccc'}, {queue:false, duration:250});
        }
        
    });
});

jQuery(function () {    
    // On cache toutes les descriptions : 
    jQuery(".musiqueDesc").hide(); 
    // On sélectionne tous les items de liste portant la classe "toggleSubMenu"  
 
    // On modifie l'évènement "click" sur les liens dans les items de liste 
    // qui portent la classe "toggleSubMenu" : 
    jQuery(".musiqueSlide").click( function () { 
        // Si le sous-menu était déjà ouvert, on le referme : 
        if (jQuery(this).next(".musiqueDesc:visible").length != 0) { 
            jQuery(this).next(".musiqueDesc").slideUp("normal"); 
            jQuery(this).attr('class', 'musiqueSlide musique');
            jQuery(this).animate({color: '#000000', backgroundColor: '#cccccc'}, {queue:false, duration:800});
        } 
        // Si le sous-menu est caché, on ferme les autres et on l'affiche : 
        else { 
            jQuery(".musiqueDesc").slideUp("normal"); 
            jQuery(".musiqueSlide").attr('class', 'musiqueSlide musique');
            jQuery(".musiqueSlide").css('color', '#000000');
            jQuery(".musiqueSlide").css('background-color', '#cccccc');
            jQuery(this).next(".musiqueDesc").slideDown("normal"); 
            jQuery(this).attr('class', 'musiqueSlide musiqueActiv');
            jQuery(this).animate({color: '#ffffff', backgroundColor: '#000000'}, {queue:false, duration:1000});
        } 
        // On empêche le navigateur de suivre le lien : 
        return false; 
    });
});


jQuery(function () {    
    jQuery(".infosTooltip").hide(); // qtipMedia 
    
    jQuery('.qtipMedia').hover(function(){
        /*if(jQuery(this).width()==122) {
            jQuery(this).find('.infosTooltip').css('width', '122px');
        }*/
        jQuery(this).find('.infosTooltip').stop().animate({height: '71px', top: '-68px', paddingTop: '6px'}, {queue:false, duration:200});
    }, function(){
            jQuery(this).find('.infosTooltip').stop().animate({height: '0px', top: '0px', paddingTop: '0px'}, {queue:false, duration:250});    
    });
});


/*==================GALERIE PHOTO===================*/
/*PREV - NEXT*/
jQuery(function () {    
    jQuery('#photoApercu').hover(function(){
        jQuery(this).find('.prev').stop().animate({width: '49px'}, {queue:false, duration:150});
        jQuery(this).find('.next').stop().animate({width: '49px', marginLeft: '319px'}, {queue:false, duration:150});
    }, function(){
            jQuery(this).find('.prev').stop().animate({width: '0px'}, {queue:false, duration:300});    
            jQuery(this).find('.next').stop().animate({width: '0px', marginLeft: '368px'}, {queue:false, duration:300});
    });    
});

function popup_player()
{
	stop_music();
    window.open('/lecteurMusique.php','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=264, height=155, left=10, top=10');
}


function is_mail(mail){
    var filter_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    return filter_email.test(mail);
}




var AjaxFormSubmiterObject = {

    handleSuccess:function(o){
        try{
            eval(o.responseText);            
        }catch(e){
            //alert('Erreur:'+e.message);    
        }
        
    },

    handleFailure:function(o){
            //alert('Erreur');    
    },

    processResult:function(o){

    },

    startRequest:function(formObject) {
        YAHOO.util.Connect.setForm(formObject); 
        YAHOO.util.Connect.asyncRequest('POST', formObject.action, callbackFormSubmit);
    }

};

/*
 * Define the callback object for success and failure
 * handlers as well as object scope.
 */
var callbackFormSubmit= {
    success:AjaxFormSubmiterObject.handleSuccess,
    failure:AjaxFormSubmiterObject.handleFailure,
    scope:AjaxFormSubmiterObject
};   


function check_keep_in_touch()
{
    var _form = Dom.get('form_keep_in_touch');
    
    var erreur = '';

    if( ( _form.email.value == '' && _form.phone.value == '' ) || ( _form.email.value == 'mail' && _form.phone.value == '+ (XX) phone number') ){
        erreur += "\n - Vous devez saisir votre adresse E-mail ou votre numéro de téléphone.";    
    }
    else{
        if( _form.email.value != '' && _form.email.value != 'mail' && !is_mail(_form.email.value) ){
            erreur += "\n - Votre adresse E-mail ne semble pas valide.";    
        } 
        if( _form.phone.value != '' && _form.phone.value != '+ (XX) phone number' && !is_phone(_form.phone.value) ){
            erreur += "\n - Votre numéro de téléphone ne semble pas valide.";    
        } 		
		
    }

    if(erreur != ''){
        alert('Attention,'+erreur);
    }
    else{
        AjaxFormSubmiterObject.startRequest( _form );
    }
}

function error_handler_keep_in_touch(error)
{
    alert(error);    
}

function success_handler_keep_in_touch(b_email, b_phone)
{
    if(b_email && b_phone)
    {
        alert('Vos coordonnées ont bien été enregistrées !');
		document.getElementById('email_field').value = "mail";
		document.getElementById('phone_field').value = "+ (XX) phone number";
    }
    else if(!b_email && !b_phone)
    {
            alert('Vos coordonnées n\'ont pas été enregistrées !');    
    }
    else if(!b_email && b_phone)
    {
        alert('Votre numéro de téléphone a bien été enregistré !');  
		document.getElementById('phone_field').value = "+ (XX) phone number";
    }
    else
    {
        alert('Votre adresse E-mail a bien été enregistrée !');  
		document.getElementById('email_field').value = "mail";

    }
}

function update_keep_in_touch()
{
    var _form = Dom.get('form_keep_in_touch');
    
    var b_error = false;

    if( ( _form.email.value == '' && _form.phone.value == '' ) || ( _form.email.value == 'mail' && _form.phone.value == '+ (XX) phone number') || ( _form.email.value == '' && _form.phone.value == '+ (XX) phone number') || ( _form.email.value == 'mail' && _form.phone.value == '') ){
        b_error = true;
    }
    else{
       if( _form.email.value != '' && _form.email.value != 'mail' && !is_mail(_form.email.value) ){
            b_error = true;
        }  
        if( _form.phone.value != '' && _form.phone.value != '+ (XX) phone number' && !is_phone(_form.phone.value) ){
            b_error = true;
        } 		
    }
	
	if(b_error){
		Dom.setStyle('a_valid_keep_in_touch', 'backgroundImage', 'url(/images/valid_form_no_activ.png)');
	}
	else{
		Dom.setStyle('a_valid_keep_in_touch', 'backgroundImage', 'url(/images/valid_form_activ.png)');	
	}
}

function is_phone(phone)
{
	if(phone[0] == '+'){
		phone = '00' + phone.substr(phone, 1);
	}
	
    phone = phone.replace(/[^\d]/i, '');	
	
    var filter = /^0[1-9]/i;
	if(filter.test(phone)){
		return true;	
	}
	
    var filter = /^00/i;
	if(filter.test(phone)){
		return true;	
	}
	
	return false;
}

	function init_gmap()
	{
		if(GBrowserIsCompatible()) 
		{
			geocoder = new GClientGeocoder();
			map = new GMap2(document.getElementById('gmap'));
			//changeCenterByCountry(296);
			
			map.setCenter(new GLatLng(45.58893609609166, 5.924077033996582), 1);  
			
			markers = [];
			
			var point;
			var icon_full_futur = new GIcon();        
			icon_full_futur.image = "/images/yelle-picto.png";
			icon_full_futur.iconSize = new GSize(27, 32);
			icon_full_futur.iconAnchor = new GPoint(13, 32);
			icon_full_futur.infoWindowAnchor = new GPoint(129, 29);  
			
			var icon_full_passed = new GIcon();        
			icon_full_passed.image = "/images/yelle-picto2.png";
			icon_full_passed.iconSize = new GSize(27, 32);
			icon_full_passed.iconAnchor = new GPoint(13, 32);
			icon_full_passed.infoWindowAnchor = new GPoint(129, 29);   			
		
						
			  
			for (var id_point in t_point) 
			{    
				
				if( typeof(t_point[id_point].marker) != 'undefined' && t_point[id_point].marker == false)
				{
					var latlng = new GLatLng(t_point[id_point].lat, t_point[id_point].lng);
					

					t_point[id_point].marker = new GMarker(latlng, t_point[id_point].futur?icon_full_futur:icon_full_passed);

					t_point[id_point].marker.id = t_point[id_point].id;
					
					GEvent.addListener(t_point[id_point].marker, 'click', function() {
						show_point(this.id);
					});
										
					GEvent.addListener(map, 'extinfowindowbeforeclose', function(){ 																	   
						do_this();
					});

					
					markers[id_point] = t_point[id_point].marker;
					map.addOverlay(t_point[id_point].marker);
				}
			}	
			
			gmapNQ.init(map);
			gmapNQ.configZoomControl("divBtnPlus","divBtnMoins");
			gmapNQ.configTypeControl("btnNavSat",null,null,"btnNavPlan");		
			gmapNQ.configScrollZoomControl('zoomPointer', 'zoomBar');
			
		}	
	}
	
	function init_gmap2()
	{
		if(GBrowserIsCompatible()) 
		{
			geocoder = new GClientGeocoder();
			map = new GMap2(document.getElementById('gmap'));
			//changeCenterByCountry(296);
			
			map.setCenter(new GLatLng(45.58893609609166, 5.924077033996582), 1);  
			
			markers = [];
			
			var point;
			var icon_full_futur = new GIcon();        
			icon_full_futur.image = "/images/yelle-picto.png";
			icon_full_futur.iconSize = new GSize(27, 32);
			icon_full_futur.iconAnchor = new GPoint(13, 32);
			icon_full_futur.infoWindowAnchor = new GPoint(129, 29);  
			
			var icon_full_passed = new GIcon();        
			icon_full_passed.image = "/images/yelle-picto2.png";
			icon_full_passed.iconSize = new GSize(27, 32);
			icon_full_passed.iconAnchor = new GPoint(13, 32);
			icon_full_passed.infoWindowAnchor = new GPoint(129, 29);   			
		
		
			var style = [{
				url: '/images/rond-p.png',
				height: 24,
				width: 24,
				opt_anchor: [0, 0],
				opt_textColor: '#FFF'
			},
			{
				url: '/images/rond-m.png',
				height: 27,
				width: 27,
				opt_anchor: [0, 0],
				opt_textColor: '#FFF'
			},
			{
				url: '/images/rond-g.png',
				height: 32,
				width: 32,
				opt_anchor: [0, 0],
				opt_textColor: '#FFF'				
			}];		
						
			  
			for (var id_point in t_point) 
			{    
				
				if( typeof(t_point[id_point].marker) != 'undefined' && t_point[id_point].marker == false)
				{
					var latlng = new GLatLng(t_point[id_point].lat, t_point[id_point].lng);
					

					t_point[id_point].marker = new GMarker(latlng, t_point[id_point].futur?icon_full_futur:icon_full_passed);

					t_point[id_point].marker.id = t_point[id_point].id;
					
					GEvent.addListener(t_point[id_point].marker, 'click', function() {
						show_point(this.id);
					});
										
					GEvent.addListener(map, 'extinfowindowbeforeclose', function(){ 																	   
						do_this();
					});

					
					markers[id_point] = t_point[id_point].marker;
					t_markers.push(t_point[id_point].marker);
					//map.addOverlay(t_point[id_point].marker);
				}
			}	
			
			var markerCluster = new MarkerClusterer(map, t_markers, {styles:style});
			
			gmapNQ.init(map);
			gmapNQ.configZoomControl("divBtnPlus","divBtnMoins");
			gmapNQ.configTypeControl("btnNavSat",null,null,"btnNavPlan");		
			gmapNQ.configScrollZoomControl('zoomPointer', 'zoomBar');
			
		}	
	}	
	
	function do_this()
	{
		for (var id_point in t_point) 
		{    
			if( typeof(t_point[id_point].marker) != 'undefined' && t_point[id_point].marker != false)
			{
				t_point[id_point].marker.show();	
			}
		}
	}
	
	
	function changeCenterByCountry(id_pays)
	{
		if( typeof(t_pays[id_pays]) != 'undefined' ){
			map.setCenter(new GLatLng(t_pays[id_pays].lat, t_pays[id_pays].lng), 1);  
		}
	}	

	function show_point(id_point)
	{
		if( typeof(t_point[id_point]) != 'undefined' ){
			map.setCenter(  t_point[id_point].marker.getLatLng() , 16);
					
			t_point[id_point].marker.openExtInfoWindow( map, "simple_example_window", t_point[id_point].html, {beakOffset: 3} );	
			t_point[id_point].marker.hide();
		}
		jQuery('html,body').animate({scrollTop: jQuery('#gmap').offset().top}, 'normal');
	}



	function change_video(id_video)
	{
		if( typeof(t_video[id_video]) != 'undefined' )
		{
			Dom.get('descr_video').innerHTML = t_video[id_video].descr;
			Dom.get('img_video').src = t_video[id_video].img;
			Dom.get('span_video').innerHTML = t_video[id_video].titre;
			Dom.get('a_video').href = t_video[id_video].url;
		}
	}

	function load_image(_image)
	{	
		jQuery('#img_first_gallery').fadeOut(400, function(){
				jQuery('#img_first_gallery').attr('src', _image);
				jQuery("#img_first_gallery").load(function(){jQuery("#img_first_gallery:hidden").fadeIn(800)});
			});	
	}




	function change_album(id_album)
	{
		current_photo_id = 0;
		current_gallery_id = id_album;
		Dom.setStyle('div_album_prev', 'visibility', 'hidden');
		
		Dom.get('span_title_album').innerHTML = t_album[current_gallery_id];
		Dom.get('span_number_photo').innerHTML = '1/' + t_photo[current_gallery_id].length + ' photos';

		load_image('/imagesGallerie_photo/medium/' + t_photo[current_gallery_id][current_photo_id]);
		
		if(t_photo[current_gallery_id].length > 1 ){
			if(current_photo_id == t_photo[current_gallery_id].length -1){
				Dom.setStyle('div_album_next', 'visibility', 'hidden');
			}
			else{
				Dom.setStyle('div_album_next', 'visibility', 'visible');
			}
		}
		else{
			Dom.setStyle('div_album_next', 'visibility', 'hidden');
		}
	
	}
	
	function goto_album_prev()
	{
		if(current_photo_id -1 <0){
			return;
		}
		else{
			current_photo_id--;
		}
		
		load_image('/imagesGallerie_photo/medium/' + t_photo[current_gallery_id][current_photo_id]);
		
		if(current_photo_id == 0){
			Dom.setStyle('div_album_prev', 'visibility', 'hidden');
		}
		else{
			Dom.setStyle('div_album_prev', 'visibility', 'visible');
		}	
		if(t_photo[current_gallery_id].length > 1 ){
			if(current_photo_id == t_photo[current_gallery_id].length -1){
				Dom.setStyle('div_album_next', 'visibility', 'hidden');
			}
			else{
				Dom.setStyle('div_album_next', 'visibility', 'visible');
			}
		}
		else{
			Dom.setStyle('div_album_next', 'visibility', 'hidden');
		}	
		Dom.get('span_number_photo').innerHTML = (current_photo_id+1)+'/' + t_photo[current_gallery_id].length + ' photos';
	}
	
	function goto_album_next()
	{
		if(current_photo_id +1 > t_photo[current_gallery_id].length -1){
			return;
		}
		else{
			current_photo_id++;
		}
		
		load_image('/imagesGallerie_photo/medium/' + t_photo[current_gallery_id][current_photo_id]);	
		
		if(current_photo_id == 0){
			Dom.setStyle('div_album_prev', 'visibility', 'hidden');
		}
		else{
			Dom.setStyle('div_album_prev', 'visibility', 'visible');
		}	
		if(t_photo[current_gallery_id].length > 1 ){
			if(current_photo_id == t_photo[current_gallery_id].length -1){
				Dom.setStyle('div_album_next', 'visibility', 'hidden');
			}
			else{
				Dom.setStyle('div_album_next', 'visibility', 'visible');
			}
		}
		else{
			Dom.setStyle('div_album_next', 'visibility', 'hidden');
		}
		Dom.get('span_number_photo').innerHTML = (current_photo_id+1)+'/' + t_photo[current_gallery_id].length + ' photos';		
	}
	
	function preload_image(t_preload)
	{
		for(var i =0;i<t_preload.length;i++){
			t_preloaded[i] = newImage();
			t_preloaded[i].src = t_preload[i];
		}
	}

	function init_event(){
		YAHOO.util.Event.addListener('img_first_gallery', "click", open_shadow_box_img);
	}
	
	function open_shadow_box_img(){
		openShadowboxImg('/imagesGallerie_photo/'+t_photo[current_gallery_id][current_photo_id]);
	}

	function openShadowboxImg( _src_img) {  
		Shadowbox.open({player:'img', content:_src_img, options:{fadeDuration:0.1, resizeDuration:0.1, animSequence:"sync"}});
	}


  	function callback_handler_contact(_return)
	{            
		if(_return)
		{
			Dom.setStyle('table_form_contact', 'display', 'none');
			Dom.setStyle('table_form_contact', 'visibility', 'hidden');        
			Dom.setStyle('success_contact', 'display', 'block');
			Dom.setStyle('success_contact', 'visibility', 'visible');                    
		}
		else
		{
			alert('Une erreur c\'est produite, veuillez recommencer ou contacter l\'administrateur.');
		}    
	}
	
	function valid_form_contactez_nous(_form)
	{
		var erreur = '';
		if(_form.nom.value == ''){
			erreur += "\n - Vous devez saisir votre nom.";
		}

		if(_form.prenom.value == ''){
			erreur += "\n - Vous devez saisir votre prénom.";
		}
		
		if(_form.email.value == ''){
			erreur += "\n - Vous devez saisir votre adresse email.";
		}
		else if(!is_mail(_form.email.value)){
			erreur += "\n - Votre adresse email ne semble pas valide.";
		}
		
		if(_form.msg.value == ''){
			erreur += "\n - Vous devez saisir votre message.";
		}
		
		if(_form.telephone.value == ''){
			erreur += "\n - Vous devez saisir votre numéro de téléphone.";
		}                                    
		
		if(erreur != ''){
			alert('Attention,'+erreur);
		}
		else{
			AjaxFormSubmiterObject.startRequest( _form );
		}
				
	}    	

 function stop_music() {
	 if (navigator.appName.indexOf("Microsoft") != -1) {
		 if(typeof(window["lecteur"]) != "undefined"){
			if(typeof(window["lecteur"].loadUrl)=='undefined') {
				window.setTimeout('try{window["lecteur"].async_stop();}catch(e){}',1000);
			}
			else {
				window["lecteur"].async_stop();
			}
		 }
	 } else {
		 if(typeof(document["lecteur"]) != "undefined"){
			 if(typeof(document["lecteur"].loadUrl)=='undefined') {
				window.setTimeout('document["lecteur"].async_stop();',1000);
			}
			else {
				document["lecteur"].async_stop();
			}
		}
	 }		 
 }	
 
 
var slider;
var slider_offset_px;
function init_scroll_rdv()
{
	var id_curseur_scrollbar = "div_cont_rdv_scroll_btn";
	var id_fond_scrollbar = "div_cont_rdv_scroll_cont";
	var id_conteneur_html = "div_cont_rdv";

	var topConstraint = 0;
	var t_region_fond = Dom.getRegion(id_fond_scrollbar);
	var t_region_curseur = Dom.getRegion(id_curseur_scrollbar);
	var t_region_conteneur_html = Dom.getRegion(id_conteneur_html);
	slider_offset_px = (t_region_fond['bottom']-t_region_fond['top']) - (t_region_curseur['bottom']-t_region_curseur['top']);
	
	
	slider = YAHOO.widget.Slider.getVertSlider(id_fond_scrollbar, id_curseur_scrollbar, topConstraint, slider_offset_px);

 

	slider.getRealValue = function() {
		return this.getValue() / slider_offset_px;
	}
	slider.animation = null;
	slider.id_conteneur_html = id_conteneur_html;
	slider.height_html = Dom.get(id_conteneur_html).scrollHeight - (t_region_conteneur_html['bottom']-t_region_conteneur_html['top']);

	slider.subscribe("change", function(offsetFromStart) {
		var actualValue = this.getRealValue();
		
		if(this.animation) {
			if(this.animation.isAnimated()) {
				this.animation.stop(false);
			}
		}
		
		this.animation = new YAHOO.util.Scroll(id_conteneur_html, { scroll: { to: [0, this.height_html*actualValue] } }, 0.3);
		this.animation.animate();
	});

}

function scroll_rdv_btn_up()
{
	var cur_val = slider.getValue();
	var new_val = cur_val - 10;
	
	if(new_val<0){
		new_val = 0;
	}
	slider.setValue(new_val);
}

function scroll_rdv_btn_down()
{
	var cur_val = slider.getValue();
	var new_val = cur_val + 10;
	
	if(new_val>slider_offset_px){
		new_val = slider_offset_px;
	}
	slider.setValue(new_val);
}


function openShadowbox( _page, _width, _height, _player) {

    if(typeof(_width) == 'undefined'){
        _width = 950;
    }
    if(typeof(_height) == 'undefined'){
        _height = 800;
    }        
    if(typeof(_player) == 'undefined'){
        _player = 'iframe';
    }    
    Shadowbox.open({player:_player, content:_page, height:_height, width:_width, options:{fadeDuration:0.1, resizeDuration:0.1, animSequence:"sync"}});
}

-->