// mootools

window.addEvent('domready', function() {
		
	// nav fade on mouseover and mouseout only for inactive links
	
	$$('#nav a.inactive').each(function(element) {
																			
		var myFx = new Fx.Morph(element, {duration: 200, wait: false});
		
		element.addEvent('mouseover', function(){
			myFx.start({	'color': '#FFFFFF',
										'padding-left': '3px',
										'border-left-width': '4px',
										'border-left-style': 'solid',
										'border-left-color': '#CB438F;',
										'font-weight': 'bold'
								 });
		});
		
		element.addEvent('mouseout', function(){
			myFx.start({	'color': '#FFFFFF',
										'padding-left': '0px',
										'border-left-width': '0px',
										'font-weight': 'normal'
								 });
		});
		
	});
	
	// accordion for news page
	
	function setupAccordion() {
	
		var accordion = new Accordion($$('.toggler'),$$('.element'), {
			opacity: 0,
			onActive: function(toggler) { toggler.setStyle('color', '#CB438F'); },
			onBackground: function(toggler) { toggler.setStyle('color', '#FFF'); }
		});
	
	}
	
	setupAccordion();
	
	// hide main text area and animate toggle button state
	
	function show() {
		$('textWrapper').fade('in');
	}
	
	function hide() {
		$('textWrapper').fade('out');
	}

	
	var toggleColourTweenEl = $('toggle').getElement('p');

	$('toggle').addEvent('click', function(e){
		e.stop();
		var status = $('vertical_status').get('html');
		if (status == 'Show Text') {
			$('vertical_status').set('html', 'Show Image');
			$('toggle').tween('width', 620);
			$('textWrapper').fade('in');
		} else {
			$('vertical_status').set('html', 'Show Text');
			$('toggle').tween('width', 70);
			$('textWrapper').fade('out');
		}
		
		toggleColourTweenEl.tween('color', '#CB438F');
		//setupAccordion();
	});
		
	$('toggle').addEvent('mouseover', function(e){
		toggleColourTweenEl.tween('color', '#CB438F');
		e.stop();
	});
	
	$('toggle').addEvent('mouseout', function(e){
		toggleColourTweenEl.tween('color', '#FFF');
		e.stop();
	});
	
});

// slide image in onload (onload triggered incorrectly before css background images load in firefox 2)

window.addEvent('load', function(){
									 
	$('content').tween('background-position', [-700, 0]);

}); 

// general stuff

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}