function zur_suche() {
    if (uebergabe_suchestart) {
        window.location.href = t3url + uebergabe_suchestart + '&showresult=2';
    } else {
        window.location.href = t3url + uebergabe + '&showresult=2';
    }
}

function zum_zielgebiet() {
    window.location.href = t3url + uebergabe + '&detail=zielgebiet&showresult=1';
}

function s_termine(kenner_id) {
    part=regionen_2[kenner_id].split('#');
    window.location.href = t3url + uebergabe + '&IFF=' + part[2] + '&zielgebiets_kenner=' + part[10] + '&detail=termine&showresult=' + part[11] + '&startposition_hotel=' + part[12];
}

function skippen(zaehler,sortierung){
    part=regionen_2[0].split('#');
    detail="hotel";
    if(DLC && DLC!="") var ldlc="&DLC="+DLC;
    else var ldlc="";
    window.location.href=t3url+uebergabe+'&sortierung='+sortierung+'&detail='+detail+'&startposition='+zaehler+'&zielgebiets_kenner='+part[10]+'&showresult='+part[11];
}

function ortsucher(ort,sortierung){
    part=regionen_2[0].split('#');
    window.location.href=t3url+uebergabe+'&sortierung='+sortierung+'&detail=hotel&startposition=0&zielgebiets_kenner='+part[10]+'&showresult='+part[11]+'&s_ort='+escape(ort);
}

function horder(sortierung)
{
    part=regionen_2[0].split('#');
    window.location.href=t3url+uebergabe+'&sortierung='+sortierung+'&detail=hotel&startposition=0&zielgebiets_kenner='+part[10]+'&showresult='+part[11];
}

function MakeStars(nStars,pfad_images) {
    var strStars = '';
    strStars += '<span style="white-space: nowrap;">';
    while (nStars > 0) {
        strStars += '<img src="' + pfad_images + '/' + ((nStars > 5) ? '1stern' : 'stern_halb') + '.gif" border="0" class="tt_hotStars" align="absmiddle">';
        nStars   -= 10;
    }
    strStars += '</span>';
    return strStars;
}

