var global_chemin_url = "http://www.aljt.com/";
var global_chemin_url_images = "http://www.aljt.com/";




// ******************************** Pour la gestion des flash ******************************** //


// Variables globales
// Version majeure de Flash requise
var requiredMajorVersion = 9;
// Version mineure de Flash requise
var requiredMinorVersion = 0;
// Révision de Flash requise
var requiredRevision = 0;
// Version de javascript prise en charge
var jsVersion = 1.0;

var msg_deja_affiche = false;

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function aff_bal(ch)
{
	document.write(ch);
}

function insert_flash(p_src,p_name,p_width,p_height) {

	if (p_src.indexOf(".flv")>=0){
		var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		if(hasRightVersion) {  // if we've detected an acceptable version
			// embed the flash movie

			AC_FL_RunContent(
				'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
				'width', p_width,
				'height', p_height,
				'src', 'PlayerVideo',
				'quality', 'high',
				'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
				'align', 'middle',
				'play', 'false',
				'loop', 'false',
				'scale', 'showall',
				'wmode', 'window',
				'devicefont', 'false',
				'id', 'PlayerVideo',
				'bgcolor', '#ffffff',
				'name', 'PlayerVideo',
				'menu', 'true',
				'allowScriptAccess','sameDomain',
				'allowFullScreen','true',
				'movie', 'PlayerVideo',
				'salign', '',
				'flashvars', 'nomflv='+p_src
				); //end AC code
		}
		else{
			// flash is too old or we can't detect the plugin
			var alternateContent = 'Alternate HTML content should be placed here.'
				+ 'This content requires the Adobe Flash Player.'
				+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
			document.write(alternateContent);  // insert non-flash content
		}
	}
	else{
		var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		if(!hasRightVersion) {  // si nous avons détecté une version acceptable
			if (!msg_deja_affiche)
			{
				msg_deja_affiche = true;

				var alternateContent = 'Pour visualiser correctement cette page vous avez besoin du Flash&nbsp;Player&nbsp;'+requiredMajorVersion+'.'
				+ '<br /><a href="http://www.macromedia.com/go/getflash/" class="text-normal-lien" target="_blank">T&eacute;l&eacute;charger Flash&nbsp;Player</a><br />';
				document.write(alternateContent);  // Insérer contenu non-Flash
			}
		}
		document.write('<embed src="' + p_src + '" name="' + p_name + '" width="' + p_width + '" height="' + p_height + '" wmode="transparent" quality="high"  align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	}
}




// ****************************** Fin pour la gestion des flash ****************************** //



// ******************************* Pour la gestion des formulaires ****************************//

function valider_moteur_recherche(){
	var f = document.form_moteur_recherche;
	var mot_recherche = f.query.value;
	wysistat_tag_mot_cle_moteur(mot_recherche);
	return true;
}

function valider_moteur_recherche_2(){
	var f = document.form_moteur_recherche_2;
	var mot_recherche = f.query.value;
	wysistat_tag_mot_cle_moteur(mot_recherche);
	return true;
}

function wysistat_tag_mot_cle_moteur(mot_recherche) {
	if (valeur==1){stat('aljt_site','','','recherche;'+mot_recherche);}
}

// ***************************** Fin pour la gestion des formulaires **************************//


// ajouter aux favoris
function add_to_favoris(){
	var titre = "Andra, agence nationale pour la gestion des déchets radioactifs";
	var url = document.location.href;
	if(navigator.appName != 'Microsoft Internet Explorer' ){
		window.sidebar.addPanel(titre,url,"");
	}
	else{
		window.external.AddFavorite(url,titre);
	}
}

/*------------------------------------------------------------------------------
| IDfr object
------------------------------------------------------------------------------*/
(function($) {

	var
	window = this,
	undefined,
	_IDfr = window.IDfr,
	tmp = function(){}
	IDfr = window.IDfr = new tmp;
	
	IDfr = IDfr.prototype = {

	printer : function(printable,callback) {
		var html = $(printable).html();
		// on supprime les flashs
		html = html.replace(new RegExp("insert_flash", "gi"), '//insert_flash');
		html = html.replace(new RegExp("<script([^>]*)>(.*)</script>", "gi"), '');

			
		$('iframe[name=printer]').contents().find('body').html(html);
		
		if(typeof callback == 'function') {
			callback();
		}
			
		window.frames["printer"].focus();
		window.frames["printer"].print();
	},

	google : function(form,from,to,map,latitude,longitude,locale) {

		var long_lat_defaut = null,
			map_canvas = null,
			geocoder = new GClientGeocoder(),
			gdir = null,
			long_lat_defaut = null,
			coord_actu = null,
			myHtmlFiche = '<div class="detail"><h1>ZA du Pont de Recardet</h1><h2>CHATEL</h2></div>';
			
		locale = (locale) ? locale : 'fr';
		geocoder.setBaseCountryCode(locale);

		// Call this function when the page has been loaded
		IDfr.google.initialize = function(){
			IDfr.google.map_canvas = new google.maps.Map2(document.getElementById(map));

			long_lat_defaut = new GLatLng(latitude, longitude);
			IDfr.google.map_canvas.setCenter(long_lat_defaut, 9);

			IDfr.google.map_canvas.addControl(new GLargeMapControl());
			IDfr.google.map_canvas.addControl(new GMapTypeControl());
			IDfr.google.map_canvas.addControl(new GOverviewMapControl());
			IDfr.google.map_canvas.enableContinuousZoom();
			IDfr.google.map_canvas.enableScrollWheelZoom();

			if (GBrowserIsCompatible()) {
				gdir = new GDirections(IDfr.google.map_canvas, document.getElementById("directions"));
				GEvent.addListener(gdir, "load", IDfr.google.onGDirectionsLoad);
				GEvent.addListener(gdir, "error", IDfr.google.handleErrors);
			}
			IDfr.google.trigger('init');
		}

		IDfr.google.exe = function(act,param) {
			eval('IDfr.google.map_canvas.'+act+'('+param+')');
		}

		IDfr.google.trigger = function(evt) {
		    $('#'+map).trigger(evt);
		}

		IDfr.google.bind = function(evt,callback) {
			if(typeof callback == 'function') {
				$('#'+map).bind(evt,callback);
			}
		}

		IDfr.google.setPoint = function(what,town,lati,longi){
			//49.0214641,1.1540472
			if(typeof IDfr.google.map_canvas != 'object') {
				IDfr.google.initialize();
			}

			IDfr.google.map_canvas.clearOverlays();
			var coord = new GLatLng(lati,longi);
			coord_actu = lati+','+longi;

			//IDfr.google.map_canvas.setCenter(coord, 13);

			var blueIcon = new GIcon(G_DEFAULT_ICON);

			// Set up our GMarkerOptions object
			markerOptions = { icon:blueIcon };

			var marker = new GMarker(coord, markerOptions);

			marker.value = what;
			IDfr.google.map_canvas.addOverlay(marker, IDfr.google.markerOptions);
			if (myHtmlFiche.length>0) {
				window.GEvent.addListener(marker, "click", function(){
					IDfr.google.map_canvas.openInfoWindowHtml(coord, what);
					//IDfr.google.map_canvas.setCenter(coord, 10);
				});
			}
		}
		
		IDfr.google.setMarker = function(tpl, lati, longi){
		    tpl = (!tpl) ? address: tpl;
		    
		    var point = new GLatLng(lati,longi);
	        var marker = new GMarker(point);
	        
	        window.GEvent.addListener(marker, "click", function(){
				IDfr.google.map_canvas.openInfoWindowHtml(point, tpl);
			});
			IDfr.google.map_canvas.addOverlay(marker);
		}

		IDfr.google.AdressToGPS = function(address, tpl) {

		    tpl = (!tpl) ? address: tpl;

			address = address.replace(/&#039;/g,"'");
            geocoder.getLatLng(
		        address ,
		        function(point) {
					if (!point) {
						if (typeof console != 'undefined' && typeof console.log == 'function') {
							console.log(address + " not found : "+point);
						}
		            }
					else {
					    coord_actu = point.y+','+point.x;
					    
	               		var marker = new GMarker(point);
	               		
	               		window.GEvent.addListener(marker, "click", function(){
							IDfr.google.map_canvas.openInfoWindowHtml(point, tpl);
							//IDfr.google.map_canvas.setCenter(point, 10);
						});
						
						IDfr.google.map_canvas.addOverlay(marker);
						
						//IDfr.google.map_canvas.setCenter(point, 10);
		            }
		        }
		    );
		}

		IDfr.google.setDirections = function() {
			var f = document.form_geo;
			var $from = $(from);

			if ($from.size()<1)	{
				$from.focus();
				alert("Vous devez saisir une adresse de départ !");
				return false;
			}
			if (!coord_actu) {
				$from.focus();
				alert("Merci de saisir une adresse d'arrivée !");
				return false;
			}

			gdir.load("from: " + $from.val() + " to: " + coord_actu, { "locale": locale });
		}

		IDfr.google.resize = function() {
		    if(typeof IDfr.google.map_canvas != 'object') {
				IDfr.google.initialize();
			}

		    IDfr.google.map_canvas.checkResize();
		    
		    if(typeof IDfr.google.map_canvas == 'object') {
		    	IDfr.google.map_canvas.setCenter(long_lat_defaut, 9);
			}
		}

		IDfr.google.handleErrors = function(){
			if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
			{
				/*alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);*/
				alert("Aucun zone géographique ne peut être trouvé pour l'une des adresses spécifiées. Ceci est peut être due au fait que l'adresse est nouvelle, ou bien incorrecte.");
			}
			else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
			{
				//alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
				alert("Le calcul d'itinéraire n'a pu aboutir, la raison en est inconnue.");
			}
			else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
			{
				//alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
				alert("Merci de saisir une adresse de déart et d'arrivée.");
			}
			//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
			//alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);

			else if (gdir.getStatus().code == G_GEO_BAD_KEY)
			{
				//alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
				alert("Erreur de clé d'activation.");
			}
			else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
			{
				//alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
				alert("Le calcul d'itinéraire n'a pu aboutir.");
			}
			else
			{
				//alert("An unknown error occurred.");
				alert("Une erreur inconnue s'est produite.");
			}
		}

		IDfr.google.onGDirectionsLoad = function(){

		}

		$(form).submit(function(e){
			e.preventDefault();
			IDfr.google.setDirections();
		});
		
		google.setOnLoadCallback(IDfr.google.initialize);
	},

	//phpjs
	strip_tags : function  (str, allowed_tags) {
		    var key = '', allowed = false;
		    var matches = [];
		    var allowed_array = [];
		    var allowed_tag = '';
		    var i = 0;
		    var k = '';
		    var html = '';

		    var replacer = function (search, replace, str) {
		        return str.split(search).join(replace);
		    };

		    if (allowed_tags) {
		        allowed_array = allowed_tags.match(/([a-zA-Z0-9]+)/gi);
		    }

		    str += '';

		    matches = str.match(/(<\/?[\S][^>]*>)/gi);

		    for (key in matches) {
		        if (isNaN(key)) {
		            continue;
		        }

		        html = matches[key].toString();

		        allowed = false;

		        for (k in allowed_array) {
		            allowed_tag = allowed_array[k];
		            i = -1;

		            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}
		            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}
		            if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}

		            if (i == 0) {
		                allowed = true;
		                break;
		            }
		        }
		        if (!allowed) {
		            str = replacer(html, "", str);
		        }
		    }
		    return str;
		}


}

})(jQuery);

