        
function add(anzahl) {

    index = document.getElementById('left').selectedIndex;
    
    values = new Array(); 
    text = new Array();
    for (var i = 0; i < document.getElementById('left').options.length; i++) {
     
        if (document.getElementById('left').options[i].selected) {
            values.push(document.getElementById('left').options[i].value);
            text.push(document.getElementById('left').options[i].text);
        }
    } 
    
    for (var i = 0; i < values.length; i++) {
        
        if (document.getElementById('right').options.length < anzahl) {
        
            option = new Option(
            text[i],     
            values[i], 
            false, 
            true);
            
            //dem rechten Dropdown hinzufuegen
            document.getElementById('right').options[document.getElementById('right').length] = option;
            //aus dem linken Dropdown entfernen
            document.getElementById('left').options[index] = null;
            //Counter aktualisieren
            document.getElementById('counter').innerHTML = (anzahl - document.getElementById('right').options.length);
            //Formularfeld zur Datenuebergabe aktualisieren
            actForm();
            
        } else {
        
            alert('Sie können maximal '+anzahl+' PLZ-Gebiete auswaehlen.');
            //Formularfeld zur Datenuebergabe aktualisieren
            actForm();
            return;
        
        }
        
    }

}

function remove(anzahl) {
    
    index = document.getElementById('right').selectedIndex;

    if (index >= 0) {
    
        if ((document.getElementById('right').options[index].getAttribute('rel')) != 'disabled') {
        
            option = new Option(
                document.getElementById('right').options[index].text,     
                document.getElementById('right').options[index].value, 
                false, 
                true);
            
            //dem linken Dropdown hinzufuegen
            document.getElementById('left').options[document.getElementById('left').length] = option;
            //aus dem rechten Dropdown entfernen
            document.getElementById('right').options[index] = null;
            //Counter aktualisieren
            document.getElementById('counter').innerHTML = (anzahl - document.getElementById('right').options.length);
            //Formularfeld zur Datenuebergabe aktualisieren
            actForm();
        }
    }
    
}

function actForm() {

    temp = new Array();
    for (var i = 0; i < document.getElementById('right').options.length; i++) {
        temp.push(document.getElementById('right').options[i].value);                 
    }
    document.getElementById('loc_id').value = temp.join(',') 
}

function changePic(id_pic,id_select,id_link) {

    document.getElementById(id_pic).src = 'http://'+ document.getElementById(id_select).options[document.getElementById(id_select).selectedIndex].value+'/images/flyer-klein.jpg';
    document.getElementById(id_link).href = 'http://'+ document.getElementById(id_select).options[document.getElementById(id_select).selectedIndex].value+'/images/flyer-print.pdf';

    document.getElementById('provision').innerHTML = provision_arr[document.getElementById(id_select).options.selectedIndex];
}
