function zur_suche(){
    window.location.href=uebergabe+'&showresult=2';
}

function zum_zielgebiet(){
    window.location.href=uebergabe+'&detail=zielgebiet&showresult=1';
}

function s_termine(kenner_id){
    part=regionen_2[kenner_id].split('#');
    window.location.href=uebergabe+'&IFF='+part[2]+'&zielgebiets_kenner='+part[10]+'&CRS='+part[17]+'&TVA='+part[16]+'&HBit='+part[18]+'&detail=termine&showresult='+part[11]+'&startposition_hotel='+part[12];
}
function skippen(zaehler,sortierung){
    part=regionen_2[0].split('#');
    window.location.href=uebergabe+'&sortierung='+sortierung+'&detail=hotel&startposition='+zaehler+'&zielgebiets_kenner='+part[10]+'&showresult='+part[11];
}

function ortsucher(ort,sortierung){
    part=regionen_2[0].split('#');
    window.location.href=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=uebergabe+'&sortierung='+sortierung+'&detail=hotel&startposition=0&zielgebiets_kenner='+part[10]+'&showresult='+part[11];
}

function legende(KID,ornder_name){
    var legwin = window.open('popup_legende.php?KID='+KID+'&ordner_name='+ornder_name,'Legende','width=420,height=250,scrollbars=no,statusbar=false,locationbar=false,toolbar=false');
    legwin.focus();
}

function MakeStars(nStars,pfad_images)
{
    var strStars="";
    while(nStars>0){
        strStars+='<img src="'+pfad_images+'/'+((nStars>5)?'1stern':'stern_halb')+'.gif" border="0">';
        nStars-=10;
    }
    return strStars;
}

//_________________________________________________________________________________________________
/*
    Funktion ermittelt die Position eines Elements anhand seiner Elternelement
    Parameter: ein Element (z.B. ermittelt durch getElementById
    Rückgabewert: ein Positionselement
*/
function getPosition(element)
{
  var elem=element,tagname="",x=0,y=0;        
  while ((typeof(elem)=="object")&&(typeof(elem.tagName)!="undefined"))  
  {
    y+=elem.offsetTop;
    x+=elem.offsetLeft;
    tagname=elem.tagName.toUpperCase();

    if (tagname=="BODY" || tagname == 'HTML')
      elem=0;

    if (typeof(elem)=="object")
      if (typeof(elem.offsetParent)=="object")
        elem=elem.offsetParent;
  }

  position=new Object();
  position.x=x;
  position.y=y;

  return position;
}
//-----------------------------------------------
// Array zum globalen Abspeichern der Bildgrößen
//-----------------------------------------------
var picDisplUp = new Array();

//--------------------------------------------------------
// Bildhöhen ermitteln und in das globale Array eintragen
//--------------------------------------------------------
function getBildHeight(saison, veranstalter, land, bildname, rowId) {
       bild = new Image();       
       bild.onload = function() {
            // liefert die tatsächliche Höhe
            picDisplUp[rowId] = this.height;
       }; 
       bild.src = imgservPfad + '/images/content/FW_thumbs_' + saison + '_gr/' + veranstalter + '/' + land + '/' + bildname + '.jpg';   
       //muss drin sein, um beim Fehlen der Angabe die 0 zur Ausblendung des Divs zu liefern
       picDisplUp[rowId] = bild.height;
       return true;
}


