window.addEvent('domready', function() {
	
	//document.body.quote = new CenterQuote();
	
	//new DisplayEventList();
	
	/*var myAccordion = new Fx.Accordion($$('.track'), $$('.drawer'), {
	    display: 0,
	    alwaysHide: true
	});*/
	
});

window.addEvent('load', function() {
	
	//document.body.quote.activate();
	
});

var DisplayEventList = new Class({
	initialize: function(){
		
		if (!$$('.events')[0]) return;
		
		this.events = $$('.event');
		
		this.baseurl = this.getBaseURL();
		
		
		
		this.events.each(function(event){
			event.img = event.getElement('.col1 img');
			if (event.img.src == this.baseurl) this.deleteColumn(event);	
		}.bind(this));
		
		/*
		this.container=$('quote');
		this.box=$('quote-block');
		
		this.box.fx = new Fx.Morph(this.box, {duration: 600, transition: Fx.Transitions.Sine.easeOut});
		this.box.set({'display':'none'});
		
		this.container.h = this.container.getStyle('height').toInt();
		this.box.h = this.box.getStyle('height').toInt();
	
		//console.log("hi: "+this.box.h);
		
		var newpadding = Math.floor((this.container.h-this.box.h)/2);
		
		
		//this.box.fx.start({});
		this.box.fx.start({
			'opacity':[0,1],
			'margin-top':newpadding
		});
		*/	
			
		
	},
	deleteColumn:function(target){
		
			var col1 = target.getElement('.col1');
			var col2 = target.getElement('.col2');

			col1.destroy();
			
			col2.setStyles({
				'float'  : 'left',
				'width'  : '500px'
			});
	},
	
	getBaseURL:function(){
		
	    var url = location.href;  // entire url including querystring - also: window.location.href;
	    var baseURL = url.substring(0, url.indexOf('/', 14));
	
	
	    if (baseURL.indexOf('http://localhost') != -1) {
	        // Base Url for localhost
	        var url = location.href;  // window.location.href;
	        var pathname = location.pathname;  // window.location.pathname;
	        var index1 = url.indexOf(pathname);
	        var index2 = url.indexOf("/", index1 + 1);
	        var baseLocalUrl = url.substr(0, index2);
	
	        return baseLocalUrl + "/";
	    }
	    else {
	        // Root Url for domain name
	        return baseURL + "/";
	    }
	

	}
});




//*******************************************


var CenterQuote = new Class({
	initialize: function(){
		
		this.container=$('quote');
		this.box=$('quote-block');
		
		this.box.fx = new Fx.Morph(this.box, {duration: 600, transition: Fx.Transitions.Sine.easeOut});
		this.box.set({'display':'none'});			
		
	},
	activate:function(){

		this.container.h = this.container.getStyle('height').toInt();
		this.box.h = this.box.getStyle('height').toInt();
	
		//console.log("hi: "+this.box.h);
		
		var newpadding = Math.floor((this.container.h-this.box.h)/2);

		this.box.fx.start({
			'opacity':[0,1],
			'margin-top':newpadding
		});
	}
});



