/*
function zur_suche(){
    window.location.href=uebergabe+'&showresult=2';
}
*/
function zur_suche() {
	f.setElementValue( { startposition : 0, startposition_hotel:0 });
	qs.submitQuickSearch('');
}

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]+'&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];
	 var temp_url = window.location.href;
	 temp_url = addOrReplaceGETElementValue( temp_url, 'sortierung', sortierung );
	 temp_url = addOrReplaceGETElementValue( temp_url, 'startposition', zaehler );
	 window.location.href = temp_url;
}

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);
	 window.location.href = addOrReplaceGETElementValue( window.location.href, '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];
	 window.location.href = addOrReplaceGETElementValue( window.location.href, 'sortierung', sortierung );
}

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;
}

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;
   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_strL="hottdUL";
                    c_strM="hottdUM";
                    c_strR="hottdUR";
                    c_strLink="hotlpreis";
                    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_strL="hottdULALT";
                    c_strM="hottdUMALT";
                    c_strR="hottdURALT";
                    c_strLink="hotlpreisALT";
                    alt_txt="&nbsp;(alternatywna)";
                    if(parts[0]==1){
                        document.write('<tr>');
                        document.write('<td colspan="3" class="onlyalt">Nie można znaleźć żadnych propozycji,<br />które odpowiadałyby w 100% Twoim życzeniom.</td>');
                        document.write('</tr>');
                    }
                    if(n_TopFlag==1){
                        document.write('<tr>');
                        document.write('<td colspan="3" class="hottab_271107"><img src="/images/spacer.gif" alt="" border="0" width="1" height="12"></td>');
                        document.write('</tr>');
                    }
                    document.write('<tr>');
                    document.write('<td colspan="3" class="alttxt">Alternatywne propozycje, bliskie Twoim życzeniom:</td>');
                    document.write('</tr>');
                    n_AltFlag=1;
                }
            }

            document.write('<tr class="'+c_strTR1+'">');
            document.write('<td class="'+c_strOL+'" colspan="2">');
            document.write(''+parts[0]+'. Oferta '+alt_txt);
            document.write('</td>');
            document.write('<td class="'+c_strOR+'">');
            document.write('<a class="'+c_strLink+'" href="javascript:s_termine('+i+');">Cena za os. od '+ConvertPriceValues(parts[1],RecalculationType,'EUR')+'</a>');
            document.write('</td>');
            document.write('</tr>');

            document.write('<tr class="'+c_strTR2+'">');
            //thumbnail
            document.write('<td class="'+c_strL+'"><a href="javascript:oHIB(\''+parts[2]+'\',\''+parts[2]+'\',\''+parts[3]+'\',\'1\',\'\',\'\',\''+parts[4]+'\',\''+parts[13]+'\',\'\',\'\',\'\',\'\',\'\',\'hotel\');" title="Wywołaj opisy świadczeń hotelu">')
            np=String(parseInt(parts[2]/5000)*5000);
            while(np.length<5)np="0"+np;
            document.write('<img src="/images/content/booking_thumbs/'+np+'/THB_999_H'+parts[2]+'.jpg" height="65" width="100" alt="Wywołaj opisy świadczeń hotelu" 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>');
            nSterne=Math.floor(parts[4]*10);
            document.write(MakeStars(nSterne,pfad_images));
            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>');
            document.write('</td>');

            //wunscherfuellung
            document.write('<td class="'+c_strR+'">Zgodność z życzeniami:<br>');
            npw=String(parseInt(parts[15]/5)*5);
            if(npw<80)np=0;
            document.write('<img src="'+pfad_images+'/'+npw+'.gif" alt="" border="0" vspace="4"></td>');
            document.write('</tr>');

            if(i!=(regionen_2.length-1)&&n_TopFlag!=1)
            {
            document.write('<tr>');
            document.write('<td colspan="3" class="hottab_RLB271107"><img src="/images/spacer.gif" alt="" border="0" width="1" height="12"></td>');
            document.write('</tr>');
            } else if(i!=(regionen_2.length-1)) {
                        document.write('<tr>');
            document.write('<td colspan="3" class="hottab_RLB271107"><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)*anzahl_treffer_seite;
        if(t!=apage)
           document.write('<a href="javascript:skippen('+zaehler+',\''+sortierung+'\');" class="tt_pageInActive" title="Przejdź do '+t+' strony naszych propozycji">'+t+'</a>&nbsp;&nbsp;');
        else
            document.write('<span class="tt_pageActive">'+t+'</span>&nbsp;&nbsp;');
    }
}

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>');
    }
}

