//Function below is called by buttons in the scrolling Flash header - this function is used to jump to an anchor on the page - there is an issue with doing that internally within Flash with Flash's getURL function.
function jumpToAnchor(URLtoOpen, windowName, windowFeatures){
	newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}

window.addEvent('domready', function() {
	//EVENTS
	//all events contain an a tag with the id event_link_[id] - this is what we are going to target and add an event to
	//USING Mootools Fx.Slide - CAUTION: you cannot create a new Fx object inside the attached event - this must be done before the event is called - so that is why we are setting up an array below
	//create an array of Mootools Fx Slide objects to be used by the attached event
	var event_info_sliders = new Array();
	//get a list of all the elements in the events that we need to attach links to
	var event_links = $('eventwrapper').getElements('a[id^=event_link]');
	for (var i=0;i<event_links.length;i++)
	{
		var elem_id = event_links[i].id;
		//id is in the format event_link_num where num is 01, 02 etc. and matches the suffix for the parent element and the info element to be toggled
		var temp = elem_id.split('_');
		var suffix = temp[2];
		var infoId = 'event_info_'+suffix;
		var mySlide = new Fx.Slide(infoId);
		//hide the info box to initialize - cannot be done by the style sheet - Mootools needs it to be done here
		mySlide.hide();
		event_info_sliders[elem_id]=mySlide;
	}
	//now attach the events
	for (var i=0;i<event_links.length;i++)
	{
		event_links[i].addEvents({
			'click': function(e) {
				e = new Event(e);
				var infoSlider = event_info_sliders[this.id];
				infoSlider.toggle();
				e.stop();
			}
		});
	}
	//create a variable that remembers state of complete event listings
	var event_complete_visible = false;
	//attach an event to the complete event listing link to show all fall event listings
	$('event_complete').addEvents({
		'click': function(e) {
			e = new Event(e);
			for (var i=0;i<event_links.length;i++)
			{
				var infoSlider = event_info_sliders[event_links[i].id];
				if (!event_complete_visible) infoSlider.slideIn();
				else infoSlider.slideOut();
			}
			//toggle
			event_complete_visible = !event_complete_visible;
			e.stop();
		}
	});
	
	//EXPERIENCES
	//all experiences contain an a tag with the id exp_link_[id] - this is what we are going to target and add an event to
	//USING Mootools Fx.Slide - CAUTION: you cannot create a new Fx object inside the attached event - this must be done before the event is called - so that is why we are setting up an array below
	//create an array of Mootools Fx Slide objects to be used by the attached event
	var exp_info_sliders = new Array();
	//get a list of all the elements in the events that we need to attach links to
	var exp_links = $('botboxeswrap').getElements('a[id^=exp_link]');
	for (var i=0;i<exp_links.length;i++)
	{
		var elem_id = exp_links[i].id;
		//id is in the format exp_link_num where num is 01, 02 etc. and matches the suffix for the parent element and the info element to be toggled
		var temp = elem_id.split('_');
		var suffix = temp[2];
		var infoId = 'exp_info_'+suffix;
		$(infoId).style.display='none';
//alert(infoId);
/*	
		var mySlide = new Fx.Slide(infoId);
		//hide the info box to initialize - cannot be done by the style sheet - Mootools needs it to be done here
		mySlide.hide();
		exp_info_sliders[elem_id]=mySlide;
*/
	}
	//now attach the events
	for (var i=0;i<exp_links.length;i++)
	{
		exp_links[i].addEvents({
			'click': function(e) {
				e = new Event(e);
				var elem_id = this.id;
				//id is in the format exp_link_num where num is 01, 02 etc. and matches the suffix for the parent element and the info element to be toggled
				var temp = elem_id.split('_');
				var suffix = temp[2];
				var infoId = 'exp_info_'+suffix;
				if ($(infoId).style.display=='') $(infoId).style.display='none';
				else $(infoId).style.display='';
/*
				var infoSlider = exp_info_sliders[this.id];
				infoSlider.show();
*/
				e.stop();
			}
		});
	}
});