// JavaScript Document
	
window.addEvent('domready', function() {
	
	/*
	var eventIMGs = new Array();
    var eventURLs = new Array();
	
	var data = {};
	var data2 = {};
	
	
	for(i=0; i<eventIMGs.length; i++) {
		var s = eventIMGs[i].toString();
		var u = eventURLs[i].toString();
		data[s] = {'href': u, 'title':'Click', 'caption':''};
	}	
	for(i=0; i<eventIMGs2.length; i++) {
		var s = eventIMGs2[i].toString();
		var u = eventURLs2[i].toString();
		data2[s] = {'href': u, 'title':'Click', 'caption':''};
	}*/
	
	var d1  = new Element('div', {id: 'drop_panel_content'});
	var d2  = new Element('div', {id: 'drop_panel'});
	var d3  = new Element('div', {id: 'caption'});
	var d4	= new Element('img', {id: 'dropped_image', src:'uploads/images/nautica/placeholder_event_poster.jpg', alt:'dropped_image'});
	var d5	= new Element('p', {id: 'event_caption'});
	var d6	= new Element('a', {id: 'dropped_event_link', href:'entertainment'});
	
	d5.set('text', 'Welcome to the Hervey Bay Boat Club!');
	
	
	d1.set('class', 'drop_panel_content');
	d2.set('class', 'drop_panel');
	d3.set('class', 'caption');
	
	
	d3.adopt(d5);
	d6.adopt(d4);
	d1.adopt([d6, d3]);
	d2.adopt(d1);
	$('drop_content_container').adopt(d2);
	
	var myDropEffect = new Fx.Morph('drop_panel', {duration: 'normal', transition: Fx.Transitions.Quart.easeOut, link: 'chain'});
 
	myDropEffect.start({
		'padding-top': [0, 200],
		'top': [-300, 0]
	});
	
	notifyReadyToChange = function() {
	
	}
	
	dropInWithImageAndCaption = function(trigger) {
		// Lift the panel
		myDropEffect.trigger = trigger;
		
		myDropEffect.duration = 1500;	
		myDropEffect.start({
			'padding-top': 0,
			'top': -400
		}).chain(function() {
		
			// change the content
			$('event_caption').set('text', $(this.trigger).get('title'));
		
			/* To get the bigger image source we just manipulate the path */
			/* we replace the 'uploads/images/photobox/thumb_' with 'uploads/images/photobox/' */
			
			str = $(this.trigger).getFirst().get('src');
			str = str.replace('thumb_','');
			
			$('dropped_image').set('src', str);
			$('dropped_image').set('width', 222);
			$('dropped_image').set('height', 300);
			$('dropped_event_link').set('href', $(this.trigger).get('href'));
			
			this.callChain();
		}).chain( function() {
		
		// Drop it back down changed
		this.duration = 500;		
		this.start({
			'padding-top': 200,
			'top': 0
		});
		});
	}
	
	$$('a.selecter').each(function(elm) {
		elm.addEvent('click', function(e) {
			//e.stop();
			ev = new Event(e);
			ev.stop();
			dropInWithImageAndCaption(this.get('id'));
		});
	});
});