// Konfigurajca HIB : START
function makePlaceForHIB(el) {
	// utworzenie struktury nowgo hib względem elementu kliknietego el
	var parentDIV = el;
	parentDIV = parentDIV.parentNode.parentNode.parentNode;
	$(parentDIV).after('<div class="tt_clear tt_hib" style=""></div>');
	/*
	if($(parentDIV.parentNode).attr('class') == 'tt_HotelResultContent') {
		$(parentDIV.parentNode).removeClass('tt_HotelResultContent');
		$(parentDIV.parentNode).addClass('tt_HotelResultContentActive');
	} else if($(parentDIV.parentNode).attr('class') == 'tt_HotelResultContentActive') {
		$(parentDIV.parentNode).removeClass('tt_HotelResultContentActive');
		$(parentDIV.parentNode).addClass('tt_HotelResultContent');
	}
	*/
	return {main: $(parentDIV.nextSibling), remove: $(parentDIV.nextSibling)};
}
// nadpisanie hib_core.js : START
hib.config.starImage = "/kunden_parameter/allewakacje/ibe_v2/images/erde/sterne/1_stern.gif";
hib.config.starHalfImage = "/kunden_parameter/allewakacje/ibe_v2/images/erde/sterne/stern_halb.gif";
hib.config.loadingAnimationHTML = '<div class="" style="background-color: #fff9d0; text-align: center;"><img src="/kunden_parameter/allewakacje/ibe_v2/images/erde/hib/ajax_loader.gif" alt="" class="varHeight"></div>';
hib.config.structureHTML = '<div id="menu" class="tt_floatLeft tt_hibLeftMenu"></div><div id="content" class="tt_floatRight tt_hibRightContent"></div><div class="tt_clear"></div><div id="" class="tt_floatRight tt_hibClose" style="" onclick="hib.hideCurrentBox();">zwiń opis</div><div class="tt_clear"></div>';
hib.config.areasPerPage = 10;
hib.config.areaMoreLinkTxt = '<img src="/kunden_parameter/allewakacje/ibe_v2/images/erde/hib/info_gross.gif" alt="" class="tt_POIInfoImage" />';
//hib.config.connector = "../inc/hib_connect.php";
hib.pfadImages = "/kunden_parameter/allewakacje/ibe_v2/images/erde/";
hib.config.displayModeForSlideShow = "fitParentHeightWidth";

hib.show_old=hib.show;
hib.show = function( params ) {
	hib.show_old( params );
	$(params.elements.main[0].parentNode).removeClass('tt_HotelResultContent');
	$(params.elements.main[0].parentNode).addClass('tt_HotelResultContentActive');
}
hib.hideCurrentBox_old = hib.hideCurrentBox;
hib.hideCurrentBox = function(){
	if(!!this.mainElement[0]) {
		$(this.mainElement[0].parentNode).removeClass('tt_HotelResultContentActive');
		$(this.mainElement[0].parentNode).addClass('tt_HotelResultContent');
	}
	hib.hideCurrentBox_old();
}
/*
hib.show = function( params ) {
	// zamykanie HIB jeżeli jest otwarty
	if (this.mainElement && !params.replace) {
		if (this.isNewHIB( params, this.parameters )) {
			// otwarty już jest ten sam HIB
			if (params.elements.remove) $(params.elements.remove).remove();
			this.hideCurrentBox();
			return
		} else {
			// HIB jest już otwarty, ale to nie ten sam
			this.hideCurrentBox();
		}
	}
	
	// jeżeli są wymagane parametry...
	if (params.elements) {
		this.mainElement = params.elements.main;
		this.elementToRemove = params.elements.remove;
	}
	
	$(this.mainElement[0].parentNode).removeClass('tt_HotelResultContent');
	$(this.mainElement[0].parentNode).addClass('tt_HotelResultContentActive');
	
	this.currentView = (params.view)?params.view:null;
	this.currentRefID = (params.ref_id)?params.ref_id:null;
	this.currentIFF = (params.iff)?params.iff:null;
	this.currentVA = (params.va)?params.va:null;
	this.currentAirport = (params.airport)?params.airport:null;
	this.currentWeatherAirport = (params.weatherAirport)?params.weatherAirport:null;
	this.parameters = params;
	
	if (this.afterInit==false) this.showLoadingAnimation();
	if (this.afterInit==false && params.onWSFailure) {
		setTimeout(this.onWSFailure,params.onWSFailure)
	}
	//this.clearContent();
	this.getDataForContent();
}

hib.hideCurrentBox = function(){
	$(this.mainElement[0].parentNode).removeClass('tt_HotelResultContentActive');
	$(this.mainElement[0].parentNode).addClass('tt_HotelResultContent');
	
	$(this.mainElement).data('remove',hib.elementToRemove).slideUp('slow',function(){
		// po zwinięciu usuwamy box ze struktury
		$(this).data('remove').remove();
		
	});
	this.mainElement = false;
	this.elementToRemove = false;
	this.parameters={};
	this.afterInit = false;
	this.currentDataNode = false;
	this.currentPois = false;
	this.currentHPoiRefID = false;
	this.hasArealImages = false;
	this.hasPanoramas = false;
	this.hasPictures = false;
}
			  */