var fooObMz = new Array();
function s_hotel_tabelle(pfad_images, nuralt) {
    var thisHTML  = '';
    var showLinie = false;
    var n_AltFlag = 0;
    var n_TopFlag = 0;
    var linienchecker = 0; //zähler für zwischenlinien
    var alt_txt;
    
    if (regionen_2.length <= 0) {
    } else {
        for (i = 0; i < regionen_2.length; i++) {
            parts = regionen_2[i].split('#');
            if (parts[9] == 0) {
                if (n_TopFlag == 0) {
                    c_strLink = '';
                    c_tabBack = ' tt_hot_AngBg';
                    c_tabLine = 'tt_hot_AngFuell';
                    alt_txt='';
                    n_TopFlag = 1;
                
                    thisHTML += '<div class="tt_hotHeader">';
                    thisHTML += '    <div class="tt_hotHeadlinebalken">';
                    thisHTML += '       <div class="tt_hotHeadline">';
                    thisHTML += '           IHRE HOTELAUSWAHL';
                    thisHTML += '       </div>';
                    thisHTML += '       <div class="tt_hotHeadPageSkip">';
                    thisHTML +=             (seiten > 1 ? pageSkip(seiten,apage, sortierung,'head') : spacer);
                    thisHTML += '        </div>';
                    thisHTML += clearboth;
                    thisHTML += '    </div>';
                    thisHTML += '</div>';
                }
            } else {
                if (n_AltFlag == 0) {
                    showLinie = false;
                    c_strLink = 'Alt';
                    c_tabBack = ' tt_hot_AngBgAlt';
                    c_tabLine = 'tt_hot_AngFuellAlt';
                    alt_txt   = '&nbsp;(alternativ)';
                    if (nuralt != 1) {                         
                        linienchecker = 0;
                        
                        thisHTML += '<div class="tt_hotHeaderAlt">';
                        thisHTML += '    <div class="tt_hotHeadlinebalkenAlt">';
                        thisHTML += '       <div class="tt_hotHeadlineAlt">';
                        thisHTML += '           ALTERNATIVE HOTELAUSWAHL';
                        thisHTML += '       </div>';
                        thisHTML += '       <div class="tt_hotHeadPageSkipAlt">';
                        thisHTML +=             (seiten > 1 ? pageSkip(seiten,apage, sortierung,'head') : spacer);
                        thisHTML += '        </div>';
                        thisHTML += clearboth;
                        thisHTML += '    </div>';
                        thisHTML += '</div>';
                    }
                    n_AltFlag=1;
                }
            }
            
            // thumbnail
            np = String(parseInt(parts[2]/5000)*5000);
            while (np.length < 5) {
                np = '0' + np;
            }
            thumbSrc = imgservPfad + '/images/content/booking_thumbs_mi/' + np + '/THB_999_H' + parts[2] + '.jpg';
            // Stars
            nSterne = Math.floor(parts[4]*10);
            // Merkzettel HotelName
            var hotelname         = parts[6].replace("'","\'");
            var hotelnameImgTitle = hotelname;
            if (hotelname.length > 23) {
                hotelname = hotelname.substring(0,22) + '...';
            }
            var ort       = parts[7].replace("'","\'");     
            
            thisHTML += '<div class="tt_hotZeile' + c_strLink + '" id="tt_hotZeile_' + i + '">';
            if (showLinie == false) {
                thisHTML += '<div class="tt_hotLinieWeiss">' + spacer + '</div>';
                showLinie = true;
            } else {
                thisHTML += '<div class="tt_hotLinie">' + spacer + '</div>';
            }
            thisHTML += '   <div class="tt_hotBild" scrollparams="idContent=' + i + '&time=' + getWSdate(parts[13]) + '&IFF=' + parts[2] + '&VA=JT&prefix=0&engine=' + engine + '&topRegion=' + topRegion + '" scrollrequest="reqAllHbs" scrolltype="hi" scrollreference="tt_hotZeile_' + i + '" onclick="ttScrollBox.boxControl(this);">';
            thisHTML +=         '<img src="/tools/image.php?pfad=' + imgservPfad + '/images/content/booking_thumbs_gr/' + np + '/THB_999_H' + parts[2] + '.jpg&b=130&h=80" alt="' + hotelname + '" title="' + hotelnameImgTitle + '">';
            thisHTML += '   </div>';
            thisHTML += '   <div class="tt_hotZeileMitte">';
            thisHTML += '       <div class="tt_hotHotelName" id="tt_hotHotelName' + i + '" onMouseOver="mouseOver(\'tt_hotHotelName' + i + '\',1,0);" onMouseOut="mouseOut(\'tt_hotHotelName' + i + '\',1,0);" scrollparams="idContent=' + i + '&time=' + getWSdate(parts[13]) + '&IFF=' + parts[2] + '&VA=JT&prefix=0&engine=' + engine + '" scrollrequest="reqAllHbs" scrolltype="hi" scrollreference="tt_hotZeile_' + i + '" onclick="ttScrollBox.boxControl(this);" title="' + hotelnameImgTitle + '">';
            thisHTML +=             hotelname + ' ' + MakeStars(nSterne,pfad_images);
            thisHTML += '       </div>';
            thisHTML += '       <div class="tt_hotOrt">';
            thisHTML +=             parts[7];
            thisHTML += '       </div>';
            thisHTML += '       <div class="tt_hotTeaser">';
            thisHTML +=             parts[19];
            thisHTML += '       </div>';
            if (showHbw == 1) {
                if (parts[20] != '') {
                    hbw_details = parts[20].split('_');
                    thisHTML += '       <div class="tt_hotAnzBew">';
                    thisHTML +=             hbw_details[0] + ' BEWERTUNG' + (hbw_details[0] > 1 ? 'EN' : '');
                    thisHTML += '       </div>';
                    thisHTML += '       <div class="tt_hotBew" style="cursor: pointer;" scrollparams="idContent=' + i + '&time=' + getWSdate(parts[13]) + '&IFF=' + parts[2] + '&VA=JT&prefix=1&topRegion=' + topRegion + '" scrollrequest="reqHbw" scrolltype="hbw" scrollreference="tt_hotZeile_' + i + '" onclick="ttScrollBox.boxControl(this);">';
                    thisHTML += '           <div class="tt_hotBewScale">';
                    thisHTML +=                 hbw_details[2].substring(0,1) + '.' + hbw_details[2].substring(1,2);
                    thisHTML += '           </div>';
                    thisHTML += '           <img class="tt_hotBewImg" src="' + pfad_images + '/hbw/scale_' + hbw_details[2] + '.gif" border="0">';
                    thisHTML +=             clearboth;
                    thisHTML += '       </div>';
                    thisHTML +=         clearboth;
                    if (hbw_details[0] > 1) {
                        thisHTML += '   <div class="tt_hotEmpf">';
                        thisHTML += '       WEITEREMPFEHLUNG';
                        thisHTML += '   </div>';
                        thisHTML += '   <div class="tt_hotEmpfRate">';
                        thisHTML +=         (hbw_details[1] / 10).toString().replace('.', ',') + '%';
                        thisHTML += '   </div>';
                        thisHTML +=     clearboth;
                    }
                }
            }
            thisHTML += '   <div class="tt_hotDetails">';
            thisHTML += '       <span class="tt_infobutton" id="tt_hotDetails' + i + '" onMouseOver="mouseOver(\'tt_hotDetails' + i + '\',0,1);" onMouseOut="mouseOut(\'tt_hotDetails' + i + '\',0,1);" scrollparams="idContent=' + i + '&time=' + getWSdate(parts[13]) + '&IFF=' + parts[2] + '&VA=JT&prefix=0&engine=' + engine + '&zielgebiets_kenner=' + mzielg +'&id=' + mtypo_id +'&topRegion=' + topRegion + '" scrollrequest="reqAllHbs" scrolltype="hi" scrollreference="tt_hotZeile_' + i + '" onclick="ttScrollBox.boxControl(this);">HOTELDETAILS</span>';
            thisHTML += '   </div>';
            thisHTML += '   </div>';
            thisHTML += '   <div class="tt_hotZeileRechts">';
            thisHTML += '       <div class="tt_hotPreisDiv" id="tt_hotPreisDiv' + i + '" onMouseOver="mouseOver(\'tt_hotPreisDiv' + i + '\',1,0);" onMouseOut="mouseOut(\'tt_hotPreisDiv' + i + '\',1,0);" onClick="s_termine('+i+');return false;">';
            thisHTML += '           PREIS PRO PERSON<br><span class="tt_hotPreis">' + parts[1] + ' &euro;</span>';
            thisHTML += '       </div>';
            thisHTML += '       <div class="tt_hotWeiterCont">';
            fooObMz[i] = {
                dataType:           dataType,
                mzFlag:             'hotel',
                uebergabe:          uebergabe,
                url:                mzUrl,
                strecke:            engine=="pauschal"?"pauschal":"lami",
                iff:                parts[2],
                crs:                '',
                tva:                '',
                hotelName:          parts[6],
                zielgebiet:         mzielg,
                ort:                parts[7],
                region:             mhotreg,
                land:               mhotland,
                kategorie:          parts[4],
                Laender_Ref_ID:     Laender_Ref_ID,
                port:               port,
                dlcabflug:          DLC,
                dlcankunft:         '',
                termin:             mhin_termin,
                ruecktermin:        mrueck_termin,
                personen:           mpersonen,
                abflughafen:        '',
                anflughafen:        '',
                hindatum:           '',
                rueckdatum:         '',
                dauer:              mdauer,
                abpreis:            parts[1],
                veranstalter:       mMarke,
                veranstalter_lang:  '',
                hotelbewertung:     parts[20],
                hbit:               '',
                vbit:               '',
                zbit:               '',
                agent:              agent,
                detail:             'hotel',
                dirIBE:            dirIBE,
                dirKparam:         dirKparam,
                sessName:          sessName,
                sessCookie:        sessCookie
            }
            idStringMerk = 'tt_merkzettel_' + i;
            thisHTML += '<span class="tt_infobutton tt_hotMzMerken" id="'+idStringMerk+'" onMouseOver="mouseOver(\''+idStringMerk+'\',0,1);" onMouseOut="mouseOut(\''+idStringMerk+'\',0,1)" onclick="addToMkz(fooObMz['+i+'],this);" mzs="1">HOTEL MERKEN</span>';
            thisHTML += '       <div class="tt_hotWeiter" onClick="s_termine('+i+');return false;">';
            thisHTML += '           AUSWÄHLEN';
            thisHTML += '       </div>';
            thisHTML += '       </div>';
            thisHTML += '   </div>';
            thisHTML +=     clearboth;
            thisHTML += '</div>';
            thisHTML += '';
        }
    }
    document.write(thisHTML);
}
addToMkz = function(obj,element) {
    if (element.getAttribute('mzs') == '1') {
        var retvalue;
        var retV = false;
        retvalue = merkzettel.addToMerkzettelHotel(obj,dataType);

        if (retvalue[0] == true) {
            element.setAttribute('mzs','0');
            merkzettel.refresh();
            retV = true;
        } else if (online == "0" && typeof console != 'undefined') {
            console.log (retvalue)
        }
    }
    jQuery(element).replaceWith('<span style="color:#707173;">HOTEL VORGEMERKT</span>');
    return retV;
}
function fillOrte(s_ort){
    for (t=0;t<anzahl_treffer_orte;t++)
    {
       if(s_ort!=escape(Orte[t]))
           document.write('<option value="'+Orte[t]+'">'+Orte[t]+'</option>');
       else
           document.write('<option value="'+Orte[t]+'" SELECTED>'+Orte[t]+'</option>');
    }
}

