function makeValues(liste,stelle,ziel){
        var listeValues = liste.split(";");
        document.suchmaske.elements[ziel].value=listeValues[stelle];
}


function setRegion(what){
        if(document.suchmaske.ixp.value=="katalog_2"){
                fillSelect(dsi_P[what], document.suchmaske.dsi_detail, 1)
        }
        if(document.suchmaske.ixp.value=="hotel"){
                fillSelect(dsi_H[what], document.suchmaske.dsi_detail, 1)
        }
        if(document.suchmaske.ixp.value=="charter"){
                fillSelect(dsi_N[what], document.suchmaske.dsi_detail, 1)
        }
}

function deleteSelectOptions(feld){
        var laenge = feld.length;
        for (i=0; i <laenge; i++){
                feld.options[feld.length-1] = null;
        }
}


function addSelectOption(selectionElement, text)
{
        var option = document.createElement("OPTION");
        var Text = document.createTextNode(text);
        option.appendChild(Text);
        selectionElement.appendChild(option)
}
function fillSelect(liste, ziel, init){
        var liste1 = liste.split(";");
        if (init == 1){
                deleteSelectOptions(ziel);
        }
        for (i=0; i<liste1.length; i++){
                addSelectOption(ziel, liste1[i]);
        }
        ziel.style.width="100%";
}


function radioWert(rObj) {
        for (var i=0; i<rObj.length; i++) if (rObj[i].checked) return rObj[i].value;
        return false;
}


function chancheExpress(what){
        switch (what){
                case('P'):
                        //document.getElementById('five').style.display="";
                        //document.getElementById('six').style.display="";
                        //document.getElementById('seven').style.display="";
                        document.suchmaske.ixp.value='katalog_2';
                        document.suchmaske.action='./index.php?page=ibe_pauschal';
                        //fillSelect(hmi, document.suchmaske.spacerone, 1);
                        fillSelect(dsi_P_Reg, document.suchmaske.dsi_all, 1);
                        document.getElementById('switchfield2').style.display='none';
                        document.getElementById('switchfield1').style.display='';
                        //document.getElementById('titlefive').firstChild.nodeValue="Reiseziel";
                        //document.getElementById('titlesix').firstChild.nodeValue="Region";
                        break;
                case('N'):
                        //document.getElementById('five').style.display="";
                        //document.getElementById('seven').style.display="none";
                        document.suchmaske.ixp.value='charter';
                        document.suchmaske.action='./index.php?page=ibe_charter';

                        //fillSelect(hmi, document.suchmaske.spacerone, 1);
                        fillSelect(dsi_N_Reg, document.suchmaske.dsi_all, 1);
                        document.getElementById('switchfield2').style.display='none';
                        document.getElementById('switchfield1').style.display='';
                        //document.getElementById('titlefive').firstChild.nodeValue="Reiseziel";
                        //document.getElementById('six').style.display="none";
                        break;
                case('H'):
                        //document.getElementById('seven').style.display="";
                        document.suchmaske.ixp.value='hotel';
                        document.suchmaske.action='./index.php?page=ibe_hotel';
                        document.getElementById('switchfield1').style.display='none';
                        document.getElementById('switchfield2').style.display='';
                        fillSelect(dsi_H_Reg, document.suchmaske.dsi_all, 1);
                        setRegion(0);
                        //fillSelect(stc, document.suchmaske.spacerfive, 1);
                        //document.getElementById('titleone').firstChild.nodeValue="Reiseziel";
                        //document.getElementById('titlefive').firstChild.nodeValue="Hotelkategorie";
                        //document.getElementById('titlesix').firstChild.nodeValue="Hotelkategorie";
                        //document.getElementById('titlefour').firstChild.nodeValue="Spätester Rückflug";
                        //document.getElementById('six').style.display="none";
                        //document.getElementById('five').style.display="none";
                        break;
        }
}


function submitData(){
what=radioWert(document.suchmaske.typ)
        switch(what){
                case('P'):
                        //makeValues(hmi_values,document.suchmaske.spacerone.selectedIndex,"hmi")
                        makeValues(dsi_P_value[document.suchmaske.dsi_all.selectedIndex],document.suchmaske.dsi_detail.selectedIndex,"dsi")
                        break;
                case('N'):
                        //makeValues(hmi_values,document.suchmaske.spacerone.selectedIndex,"hmi")
                        makeValues(dsi_N_value[document.suchmaske.dsi_all.selectedIndex],document.suchmaske.dsi_detail.selectedIndex,"dsi")
                        break;
                case('H'):
                        //document.suchmaske.hmi.value="";
                        makeValues(dsi_H_value[document.suchmaske.dsi_all.selectedIndex],document.suchmaske.dsi_detail.selectedIndex,"dsi")
                        //makeValues(stc_values,document.suchmaske.spacerfive.selectedIndex,"stc");
                        break;
        }
        document.forms['suchmaske'].submit();
}