// nadpisanie hib_core.js : STOP
// nadpisanie hib_opinions.js : START
op.config.mark_img_width = 60;
op.attachMarksToolTip = function(m, el) {
	var num=0;
	// podłączanie obsługi ToolTip'a do wszystkich elementów
	// przy ruszseniu myszką ToolTip należy przesunąć
	// w chwili pierwszego poruszenia myszką ToolTip należy wygenerować

	$(el).data('marks',m)
	.each(
		function(){
			this.id='m_'+(++num)+'_0'
		}
		)
	.mousemove(
		function( e ){
			// generowanie nowego ToolTipa
			if (op.isToolTipVisible==false){

				// wstawienie ToolTipa do struktury dokumentu
				$('.op_marks').after('<div id="op_cloud"><div class="rShadow"></div><div class="bShadow"></div><div class="rbShadow"></div></div>');
				//var inner = ['<dl>'];
				
				var inner = ['<div class="op_marks_cloud">'];
				var cat_id = this.id.substr(2,1);
				var mark_data = $(this).data('marks');

				inner.push('<div style="font: bold 11px/11px verdana; color: #e95200; padding-bottom: 5px;">' + op.marks[cat_id].name + '</div>');
				// generowanie zawartości
				for (n in op.marks[cat_id].details){
					inner.push(op.drawMarkLineCloud( mark_data['m_'+cat_id+'_'+n], op.marks[cat_id].details[n] ));
				}
				inner.push('</div>');

				// wypełnienie elementu zawartością
				$('#op_cloud .rShadow').html( inner.join('') );

				// ustawienie znacznika wskazującego, że ToolTip jest widoczny
				op.isToolTipVisible=true;
			}

			// po każdym poruszeniu myszą korekta położenia
			//op.moveToolTip(parseInt(0.5 * e.pageX + 210), 330);
			op.moveToolTip(e.currentTarget.offsetLeft - 50, e.currentTarget.offsetTop + 50);
		}
		).mouseout(
		// zamknięcie ToolTipa w chwili opuszczenia obszaru do którego jest podłączony
		op.closeToolTip
		);
}

// buduje pełną linijkę oceny (nazwa, wskaźnik, ocena liczbowo)
op.drawMarkLineCloud = function(mark_val, mark_title ){
	return '<div class="mark_line" style=""><div style="float: left; font-weight: normal; font-size: 11px;">'+mark_title+'</div><div style="float: right; font-size: 10px;">' + ((mark_val)? this.drawMark(mark_val) : 'brak oceny' ) + '</div><div style="clear: both;"></div></div>';
}

// nadpisanie hib_opinions.js : STOP
// Konfigurajca HIB : STOP

//---Aufruf der Seite ueber Kartentool
function SearchOrtKarte(ort) {

	var sOrts=document.searchort.elements["s_ort"].options;
	sOrts[sOrts.selectedIndex].value=ort;
	sOrts[sOrts.selectedIndex].text=unescape(ort);
	
	var sOrtOptions = document.searchort.elements["s_ort"].options;
	var sortierungOptions = document.searchort.elements["sortierung"].options;
	ortsucher(sOrtOptions[sOrtOptions.selectedIndex].value, sortierungOptions[sortierungOptions.selectedIndex].value);
	//return BookingAction('hotel');
	//document.searchort.submit();
	//window.location.href = addOrReplaceGETElementValue( window.location.href, 's_ort', escape(ort) );
}

