// JavaScript Document

function show_hide(box,button){

	var thisbox = document.getElementById(box);
	var thisbutton = button;

	var current_display = thisbox.style.display;
	
	if (current_display == '' || current_display == 'block'){

		thisbox.style.display = 'none';
		thisbutton.style.backgroundPosition = '0 -25px';

	} else {

		thisbox.style.display = 'block';
		thisbutton.style.backgroundPosition = '0 0';

	}
	
}

function add_remove(box){
	
	var thisbox = document.getElementById(box);
	var thischeckbox = document.getElementById('checkbox_' + box);

	var current_display = thisbox.style.display;

	if (current_display == '' || current_display == 'block'){

		thisbox.style.display = 'none';
		thischeckbox.checked = false;
		
	} else {

		thisbox.style.display = 'block';
		thischeckbox.checked = true;

	}
	
}

function add_element(controlname, header, target) {

    var container = document.getElementById(target);
    var new_element = document.createElement('li');
    
    new_element.innerHTML = '<input id="checkbox_' + controlname +'" type="checkbox" checked="checked" onclick="add_remove(\'' + controlname + '\') /> ' + header;
    container.appendChild(new_element);
            
}