/*------------------------------------------------------------------------------
| jQuery plugin
------------------------------------------------------------------------------*/
 /*
 * TipTip
 * Copyright 2010 Drew Wilson
 * www.drewwilson.com
 * code.drewwilson.com/entry/tiptip-jquery-plugin
 *
 * Version 1.2   -   Updated: Jan. 13, 2010
 *
 * This Plug-In will create a custom tooltip to replace the default
 * browser tooltip. It is extremely lightweight and very smart in
 * that it detects the edges of the browser window and will make sure
 * the tooltip stays within the current window size. As a result the
 * tooltip will adjust itself to be displayed above, below, to the left
 * or to the right depending on what is necessary to stay within the
 * browser window. It is completely customizable as well via CSS.
 *
 * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.fn.tipTip=function(options){var defaults={maxWidth:"200px",edgeOffset:3,delay:400,fadeIn:200,fadeOut:200,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')));}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow");}
return this.each(function(){var org_elem=$(this);var org_title=org_elem.attr("title");if(org_title!=""){org_elem.removeAttr("title");org_elem.attr("alt",'');var timeout=false;org_elem.hover(function(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(w_compare<0){if((w_compare+left)<parseInt($(window).scrollLeft())){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare);}else if((tip_w+left)>parseInt($(window).width())){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare);}}
if((top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop())){t_class=t_class+"_top";arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset));}else if(((top+org_height)-(opts.edgeOffset+tip_h))<0||t_class==""){t_class=t_class+"_bottom";arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset);}
if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5;}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5;}
if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5;}
tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout);}
timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn);},opts.delay);},function(){opts.exit.call(this);if(timeout){clearTimeout(timeout);}tiptip_holder.fadeOut(opts.fadeOut);});}});}})(jQuery);

/*
    anythingSlider v1.2

    By Chris Coyier: http://css-tricks.com
    with major improvements by Doug Neiner: http://pixelgraphics.us/
    based on work by Remy Sharp: http://jqueryfordesigners.com/


	To use the navigationFormatter function, you must have a function that
	accepts two paramaters, and returns a string of HTML text.

	index = integer index (1 based);
	panel = jQuery wrapped LI item this tab references
	@return = Must return a string of HTML/Text

	navigationFormatter: function(index, panel){
		return index + " Panel"; // This would have each tab with the text 'X Panel' where X = index
	}
*/