//--------------------------------------------------------
// Positionierung und Anzeigen des grossen Hotelthumbs
//--------------------------------------------------------
function showBigThumb(rowId, saison, veranstalter, land, bildname, EndBild) {
    var thumbBig = document.getElementById('tt_HotThumbBig_' + rowId); 
    if(thumbBig == null || typeof(thumbBig) == 'undefined') {
        var thumbBigDiv = document.createElement("div");
        var thumbBigDiv_id = document.createAttribute("id");
        thumbBigDiv_id.nodeValue = "tt_HotThumbBig_" + rowId;
        thumbBigDiv.setAttributeNode(thumbBigDiv_id);
        var thumbBigDiv_class = document.createAttribute("class");
        thumbBigDiv_class.nodeValue = "tt_HotThumbBig iepngfix";
        thumbBigDiv.setAttributeNode(thumbBigDiv_class);
        document.body.appendChild(thumbBigDiv);
    }
    thumbBig = document.getElementById('tt_HotThumbBig_' + rowId);

    var pos = getPosition(document.getElementById('tt_HotThumb' + rowId));
    thumbBig.innerHTML = '<img src="' + imgservPfad + '/images/content/FW_thumbs_' + saison + '_gr/' + veranstalter + '/' + land + '/' + bildname + '.jpg" alt=""/>';
    thumbBig.style.position = 'absolute';
    
    thumbBig.style.left = (pos.x + 108) + 'px';
    var dispY = pos.y;

    // wenn das Bild von unten nach oben angezeigt werden soll,
    //y-Position um Bildgröße nach oben versetzen und Höhe des
    // kleinen Bildes abziehen    
    if(EndBild != '') {    
        dispY = (pos.y - picDisplUp[rowId]) + 65;
    }      
    thumbBig.style.top  = dispY + 'px';

    // Abfrage wegen Problemen mit IE7 entfernt
    //if(picDisplUp[rowId] != 0)        
    thumbBig.style.display = 'block';
    /*else
        thumbBig.style.display = 'none';*/
}

function hideBigThumb(rowId) {
    if(document.getElementById('tt_HotThumbBig_' + rowId)) {
        document.getElementById('tt_HotThumbBig_' + rowId).style.display = 'none';
    }
}

