var Site = {            
	smoothscroll: function() {
	   var mySmoothScroll = new SmoothScroll();
	},  
	intro: function() {
//	    var logo = $('inner');
//	    var logoFx = new Fx.Tween(logo, {duration: 'long', transition: Fx.Transitions.Bounce.easeOut});
//	    logoFx.start('margin-top', [-140, 20]);
	}, 
	nav: function() {      
		var links = $$('#left_navigation ul li a','#left_links a');
		links.each(function(link){
	   		var myFx = new Fx.Tween(link, {link: 'chain'});
			var imageout = new Fx.Morph(link, {duration: 'normal', transition: Fx.Transitions.Sine.easeOut});
			//myFx.start('opacity', 0.5);
			link.setStyle('opacity', 0.5);
			
			link.addEvent('mouseover',function(){
			   myFx.start('opacity',  1);
			}); 
			link.addEvent('mouseleave',function(){
			   myFx.start('opacity', 0.5);
			});
		    link.addEvent('mousedown',function(){
		   	imageout.start({
		    	    'color': '#fff',
		    		'opacity': 1
		    	});   
			}); 			
		});                            
	    //$$('#left_navigation li.trigger.active a').setStyle('opactiy', 1);
	},   
	subnav: function() {      
		var twinks = $$('#right_links ul li a');
		twinks.each(function(twink){
	   		var thisFx = new Fx.Morph(twink, {link: 'chain', duration: 'short'});
			var oldColors = twink.getStyle('color'); 
			//var imageout = new Fx.Morph(link, {duration: 'long', transition: Fx.Transitions.Sine.easeOut});
			twink.addEvent('mouseover',function(){
			   thisFx.start({'padding-left': 10, 'color': '#fff'});
			}); 
			
			twink.addEvent('mouseleave',function(){
			   thisFx.start({'padding-left': 0, 'color': oldColors});
			});
			/*
			link.addEvent('mousedown',function(){
				imageout.start({
				    'font-size': '23px', 
				    'color': '#fff'
				});   			   
			
			}); 
			*/ 
			//thisFx.start({'padding-left': 10});
			//thisFx.start({'padding-left': 0});
		});
	},
	
	slide: function() {     
		var slideFx = new Fx.Slide('directions', {
		    duration: 'long',
		    transition: Fx.Transitions.Bounce.easeOut
		});              
		var slinky = $$('.trigger')
		slinky.addEvent('click',function(){
		   slideFx.toggle();
		});
		//Automatically hides and then slies in "myElement":
		slideFx.hide();
	},  
	listing: function() {
		var listings = $$('div.listingEntry','div.easyEventsList_item','div.blogEntry','div.cultureEntry','div#memberGallery', 'div#memberLink');
		if (listings) {
			console.warn('listings exist');
			listings.each(function(listing){
		   		var listFx = new Fx.Tween(listing, {link: 'chain'});
				var oldColor = listing.getStyle('background-color'); 
				listFx.start('background-color', '#e6e6e6');

				listing.addEvent('mouseenter',function(){
				   listFx.start('background-color', '#fff');
				}); 
				listing.addEvent('mouseleave',function(){
				   listFx.start('background-color', '#e6e6e6');
				});
			    			
			});
		}
	},
	maps: function() {
		var map = $('map');
		
		var mapFx = new Fx.Tween(map, {link: 'chain'});
		mapFx.start('opacity', 0.7);

		map.addEvent('mouseenter',function(){
		   mapFx.start('opacity', 1);
		}); 
		map.addEvent('mouseleave',function(){
		   mapFx.start('opacity', 0.7);
		});
		
	},
	init: function() { 
		Site.smoothscroll();	
	   Site.nav();
	   Site.subnav();
		Site.listing();
	   if($('directions')) Site.slide();
		if($('map')) Site.maps();
//	   $('inner').setStyle('margin-top', -140);
	}    
};

window.addEvent('load', Site.init);
//window.addEvent('domready', function() {
//	SqueezeBox.assign($$('a[rel=boxed][href^=#]'), {
//		size: {x: 200, y: 200}
//	});        	
//	var myCookie = Cookie.write('zipcode', 'false', {domain: 'destinationchelsea.org'});
//	if (Cookie.read('zipcode') == 'true') {
//		do nothing 
//	} else {
//		SqueezeBox.fromElement($('zipcode'), {
//   		size: {x: 350, y: 200},
//    		handler: 'adopt' // we set a handler to disable handler/parser detection
//		});
//		var dcCookie = Cookie.write('zipcode', 'true', {domain: 'destinationchelsea.org'});
//	}
 
//});