(function($){

    $.anythingSlider = function(el, options){
        // To avoid scope issues, use 'base' instead of 'this'
        // to reference this class from internal events and functions.
        var base = this;

        // Access to jQuery and DOM versions of element
        base.$el = $(el);
        base.el = el;

		// Set up a few defaults
        base.currentPage = 1;
		base.timer = null;
		base.playing = false;

        // Add a reverse reference to the DOM object
        base.$el.data("AnythingSlider", base);

        base.init = function(){
            base.options = $.extend({},$.anythingSlider.defaults, options);

			// Cache existing DOM elements for later
			base.$wrapper = base.$el.find('> div').css('overflow', 'hidden');
            base.$slider  = base.$wrapper.find('> ul');
            base.$items   = base.$slider.find('> li');
            base.$single  = base.$items.filter(':first');

			// Build the navigation if needed
			if(base.options.buildNavigation) base.buildNavigation();

        	// Get the details
            base.singleWidth = base.$single.outerWidth();
            base.pages = base.$items.length;

            // Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
			// This supports the "infinite" scrolling
			base.$items.filter(':first').before(base.$items.filter(':last').clone().addClass('cloned'));
            base.$items.filter(':last' ).after(base.$items.filter(':first').clone().addClass('cloned'));

			// We just added two items, time to re-cache the list
            base.$items = base.$slider.find('> li'); // reselect

			// Setup our forward/backward navigation
			base.buildNextBackButtons();

			// If autoPlay functionality is included, then initialize the settings
			if(base.options.autoPlay) {
				base.playing = !base.options.startStopped; // Sets the playing variable to false if startStopped is true
				base.buildAutoPlay();
			};

			// If pauseOnHover then add hover effects
			if(base.options.pauseOnHover) {
				base.$el.hover(function(){
					base.clearTimer();
				}, function(){
					base.startStop(base.playing);
				});
			}

			// If a hash can not be used to trigger the plugin, then go to page 1
			if((base.options.hashTags == true && !base.gotoHash()) || base.options.hashTags == false){
				base.setCurrentPage(1);
			};
        };

		base.gotoPage = function(page, autoplay){
			// When autoplay isn't passed, we stop the timer
			if(autoplay !== true) autoplay = false;
			if(!autoplay) base.startStop(false);

			if(typeof(page) == "undefined" || page == null) {
				page = 1;
				base.setCurrentPage(1);
			};

			// Just check for bounds
			if(page > base.pages + 1) page = base.pages;
			if(page < 0 ) page = 1;

			var dir = page < base.currentPage ? -1 : 1,
                n = Math.abs(base.currentPage - page),
                left = base.singleWidth * dir * n;

			base.$wrapper.filter(':not(:animated)').animate({
                scrollLeft : '+=' + left
            }, base.options.animationTime, base.options.easing, function () {
                if (page == 0) {
                    base.$wrapper.scrollLeft(base.singleWidth * base.pages);
					page = base.pages;
                } else if (page > base.pages) {
                    base.$wrapper.scrollLeft(base.singleWidth);
                    // reset back to start position
                    page = 1;
                };
				base.setCurrentPage(page);

            });
		};

		base.setCurrentPage = function(page, move){
			// Set visual
			if(base.options.buildNavigation){
				base.$nav.find('.cur').removeClass('cur');
				$(base.$navLinks[page - 1]).addClass('cur');
			};

			// Only change left if move does not equal false
			if(move !== false) base.$wrapper.scrollLeft(base.singleWidth * page);

			// Update local variable
			base.currentPage = page;
		};

		base.goForward = function(autoplay){
			if(autoplay !== true) autoplay = false;
			base.gotoPage(base.currentPage + 1, autoplay);
		};

		base.goBack = function(){
			base.gotoPage(base.currentPage - 1);
		};

		// This method tries to find a hash that matches panel-X
		// If found, it tries to find a matching item
		// If that is found as well, then that item starts visible
		base.gotoHash = function(){
			if(/^#?panel-\d+$/.test(window.location.hash)){
				var index = parseInt(window.location.hash.substr(7));
				var $item = base.$items.filter(':eq(' + index + ')');
				if($item.length != 0){
					base.setCurrentPage(index);
					return true;
				};
			};
			return false; // A item wasn't found;
		};

		// Creates the numbered navigation links
		base.buildNavigation = function(){
			base.$nav = $("<div id='thumbNav'></div>").appendTo(base.$el);
			base.$items.each(function(i,el){
				var index = i + 1;
				var $a = $("<a href='#'></a>");

				// If a formatter function is present, use it
				if( typeof(base.options.navigationFormatter) == "function"){
					$a.html(base.options.navigationFormatter(index, $(this)));
				} else {
					$a.text(index);
				}
				$a.click(function(e){
                    base.gotoPage(index);

                    if (base.options.hashTags)
						base.setHash('panel-' + index);

                    e.preventDefault();
				});
				base.$nav.append($a);
			});
			base.$navLinks = base.$nav.find('> a');
		};


		// Creates the Forward/Backward buttons
		base.buildNextBackButtons = function(){
			var $forward = $('<a class="arrow forward">&gt;</a>'),
				$back    = $('<a class="arrow back">&lt;</a>');

            // Bind to the forward and back buttons
            $back.click(function(e){
                base.goBack();
				e.preventDefault();
            });

            $forward.click(function(e){
                base.goForward();
				e.preventDefault();
            });

			// Append elements to page
			base.$wrapper.after($back).after($forward);
		};

		// Creates the Start/Stop button
		base.buildAutoPlay = function(){

			base.$startStop = $("<a href='#' id='start-stop'></a>").html(base.playing ? base.options.stopText :  base.options.startText);
			base.$el.append(base.$startStop);
            base.$startStop.click(function(e){
				base.startStop(!base.playing);
				e.preventDefault();
            });

			// Use the same setting, but trigger the start;
			base.startStop(base.playing);
		};

		// Handles stopping and playing the slideshow
		// Pass startStop(false) to stop and startStop(true) to play
		base.startStop = function(playing){
			if(playing !== true) playing = false; // Default if not supplied is false

			// Update variable
			base.playing = playing;

			// Toggle playing and text
			if(base.options.autoPlay) base.$startStop.toggleClass("playing", playing).html( playing ? base.options.stopText : base.options.startText );

			if(playing){
				base.clearTimer(); // Just in case this was triggered twice in a row
				base.timer = window.setInterval(function(){
					base.goForward(true);
				}, base.options.delay);
			} else {
				base.clearTimer();
			};
		};

		base.clearTimer = function(){
			// Clear the timer only if it is set
			if(base.timer) window.clearInterval(base.timer);
		};

		// Taken from AJAXY jquery.history Plugin
		base.setHash = function ( hash ) {
			// Write hash
			if ( typeof window.location.hash !== 'undefined' ) {
				if ( window.location.hash !== hash ) {
					window.location.hash = hash;
				};
			} else if ( location.hash !== hash ) {
				location.hash = hash;
			};

			// Done
			return hash;
		};
		// <-- End AJAXY code


		// Trigger the initialization
        base.init();
    };


    $.anythingSlider.defaults = {
        easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        delay: 3000,                    // How long between slide transitions in AutoPlay mode
        animationTime: 600,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Start",             // Start text
		stopText: "Stop",               // Stop text
		navigationFormatter: null       // Details at the top of the file on this use (advanced use)
    };


    $.fn.anythingSlider = function(options){
		if(typeof(options) == "object"){
		    return this.each(function(i){
				(new $.anythingSlider(this, options));

	            // This plugin supports multiple instances, but only one can support hash-tag support
				// This disables hash-tags on all items but the first one
				options.hashTags = false;
	        });
		} else if (typeof(options) == "number") {

			return this.each(function(i){
				var anySlide = $(this).data('AnythingSlider');
				if(anySlide){
					anySlide.gotoPage(options);
				}
			});
		}
    };


})(jQuery);

