function hide_all(){
	record_step();
	for (_i = 1; _i < step_count; _i++) {
		var myFx = new Fx.Slide('step_' + _i + '_container').hide();
	};

	removeAllClasses();
	all_open = false;
}

function record_step(_step) {
	var jSonRecordStep = new Request.JSON({url: "store_step.php", 
	onComplete: function(summary) {
	    //    		    
	 }}).POST({step: _step});
}


function close_all(_current) {
	record_step();
	for (_i = 1; _i < step_count; _i++) {
		if (_i != _current) {
			var myFx = new Fx.Slide('step_' + _i + '_container').slideOut();
		}
	}
	removeAllClasses();
	all_open = false;
	
	var new_inner_html = '<img src="images/features/displayall-downarrow.gif" alt=""/><a href="">Display All Features</a><img src="images/features/displayall-downarrow.gif" alt=""/>';
	$('features_expand_contract').innerHTML = new_inner_html; 
}

var step_count = 12;
var current_step = 0;
var all_open = false;

function removeAllClasses() {
	for (_i = 1; _i < step_count; _i++) {
		$('btn_step_' + _i).removeClass("btn_active");
	}
}

function click_step(_step) {
	record_step(_step);
	current_step = _step;
	currently_all_open = all_open;
	var x = new Chain();
	x.chain(function(){
		close_all(_step);
		x.callChain();
	}).chain(function(){
		if (!currently_all_open) {
			var myFx = new Fx.Slide('step_' + _step + '_container').toggle();
		}
	});
	x.callChain();
	$('btn_step_' + _step).toggleClass("btn_active");	
}

function open_all_steps() {
	//record_step('all');
	var x = new Chain();
	x.chain(function(){
		//close_all();
		x.callChain();
	}).chain(function(){
		var myFx = new Fx.Slide('step_1_container').toggle();
		var myFx = new Fx.Slide('step_2_container').toggle();
		var myFx = new Fx.Slide('step_3_container').toggle();
		var myFx = new Fx.Slide('step_4_container').toggle();
		var myFx = new Fx.Slide('step_5_container').toggle();
		var myFx = new Fx.Slide('step_6_container').toggle();
		var myFx = new Fx.Slide('step_7_container').toggle();
		var myFx = new Fx.Slide('step_8_container').toggle();
		var myFx = new Fx.Slide('step_9_container').toggle();
		var myFx = new Fx.Slide('step_10_container').toggle();
		var myFx = new Fx.Slide('step_11_container').toggle();
	});
	x.callChain();
	all_open = true;
	var new_inner_html = '<img src="images/features/displayall-uparrow.gif" alt=""/><a href="">Hide All Features</a><img src="images/features/displayall-uparrow.gif" alt=""/>';
	$('features_expand_contract').innerHTML = new_inner_html; 
	
	$('btn_step_1').toggleClass("btn_active");
	$('btn_step_2').toggleClass("btn_active");
	$('btn_step_3').toggleClass("btn_active");
	$('btn_step_4').toggleClass("btn_active");
	$('btn_step_5').toggleClass("btn_active");
	$('btn_step_6').toggleClass("btn_active");
	$('btn_step_7').toggleClass("btn_active");
	$('btn_step_8').toggleClass("btn_active");
	$('btn_step_9').toggleClass("btn_active");
	$('btn_step_10').toggleClass("btn_active");
	$('btn_step_11').toggleClass("btn_active");
}

_initial_menu_height = 0;

function resize_menu() {
	_content_height_str = $('centreColumn').getStyle('height');
	_menu_height_str = $('product_menu').getStyle('height');
	_content_height = _content_height_str.substring(0, _content_height_str.length - 2);
	_menu_height = _menu_height_str.substring(0, _menu_height_str.length - 2);
	if (((_content_height * 1) + 28) >= (_menu_height * 1)) {
		$('product_menu').setStyle('height', (_content_height *1 )+ 28);
	} else {
		if (_initial_menu_height != 0) { 
			$('product_menu').setStyle('height', _initial_menu_height);
		}
	}
	
	if (_initial_menu_height == 0) {
		_initial_menu_height = $('product_menu').getStyle('height');
	}
	
	setTimeout("resize_menu()",500);
}

window.addEvent('domready', function() {
	setTimeout("resize_menu()",500);
	
});