var Site = {
		
	start: function(){
		
		$$('.external').addEvent('click', function(ev){
				window.open(this.href); 
				new Event(ev).stop(); 
				return; 
		});
		
		if( $('activites') ) Site.slide();
		if( $('SlideItMoo_outer') ) Site.SlideItMoo();
		if( $('nav') ) Site.transition();
		if( $('isGallery') ) Site.SlideGallery();
		
	},
	
	slide : function(){
		
		$$('#activites li').setStyle('cursor','pointer');
		
		$$('#activites li').each(function(element){
			
			var p = element.getElement('p') || '';
			var a = element.getElement('a').href || '';			
			
			if( p!='' ) {
		
				var slide =  new Fx.Morph(p, {duration: 70, transition: Fx.Transitions.linear});
				
				element.addEvents({
									
					'mouseenter': function(e) {
						e = new Event(e);
						slide.start({'height': [0, 155]});
						e.stop();			
					},	
					
					'mouseout': function(e) {
						e = new Event(e);									
						slide.start({'height': [155, 0]});
						e.stop();	
					},
					
					'click': function(e) {
						new Event(e).stop();
						document.location = a;
					}
						
				});	
			
			}
		
		});
		
	},
	
	transition : function (){  
	
		$('nav').getElements('a').addEvents({
				
				'mouseenter': function(e){
		
		          new Fx.Morph(this, {duration: 700}).start({'opacity': 0.8});	
			     
				},
				
				'mouseout': function(e){
					
		          new Fx.Morph(this, {duration: 700}).start({'opacity': 1});	
			     
				}
		})				
	},
	  
	SlideItMoo : function(){
		
		/* thumbnails example , div containers */
		new SlideItMoo({
					overallContainer: 'SlideItMoo_outer',
					elementScrolled: 'SlideItMoo_inner',
					thumbsContainer: 'SlideItMoo_items',		
					itemsVisible:2,
					elemsSlide:2,
					duration: 2200,
					itemsSelector: '.SlideItMoo_element',
					autoSlide: 1,
					showControls:1,
					startIndex:5,
					onChange: function(index){
						//alert(index);
					}
		
		});
		
	},
	
	SlideGallery : function(){
	   new slideGallery( $$('div.gallery')[0], {
            steps: 1,
            speed: 2000,
            duration: 4000,
            mode: 'circle',
            autoplay: 1
        });
    }
	
}



window.addEvent('domready', function(){
	Site.start();
});



