var agendaTypes = new Array('workshop', 'keynote', 'session', 'presentation', 'panel');

//Genearl functions ============================================================
//==============================================================================
// getElementsToHide -----------------------------------------------------------
// loop through the agendaTypes and grab all of the elements to hide
// -----------------------------------------------------------------------------
function getElementsToHide(s) {
	var array = new Array();
	var tarray = new Array();
	for(var i = 0; i < agendaTypes.length; i++ ) {
		if(agendaTypes[i] != s) {
			tarray = document.getElementsByClassName(agendaTypes[i]);
		}
		for(var j = 0; j < tarray.length; j++) {
			array.push(tarray[j]);
		}
	}
	return array;
} // getElementsToHide

// getElementsToShow -----------------------------------------------------------
// a synonym for getElementsToHide
// -----------------------------------------------------------------------------
function getElementsToShow(s) {
	return getElementsToHide(s);
}

// Hide ------------------------------------------------------------------------
// hides what you neeed to hide
// -----------------------------------------------------------------------------
function hide(es) {
	for(var i = 0; i < es.length; i ++) {
		new Effect.BlindUp(es[i], {queue: 'end', duration: .1});
	}
} //hide

// show ------------------------------------------------------------------------
// shows what you need to show
// -----------------------------------------------------------------------------
function show(es) {
	for(var i = 0; i < es.length; i ++) {
		new Effect.BlindDown(es[i], {queue: 'front', duration: .1});
	}
} //show


//Behaviours ===================================================================
//==============================================================================
Event.addBehavior({
  '#fworkshops:click' : function(e) {
  		var eh = getElementsToHide('workshop');
  		var es = document.getElementsByClassName('workshop');
  		
		show(es)
		hide(eh);		

		return false;
  },
   '#fkeynotes:click' : function(e) {
  		var eh = getElementsToHide('keynote');
  		var es = document.getElementsByClassName('keynote');
  		
		show(es)
		hide(eh);		
		
		return false;		
  },
   '#fsessions:click' : function(e) {
  		var eh = getElementsToHide('session');
  		var es = document.getElementsByClassName('session');
  		
		show(es)
		hide(eh);		

		return false;
  },
   '#fpresentations:click' : function(e) {
  		var eh = getElementsToHide('presentation');
  		var es = document.getElementsByClassName('presentation');
  		
		show(es)
		hide(eh);		

		return false;
  },
   '#fpanels:click' : function(e) {
  		var eh = getElementsToHide('panel');
  		var es = document.getElementsByClassName('panel');
  		
		show(es)
		hide(eh);		

		return false;
  },
   '#fall:click' : function(e) {
  		var es = getElementsToShow('all');
  		
		show(es)

		return false;
  },
	'.sessionLink:click' : function(e) {
		var id = this.id.split("-")[1];
		Effect.toggle('desc-'+id, 'blind', {duration:.2}); 
		return false;
		
		
  }
});