function s_hotel_tabelle(pfad_images)
{
   var n_AltFlag=0; var n_TopFlag=0;
   var c_strOL,c_strOR,c_strL,c_strM,c_strR,alt_txt,ordner_name;
   ordner_name=pfad_images.split("/");
   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_strTR1="hottrhead"
                    c_strTR2="hottrsub"
                    c_strOL="hottdOL";
                    c_strOR="hottdOR";
                    c_strOM="hottdOM";
                    c_strL="hottdUL";
                    c_strM="hottdUM";
                    c_strM2="hottdUM2";
                    c_strR="hottdUR";
                    c_strLink="hotlpreis";
                    c_strLinkfW="hotlpreisfw";
                    alt_txt="";
                    //alert('hell');
                    n_TopFlag=1;
                }
            }
            else{
                if(n_AltFlag==0){
                    c_strTR1="hottrheadALT"
                    c_strTR2="hottrsubALT"
                    c_strOL="hottdOLALT";
                    c_strOR="hottdORALT";
                    c_strOM="hottdOMALT";
                    c_strL="hottdULALT";
                    c_strM="hottdUMALT";
                    c_strM2="hottdUM2ALT";
                    c_strR="hottdURALT";
                    c_strLink="hotlpreisALT";
                    c_strLinkfW="hotlpreisALTfW";
                    alt_txt="&nbsp;(alternativ)";
                    if(parts[0]==1){
                        document.write('<tr>');
                        document.write('<td colspan="4" class="onlyalt">Es konnten keine Angebote gefunden werden,<br>die zu 100% mit Ihren Wünschen übereinstimmen.</td>');
                        document.write('</tr>');
                    }
                    document.write('<tr>');
                    document.write('<td colspan="4" class="alttxt">Alternative Reiseangebote, die Ihren Wünschen nahe kommen:</td>');
                    document.write('</tr>');
                    n_AltFlag=1;
                }
            }

            va_logo=parts[16].split("-");
            if (va_logo[1]) va_bild=KID+'-'+va_logo[0];
            else va_bild=va_logo[0];

            //Hotelbit ausschluesseln
            parts_hbit=parts[18].split(";");
            var CRS = parts[17].replace('/','_');

            document.write('<tr class="'+c_strTR1+'">');
            if(displHotelInfoEx == 1 || displHotelInKarteEx == 1) {
                document.write('<td class="'+c_strOL+'">');
                document.write(''+parts[0]+'. Angebot '+alt_txt);            
                document.write('</td><td class="'+c_strOM+'">');
                if (displHotelInfoEx == 1) {
                    document.write('<a href="javascript:oHIB(\'\',\''+CRS+'\',\''+parts[3]+'\',\'1\',\''+parts[16]+'\',\'\',\''+parts[4]+'\',\''+parts[13]+'\',\'\',\''+CRS+'\',\'\',\'\',\'\',\'hotel\',\'\',\'\',\'\',\'fewo\');"  class="hotInfoExtra" title="Objekt- und Leistungsbeschreibungen aufrufen">Objektinfos</a>');
                }
                if (displHotelInKarteEx == 1 && (parts[21] != 0 || parts[22] != 0)) {
                    if (displHotelInfoEx == 1) {
                        document.write(' / ');
                    }
                    document.write('<a href="javascript:oHIB(\'\',\'' + CRS + '\',\'' + parts[3] + '\',\'3\',\''+parts[16]+'\',\'\',\'' + parts[4] + '\',\'' + parts[13] + '\',\'\',\''+CRS+'\',\'\',\'\',\'\',\'hotel\',\'\',\'\',\'\',\'fewo\',\'\',\'\');"  class="hotKarteExtra" title="Lage des Hotels">Lage des Objektes</a>');
                }
            } else {
                document.write('<td class="'+c_strOL+'" colspan="2">');
                document.write(''+parts[0]+'. Angebot '+alt_txt);             
            }
            document.write('</td>');
            document.write('<td class="'+c_strOR+'" colspan="2">');


            //Schweizer Franken in IBE Basic
            if (ibeCountry == 2) {
				var priceCirca = (showCurrencyCirca==1)?"ca. ":"";
                if (showWaehrung & 1) {
                    document.write('<a class="'+c_strLink+'" href="javascript:s_termine('+i+');">Objektpreis ab '+parts[1]+',-&euro;</a>');
                }
                if (showWaehrung & 2) {
                    if (showWaehrung & 1) {
                        document.write('&nbsp;/&nbsp;<a class="'+c_strLinkfW+'" href="javascript:s_termine('+i+');">'+priceCirca+Math.ceil(uFaktor*parts[1])+'.-CHF</a>');
                    }
                    else {
                        document.write('<a class="'+c_strLinkfW+'" href="javascript:s_termine('+i+');">Objektpreis ab '+priceCirca+Math.ceil(uFaktor*parts[1])+'.-CHF</a>');
                    }
                }
                if (showWaehrung & 4) {
                    document.write('&nbsp;/&nbsp;<a class="'+c_strLink+'" href="javascript:s_termine('+i+');">'+parts[1]+',-&euro;</a>');
                }
            }
            else {
                document.write('<a class="'+c_strLink+'" href="javascript:s_termine('+i+');">Objektpreis ab '+parts[1]+',-&euro;</a>');
            }
            document.write('</td>');
            document.write('</tr>');

            

            document.write('<tr class="'+c_strTR2+'">');
            //thumbnail
            document.write('<td valign="top" class="'+c_strL+'"><a href="javascript:oHIB(\'\',\''+CRS+'\',\''+parts[3]+'\',\'1\',\''+parts[16]+'\',\'\',\''+parts[4]+'\',\''+parts[13]+'\',\'\',\''+CRS+'\',\'\',\'\',\'\',\'hotel\',\'\',\'\',\'\',\'fewo\');" title="Objekt- und Leistungsbeschreibungen aufrufen">')
            np=parts[17].slice(0,1);
            var sOK="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            chkZ=sOK.indexOf(np.charAt(0))>=0;
            if (!chkZ) verzeichnis="REST";
            else verzeichnis=np;
            bildname=CRS.toLowerCase();
            //document.write('<img src="'+imgservPfad+'/images/content/FW_thumbs_'+parts[19]+'_kl/'+parts[16]+'/'+verzeichnis+'/'+bildname+'.jpg" height="65" width="100" alt="" title="Objekt- und Leistungsbeschreibungen abrufen" border="0">');
            if(displVarBigThumb == "1")  {
	            var EndBild = '';
	            // wenn das Bild von unten nach oben angezeigt werden soll, markieren 
	            if(BigThumbEndUp != "") {            
	                if(i >= (regionen_2.length-BigThumbEndUp)) {
	                  EndBild = i;
	                 }
	            }
	            // Bildgrößen einholen
	            getBildHeight(parts[19], parts[16], verzeichnis, bildname,i);
                document.write('<img id="tt_HotThumb' + i + '" src="' + imgservPfad + '/images/content/FW_thumbs_' + parts[19] + '_kl/' + parts[16] + '/' + verzeichnis + '/' + bildname + '.jpg" height="65" width="100" alt="Objekt- und Leistungsbeschreibungen abrufen" border="0" onmouseover="showBigThumb(' + i + ', \'' + parts[19] + '\', \'' + parts[16] + '\', \'' + verzeichnis + '\', \'' + bildname + '\',  \'' + EndBild + '\');" onmouseout="hideBigThumb(' + (i) + ');">');
            } else { 
                document.write('<img src="'+imgservPfad+'/images/content/FW_thumbs_' + parts[19] + '_kl/' + parts[16] + '/' + verzeichnis + '/' + bildname + '.jpg" height="65" width="100" alt="Objekt- und Leistungsbeschreibungen abrufen" border="0">');            
            }
            
            document.write('</a></td>');

            //name, sterne,ort,image
            document.write('<td class="'+c_strM+'">');
            document.write('<b>'+parts[6]+'</b>');
            document.write('<br>Objekt: '+parts[17]);
            if(parts_hbit[3]!=0){
            document.write(' mit '+parts_hbit[3]+' m²');
            }
            document.write('<br>'+parts[7]+parts[8]+'<br>');
            document.write('<a href="javascript:s_termine('+i+');"><img src="'+pfad_images+'/hotelinfo_buchen.gif" border="0" alt="" vspace="4"></a>');
             //Anbieter
            document.write('&nbsp;&nbsp;<img src="'+imgservPfad+'/images/content/va_logos/small/'+va_bild+'.gif" style="padding-bottom:3px" "alt="Veranstalter '+parts[20]+'" title="Veranstalter '+parts[20]+'" border="0" width="75" height="21">&nbsp;');
            document.write('</td>');
                var img_bit='';
                if(parts_hbit[0] & 1)    img_bit+='<img src="'+pfad_images+'/forms/icon/schwimmbad.gif" alt="Schwimmbad" title="Schwimmbad" border="0">';
                if(parts_hbit[0] & 2)    img_bit+='<img src="'+pfad_images+'/forms/icon/sauna.gif" alt="Sauna" title="Sauna" border="0">';
                if(parts_hbit[0] & 4)    img_bit+='<img src="'+pfad_images+'/forms/icon/tv.gif" alt="TV/Sat" title="TV/Sat" border="0">';
                if(parts_hbit[0] & 8)    img_bit+='<img src="'+pfad_images+'/forms/icon/kamin.gif" alt="Kamin" title="Kamin" border="0">';
                if(parts_hbit[0] & 16)   img_bit+='<img src="'+pfad_images+'/forms/icon/rollstuhl.gif" alt="Rollstuhl" title="Rollstuhl" border="0">';
                if(parts_hbit[0] & 32)   img_bit+='<img src="'+pfad_images+'/forms/icon/angeln.gif" alt="Angeln" title="Angeln" border="0">';
                if(parts_hbit[0] & 64)   img_bit+='<img src="'+pfad_images+'/forms/icon/haustier.gif" alt="Haustier" title="Haustier" border="0">';
                if(parts_hbit[0] & 128)  img_bit+='<img src="'+pfad_images+'/forms/icon/geschirrspueler.gif" alt="Geschirrspüler" title="Geschirrspüler" border="0">';
                if(parts_hbit[0] & 256)  img_bit+='<img src="'+pfad_images+'/forms/icon/waschmaschine.gif" alt="Waschmaschine" title="Waschmaschine" border="0">';
                if(parts_hbit[0] & 512)  img_bit+='<img src="'+pfad_images+'/forms/icon/boot.gif" alt="Boot" title="Boot" border="0">';
                if(parts_hbit[0] & 1024) img_bit+='<img src="'+pfad_images+'/forms/icon/tennis.gif" alt="Tennis" title="Tennis" border="0">';
                if(parts_hbit[0] & 2048) img_bit+='<img src="'+pfad_images+'/forms/icon/garage.gif" alt="Garage" title="Garage" border="0">';
                if(parts_hbit[0] & 4096) img_bit+='<img src="'+pfad_images+'/forms/icon/kinderbett.gif" alt="Kinderbett" title="Kinderbett" border="0">';

            document.write('<td valign="top" class="'+c_strM2+'">');
            document.write('    <div style="width:85px;">');            
            document.write('        <a href="javascript:void(0);" onClick="legende(\''+KID+'\',\''+ordner_name[2]+'\');">'+img_bit+'</a>&nbsp;');
            document.write('    </div>');
            document.write('</td>');            

            //wunscherfuellung
            document.write('<td class="'+c_strR+'">Übereinstimmung mit<br>Ihren Urlaubswünschen:<br>');
            npw=String(parseInt(parts[15]/5)*5);
            if(npw<80)np=0;
            document.write('<img src="'+pfad_images+'/'+npw+'.gif" alt="" border="0" width="134" height="22" vspace="4"></td>');
            document.write('</tr>');

            if(i!=(regionen_2.length-1))
            {
            document.write('<tr>');
            document.write('<td colspan="4"><img src="/images/spacer.gif" alt="" border="0" width="1" height="12"></td>');
            document.write('</tr>');
            }

        }
   }
}

