// (c) 2003 Alexander-Philipp Lintenhofer
// attention: function init_dynamic_list() must not be called
// until complete sourcecode is loaded !!!

var form;

function init_dynamic_list(f)
{
    form = f;
}
// =====================================================================================
function collect_dynamic_list_elements(thisList)
{
    var s = "";
    for (i=0;i<thisList.length;i++)
    {
        s += thisList.options[i].value;
        if (i<(thisList.length-1)) s +="#";
    }
    return s;
}
// =====================================================================================        
function change_item(dest,btnRemove)
{
	btnRemove.disabled = false;
}
// =====================================================================================
function add_item(source,dest)
{
    pass = true;	
	index = source.selectedIndex;

	if (index==-1) pass=false;
	
	for (i=0;i<dest.length;i++)
	    if(source.options[index].value==dest.options[i].value) pass=false;
	
	if((pass)&&(dest.length<5))
	    dest.options[dest.length] = new Option(source.options[index].text,source.options[index].value);
}
// =====================================================================================
function remove_item(dest,btnRemove)
{
	if(dest.selectedIndex != -1) {
		dest.options[dest.selectedIndex]=null;
	}
	if(dest.length < 1) {
		btnRemove.disabled = true;
	}
	btnRemove.disabled = true;
}
// =====================================================================================