/*
 * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
 *
 * Uses the built In easIng capabilities added In jQuery 1.1
 * to offer multiple easIng options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// t: current time, b: begInnIng value, c: change In value, d: duration

jQuery.extend( jQuery.easing,
{
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
	Galeria plugin
	http://devkick.com/lab/galleria/
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){4 q;q=$.23.7=5(k){6(!q.1o()){Q J}$.1p(q.1b);4 l={Z:\'.1q\',K:E,10:E,1c:5(a,b,c){},1r:5(a){}};4 m=$.11(l,k);1d(4 i 24 m){6(i){$.7[i]=m[i]}}4 n=($(m.Z).R(m.Z))?$(m.Z):3(B.12(\'1e\')).25(8);4 o=$(B.12(\'1e\')).u(\'1s\');4 p=$(B.12(\'1f\')).u(\'1g\');n.u(\'1q\').13(o).13(p);Q 8.1t(5(){$(8).u(\'7\');$(8).1u(\'L\').1t(5(i){4 b=$(8);4 c=$.26?$.11({},m,b.27()):m;c.10=$(8).R(\':28-S\')?J:c.10;4 d=$(8).T(\'a\').R(\'a\')?$(8).T(\'a\'):J;4 e=$(8).1u(\'F\').C(\'M\',\'U\');4 f=d?d.9(\'1v\'):e.9(\'1h\');4 g=d?d.9(\'14\'):e.9(\'14\');4 j=1w 1x();6(c.K&&(N.r.t&&N.r.t.V(/\\#/,\'\')==f)){b.G(\'.D\').W(\'D\');b.u(\'D\')}$(j).29(5(){$(8).9(\'1y\',e.9(\'1y\'));4 a=d?d.T(\'F\').u(\'1z 1A\').C(\'M\',\'U\'):e.2a(E).u(\'1z\').C(\'M\',\'U\');6(d){d.2b(a)}6(!a.1B(\'1A\')){4 w=1i.1C(e.v()/e.y()*b.y());4 h=1i.1C(e.y()/e.v()*b.v());6(w<h){a.C({y:\'1D\',v:b.v(),1E:-(h-b.y())/2})}s{a.C({v:\'1D\',y:b.y(),1F:-(w-b.v())/2})}}s{N.1G(5(){a.C({1F:-(a.v()-b.v())/2,1E:-(a.y()-b.y())/2})},1)}a.9(\'O\',f);a.9(\'14\',g);a.1H(5(){$.7.X(f)});a.P(5(){$(8).u(\'P\')},5(){$(8).W(\'P\')});b.P(5(){b.u(\'P\')},5(){b.W(\'P\')});b.1I(a);a.C(\'M\',\'2c\');c.1r(3(a));6(b.1B(\'D\')){$.7.X(f)}e.1J()}).1K(5(){b.2d(\'<1f 2e="1K" 1L="2f:2g">2h 2i 2j: \'+f+\'</1f>\')}).9(\'1h\',f)})})};q.1M=5(a){Q $(a).R(\':1N-S\')?$(a).G(\':1O-S\'):$(a).1j()};q.1P=5(a){Q $(a).R(\':1O-S\')?$(a).G(\':1N-S\'):$(a).1Q()};q.1o=5(){$(\'1R\').13($(B.12(\'1e\')).9(\'1S\',\'1k\').C({v:\'1T\',y:\'1T\',M:\'U\'}));4 a=($(\'#1k\').v()!=1)?J:E;$(\'#1k\').1J();Q a};q.1b=5(a){4 b=$(\'.1s\');4 c=$(\'.7 F[O="\'+a+\'"]\');6(a){6($.7.K){N.r=N.r.1v.V(/\\#.*/,\'\')+\'#\'+a}c.15(\'L\').G(\'.D\').W(\'D\');c.15(\'L\').u(\'D\');4 d=$(1w 1x()).9(\'1h\',a).u(\'2k\');b.1U().13(d);b.G(\'.1g\').2l(c.9(\'14\'));$.7.1c(d,b.G(\'.1g\'),c);6($.7.10){d.C(\'2m\',\'2n\').1H(5(){$.7.1j()})}}s{b.G().2o().1U();$(\'.7 L.D\').W(\'D\')}$.7.16=a};$.11({7:{16:\'\',1c:5(){},X:5(a){6($.7.K){$.1V(a)}s{q.1b(a)}},1j:5(){4 a=$(q.1M($(\'.7 F[O="\'+$.7.16+\'"]\').15(\'L\'))).T(\'F\').9(\'O\');$.7.X(a)},1Q:5(){4 a=$(q.1P($(\'.7 F[O="\'+$.7.16+\'"]\').15(\'L\'))).T(\'F\').9(\'O\');$.7.X(a)}}})})(3);3.11({z:17,x:17,1p:5(a){3.x=a;4 b=r.t;3.z=b;6(3.H.1l){6(3.z===\'\'){3.z=\'#\'}$("1R").1I(\'<1W 1S="18" 1L="M: U;"></1W>\');4 c=$("#18")[0];4 d=c.1m.B;d.1X();d.1Y();d.r.t=b}s 6($.H.19){3.A=[];3.A.I=K.I;3.1a=[];3.Y=E}3.x(b.V(/^#/,\'\'));2p(3.1Z,2q)},20:5(a){3.A.21(a);3.1a.I=0;8.Y=E},1Z:5(){6(3.H.1l){4 a=$("#18")[0];4 b=a.2r||a.1m.B;4 c=b.r.t;6(c!=3.z){r.t=c;3.z=c;3.x(c.V(/^#/,\'\'))}}s 6($.H.19){6(!3.1n){4 d=K.I-3.A.I;6(d){3.Y=J;4 i;6(d<0){1d(i=0;i<1i.2s(d);i++){3.1a.2t(3.A.2u())}}s{1d(i=0;i<d;i++){3.A.21(3.1a.2v())}}4 e=3.A[3.A.I-1];6(e!==17){3.z=r.t;3.x(e)}}s 6(3.A[3.A.I-1]===17&&!3.Y){6(B.22.2w(\'#\')>=0){3.x(B.22.2x(\'#\')[1])}s{c=r.t;3.x(\'\')}3.Y=E}}}s{c=r.t;6(c!=3.z){3.z=c;3.x(c.V(/^#/,\'\'))}}},1V:5(a){4 b;6(3.H.19){b=a}s{b=\'#\'+a;r.t=b}3.z=b;6(3.H.1l){4 c=$("#18")[0];4 d=c.1m.B;d.1X();d.1Y();d.r.t=b;3.x(a)}s 6(3.H.19){3.1n=E;8.20(a);4 e=5(){3.1n=J};N.1G(e,2y);3.x(a);r.t=b}s{3.x(a)}}});',62,159,'|||jQuery|var|function|if|galleria|this|attr||||||||||||||||||location|else|hash|addClass|width||historyCallback|height|historyCurrentHash|historyBackStack|document|css|active|true|img|siblings|browser|length|false|history|li|display|window|rel|hover|return|is|child|find|none|replace|removeClass|activate|isFirst|insert|clickNext|extend|createElement|append|title|parents|current|undefined|jQuery_history|safari|historyForwardStack|onPageLoad|onImage|for|div|span|caption|src|Math|next|css_test|msie|contentWindow|dontCheck|hasCSS|historyInit|galleria_container|onThumb|galleria_wrapper|each|children|href|new|Image|alt|thumb|noscale|hasClass|ceil|auto|marginTop|marginLeft|setTimeout|click|prepend|remove|error|style|nextSelector|last|first|previousSelector|prev|body|id|1px|empty|historyLoad|iframe|open|close|historyCheck|historyAddHistory|push|URL|fn|in|insertBefore|meta|data|only|load|clone|replaceWith|block|html|class|color|red|Error|loading|image|replaced|text|cursor|pointer|andSelf|setInterval|100|contentDocument|abs|unshift|pop|shift|indexOf|split|200'.split('|'),0,{}))



