function transfer_items(from, to)
{
    var elements = ",";

    for (i = to.length - 1; i > -1; i--) {
        elements = elements + "," + to.options[i].value + ",";
    }

    // Pull selected and add them to list
    for (i = from.length - 1; i > -1; i--) {

        if (from.options[i].selected && elements.indexOf( "," + from.options[i].value + "," ) == -1) {

            to.options[to.length] = new Option(from.options[i].text, from.options[i].value);
            from.options[i] = null;

        }

    }

    return false;
}

function select(clicked) {

    var select = clicked.name;

    var select_from = document.getElementById(select + '_from');
    var select_to = document.getElementById(select + '_to');


    return transfer_items(select_from, select_to);
}


function deselect(clicked) 
{
    var select = clicked.name;

    var select_from = document.getElementById(select + '_to');
    var select_to = document.getElementById(select + '_from');


    return transfer_items(select_from, select_to);
}

var form_changed = true;

function formOnLeave(e)
{
    if (form_changed) {
	conf = confirm("Your modifications were not saved.\nTo save the modifications click on the 'Save Changes' button on the bottom of the page.\n\nDiscard your modifications?");
	
	if (!e) {
	    e = event;
	}
	if (!conf) {
	}
    }
    
    return false;
}