function pageSkip(seiten,apage,sortierung){
    for (t=1;t<=seiten;t++)
    {
        zaehler=(t-1)*10;
        if(t!=apage)
           document.write('<a href="javascript:skippen('+zaehler+',\''+sortierung+'\');" class="pageskip" title="Angebote der Seite '+t+' abrufen">'+t+'</a>&nbsp;&nbsp;');
        else
            document.write('<span class="pageaktive">'+t+'</span>&nbsp;&nbsp;');
    }
}

//---Kartenauswahl fuer die Orte der Hotelseite anzeigen-----
function select_iff_ort(){
    //---Onlinelink fuer LIVE Betrieb
    //var infowin = window.open("../../maptool/select_iff_ort_google.php?url="+encodeURIComponent(url)+"&ORTE="+ortsliste,"Kartenansicht","width=730,height=402,scrollbars=no");

    //---Testlink
    //var infowin = window.open("../../../maps/google/select_iff_ort_google.php?url="+encodeURIComponent(url)+"&mTStartMod="+mTStartMod+"&KID="+KID+"&ORTE="+ortsliste,"Kartenansicht","width=730,height=402,scrollbars=no");

    //---Onlinelink
    var infowin = window.open("http://www.vidado.com/maps/google/select_iff_ort_google.php?url="+encodeURIComponent(url)+"&mTStartMod="+mTStartMod+"&KID="+KID+"&ORTE="+ortsliste,"Kartenansicht","width=730,height=402,scrollbars=no");

    infowin.focus();
}