$(document).ready(function() {
    $('.toolTips').tipTip();
    var add_label = '-over';
    $('.mouseover').mouseover(function(){
		var img_obj = ($(this).attr('src')) ? $(this) : $(this).children('img');
		var img_src = img_obj.attr('src');
		if (img_src && !img_src.match(new RegExp(add_label, 'gi'))){
			img_src = img_src.replace(new RegExp('\.([a-z0-9]+)$', 'gi'), add_label+'\.$1');
			img_obj.attr('src', img_src);
		}
	}).mouseout(function(){
		var img_obj = ($(this).attr('src')) ? $(this) : $(this).children('img');
		var img_src = img_obj.attr('src');
		if (img_src && img_src.match(new RegExp(add_label, 'gi'))){
			img_src = img_src.replace(new RegExp(add_label+'\.([a-z0-9]+)$', 'gi'), '\.$1');
			img_obj.attr('src', img_src);
		}
	});
			$('a').each(function(ind, obj) {
			var href = $(this).attr('href');
			if (href) {
				var arr_match = href.match(new RegExp('\\\.pdf|\\\.xls|\\\.doc|\\\.exe', 'gi'));
				if (arr_match && arr_match.length) {
					var pos_slash = href.lastIndexOf('/');
					var doc = (pos_slash>-1) ? href.substring(pos_slash+1): href;
					doc = (doc);
					$(this).click(function() {
						if (valeur==1){stat('aljt_site','','','telechargement doc;'+doc);}
					});
				}
			}
		});
			
	$('#listingPartenaire').click(function(e){
		e.preventDefault();
		var id = $('select[name=listingPartenaire]').val();
		var val = $(this).attr('href');
		val += '&pid='+id;
		self.location = val;
	});
	
	$('#listingBassin').click(function(e){
		e.preventDefault();
		var id = $('select[name=listingBassin]').val();
		var val = $(this).attr('href');
		val += '&bid='+id;
		self.location = val;
	});
	
	// *************** Fancy zoom *************** //
 	$(function(){
		$('img.imgzoom').fancyzoom({
			"imgDir": "/lib/css/jquery-plugin/fancyzoom/images/"
		});
	});

	// ****************** 360 ******************* //
	$('.diaporama').each(function(i, ui) {
		var img = $(ui);
		var ajax_file = '/module/jqueryvirtualtour/getImageSize.php';
		var post_data = {
			'url' : $(img).attr('src').replace('_diaporama', '')
		};
		$.post(ajax_file,post_data,function(data){
			data = ''+data;
			var arr_data = data.split('|');
			var width=arr_data[0];
			var height=arr_data[1];
			$(img).attr({'src':$(img).attr('src').replace('_diaporama',''),'height': height,'width':width});

			// exec diaporama on the image => with the lib you'll found
			$(img).panorama({
				'auto_start': 0,
				'start_position': 0
			});
		});

 	});
});

$(window).load(function(){
	$('*.rotten').removeClass('rotten');
});

var defaultPrinter = function(html){
	$('iframe[name=printer]').contents().find('.colA').remove();
	$('iframe[name=printer]').contents().find('.divcontent').before('<h1>'+$('h1').html()+'</h1>');
};

$('.print').click(function(e) {
	e.preventDefault();
	//IDfr.printer('#middlespace', defaultPrinter);
	print();
});