function fillOrte(s_ort, mapIff) {        
    if (typeof(ortsliste) == 'string' && ortsliste != '' && mapIff != '' && mapIff != null) {
        var aIffOrte = ortsliste.split('{');
        for (var t = 0; t < anzahl_treffer_orte; t++) {
            if (mapIff != aIffOrte[t]) {
                document.write('<option value="' + Orte[t] + '">' + Orte[t] + '</option>');     
            } else {
                document.write('<option value="' + Orte[t] + '" SELECTED>' + Orte[t] + '</option>');    
            }
        }
    } else {
        for (var t = 0; t < anzahl_treffer_orte; t++) {
            if (s_ort != escape(Orte[t])) document.write('<option value="' + Orte[t] + '">' + Orte[t] + '</option>');
            else document.write('<option value="' + Orte[t] + '" SELECTED>' + Orte[t] + '</option>');
        }
    }
}

//---Aufruf Kartentool Google
function select_iff_ort() {
    if (typeof(mTStartMod) == 'undefined')  {
        return;
    }
    
    var isIE = false;
    var isIElt7 = false;
    var isIE8 = false;
    if (navigator.userAgent.indexOf("MSIE") != -1) {
        isIE = true;
        if (parseFloat(navigator.appVersion.split("MSIE")[1]) < 7) {
            isIElt7 = true;
        } else if (parseFloat(navigator.appVersion.split("MSIE")[1]) == 8) {
            isIE8 = true;
        }
    }
    
    if (document.getElementById('tt_ortsauswahlOpacBox') == null || typeof(document.getElementById('tt_ortsauswahlOpacBox')) == 'undefined') {
        var opacDiv             = document.createElement('div');        
        var opacDiv_id          = document.createAttribute('id');
        opacDiv_id.nodeValue    = 'tt_ortsauswahlOpacBox';        
        opacDiv.setAttributeNode(opacDiv_id);        
        var opacDiv_class       = document.createAttribute('class');
        opacDiv_class.nodeValue = 'iepngfix2';        
        opacDiv.setAttributeNode(opacDiv_class);        
        document.body.appendChild(opacDiv);    
    }
    
    if (document.getElementById('tt_ortsauswahlOpacBoxContent') == null || typeof(document.getElementById('tt_ortsauswahlOpacBoxContent')) == 'undefined') {
        var opacDiv             = document.createElement('div');        
        var opacDiv_id          = document.createAttribute('id');
        opacDiv_id.nodeValue    = 'tt_ortsauswahlOpacBoxContent';        
        opacDiv.setAttributeNode(opacDiv_id);        
        var opacDiv_class       = document.createAttribute('class');
        opacDiv_class.nodeValue = 'iepngfix2';        
        opacDiv.setAttributeNode(opacDiv_class);        
        document.body.appendChild(opacDiv);    
    }
    
    if (document.body && document.body.offsetHeight && document.body.offsetHeight > 0) {
        var iW = document.body.offsetWidth;
        var iH = document.body.offsetHeight;    
    } else if (document.body && document.body.clientHeight && document.body.clientHeight > 0) {
        var iW = document.body.clientWidth;
        var iH = document.body.clientHeight;    
    } else if (window.innerHeight && window.innerHeight > 0) {
        var iW = window.innerWidth;
        var iH = window.innerHeight;    
    }
    
    document.getElementById('tt_ortsauswahlOpacBox').style.width  = iW + 'px';
    document.getElementById('tt_ortsauswahlOpacBox').style.height = iH + 'px';
    
    //--- if body height ist not valid --------------------------
    if (document.body.offsetHeight < 1200) {
        document.getElementById('tt_ortsauswahlOpacBox').style.height = '3000px';
    }
    
    if (online == 1) {
        document.getElementById('tt_ortsauswahlOpacBoxContent').innerHTML = '<iframe src="' + url + 'maps/google/selectIffOrtGoogle_882815.php?url=http://' + document.domain + '/&mTStartMod=' + mTStartMod  +'&KID=' + KID + '&ORTE=' + ortsliste + '" width="650" height="430" frameborder="0" scrolling="no" style="background: #FFFFFF; border: 1px solid #5F294F; padding: 10px;" />';
    } else {
        document.getElementById('tt_ortsauswahlOpacBoxContent').innerHTML = '<iframe src="' + url + 'maps/google/selectIffOrtGoogle_882815.php?url=' + encodeURIComponent(url) + '&mTStartMod=' + mTStartMod + '&KID=' + KID + '&ORTE=' + ortsliste + '" width="650" height="430" frameborder="0" scrolling="no" style="background: #FFFFFF; border: 1px solid #5F294F; padding: 10px;" />';
    }
    
    var posTop = document.getElementById('tt_karte').offsetTop + 50;
    var posLeft = document.getElementById('tt_karte').offsetLeft + document.getElementById('mainwrap').offsetLeft - 612;
    
    if (isIE) {
        var refObj   = document.getElementById('tt_karte');
        var refObjX  = refObj.offsetTop;
        var refObjY  = refObj.offsetLeft;
        var oParent  = refObj.offsetParent;
        while (oParent) {
            refObjX += oParent.offsetLeft;
            refObjY += oParent.offsetTop;
            oParent  = oParent.offsetParent;
        }
        posTop = refObjY - 410;
        posLeft = refObjX - 184;
        
        if (isIElt7) {
            posLeft -= 2;
        }
        if (isIE8) {
            posTop += 21;
            posLeft -= 20;
        }
    }
    
    document.getElementById('tt_ortsauswahlOpacBoxContent').style.top = posTop + 'px';
    document.getElementById('tt_ortsauswahlOpacBoxContent').style.left = posLeft + 'px';
    
    document.getElementById('tt_ortsauswahlOpacBox').style.display = 'block';
    document.getElementById('tt_ortsauswahlOpacBoxContent').style.display = 'block';

    $('#tt_ortsauswahlOpacBox').appendTo($('#body'));
    $('#tt_ortsauswahlOpacBoxContent').appendTo($('#body'));
}

