'use strict';
var BIO = function ($) {
	var VA = {
	}
	BIO = {
		initialise: function (event) {
			
			$.ajax({
				url: 'http://www.biosphere-fontainebleau-gatinais.fr/biosphereAdmin/agenda/agenda/',
				dataType: "html",
					success: function(html){
						$('#scroll').replaceWith(html);
						$('.vertical').scrollable({vertical: true}).navigator({navi: '#flowtabs', navItem: 'a', activeClass: 'current'});
					}			
			});

					
		},
	  	loaded: function (event) {
			$.ajax({
			  url: 'http://www.biosphere-fontainebleau-gatinais.fr/biosphereAdmin/messages/agenda/',
			   success: function(data){
			   	$('#scroller').append(data);
  				$("#scroller").scrollable({circular: true}).autoscroll({ autoplay: true, interval: 3000 });

			   }
			});
			$.ajax({
			  url: 'http://www.biosphere-fontainebleau-gatinais.fr/biosphereAdmin/messages/approfondir/',
			   success: function(data){
			   	$('#scroller2').append(data);
  				$("#scroller2").scrollable({circular: true}).autoscroll({ autoplay: true, interval: 3500 });

			   }
			});
		
			$("#scroller").empty();
			$("#scroller2").empty();

			/* display in new window for external link */
			$('a[rel="external"]').bind('click', function (event) {
   				event.preventDefault();
   				window.open($(this).attr('href'));
   				return false;
			});	
			
			$('.breadcrumbs').find('a:first').attr('href','http://biosphere-fontainebleau-gatinais.fr/wiki/doku.php?id=approfondir:accueil');
	  	}
	}
	$(document).bind('ready', BIO.initialise);
	$(window).bind('load', BIO.loaded);
 
 	return BIO;
 
	};

BIO = (BIO)(jQuery);
