function choose_next_container(this_container,next_container,sub_container){
	new Effect.BlindUp(this_container,{duration:0.2});
	new Effect.BlindDown(next_container,{duration:0.2});
	new Effect.BlindDown(sub_container,{duration:0.2});
}

function choose_level2(){
	choose_next_container('level1_container','level2_container', $F('level1') + '_choices');
}

function choose_level3(){
	choose_next_container('level2_container','level3_container', $F('level2') + '_choices');
}

function choose_level4(){
	choose_next_container('level3_container','level4_container', $F('level3') + '_choices');
}


function choose_level5(){
	choose_next_container('level4_container','level5_container', $F('level4') + '_choices');
}

function replace_text(baseId,appendId){
/*

So - the "baseId" should wrap the entire tool name.
The text/inputs should be contained in a block-level element (<p> probably makes the most sense). The block-level element that contains the text should have an id of baseId + '_text'. The input elements should have a class of baseId + '_field'.

appendId is the element that the output of this tool gets appended to.

*/
	var elements=document.getElementsByClassName(baseId + '_field',baseId);
	for(var i=0; i < elements.length; i++){
		var form_element=elements[i];
		var form_value=$F(form_element);
		new Insertion.After(form_element,form_value);
		new Element.remove(form_element);
	}
	var text_element=$(baseId + '_text');
	var append_element=$(appendId);
	if (append_element){
		append_element.value += '\n' + text_element.innerHTML + '\n';
	}
}

function cloneObject(what) {
    for (i in what) {
        if (typeof what[i] == 'object') {
            this[i] = new cloneObject(what[i]);
        }
        else
            this[i] = what[i];
    }
}

function start_over(){
	var elements=document.getElementsByClassName('container','facilitator');
	for(var i=0; i< elements.length ; i++){
		var container=elements[i];
		if (container){
			if(Element.visible(container)){
				new Effect.BlindUp(container,{duration:0.2});
			}
		}
	}
	if(! Element.visible('level1_container')){
		new Effect.BlindDown('level1_container',{duration:0.2});
	}
}

