var Site = {            
	
	smoothscroll: function() {
	   var mySmoothScroll = new SmoothScroll();
	},  
	
	accordion: function() {
	   	var myAccordion = new Accordion('h3.toggler', 'div.slider', {
			opacity: false,
			display: -1,
			alwaysHide: true,
			
			onActive: function(toggler, element){
				toggler.tween('color', '#000');
			},
			onBackground: function(toggler, element){
				toggler.tween('color', '#666');
			}
		});
		
	}, 
	
	tips: function() {
		
		$$('.tips').each(function(element,index) {  
		        var content = element.get('title').split('::');  
		        element.store('tip:title', content[0]);  
		        element.store('tip:text', content[1]);  
		    });  
		
	   
			var myTips = new Tips('.tips', {
				showDelay: 700,
				hideDelay: 100
			});
		
		    	myTips.addEvents({  
			    'show': function(tip) {  
			        tip.fade('in');  
			    },  
			    'hide': function(tip) {  
			        tip.fade('out');  
			    }  
			});
			
	},   
	
	thumbs: function() {
		var thumbs = $$('.thumbnail');
		thumbs.each(function(thumb){
	   		var thumbFx = new Fx.Tween(thumb, {link: 'chain', duration: 'normal', wait: false});
			
			//initialize effects
			thumbFx.start('opacity', 1);
			
			//mouse actions
			thumb.addEvent('mouseover',function(){
			   thumbFx.start('opacity', 0.5);
			}); 
			
			thumb.addEvent('mouseleave',function(){
			   thumbFx.start('opacity', 1);
			});
			
			
			
		});
	},
	
	tagcloud: function() {
		var tags = $$('div.tagcloud span a');
		
		
		tags.each(function(tag){
	   		var tagFx = new Fx.Tween(tag, {link: 'chain'});
			
			//initialize effects
			tagFx.start('opacity', 0.5);
			
			tag.addEvent('mouseenter',function(){
			   tagFx.start('opacity', 1);   				
			}); 

			tag.addEvent('mouseleave',function(){
			   tagFx.start('opacity', 0.5);
			}); 

		});       
	},
	
	nav: function() {
		var links = $$('#nav a');
		
		
		links.each(function(link){
	   		var linkFx = new Fx.Tween(link, {link: 'chain'});
			
			linkFx.start('color', '#000');
			
			link.addEvent('mouseenter',function(){
			   linkFx.start('color', '#999');   				
			}); 

			link.addEvent('mouseleave',function(){
			   linkFx.start('color', '#000');
			}); 

		});       
	}, 
	
	
	init: function() { 
	   if($('accordion')) Site.accordion();
	   //if($$('#wrapper.Series')) Site.accordion2();
	   if($$('.tips')) Site.tips(); 
	   if($$('.thumbnail')) Site.thumbs();
	   if($$('div.tagcloud')) Site.tagcloud();
		Site.nav();
	   //Site.loader();
	}    
	
};

window.addEvent('domready', Site.init);