function SearchOrtKarteByIff(ort, code){
    if(document.searchort){
        var valCode = '';
        if (typeof(code) != 'undefined' && code != '' && code != 'undefined' && typeof(document.searchort.mapIffOrt) != 'undefined') {
            document.searchort.mapIffOrt.value = code; 
            valCode = code; 
            if (typeof(ortsliste) != 'undefined' && ortsliste != '') {
                var aIffOrte = ortsliste.split("{");
                for (var t = 0; t < anzahl_treffer_orte; t++) {
                    if (code == aIffOrte[t]) {
                        ort = Orte[t]; 
                        break;        
                    }
                }    
            }                           
        }        
        var sOrts=document.searchort.elements["s_ort"].options;
        sOrts[sOrts.selectedIndex].value=ort;
        sOrts[sOrts.selectedIndex].text=unescape(ort);
        ortsucher(sOrts[sOrts.selectedIndex].value,document.searchort.sortierung.options[document.searchort.sortierung.options.selectedIndex].value, valCode)
    }
    else{        
        if (typeof(code) != 'undefined' && code != '' && code != 'undefined' && typeof(document.bengine.mapIffOrt) != 'undefined') {
            document.bengine.mapIffOrt.value = code;              
            if (typeof(ortsliste) != 'undefined' && ortsliste != '') {
                var aIffOrte = ortsliste.split("{");
                for (var t = 0; t < anzahl_treffer_orte; t++) {
                    if (code == aIffOrte[t]) {
                        ort = Orte[t]; 
                        break;        
                    }
                }    
            }                           
        }
        var sOrts=document.bengine.elements["s_ort"].options;
        sOrts[sOrts.selectedIndex].value=ort;
        sOrts[sOrts.selectedIndex].text=unescape(ort);
        return BookingAction('hotel');
    }
}

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>');
    }
}