//________________________________________________________________

//---Aufruf der Seite ueber Kartentool
function SearchOrtKarteByIff(ort, code){ 
    var aIffOrte = ortsliste.split('{');
    for (var t = 0; t < anzahl_treffer_orte; t++) {
        if (code == aIffOrte[t]) {
            ort = Orte[t];
            break;        
        }
    }
    document.bengine.s_ort.value     = ort;
    document.bengine.mapIffOrt.value = code; 
    document.getElementById('tt_ortsauswahlOpacBox').style.display = 'none';
    document.getElementById('tt_ortsauswahlOpacBoxContent').style.display = 'none';
    return IBE.BookingAction('hotel');
}


function set_merkzettel(stern,Hotel_Name,IFF,Ort,preis,hotelattribut,angebotsAttr)
{
    //MZ-Fenster öffnen beim Aktualisieren
    //window.open(url+'booking/'+ordner_name+'/teaser/merkzettel/merkzettel.php?KID='+KID+'&id='+mtypo_id+'&merkzettel_aktion=safe&merk_win_open=1&mhin_termin='+mhin_termin+'&mrueck_termin='+mrueck_termin+'&Laender_Ref_ID='+escape(Laender_Ref_ID)+'&mdauer='+escape(mdauer)+'&obj_sterne='+escape(stern)+'&mhotname='+encodeURI(Hotel_Name)+'&miff='+IFF+'&mhotort='+encodeURI(Ort)+'&mhotreg='+encodeURI(mhotreg)+'&mzielg='+mzielg+'&mhotland='+encodeURI(mhotland)+'&mpersonen='+escape(mpersonen)+'&mgesamtpreis='+preis+'&mhot_attribut='+escape(hotelattribut)+tmp_sessid+'&ordner_name='+ordner_name+'&hid='+HID+'&mzimmer='+mzimmer+'&mverpflegung='+mverpflegung+'&mabflughafen='+escape(mabflughafen)+'&mang_attribut='+angebotsAttr+'&port='+port+'&t3url='+escape(t3url)+'&url='+escape(url),'merkzettel','height=500,width=760,dependent=yes,scrollbars=no,menubar=no,resizable,status=no,toolbar=no');
    // ####################################################################
    //MZ-Fenster nicht öffnen
    var str_mzURL = t3url+uebergabe+'&detail=hotel&merkzettel_aktion=safe&mhin_termin='+mhin_termin+'&mrueck_termin='+mrueck_termin+'&Laender_Ref_ID='+escape(Laender_Ref_ID)+'&mdauer='+escape(mdauer)+'&obj_sterne='+escape(stern)+'&mhotname='+encodeURI(Hotel_Name)+'&miff='+IFF+'&mhotort='+encodeURI(Ort)+'&mhotreg='+encodeURI(mhotreg)+'&mzielg='+mzielg+'&mhotland='+encodeURI(mhotland)+'&mpersonen='+escape(mpersonen)+'&mgesamtpreis='+preis+'&mhot_attribut='+escape(hotelattribut)+tmp_sessid+'&ordner_name='+ordner_name+'&hid='+HID+'&mzimmer='+mzimmer+'&mverpflegung='+mverpflegung+'&mabflughafen='+escape(mabflughafen)+'&mang_attribut='+angebotsAttr+'&port='+port+'&t3url='+escape(t3url)+'&url='+escape(url)+'&startposition='+mstartposition;
    window.location.href = str_mzURL;
    return true;
}

