// 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': '#7E9F90',
										'padding-left': '3px',
										'border-left-width': '1px',
										'border-left-style': 'solid',
										'border-left-color': '#CCCCCC'
								 });
		});
		
		element.addEvent('mouseout', function(){
			myFx.start({	'color': '#666666',
										'padding-left': '0px',
										'border-left-width': '0px'
								 });
		});
		
	});
	
	// hide main text area and animate toggle button state
	
	var status = {
		'true': 'Show Image',
		'false': 'Show Text'
	};
	
	var toggleWidth = {
		'true': 65,
		'false': 620
	};
	
	var myVerticalSlide = new Fx.Slide('text');

	$('toggle').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.toggle();
		toggleColourTweenEl.tween('color', '#7E9F90');
	});
	
	var toggleColourTweenEl = $('toggle').getElement('p');
	//var toggleColourTween = new Fx.Tween(toggleColourTweenEl, {property: 'color', link: 'chain'});
	
	/*$('toggle').addEvent('mouseover', function(e){
		toggleColourTween.start('#E3701E').start('#7E9F90');
		e.stop();
	});*/
	
	$('toggle').addEvent('mouseover', function(e){
		toggleColourTweenEl.tween('color', '#E3701E');
		e.stop();
	});
	
	$('toggle').addEvent('mouseout', function(e){
		toggleColourTweenEl.tween('color', '#7E9F90');
		e.stop();
	});

	// When myVerticalSlide begins its transition, we check for its status
	myVerticalSlide.addEvent('start', function() {
		$('toggle').tween('width', toggleWidth[myVerticalSlide.open]);
		$('vertical_status').set('html', '');
	});
	
	myVerticalSlide.addEvent('complete', function() {
		$('vertical_status').set('html', status[myVerticalSlide.open]);
	});
	
});

// 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);
}