COM.Log('--- search ---');
APP.PRICE.REGION=new function()
{
//
//  private vars
//
var requestIdent  =0,
finish_timeout_event=false,
timeout_complete=60000,
execution_time=   0,
http_obj,
service_response,
//all ajax - states
ajax_state_error =-1,
ajax_state_incomplete=0,
ajax_state_complete=1,
service ={ 'run':0, 'status':ajax_state_incomplete, 'resultcount':0  },
max_service_runs=40; // max repeat-loopings
//
//
//
this.Init=function(request_ident)
{
APP.SNAPSHOT.Request('request_ident',(requestIdent=request_ident));
APP.PRICE.STRINGS.Init({"details":"Detaylar","opinions":"De\u011ferlendirme","map":"Harita","hotels":"Otel","more":"devam\u0131...","less":"daha az","count_image":"Resimler","more_prices":"T\u00fcm Fiyatlar","deals_forward":"Devam","certificates":"Dereceler","best_price":"En iyi fiyat","room_details":"Oda ve Fiyat Bilgileri","available_offers":"$count acentede mevcut","available_offer":"$count acentede mevcut","deals_partner":"Partner","partner_no_answer":"sonu\u00e7 bulunamad\u0131","partner_loading":"y\u00fckleniyor","partners_deals_from":"En uygun fiyatl\u0131 oteller","deals_proof":"Kontrol Et","not_rated_yet":"hen\u00fcz de\u011ferlendirilmedi","all_notices":"T\u00fcm\u00fcn\u00fc g\u00f6ster","stars":"Y\u0131ld\u0131z","filter_group_14":"Otel tipleri","filter_group_8":"Uygunluk","filter_group_2":"Otel donan\u0131m\u0131","filter_group_6":"Spor imkanlar\u0131","filter_group_3":"Oda donan\u0131m\u0131","filter_group_9":"Konaklama tipi","filter_group_1":"Otel zincirleri","value_label_1_39":"Bastion","value_label_1_43":"Best Western","value_label_1_62":"City Partner Hotels","value_label_1_66":"Comfort Inn","value_label_1_87":"Dorint Hotels & Resorts","value_label_1_101":"Familotel","value_label_1_113":"Four Seasons","value_label_1_116":"Golden Tulip","value_label_1_127":"Hilton","value_label_1_128":"Hipotels","value_label_1_129":"Holiday Inn","value_label_1_135":"Hyatt","value_label_1_136":"Iberostar","value_label_1_137":"Ibis","value_label_1_143":"InterConti","value_label_1_155":"Kempinski","value_label_1_161":"Le Meridien","value_label_1_166":"LTI International","value_label_1_170":"Marriott","value_label_1_172":"Maritim","value_label_1_175":"Melia","value_label_1_176":"Mercure","value_label_1_185":"M\u00f6venpick","value_label_1_189":"NH","value_label_1_190":"Novotel","value_label_1_210":"Quality Inns","value_label_1_212":"Radisson","value_label_1_214":"Ramada","value_label_1_224":"Ritz Carlton","value_label_1_225":"RIU","value_label_1_226":"Robinson Club","value_label_1_240":"Sheraton","value_label_1_246":"Sofitel","value_label_1_247":"Sol","value_label_1_254":"Steigenberger","value_label_1_261":"Swiss\u00f4tel","value_label_1_270":"Tryp","value_label_1_275":"Westin","value_label_1_281":"Magic Life","value_label_1_282":"Iberotel","value_label_1_287":"Hapimag","value_label_1_296":"Occidental","value_label_1_323":"Paradores","value_label_1_333":"Delta","value_label_1_348":"Clarion","value_label_1_349":"mD-Hotel","partner_1":"hotel.info","partner_2":"Booking.com","partner_3":"venere","partner_4":"HotelClub","partner_5":"Expedia","partner_6":"giata","partner_7":"skoosh","partner_8":"ebookers","partner_9":"Hotelopia","partner_10":"gtahotels","partner_11":"alpharooms","partner_12":"Hotels.com","partner_13":"InterConti","partner_14":"Accor","partner_15":"HRS","partner_16":"Best Western","partner_17":"Golden Tulip","partner_18":"Choice Hotels","partner_19":"Marriott","partner_20":"One Travel","partner_21":"eDreams","partner_22":"AsiaRooms","partner_23":"iff","partner_24":"HotelPronto","partner_25":"RatesToGo","partner_26":"Hilton","partner_27":"Quality Inn","partner_28":"LateRooms","partner_29":"AffiliateFuture","partner_30":"Reserve A Hotel Online","partner_31":"Quick Rooms","partner_32":"tiscover","partner_33":"octopustravel","partner_34":"HotelsChart","partner_35":"PlaniGo","partner_36":"ehotel","partner_37":"hotel.info","partner_38":"Ab in den Urlaub","partner_40":"opodo","partner_41":"weg.de","partner_42":"Asiativ","partner_43":"travel scout 24","partner_46":"FastBooking","partner_47":"EasyClickTravel","partner_48":"beauty24","partner_49":"escapio","partner_50":"Atrapalo","partner_51":"lastminute","partner_52":"lastminute Holiday","partner_53":"lastminute.de","partner_54":"priceline","partner_55":"hotelbook","partner_56":"opodo","partner_57":"Holidaycheck","partner_58":"tripadvisor","partner_59":"agoda","partner_60":"EasyToBook","partner_61":"hostelsclub","partner_62":"Epoque Hotels","partner_63":"Superbreak","partner_64":"hoteladvisor","partner_65":"onhotels","partner_66":"hotels.nl","partner_67":"Hotusa Group","partner_68":"Voyages SNCF","partner_69":"barceloviajes.com","partner_70":"Certified Business Hotels","partner_72":"Rural Gest","partner_73":"Crowne Plaza","partner_74":"lastminute.com","partner_75":"Candlewood","partner_76":"Hostelworld","partner_77":"Holiday Inn Express","partner_79":"Indigo","partner_80":"Hotel-Website","partner_81":"Holiday Inn","partner_82":"otel.com","partner_83":"StayBridge","partner_84":"1800-Hotels","partner_85":"Initalia","partner_86":"TUI","partner_87":"infohostal","partner_89":"Budgetplaces","partner_91":"HolidayHotels","partner_93":"Hotel-Website","partner_95":"booking.com","partner_97":"Hotel-Website","partner_99":"Hotel-Website","partner_101":"Tui","partner_103":"Opodo","partner_105":"logiTravel","partner_107":"LTUR","partner_109":"reserveTravel","partner_111":"travelclick","partner_113":"Feratel","partner_115":"FirstAustrianHotels","partner_117":"WORLDHOTELS","partner_119":"Hotelscombined","partner_121":"Agoda.com","partner_123":"BookDirectRooms.com","partner_125":"Booking.com","partner_127":"CarlsonHotels.com","partner_129":"ChoiceHotels.com","partner_131":"EasyClickTravel","partner_133":"ebookers.com","partner_135":"Expedia","partner_137":"FastBooking.com","partner_139":"gtahotels","partner_141":"Hilton.com","partner_143":"Hotel.info","partner_145":"HotelBook.com","partner_147":"HotelClub.com","partner_149":"Hotelopia.com","partner_151":"Hotels.com","partner_153":"HolidayHotels","partner_155":"HotelsChart.com","partner_157":"hrs.com","partner_159":"InterContinental.com","partner_161":"lastminute.com","partner_163":"LateRooms.com","partner_165":"NeedItNow.com","partner_167":"OctopusTravel.com","partner_169":"Orbitz.com","partner_171":"Otel.com","partner_173":"Priceline.com","partner_175":"RatesToGo.com","partner_177":"ReserveTravel.com","partner_179":"RoamFree.com","partner_181":"Skoosh.com","partner_183":"Travelmate.com.au","partner_187":"Venere.com","partner_189":"EasyToBook.com","partner_191":"Travelocity.com","partner_193":"Synxis","partner_195":"StayPoland","partner_197":"NetHotels","partner_199":"skoosh","item_group_1":"Otel","item_group_2":"Otel","item_group_3":"Pansiyon","item_group_4":"Misafirhane","item_group_5":"Motel","item_group_6":"Apartotel","item_group_7":"Tatil K\u00f6y\u00fc","item_group_8":"Tatil Evi\/Yazl\u0131k","item_group_9":"Hostel","item_group_10":"Misafir odas\u0131","item_group_11":"Kamp alan\u0131","item_group_12":"Manzara alan\u0131","item_group_13":"Bar\/Pub","item_group_14":"Gemi turu","item_group_15":"An\u0131t","item_group_16":"Diskotek\/gece kulub\u00fc","item_group_17":"Bina","item_group_18":"Golf alan\u0131","item_group_19":"Kasino","item_group_20":"Sinema","item_group_21":"Cami\/Kilise\/Sinagog","item_group_22":"Ko\u015fu parkuru","item_group_23":"M\u00fcze \/ Galeri","item_group_24":"Do\u011fa\/Manzara","item_group_25":"Park\/ Botanik bah\u00e7e","item_group_26":"Promenad\/ Sokak","item_group_27":"Bisiklet\/paten pisti","item_group_28":"Festivaller\/G\u00f6steriler","item_group_29":"Caf\u00e9\/Bar\/Restoran","item_group_30":"\u015eehir turu","item_group_31":"\u015eato \/ Kale","item_group_32":"Shopping","item_group_33":"Kayak merkezi","item_group_34":"Spor merkezi\/ stadyum","item_group_35":"Sahil","item_group_36":"Dal\u0131\u015f sporu","item_group_37":"Tiyatro\/opera","item_group_38":"Traking \/ Da\u011fc\u0131l\u0131k","item_group_39":"Termal\/ Spa","item_group_40":"R\u00fczgar S\u00f6rf\u00fc","item_group_41":"Hayvanat Bah\u00e7esi\/ Akvaryum","item_group_42":"E\u011flence Park\u0131","item_group_43":"Di\u011fer G\u00f6r\u00fclecek Yer","item_group_44":"Do\u011fal An\u0131t","item_group_45":"Havaliman\u0131\/Gar\/Liman","field_1":"Oteller Zinciri","field_2":"Leading Hotels of the World","field_3":"Relais & Ch\u00e2teaux","field_4":"Ring Hotels","field_5":"Romantik Oteller","field_6":"Small Luxury Hotels of the World","field_7":"The Luxury Collection","field_8":"Di\u011fer-S\u0130L","field_9":"Hi\u00e7bir\u015fey-S\u0130L","field_10":"G\u00fczellik Merkezi","field_11":"\u00d6z\u00fcrl\u00fclere Uygun Gezi Yerleri","field_12":"Sahne","field_13":"\u0130\u015f Merkezi","field_14":"Cafe","field_15":"Hamam","field_16":"Bilgisayar Oyunu\/Playstation","field_17":"Diskotek\/Geceklub\u00fc","field_18":"Lobi","field_19":"Express Checkin\/Checkout","field_20":"Asans\u00f6r","field_21":"Televizyon Salonu","field_22":"Yang\u0131n alarm\u0131","field_23":"Jimnastik Salonu","field_24":"Kuaf\u00f6r","field_25":"Otopark","field_26":"Bah\u00e7e veya Park","field_27":"Teras","field_28":"Bagaj Servisi","field_29":"Kendi Golf Sahas\u0131","field_30":"Ev hayvan\u0131 m\u00fcmk\u00fcn","field_31":"Otelbar","field_32":"Sahilde Otelbar mevcut","field_33":"Manzarl\u0131 Otel Bar\u0131","field_34":"Poolbar","field_35":"A\u00e7\u0131k Y\u00fczme Havuzu","field_36":"Kapal\u0131 Y\u00fczme Havuzu","field_37":"Otel Kasas\u0131","field_38":"\u00c7ocuk Yata\u011f\u0131","field_39":"\u00c7ocuk Bak\u0131m\u0131","field_40":"Minimarket\/Tekelbayii","field_41":"Toplant\u0131 Odas\u0131","field_42":"Masaj","field_43":"Gece Bek\u00e7isi","field_44":"Sigara i\u00e7ilmeyen Oda","field_45":"\u0130nternet Eri\u015fimi","field_46":"Kumarhane","field_47":"Restoran","field_48":"24 saat a\u00e7\u0131k Resepsiyon","field_49":"Engellilere uygunluk","field_50":"Sessiz Odalar mevcut","field_51":"Sauna","field_52":"Otelde Al\u0131\u015f-veri\u015f","field_53":"Snack Bar","field_54":"Solaryum","field_55":"Denize s\u0131f\u0131r","field_56":"G\u00fcne\u015f \u015eemsiyesi","field_57":"\u015eezlong","field_58":"Havlular mevcut","field_59":"\u00c7ama\u015f\u0131rhane Servisi","field_60":"G\u00fczellik Merkezi \/ Spa","field_61":"Jakuzi","field_62":"Kablosuz \u0130nternet Eri\u015fimi","field_63":"Oda Servisi","field_64":"24 Saat Oda Servisi","field_65":"Balkonlu\/ Terasl\u0131 Oda","field_66":"Bungalov","field_67":"Ayakkab\u0131 Boyac\u0131s\u0131\/Makinas\u0131 mevcut","field_68":"Oda Say\u0131s\u0131-S\u0130L","field_69":"\u015e\u00f6mine(Yazl\u0131k otel)","field_70":"Bula\u015f\u0131k Makinas\u0131(Yazl\u0131k otel)","field_71":"\u00c7ama\u015f\u0131r Makinas\u0131","field_72":"Kay\u0131k Kiralama mevcut","field_73":"Di\u011fer - S\u0130L","field_74":"K\u00fcvetli Banyo","field_75":"Du\u015flu Banyo","field_76":"Vantilat\u00f6r","field_77":"\u00dct\u00fc ve \u00dct\u00fc Masas\u0131 mevcut","field_78":"Faks\/Modem","field_79":"A\u00e7\u0131labilir Pencere","field_80":"Televizyon","field_81":"Yang\u0131n Alarm\u0131","field_82":"Sa\u00e7 Kurutma Makinas\u0131","field_83":"Is\u0131tma","field_84":"Pantolon \u00dct\u00fcleme Servisi","field_85":"Su Is\u0131t\u0131c\u0131s\u0131 mevcut","field_86":"Klima","field_87":"Makyaj Aynas\u0131","field_88":"\u0130zolasyonlu Pencereler","field_89":"Minibar","field_90":"Pay-TV","field_91":"Radyo","field_92":"Uydu Kanallar\u0131","field_93":"\u00c7al\u0131\u015fma Masas\u0131","field_94":"Oturma Grubu","field_95":"Telefon","field_96":"Uzaktan Kumanda","field_97":"Oda Kasas\u0131","field_98":"DVD Oynat\u0131c\u0131\/Video","field_99":"M\u00fczik Seti\/CD \u00c7alar","field_100":"Bilgisayar Oyunu\/Playstation","field_101":"Kablolu TV","field_102":"Ana yemeklerde ki K\u0131yafet Y\u00f6netmeli\u011fi","field_103":"A\u00e7\u0131k B\u00fcfe","field_104":"Men\u00fcl\u00fc Ana Yemek","field_105":"Otoyol","field_106":"Havaliman\u0131","field_107":"Gar","field_108":"Fuar ve Kongre Merkezi","field_109":"Toplu Ta\u015f\u0131ma Ara\u00e7lar\u0131","field_110":"\u015eehir Merkezi","field_111":"Sahil","field_112":"Badminton","field_113":"Voleybol\/ Beach Voleybol","field_114":"Bilardo","field_115":"Ok\u00e7uluk\/At\u0131\u015f","field_116":"Tekne Kiralama","field_117":"Bowling","field_118":"Bisiklet Kiralama","field_119":"Golf Sahas\u0131","field_120":"Jimnastik\/Aerobik","field_121":"Ko\u015fu ve Tekerlekli Paten Parkuru","field_122":"Minigolf","field_123":"Binicilik","field_124":"Yat\u00e7\u0131l\u0131k","field_125":"Kayak","field_126":"Squash","field_127":"S\u00f6rf","field_128":"Tenis Kortu","field_129":"Tenis Kortu","field_130":"Y\u00fcr\u00fcy\u00fc\u015f Parkurlar\u0131","field_131":"Nakit","field_132":"\u00c7ek","field_133":"Fatura Firmaya","field_134":"EC\/ Maestro","field_135":"American Express","field_136":"Diner\u00b4s Club","field_137":"Eurocard\/ Mastercard","field_138":"JCB Intl.","field_139":"Visa","field_140":"Spor Tutkunlar\u0131","field_141":"K\u0131\u015f Sporu Tutkunlar\u0131","field_142":"Alternatif Tatilcilere Uygun","field_143":"Tatile ihtiya\u00e7 duyanlar i\u00e7in","field_144":"Fitness Tutkunlar\u0131","field_145":"Golf\u00e7\u00fcler","field_146":"Gurmeler","field_147":"K\u00fclt\u00fcr Merakl\u0131lar\u0131","field_148":"Parti Sevenler","field_149":"T\u00fcps\u00fcz Dalg\u0131\u00e7lar","field_150":"Yat\u00e7\u0131lar","field_151":"G\u00fcne\u015f Tutkunlar\u0131","field_152":"Pazarl\u0131k Yapmay\u0131 Sevenler","field_153":"T\u00fcpl\u00fc dalg\u0131\u00e7lar","field_154":"Club tatili","field_155":"Uzun Y\u00fcr\u00fcy\u00fc\u015fleri Sevenler","field_156":"Su Tutkunlar\u0131","field_157":"Sa\u011fl\u0131k Arayanlar","field_158":"R\u00fczgar S\u00f6rf\u00e7\u00fcleri","field_159":"\u0130\u015f Adamlar\u0131","field_160":"Otel","field_161":"Oda&Kahvalti","field_162":"Misafirhane","field_163":"Motel","field_164":"Apartotel","field_165":"Tatil K\u00f6y\u00fc","field_166":"Yazl\u0131k","field_167":"Hostel","field_168":"Pansiyon","field_169":"Manzara alan\u0131","field_170":"Bar","field_171":"Mavi Tur","field_172":"An\u0131t","field_173":"Disko\/Club","field_174":"Yap\u0131","field_175":"Golf Alan\u0131","field_176":"Kumarhane","field_177":"Sinema","field_178":"Cami\/Kilise\/Sinagog","field_179":"Ko\u015fu Parkuru","field_180":"M\u00fcze\/Sergi\/Galeri","field_181":"Do\u011fa","field_182":"Park \/ Botanik Bah\u00e7e","field_183":"Gezi Yeri\/Y\u00fcr\u00fcy\u00fcy\u00fc\u015f yolu","field_184":"Bisiklet ve Tekerlekli Paten Parkuru","field_185":"Festivaller\/E\u011flenceler","field_186":"Restoran","field_187":"\u015eehir Turu","field_188":"Saray\/\u015eato\/Kale","field_189":"Shopping","field_190":"Kayak Merkezi","field_191":"Spor Merkezi\/Stadyum","field_192":"Sahil","field_193":"Dali\u015f Sporu","field_194":"Tiyatro\/Opera","field_195":"Da\u011fc\u0131l\u0131k\/Do\u011fa Y\u00fcr\u00fcy\u00fc\u015f\u00fc\/T\u0131rmanma","field_196":"Sa\u011fl\u0131k Merkezi\/Spa","field_197":"R\u00fczgar S\u00f6rf\u00fc","field_198":"Hayvanat Bah\u00e7esi","field_199":"Telefon","field_200":"Cep Telefonu","field_201":"Faks","field_202":"Adres","field_203":"Posta Kodu","field_204":"Newsletter","field_205":"E\u011fitim","field_206":"Net Kazan\u00e7","field_207":"\u015eehir Nuf\u00fcsu","field_208":"Meslek","field_209":"Aile B\u00fcy\u00fckl\u00fc\u011f\u00fc","field_210":"Medeni Hal","field_211":"Pazar Ara\u015ft\u0131rmas\u0131","field_212":"Standart Otel","field_213":"Standart gezi yeri","field_214":"Aile Reisi","field_215":"Her\u015fey Dahil Oteller\/Clubler","field_216":"All-Suite Otel","field_217":"Motel","field_218":"Ekonomik Otel","field_219":"Club\/ Club otel","field_220":"Design Otel","field_221":"Turistik Otel","field_222":"Tatil Oteli","field_223":"Havaliman\u0131 Oteli","field_224":"Business Otel","field_225":"Golf Otel","field_226":"Kur\/Kapl\u0131ca","field_227":"L\u00fcks Otel","field_228":"Binicilik Oteli","field_229":"Spor tesisleri olan otel","field_230":"\u015eehir Oteli","field_231":"Sahil Oteli","field_232":"Kongre Oteli","field_233":"Tenis Oteli","field_234":"Spa Oteli","field_235":"K\u0131\u015f Sporular\u0131 Oteli","field_236":"Di\u011fer - S\u0130L","field_237":"Oda Say\u0131s\u0131","field_238":"Traveller Checks","field_239":"Giri\u015f bloke edildi","field_240":"Kaptanl\u0131k derecesi","field_241":"INFOSOURCE_1","field_242":"INFOSOURCE_2","field_243":"INFOSOURCE_3","field_244":"COMMENT_FOR_CONFIRM","field_245":"Anti-alerjik odalar mevcut","field_246":"Animasyon","field_247":"Otel sa\u011fl\u0131k ekibi","field_248":"Otelde araba kiralamak m\u00fcmk\u00fcn","field_249":"Dan\u0131\u015fma","field_250":"\u00c7ocuk Park\u0131","field_251":"Okuma Odas\u0131","field_252":"\u00c7ocuk Klub\u00fc","field_253":"Y\u00fcksek H\u0131zl\u0131 \u0130nternet","field_254":"Odalarda Wi-Fi Ba\u011flant\u0131s\u0131","field_255":"Mutfak","field_256":"Mikrodalga","field_257":"Buzdolab\u0131","field_258":"Vantilat\u00f6r","field_259":"Dal\u0131\u015f","field_260":"Masa Tenisi","field_261":"Tatilci","field_262":"Balay\u0131 \u00e7iftleri","field_263":"Bekarlar","field_264":"Aileler","field_265":"Turistler","field_266":"B\u00fcy\u00fck Gruplar","field_267":"\u00d6\u011frenciler","field_268":"Aktif Tatilciler","field_269":"Macera Tutkunlar\u0131","field_270":"Kamp","field_271":"E\u011flence Park\u0131","field_272":"\u00c7evrede bulunan gezi yeri","field_273":"An\u0131t","field_274":"Do\u011fa Oteli","field_275":"\u00c7iftlik","field_276":"Aile Oteli","field_277":"trivago ile nas\u0131l tan\u0131\u015ft\u0131n?","field_278":"Hesap Sahibi","field_279":"Banka Kodu","field_280":"Banka ismi","field_281":"Hesap Numaras\u0131","field_282":"Havaliman\u0131\/Gar\/Liman","field_283":"Paypal E-Posta","field_284":"\u00d6deme \u00c7e\u015fiti","field_330":"Certified Business Hotels","field_331":"K\u0131\u015f sporlar\u0131n\u0131 sevenler","field_332":"Gay Friendly","field_333":"Su sporlar\u0131n\u0131 sevenler","field_334":"Evcil hayvan ile seyahat edenler","field_339":"BrownHouse Hotels & Resorts"});
//loading page animation
APP.PRICE.REGION.STANDBY.Init();
//page elements
APP.PRICE.REGION.HEADER.Init();
APP.PRICE.REGION.FOOTER.Init();
APP.PRICE.REGION.DESIGN.Init();
APP.PRICE.REGION.PROGESSBAR.Init();
APP.PRICE.REGION.NO_RESULTS.Init();
APP.PRICE.REGION.PARTNER_BANNER.Init();
APP.PRICE.REGION.TRANSPARENCY.Init();
APP.PRICE.REGION.DEBUG.Init();
APP.PRICE.REGION.CACHE.FILTER.Set(APP.SNAPSHOT.Get(), requestIdent);
//action blocks
APP.PRICE.REGION.PATH_ID_MULTI_AVAIL.Init();
APP.PRICE.REGION.FILTER.QUERYSTRING.Init();
APP.PRICE.REGION.TOP_NAV.Init();
APP.PRICE.REGION.MAP.Init();
APP.PRICE.REGION.FILTER.PRICE.Init();
APP.PRICE.REGION.FILTER.ATTRACTION.Init();
APP.PRICE.REGION.FILTER.STARS.Init();
}
//
//  is the start-call on the php-page, than we call directly this function and we must load the get-part(no-data)
//  is the start-call on the client-page, than we have the data directly and can display the actual list.
//
this.InitRpc=function(s, r)
{
service ={ 'run':0, 'status':ajax_state_incomplete, 'resultcount':0  };
APP.PRICE.REGION.SYNTHETIC_DELAY.Set(new Date().getTime());
APP.PRICE.REGION.DEBUG.Set('func: InitRpc, resultcount:'+service['resultcount']+', run:'+service['run']+', status:'+service['status']);
if(r)
{
if(typeof r.snapshot!='undefined')
{
APP.SNAPSHOT.Response(eval('('+r.snapshot+')'), true);
// cache the search-request with all filter-options
APP.PRICE.REGION.CACHE.FILTER.Set(APP.SNAPSHOT.Get(), requestIdent);
APP.PRICE.REGION.HASH.Set(APP.SNAPSHOT.GetQuery(true, true, false));
}
if(r.skip_loading =='0')
{
this.readystatechangefunction(r, false);
}
else
{
service['resultcount']=r.count;
APP.PRICE.REGION.FOOTER.Show();
if(finish_timeout_event)
{
window.clearTimeout(finish_timeout_event);
}
}
}
else
{
this.FetchData(requestIdent, s);
}
}
//
//  starting the price search.(start-part is client-page and not the server-page)
//  @param s display the animation or not in the loading-procedure
//  @param skip_loading skip the response. don't load the list or navigation again
//
this.Start=function(s, skip_loading)
{
(typeof skip_loading =='undefined') &&(skip_loading=0);
APP.SNAPSHOT.Request('request_ident',(++requestIdent));
// change layout
APP.PRICE.REGION.FOOTER.Hide();
(s!=1) && APP.PRICE.REGION.TRANSPARENCY.Show();
this.SetTimeout();
// start the load session
(http_obj) && http_obj.abort();
APP.PRICE.REGION.CACHE.FILTER.Flush(requestIdent);
APP.PRICE.REGION.DEBUG.Clear();
APP.PRICE.REGION.DEBUG.Set('func: start');
var r=this.GetResponse();
if(r && r.items)
{
r=r.items;
}
var request_url='/trivago_rpc.php?skip_loading='+skip_loading+'&action=starthotelservice&'+APP.SNAPSHOT.GetQuery(true)+"&cached_items="+encodeURI(APP.PRICE.REGION.CACHE.RESPONSE.GetCachedItems( r ));
APP.PRICE.REGION.DEBUG.Set('func: Start, url:'+request_url);
http_obj=new COM.HTTP.Request('GET', request_url,{
'onfinish':function(j){
if(j)
{
APP.PRICE.EvalCode("APP.PRICE.REGION.InitRpc("+j.serviceId+", "+j+");");
}
else
{
APP.PRICE.REGION.DEBUG.Set('request -> starthotelservice undefined response'+j);
}
}});
this.StartRequest();
}
//
// todo: cschmidt: comment more detailed
// @param string r, response json-object
// @param integer id, requestIdent - needed??
//
this.readystatechangefunction=function(r, id)
{
APP.PRICE.REGION.DEBUG.Set('func: readystatechangefunction, resultcount:'+r.count+', run:'+service['run']+', status:'+r.state);
if(r.standby)
{
APP.PRICE.REGION.PARTNER_BANNER.Show(r.standby, service['status']);
APP.PRICE.REGION.PROGESSBAR.CreateStandBy(r.standby, service['status']);
APP.PRICE.REGION.HEADER.Show();
}
// error situation?
if(r.noresultclaim)
{
return APP.PRICE.REGION.NO_RESULTS.DisplayErrorMessage(r, service['resultcount']);
}
// check the correct requestIdent
if(requestIdent!=r.requestIdent)
{
APP.PRICE.REGION.DEBUG.Set('break related by '+requestIdent+'!='+r.requestIdent);
return false;
}
++service['run'];
service['status'] =r.state;
service['resultcount']=r.count;
// finished and no results?
if(service['status'] ==ajax_state_complete &&
service['resultcount'] ==0)
{
return APP.PRICE.REGION.NO_RESULTS.DisplayErrorMessage(r, service['resultcount']);
}
// if we do not have a result, than we hide the top order-list
if(r.update ==1)
{
r.items=APP.PRICE.REGION.CACHE.RESPONSE.Get(r.items);
// Ein und Ausblenden der Tabs oben
if(!r.items)
{
APP.PRICE.REGION.TOP_NAV.Hide();
}
else
{
APP.PRICE.REGION.TOP_NAV.Show();
}
// Städteliste
if(APP.SNAPSHOT.Get('view_type') ==2)
{
APP.PRICE.REGION.PATH_ID_MULTI_AVAIL.Hide();
}
else
{
APP.PRICE.REGION.PATH_ID_MULTI_AVAIL.Set( r.path_id_multi_avail, r.multi_avail_path_ids );
APP.PRICE.REGION.PATH_ID_MULTI_AVAIL.Show();
}
if(service['status'] ==ajax_state_complete ||
r.items)
{
// response wird lokal in einem Array gespeichert
service_response=r;
// Aufbau der Liste
APP.PRICE.REGION.DESIGN.CreateList(r.items);
// update filter-navigation(slider inklusive)
APP.PRICE.REGION.FILTER.Update();
}
// trigger criteo
try
{
if(typeof pcto_imgsrc =='function' &&
service['status'] ==ajax_state_complete &&
r.items)
{
var citems=[];
for(i=0;i!=5;++i)
{
if(r.items[i])
{
citems.push(r.items[i].id);
}
}
(citems.length > 0) && pcto_imgsrc(citems);
}
}
catch(ex)
{
// continue
alert(ex);
}
// Header aufbauen
if(r.header_bar)
{
APP.PRICE.REGION.HEADER.CreateHeader(r.header_bar);
APP.PRICE.REGION.HEADER.Show();
}
// Geodaten auslesen
APP.PRICE.REGION.GEODATA.Init(r.items);
// Karte updaten
if(service['status']!=ajax_state_complete)
{
APP.PRICE.REGION.MAP.UpdateDisplayMapStatus(false);
}
}
// Liste verarbeiten
this.FetchData(requestIdent, r.serviceId);
}
//
//  get actual data from php. we call this loop max max_service_runs times
//  @param requestIdent request-id
//
this.FetchData=function(requestIdent, serviceId)
{
try
{
if((service['status'] ==ajax_state_complete) ||
(service['run'] > max_service_runs) ||
(service['resultcount'] > 0 &&
(new Date().getTime()-execution_time) >=timeout_complete))
{
APP.PRICE.REGION.PARTNER_BANNER.Hide();
APP.PRICE.REGION.PROGESSBAR.Hide();
this.Finish();
}
// new get call when not ready
else if(requestIdent ==requestIdent &&
service['status']!=ajax_state_complete)
{
var r=this.GetResponse();
if(r && r.items)
{
r=r.items;
}
var request_url='/trivago_rpc.php?request_ident='+APP.SNAPSHOT.Get('request_ident')+'&action=gethotelservice&service_id='+serviceId+'&service_resultcount='+service['resultcount']+'&url_hash='+APP.SNAPSHOT.Get('url_hash')+'&path='+APP.SNAPSHOT.Get('path')+'&cached_items='+encodeURI(APP.PRICE.REGION.CACHE.RESPONSE.GetCachedItems( r  ));
APP.PRICE.REGION.DEBUG.Set('func: Get, url:'+request_url);
(http_obj) && http_obj.abort();
http_obj=new COM.HTTP.Request('GET', request_url,{
"onfinish": function(j){
if(j)
{
APP.PRICE.EvalCode("APP.PRICE.REGION.readystatechangefunction("+j+", "+requestIdent+");");
APP.PRICE.REGION.SYNTHETIC_DELAY.Set(new Date().getTime());
}
else
{
APP.PRICE.REGION.DEBUG.Set('request -> gethotelservice undefined response'+j);
}
}});
//start-request with a synthetic delay
window.setTimeout(function(){APP.PRICE.REGION.StartRequest();}, APP.PRICE.REGION.SYNTHETIC_DELAY.GetTimeout());
}
}
catch(e)
{
APP.PRICE.REGION.DEBUG.Set('func: FetchData, error'+e);
}
}
//
//  todo: cschmidt: comment
//
this.Finish=function()
{
try
{
APP.PRICE.REGION.DEBUG.Set('func: finish, resultcount:'+service['resultcount']+', run:'+service['run']+', status:'+service['status']);
finish_timeout_event && window.clearTimeout(finish_timeout_event);
APP.PRICE.REGION.PARTNER_BANNER.Hide();
APP.PRICE.REGION.PARTNER_BANNER.DeactivitateAutoChange();
APP.PRICE.REGION.PROGESSBAR.Hide();
if(service['resultcount'] > 0)
{
APP.PRICE.REGION.HEADER.Show();
APP.PRICE.REGION.MAP.UpdateDisplayMapStatus(true);
}
else if(service['run'] ==0)
{
APP.PRICE.REGION.NO_RESULTS.DisplayErrorMessage(false, service['resultcount'])
}
// change icon highlighting
APP.PRICE.REGION.TOP_NAV.ChangeButtonViewType(APP.SNAPSHOT.Get('view_type'));
APP.PRICE.REGION.TOP_NAV.ChangeButtonOrder(APP.SNAPSHOT.Get('order_by'));
window.setTimeout(function(){APP.PRICE.REGION.TRANSPARENCY.Hide();}, 30);
}
catch(e)
{
APP.PRICE.REGION.DEBUG.Set('func: Finish, error'+e);
}
}
//
//
//
this.StartRequest=function()
{
http_obj.start();
}
//
//
//
this.GetResponse=function()
{
return service_response;
}
//
//
//
this.GetResultCount=function()
{
return service['resultcount'];
}
//
//
//
this.SetTimeout=function()
{
execution_time=new Date().getTime();
(finish_timeout_event) && window.clearTimeout(finish_timeout_event);
finish_timeout_event=window.setTimeout(function(){APP.PRICE.REGION.Finish();}, timeout_complete);
}
};
APP.PRICE.REGION.SYNTHETIC_DELAY=new function()
{
//
// private vars
//
var max_delay =1000, // max synthetic delay between the requests
min_delay = 10, // min synthetic delay between the requests
timeout_repeat=  0; // timestamp for calculating
//
// set timeout
//
this.Set=function(t)
{
timeout_repeat=t;
}
//
// return timeout between get-requests
// max synthetic delay is 1 seconds. min is 10ms
//
this.GetTimeout=function()
{
var retval=max_delay,
timeout_time;
if(timeout_repeat > 0)
{
timeout_time=new Date().getTime() - timeout_repeat;
if(timeout_time < max_delay)
{
retval=max_delay - timeout_time;
}
else
{
retval=min_delay;
}
}
return retval;
}
};APP.PRICE.REGION.DEBUG=new function()
{
//
//
//
this.Init=function()
{
this.node=$('js_price_debug');
if(!this.node.isElement())
{
this.node=null;
}
}
//
//
//
this.Set=function(str)
{
if(this.node)
{
this.node.innerHTML +='------<br />'+str+'<br />';
}
}
//
//
//
this.Clear=function()
{
if(this.node)
{
this.node.innerHTML='';
}
}
//
//
//
this.Dump=function(arr,level)
{
var retval="",
level_padding="";
if(!level)
{
level=0;
}
//The padding given at the beginning of the line.
for(var j=0;j<level+1;j++)
{
level_padding +="&nbsp;";
}
if(typeof(arr) =='object') //Array/Hashes/Objects
{
for(var item in arr)
{
var value=arr[item];
if({'function':1,'undefined':1}[typeof value] || item=='__type')
{
break;
}
if(typeof(value) =='object') //If it is an array,
{
retval +=level_padding+"'"+item+"' ...\n"+this.Dump(value,level+1);
}
else
{
retval +=level_padding+"'"+item+"' => \""+value+"\"<br />";
}
}
}
else //Stings/Chars/Numbers etc.
{
retval="===>"+arr+"<===("+typeof(arr)+")";
}
return retval;
}
//
// private vars
//
var node;
}
APP.PRICE.REGION.DESIGN=new function()
{
//
// private vars
//
var node,
cache_images  =[],
cache_trivago_rating=[];
//
//
//
this.Init=function()
{
node=$('hotellistitems');
}
//
//  todo: cschmidt: comment
//
this.CreateList=function(items)
{
if((!items) ||(items.length ==0))
{
return;
}
if(APP.SNAPSHOT.Get('view_type') ==0)
{
node.innerHTML=APP.PRICE.REGION.DESIGN.DETAIL.Get(items);
}
else
{
node.innerHTML=APP.PRICE.REGION.DESIGN.LIST.Get(items);
}
APP.PRICE.REGION.FOOTER.Show();
APP.PRICE.REGION.DESIGN.Show();
APP.PRICE.REGION.TRANSPARENCY.Hide();
APP.PRICE.REGION.NO_RESULTS.Hide();
}
//
//
//
this.Show=function()
{
node.appear();
}
//
//
//
this.Hide=function()
{
node.disappear();
}
//
//
//
this.GetIndexNumber=function(no)
{
var number=String(Math.round(parseInt(APP.SNAPSHOT.Get('offset'))+1+parseInt(no))),
retval='';
for(var i=0, n=number.length; i<n; i++)
{
retval +=number.substr(i,1)+'<br />';
}
return retval;
}
//
//
//
this.GetBookingUrl=function(item)
{
var retval=" onclick=\"";
if((item.price) &&(item.price.url))
{
retval +="window.open('"+item.price.url+"');";
}
else
{
retval +="window.location.href='/item.php?hlpath="+APP.SNAPSHOT.Get('path')+"&item="+item.id+"&pagetype=deals'";
}
retval +="\"";
return retval;
}
//
// return hotel-category-image
//
this.GetCategory=function(category)
{
var retval='';
if(category > 0)
{
retval="<img src='http://ip1.trivago.com/images/ratingimages/star"+category+".gif' />";
}
return retval;
}
//
//
//
this.GetAllPricesButton=function(dealslink, do_available_search)
{
return  "<a href=\""+dealslink+"\" class=\"button button_red\"><span class=\"content\">"
+ APP.PRICE.STRINGS.Get(!do_available_search ? 'deals_proof':'more_prices')
+ "</span></a>";
}
//
//  The showimg-function is the same like the php-function "showimg"
//
this.ShowImg=function(id, img_type, link)
{
var key=id+"|"+img_type;
if(cache_images[key])
{
return cache_images[key];
}
var img_id=""+id;
var sub_path=img_id.length > 3? img_id.substring(0,2)+"/"+img_id.substring(2,4)+"/": "0/";
return cache_images[key]="<a href=\""+link+"\">"
+ "<img src='http://imgpe.trivago.com/itemimages/"+sub_path+id+"_"+img_type+".jpeg' />"
+ "</a>";
}
//
//
//
this.GetPartnerImg=function(file, onclick)
{
var retval='';
if(onclick!='')
{
retval +="<a href=\"javascript:void(0);\" "+onclick+">";
}
retval +="<img src=\"http://ip1.trivago.com/images/partnerlogos/"+file+"\" />";
if(onclick!='')
{
retval +="</a>";
}
return retval;
}
//
// copy from the php function getTrivagoRating()
//
this.GetTrivagoRating=function(val, item_id)
{
var key=val+"|"+item_id;
if(cache_trivago_rating[key])
{
return cache_trivago_rating[key];
}
var link_bubble="/trivago_rpc.php?action=show_item_rating&item="+item_id,
link_item="/item.php?item="+item_id+"&hlpath="+APP.SNAPSHOT.Get('path'),
color_value;
if(val>=8014)
{
color_value=1;
}
else if(val>=7767)
{
color_value=2;
}
else if(val>=7594)
{
color_value=3;
}
else if(val>=7254)
{
color_value=4;
}
else if(val==0)
{
color_value=0;
}
else
{
color_value=5;
}
cache_trivago_rating[key]="<div class=\"ratingb_quadrat"+color_value+" ";
if(val)
{
cache_trivago_rating[key] +="pointer\" onmouseover=\"new APP.Bubble(this, 0, '"+link_bubble+"');\" onclick=\"top.location.href='"+link_item+"';\"";
}
else
{
cache_trivago_rating[key] +="\" title=\""+APP.PRICE.STRINGS.Get('not_rated_yet')+"\"";
}
cache_trivago_rating[key] +=">";
cache_trivago_rating[key] +=val ? Math.round(val/100):'?';
cache_trivago_rating[key] +="</div>";
return cache_trivago_rating[key];
}
};APP.PRICE.REGION.DESIGN.LIST=new function()
{
//
//  todo: cschmidt: comment(!!)
//
this.Get=function(hotellist)
{
var booking_url,
baseurl="/item.php?hlpath="+APP.SNAPSHOT.Get('path')+"&date_range::to="+APP.SNAPSHOT.Get('date_range::to')+"&date_range::from="+APP.SNAPSHOT.Get('date_range::from')+"&room_type="+APP.SNAPSHOT.Get('room_type')+"&item=",
baselink,
dealslink,
imageslink,
item,
item_price,
nonavailable_mode=!APP.SNAPSHOT.Get('do_available_search'),
retval ="<table class=\"toplist hotellistitem\"><tbody>";
for(var i=0, n=hotellist.length; i<n; i++)
{
item=hotellist[i];
item_price=item.price;
//build links
baselink =baseurl+item.id+"&path="+item.path;
dealslink=baselink+"&pagetype=deals";
imageslink=baselink+"&pagetype=images";
//define row styles
retval +="<tr class=\""+((i+1)%2==1 ? " background":"")+"\">"
//display number
+ "<td class=\"dnumber\">"
+ APP.PRICE.REGION.DESIGN.GetIndexNumber(i)
+ "</td>"
//display image
+ "<td class=\"image\">"
+  APP.PRICE.REGION.DESIGN.ShowImg(item.img, "msq",(item.count_partners==0 ? baselink:dealslink))
+  "</td>"
//display name and details
retval +="<td class=\"details\">"
+  "<span class=\"item_group\">";
if(item.group)
{
retval +=APP.PRICE.STRINGS.Get("item_group_"+item.group);
}
retval +="</span> &nbsp;"
+  APP.PRICE.REGION.DESIGN.GetCategory(item.cat)
+  "<br /><a href=\""+((!nonavailable_mode && item.count_partners>0) ? dealslink:baselink)+"\"> "+item.name.substring(0, 20)+"</a>"
+  "</td>"
+  "<td class=\"rating\">"
+  APP.PRICE.REGION.DESIGN.GetTrivagoRating(item.ol, item.id)
+  "</td>"
+  "<td class=\"price\">";
if(item_price)
{
if(item_price.price)
{
booking_url=APP.PRICE.REGION.DESIGN.GetBookingUrl(item);
retval +="<a href=\"javascript:void(0);\" "+booking_url+" class=\"bigboldtext\">"+item_price.price+"</a>"
+  APP.PRICE.REGION.DESIGN.GetPartnerImg(item_price.img_s, booking_url);
}
}
retval +="</td>"
//display button
+  "<td class=\"dbutton\">";
if((nonavailable_mode) ||((!nonavailable_mode) &&(item_price) &&(item_price.img_m)))
{
retval +=APP.PRICE.REGION.DESIGN.GetAllPricesButton(dealslink, !nonavailable_mode);
}
retval +="</td></tr>";
}
return retval+"</tbody></table>";
}
};
APP.PRICE.REGION.DESIGN.DETAIL=new function()
{
//
//  todo: cschmidt: comment(!!!)
//
this.Get=function(items)
{
var retval='';
for(var i=0, n=items.length; i<n; ++i)
{
if(typeof items[i].name =='undefined')
{
APP.PRICE.REGION.DEBUG.Set('json:'+APP.PRICE.REGION.DEBUG.Dump(items));
}
retval +=this.GetSingle(items[i], i);
}
return retval;
}
//
//  todo: cschmidt: comment(!!!)
//
this.GetSingle=function(i,number)
{
var retval  ="",
baselink   ="/item.php?hlpath="+APP.SNAPSHOT.Get('path')+"&item="+i.id+"&path="+i.path+"&date_range::to="+APP.SNAPSHOT.Get('date_range::to')+"&date_range::from="+APP.SNAPSHOT.Get('date_range::from')+"&room_type="+APP.SNAPSHOT.Get('room_type');
var dealslink  =baselink+"&pagetype=deals",
imageslink =baselink+"&pagetype=images",
do_available_search=APP.SNAPSHOT.Get('do_available_search');
retval +="<div class=\"hotellistitem "
+(!do_available_search ? "default_hotel":"price_search")
+ "\">"
+ "<div class=\"index small\">"+APP.PRICE.REGION.DESIGN.GetIndexNumber(number)+"</div>"
//build price-box
+ this.GetPriceBox(i)
// build right highlighted-block
+ "<div class=\"highlight\">"
+ APP.PRICE.REGION.DESIGN.ShowImg(i.img, "sq",(i.count_partners==0 ? baselink:dealslink))
+ "</div>"
// build details - block
+ "<div class=\"details\">";
if(i.group)
{
retval +="<span class=\"item_group\">"+APP.PRICE.STRINGS.Get("item_group_"+i.group)+"</span> &nbsp;"
}
retval +=APP.PRICE.REGION.DESIGN.GetCategory(i.cat)
+ "<h3><a href='"+((do_available_search && i.count_partners>0) ? dealslink:baselink)+"'>"+i.name+"</a></h3>";
if(i.geo && i.geo.distance)
{
retval +="<span class=\"distance\">"
+ this.GetGeoString(i.geo)
+ "</span>";
}
retval +="<br />"
// build overall-liking
+ APP.PRICE.REGION.DESIGN.GetTrivagoRating(i.ol, i.id)
+ i.desc
+ "</div>";
// display hotellinks
if(do_available_search)
{
retval +="<div class=\"hotellinks\"><!--  --></div>";
}
// display alternative - partner
retval +=this.GetDealsList(i);
if((do_available_search) &&(i.count_partners>0))
{
retval  +="<div class=\"available_on\">";
if(i.count_partners>8)
{
retval  +=APP.PRICE.STRINGS.Get('available_offers').split('$count').join("<strong>"+i.count_partners+"</strong>")+"<br />";
}
retval  +=APP.PRICE.REGION.DESIGN.GetAllPricesButton(dealslink, do_available_search)
+  "</div>";
}
if(do_available_search)
{
retval +="<div class=\"spacer\"><!--  --></div>";
}
return retval+"</div></div>";
}
//
//
//
this.GetDealsList=function(item)
{
var retval ='',
bookingUrl   ='',
dealslink ='',
count  =item.aprices.length,
do_available_search=APP.SNAPSHOT.Get('do_available_search'),
k   =0,
baselink  ="/item.php?hlpath="+APP.SNAPSHOT.Get('path')+"&pagetype=deals&date_range::to="+APP.SNAPSHOT.Get('date_range::to')+"&date_range::from="+APP.SNAPSHOT.Get('date_range::from')+"&room_type="+APP.SNAPSHOT.Get('room_type');
for(var i=0; i<2; i++)
{
k=0;
for(var j=0; j<count; j++)
{
if(j % 2 ==i)
{
if(k % 4 ==0)
{
retval +=(j > 0 ? '</ul>':'')+"<ul class=\"alt_prices\">";
}
if(!do_available_search)
{
bookingUrl=" onclick=\"window.location.href='"+item.aprices[j].url+"';\"";
}
else if(item.aprices[j].url)
{
bookingUrl=" onclick=\"window.open('"+item.aprices[j].url+"');\"";
}
else
{
dealslink=baselink+"&item="+item.id+"&path="+item.path;
bookingUrl=" onclick=\"window.location.href='"+dealslink+"';\"";
}
retval +="<li class=\"alternatives\" "+bookingUrl+">"
+  "<div class=\"left\">"+item.aprices[j].name+"</div>"
+  "<div class=\"right\">"+item.aprices[j].price+"</div>"
+  "</li>";
++k;
}
}
}
if(retval)
{
retval +="</ul>"
}
return retval;
}
//
//
//
this.GetGeoString=function(geo)
{
var retval='';
if(geo.ref)
{
retval +=geo.ref;
}
if((geo.dist) &&(geo.obd ==0))
{
retval +="("+geo.dist+")";
}
return retval;
}
//
// build the price-box
//
this.GetPriceBox=function(i)
{
var retval   ='',
non_available_mode=!APP.SNAPSHOT.Get('do_available_search'),
onclick_event ='';
if(!(i.price && i.price.no_availability) ||(i.price && i.price.no_availability && non_available_mode))
{
onclick_event=APP.PRICE.REGION.DESIGN.GetBookingUrl(i);
}
retval +="<div class='info_field'>";
if(i.price && i.price.price)
{
retval +="<span class=\"subheadline\">"+APP.PRICE.STRINGS.Get('best_price')+"</span>"
+  "<a href=\"javascript:void(0);\" class=\"price\""+onclick_event+">"+i.price.price+"</a>";
}
else if(i.price && i.price.no_availability)
{
retval +="<br />";
if(non_available_mode)
{
retval +="<a href=\"javascript:void(0);\""+onclick_event+">";
}
retval +=i.price.no_availability;
if(non_available_mode)
{
retval +="</a>";
}
retval +="<br /><br /><br />";
}
else if(i.price && i.avg_price && !i.price.no_availability)
{
retval +="<a href=\"javascript:void(0);\""+onclick_event+">"+i.avg_price+"</a><br /><br />";
}
if((i.price) &&(i.price.img_m))
{
retval +=APP.PRICE.REGION.DESIGN.GetPartnerImg(i.price.img_m, onclick_event);
}
if((non_available_mode && i.links.partner>0) ||((!non_available_mode) &&(i.price) &&(i.price.img_m)))
{
retval +="<a class=\"button button_red\" href=\"javascript:void(0);\""+onclick_event+"><span class=\"content\">"+APP.PRICE.STRINGS.Get(non_available_mode ? 'deals_proof':'deals_forward')+"</span></a>";
}
retval +="</div>";
return retval;
}
};
APP.PRICE.REGION.HASH=new function()
{
//
//
//
this.add_event=function()
{
APP.HASH.Reg(this.key(), function(){ APP.PRICE.REGION.HASH.ChangeHash(); });
}
//
//
//
this.del_event=function()
{
APP.HASH.Reg(this.key(), function(){});
}
//
//
//
this.Init=function()
{
if(APP.HASH.Get(this.key()) =='')
{
//replacing is a fix with the history-back-feature and the first-site from the region-price-search
document.location.replace(document.location+'#'+this.key()+':"'+APP.SNAPSHOT.GetQuery(true, true)+'"');
}
this.add_event();
}
//
//
//
this.Set=function(snapshot)
{
this.del_event();
snapshot['request_ident']='';
APP.HASH.Set(this.key(), snapshot);
this.add_event();
}
//
//
//
this.key=function()
{
return 'price_region';
}
//
//
//
this.ChangeHash=function()
{
var hash,
param,
retval=false,
new_snap=[],
fields=[],
new_hash=APP.SNAPSHOT.GetQuery(true, true);
//request_ident, url_hash
if((hash=APP.HASH.Get(this.key())) &&
(new_hash!=APP.HASH.Convert(hash))
)
{
APP.PRICE.REGION.DEBUG.Set('func: ChangeHash, new:'+new_hash+', old:'+APP.HASH.Convert(hash));
hash['request_ident']=APP.SNAPSHOT.Get('request_ident');
//convert structure 'f_' and so on to the fields-array
for(param in hash)
{
if(param.split('f_').length > 1)
{
var field_id=param.split('f_');
fields[field_id[1]]=hash[param];
}
else
{
new_snap[param]=hash[param];
}
}
if(fields)
{
new_snap['fields']=fields;
}
APP.SNAPSHOT.Response(new_snap);
APP.PRICE.REGION.Start();
retval=true;
}
return retval;
}
};
APP.PRICE.REGION.PROGESSBAR=new function()
{
//
//  init object
//
this.Init=function()
{
node_progressbar=$('progressbar');
node_progressbar_value=$('progressbar_value');
node_img_progressbar=$('img_progressbar');
}
//
//  hide progressbar
//
this.Hide=function()
{
node_progressbar.disappear();
}
//
//  show progressbar
//
this.Show=function()
{
node_progressbar.appear();
}
//
//  create our progressbar
//
this.CreateStandBy=function(pdata, servicestatus)
{
if((servicestatus==ajax_state_complete) ||(pdata.length==0) ||(block_progressbar))
{
this.Hide();
}
else
{
var procent=this.GetCountPartnerComplete(pdata) /(pdata.length/100);
node_img_progressbar.style.left =((118-Math.round(118 *(procent / 100)))*-1)+"px";
node_progressbar_value.innerHTML=Math.round(procent)+"%";
if(Math.round(procent)!=100)
{
this.Show();
}
else
{
block_progressbar=true;
}
}
}
//
// get complete partner-count
//
this.GetCountPartnerComplete=function(pdata)
{
var retval=0,
count =pdata.length;
for(var i=0; i<count; i++)
{
if(pdata[i].s!=0)
{
retval++;
}
}
return retval;
}
//
// private vars..
//
var node_progressbar,
node_progressbar_value,
node_img_progressbar,
block_progressbar=false,
//all ajax - states
ajax_state_error =-1,
ajax_state_incomplete=0,
ajax_state_complete=1;
};
APP.PRICE.REGION.PARTNER_BANNER=new function()
{
//
//  init object
//
this.Init=function()
{
node_partner_banner=$('partner_banner');
}
//
//  hide partner-slider  @todo: unbenennen
//
this.Hide=function()
{
if(array_partners_blocked.length ==0 && cache)
{
node_partner_banner.innerHTML=this.GetHtml(cache, this.GetDisplayMode(true));
}
}
var cache;//@todo: wirklich brauchen?
//
//  display the partner-slider
//
this.Show=function(pdata, servicestatus)
{
// We display the partner-box only, than we user do not break the loading-process
if(pdata.length==0)
{
this.Hide();
}
else
{
cache=pdata;
this.SetPartner(pdata);
node_partner_banner.innerHTML=this.GetHtml(pdata, this.GetDisplayMode(false));
node_partner_banner.appear();
}
}
//
// create our partner-list
//
this.GetHtml=function(pdata, state_complete)
{
var retval='',
count =pdata.length,
partner,
id,
onclick;
if(count > 0)
{
retval +='<div class="filter_group">'+APP.PRICE.STRINGS.Get('deals_partner')+'</div>'
+ '<ul class="fields" id="js_partner_list">'
+ '<li id="js_enable_all_partners"'+(state_complete? ' style="display:none;"':'')+'>'
+ '<input type="checkbox" '+(array_partners_blocked.length==0 ? 'checked="checked"':'')+' id="js_select_all_partners" onclick="APP.PRICE.REGION.PARTNER_BANNER.SelectAllPartners();" /> '
+ '<label class="item" for="js_select_all_partners">'+APP.PRICE.STRINGS.Get('all_notices')+'</label>'
+ '</li>';
var str_hotels =APP.PRICE.STRINGS.Get('hotels'),
str_no_answer=APP.PRICE.STRINGS.Get('partner_no_answer'),
str_loading=APP.PRICE.STRINGS.Get('partner_loading');
for(var i=0; i<count; i++)
{
partner=pdata[i];
onclick='APP.PRICE.REGION.PARTNER_BANNER.DeactivitatePartner('+partner.i+', this.checked)';
id='js_partner_'+partner.i;
retval +='<li id="js_partner_li_'+partner.i+'" '+(state_complete && i>2 ? ' style="display:none;"':'')+'>'
+ '<input'+(partner.c==0 ? ' disabled':"")+' partner="'+partner.i+'" id="'+id+'" type="checkbox" '+(!this.IsBlockedPartner(partner.i) ? ' checked="checked"':'')+' onclick="'+onclick+'" value="1" /> '
+ '<label for="'+id+'"'+((partner.s==0 || partner.c==0) ? ' class="lighttext"':'')+'>'
+ APP.PRICE.STRINGS.Get('partner_'+partner.i)
+ ' <span class="lighttext">('
if((partner.s==partner_state_complete) &&(partner.c>0))
{
retval +=partner.c+' '+str_hotels+' - '+partner.m;
}
else if(state_complete || partner.s==1 || partner.s==-1)
{
retval +=str_no_answer;
}
else
{
retval +=str_loading;
}
retval +=')</span>'
+ '</label>'
+ '</li>';
}
retval +='</ul>'
+ '<a href="javascript:void(0);" '+(!state_complete? 'style="display:none;"':'')+' id="js_partnerlist_more" class="more_button" onclick="APP.PRICE.REGION.PARTNER_BANNER.AppearPartnerList();">'
+ APP.PRICE.STRINGS.Get('more')
+ '</a>'
+ '<a href="javascript:void(0);" '+(state_complete ? 'style="display:none;"':'')+' id="js_partnerlist_less" class="more_button" onclick="APP.PRICE.REGION.PARTNER_BANNER.DisappearPartnerList();">'
+ APP.PRICE.STRINGS.Get('less')
+ '</a>';
}
return retval;
}
//
//
//
this.SelectAllPartners=function()
{
var status=$('js_select_all_partners').checked,
nodes =$('partner_banner').getElementsByTagName('input'),
partner,
node_checkbox;
for(var i=1, n=nodes.length; i<n; i++)
{
node_checkbox=nodes[i];
partner=node_checkbox.getAttribute('partner');
node_checkbox.checked=status;
if(status)
{
this.DeleteBlockedPartner(partner);
}
else
{
this.SetBlockedPartner(partner);
}
}
APP.SNAPSHOT.Request('partner_filter', APP.PRICE.REGION.PARTNER_BANNER.GetPartner());
APP.PRICE.REGION.Start();
}
//
//
//
this.AppearPartnerList=function()
{
var nodes=$('js_partner_list').getElementsByTagName('li');
var count=nodes.length;
for(var i=0; i<count; i++)
{
$(nodes[i].id).appear();
}
$('js_partnerlist_more').disappear();
$('js_partnerlist_less').appear();
this.SetDisplayMode(false);
}
//
//
//
this.DisappearPartnerList=function(node)
{
var nodes=$('js_partner_list').getElementsByTagName('li');
var count=nodes.length;
$(nodes[0].id).disappear();
for(var i=4; i<count; i++)
{
$(nodes[i].id).disappear();
}
$('js_partnerlist_more').appear();
$('js_partnerlist_less').disappear();
this.SetDisplayMode(true);
}
//
//
//
this.GetDisplayMode=function(val)
{
if(val && !disable_auto_change_mode)
{
this.SetDisplayMode(val);
return val;
}
else
{
return user_conf_display_mode;
}
}
//
//
//
this.SetDisplayMode=function(val)
{
user_conf_display_mode=val;
}
//
//
//
this.DeactivitateAutoChange=function()
{
disable_auto_change_mode=true;
}
//
//
//
this.DeactivitatePartner=function(partner, val)
{
if(!val)
{
this.SetBlockedPartner(partner);
}
else
{
this.DeleteBlockedPartner(partner);
}
APP.SNAPSHOT.Request('offset', '0');
APP.SNAPSHOT.Request('partner_filter', APP.PRICE.REGION.PARTNER_BANNER.GetPartner());
APP.PRICE.REGION.Start();
}
//
//
//
this.IsBlockedPartner=function(val)
{
var retval=false,
count =array_partners_blocked.length;
for(var i=0; i<count; i++)
{
if(array_partners_blocked[i] ==val)
{
retval=true;
break;
}
}
return retval;
}
//
//
//
this.SetBlockedPartner=function(val)
{
if(!this.IsBlockedPartner(val))
{
array_partners_blocked.push(val);
}
}
//
//
//
this.SetBlockedPartnerArray=function(val)
{
val=(val ==null) ? array_partners:val.split(',');
array_partners_blocked=[];
for(var i=0, n=array_partners.length; i<n; i++)
{
var found=false;
for(var j=0, m=val.length; j<m; j++)
{
if(val[j] ==array_partners[i])
{
found=true;
break;
}
}
if(!found)
{
array_partners_blocked.push(array_partners[i]);
}
}
}
//
//
//
this.DeleteBlockedPartner=function(val)
{
var retval=[],
count =array_partners_blocked.length;
for(var i=0; i<count; i++)
{
if(array_partners_blocked[i]!=val)
{
retval.push(array_partners_blocked[i]);
}
}
array_partners_blocked=retval;
}
//
//
//
this.SetPartner=function(pdata)
{
array_partners=[];
for(var i=0, n=pdata.length; i<n; i++)
{
array_partners.push(pdata[i].i);
}
}
//
//
//
this.GetPartner=function()
{
var retval =[],
count_partners  =array_partners.length,
count_blocked_partners=array_partners_blocked.length,
found;
for(var i=0; i<count_partners; i++)
{
found=false;
for(var j=0; j<count_blocked_partners; j++)
{
if(array_partners_blocked[j] ==array_partners[i])
{
found=true;
break;
}
}
if(!found)
{
retval.push(array_partners[i]);
}
}
return retval.join(',');
}
//
// private vars..
//
var node_partner_banner,
partner_state_complete=1,
max_displayed_partners=3,
//all ajax - states
ajax_state_error =-1,
ajax_state_incomplete=0,
ajax_state_complete=1,
user_conf_display_mode=false,
disable_auto_change_mode=false,
array_partners  =[],
array_partners_blocked=[];
};
APP.PRICE.REGION.PATH_ID_MULTI_AVAIL=new function()
{
//
// init path-list
//
this.Init=function()
{
node=$('top_childs');
}
//
// hide the path-list
//
this.Hide=function()
{
node.disappear();
}
//
// display the path-list
//
this.Show=function()
{
node.appear();
}
//
// set the path-list
//
this.Set=function(value, multi_avail_path_ids)
{
node.innerHTML=value;
APP.SNAPSHOT.Request('path_id_multi_avail', multi_avail_path_ids);
}
//
//  baby-lb for the children-pathlist(static - variant)
//
this.GetLink=function(path_id)
{
return "/region.php?pagetype=hotels&"+APP.SNAPSHOT.GetQuery(true)+"&path="+path_id;
}
//
//  we display in the region-price-search(available-mode) the sub-path-list.
//  the user can activitate more citys or disable citys.
//  maybe the user can activitate on city, but we do not have this city in the city-list.
//  @param additional_path path-id from the separate city
//
this.DisplaySelectedChildrenPaths=function(additional_path)
{
//add non-filter pathlist
var path_list=(additional_path ? additional_path:''),
node,
i;
//add filter pathlist
for(i=0; i<30; i++)
{
node=$('children_path_'+i);
if(node.isElement())
{
if(node.checked)
{
path_list +=((path_list!='') ? ',':'')+node.getAttribute('path_id');
}
}
else
{
break;
}
}
APP.SNAPSHOT.Request('path_id_multi_avail', path_list);
APP.SNAPSHOT.Request('offset',  0);
APP.PRICE.REGION.Start();
}
//
// private vars
//
var node;
}
APP.PRICE.REGION.HEADER=new function()
{
//
// init header
//
this.Init=function()
{
node_statusbar =$('statusbar_txt');
node_header  =$('header_bar_main');
node_js_best_hotels=$('js_best_hotels');
}
//
// hide the header
//
this.Hide=function()
{
node_statusbar.disappear();
node_header.disappear();
if(node_js_best_hotels.isElement())
{
node_js_best_hotels.disappear();
}
}
//
// display the header
//
this.Show=function()
{
node_statusbar.appear();
node_header.appear();
if((node_js_best_hotels.isElement()) &&(APP.SNAPSHOT.Get('order_by')=='overall_liking'))
{
node_js_best_hotels.appear();
}
}
//
// create the header
//
this.CreateHeader=function(value)
{
node_statusbar.innerHTML=value;
}
//
// private vars
//
var node_statusbar,
node_header,
node_js_best_hotels;
}
APP.PRICE.REGION.FOOTER=new function()
{
//
// private vars
//
var node_bottom,
step=25,
cache_num_pages=0,
cache_offset=0;
//
//
//
this.Init=function()
{
node_bottom=$('hotellistbottom');
}
//
//  hide the footer-navigation
//
this.Hide=function()
{
node_bottom.disappear();
cache_num_pages=0;
cache_offset =0;
}
//
// build and display the footer-navigation
//
this.Show=function()
{
var c=APP.PRICE.REGION.GetResultCount();
if(c < 25)
{
this.Hide();
}
else
{
this.CreateNavigation(c, APP.SNAPSHOT.Get('offset'));
node_bottom.appear();
}
}
//
// If we have only one display - site, we can break this function
// or the cache_num_page is identically to num_pages(not changed)
//
this.GetUpdateStatus=function(num_pages, cache_num_pages, poffset)
{
if(num_pages ==1 ||
(cache_num_pages ==num_pages &&
cache_offset ==poffset))
{
return false;
}
return true;
}
//
//
//
this.CreateNavigation=function(count, input_offset)
{
var offset =(typeof input_offset =='undefined' ? 0:input_offset),
num_pages=Math.ceil(count/step),
retval ="";
var poffset =Number((offset/step)+1);
// set max num_pages
if(count > 500)
{
count=500;
num_pages=Math.ceil(count/step);
}
// we must build the footer again?
if(!this.GetUpdateStatus(num_pages, cache_num_pages, poffset))
{
return "";
}
var y=Math.max(Number(poffset -(Math.max((Number(10-(num_pages-poffset))),(10/2)))),1);
var upper=((num_pages > 10) ? Math.min(Number(y+10),num_pages):num_pages);
var intStart=(upper-10 < 1 ? 1:upper-10);
if((num_pages>1) &&(poffset>1))
{
retval +="<a href=\"javascript:void(0);\" onclick=\"APP.PRICE.REGION.FOOTER.SkimPage('down',"+step+");\" class=\"button button_blue l\"><span class=\"content\">geri</span></a>";
}
retval +="<div class=\"m\">";
for(var x=intStart; x<=upper; x++)
{
if(x==poffset)
{
retval +="<strong class='button button_red'><span class=\"content\">"+ x +"</span></strong>";
}
else
{
retval +="<a href='javascript:void(0);' class='button button_blue' onclick=\"APP.PRICE.REGION.FOOTER.SkimPage('new',"+Number((x*step)-step)+");\"><span class=\"content\">"+ x +"</span></a>";
}
}
retval +="</div>";
if(poffset<num_pages)
{
retval +="<a href=\"javascript:void(0);\" onclick=\"APP.PRICE.REGION.FOOTER.SkimPage('up',"+step+");\" class=\"button button_blue r\"><span class=\"content\">ileri</span></a>";
}
cache_num_pages=num_pages;
cache_offset   =poffset;
node_bottom.innerHTML=retval;
}
//
//  footer-page-navigation
//  @param direction mode-variant(up: next-page, down: last-page, new:special subpage)
//  @param offset the offset is the absolute offset related by direction 'new'. in the other situation is it the relative offset.
//
this.SkimPage=function(direction, offset)
{
var current_offset=APP.SNAPSHOT.Get('offset');
current_offset=Number(current_offset? current_offset: 0);
// scroll to the top of the page
window.scrollTo(1, 1);
node_bottom.disappear();
switch(direction)
{
case   'up':
APP.SNAPSHOT.Request('offset', current_offset+Number(offset));
break;
case 'down':
APP.SNAPSHOT.Request('offset', current_offset - Number(offset));
break;
case  'new':
APP.SNAPSHOT.Request('offset', offset);
}
APP.PRICE.REGION.Start();
}
};APP.PRICE.REGION.TOP_NAV=new function()
{
//
// init header
//
this.Init=function()
{
node_hotellisttop  =$('hotellisttop');
node_order_overall_liking=$('js_order_overall_liking');
node_order_price   =$('js_order_price');
node_order_distance=$('js_order_distance');
node_best_hotels   =$('js_best_hotels');
node_view_types=[];
for(var i=0; i<3; i++)
{
node_view_types[i]=$('list_view_style_'+i);
}
}
//
// hide the header
//
this.Hide=function()
{
node_hotellisttop.disappear();
}
//
// display the header
//
this.Show=function()
{
node_hotellisttop.appear();
}
//
//  change the css-styles from the 3 view_type - buttons(details, list and google-map)
//  @param view_type new display view_type
//
this.ChangeButtonViewType=function(view_type)
{
//check, if we have the navi. sometimes the user click too quick.
if(!node_view_types[0])
{
return false;
}
for(var i=0; i<3; i++)
{
node_view_types[i].setClass( 'icon_'+((view_type!=i) ? 'in':'')+'active');
}
return true;
}
//
//  change the css-styles from the 3 order - buttons(overall_liking, price, distance)
//  @param order ['overall_liking', 'distance', 'price']
//
this.ChangeButtonOrder=function(order)
{
if(node_best_hotels.isElement())
{
if(order=='overall_liking')
{
node_best_hotels.appear();
}
else
{
node_best_hotels.disappear();
}
}
node_order_overall_liking.setClass(((order=='overall_liking' || order=='overall_liking desc') ? 'tab_active':'tab_inactive') );
if(node_order_price.isElement())
{
node_order_price.setClass((order=='price' ? 'tab_active':'tab_inactive') );
}
if(node_order_distance.isElement())
{
node_order_distance.setClass((order=='distance' ? 'tab_active':'tab_inactive') );
}
return true;
}
//
//  todo: cschmidt: comment
//
this.ChangeViewType=function(view_type)
{
//page loaded?
if(APP.SNAPSHOT.Get('do_available_search') ==null)
{
if(++loading_try <=20)
{
window.setTimeout(function(){
APP.PRICE.REGION.TOP_NAV.ChangeViewType(view_type);
}, 100);
}
return;
}
//change view_type?
if(APP.SNAPSHOT.Get('view_type') ==view_type)
{
return;
}
APP.SNAPSHOT.Request('view_type', view_type);
// change icon highlighting
this.ChangeButtonViewType(view_type);
}
//
//  change the order from the hotellist and load the new list.
//  we must change the view_type related by the order=='distance'(display google-map)
//
//  @param order(options: overall_liking, price, distance)
//  @param geo_latitude & geo_longitude(geocode from the order related by the var order=='distance')
//
this.ChangeListOrder=function(order, geo_latitude, geo_longitude)
{
//page loaded?
if(APP.SNAPSHOT.Get('do_available_search') ==null)
{
if(++loading_try <=20)
{
window.setTimeout(function(){
APP.PRICE.REGION.TOP_NAV.ChangeListOrder(order, geo_latitude, geo_longitude);
}, 500);
}
return;
}
//change order?
if((APP.SNAPSHOT.Get('order_by') ==order) &&(APP.SNAPSHOT.Get('offset')=='0'))
{
return;
}
//select button
this.ChangeButtonOrder(order);
APP.SNAPSHOT.Request('order_by', order);
APP.SNAPSHOT.Request('offset',   '0');
if((typeof latitude!='undefined') &&(typeof latitude!='undefined'))
{
APP.SNAPSHOT.Request('geo_code::longitude', parseFloat( geo_longitude ));
APP.SNAPSHOT.Request('geo_code::latitude',  parseFloat( geo_latitude ));
}
if(order =='distance')
{
this.ChangeViewType(2);
}
APP.PRICE.REGION.Start();
}
//
// private vars
//
var node_hotellisttop,
node_view_types,
node_order_overall_liking,
node_order_price,
node_order_distance,
node_best_hotels,
loading_try=0;
}
APP.PRICE.REGION.FILTER=new function()
{
//
//
//
var loading_try=0;
//
// update complete filter-box
//
this.Update=function()
{
try{
var response=APP.PRICE.REGION.GetResponse(),
snap=APP.SNAPSHOT.Get();
var category =snap['category']==null  ?   0:snap['category'],
price_max;
APP.PRICE.REGION.FILTER.SLIDER.STARS.SetPriceValue(category);
APP.PRICE.REGION.FILTER.SLIDER.STARS.StickToPosition();
APP.PRICE.REGION.FILTER.QUERYSTRING.SetQuery(snap['search_string']);
APP.PRICE.REGION.FILTER.ATTRACTION.SetGeoDistanceLimit(snap['geo_distance_limit']);
APP.PRICE.REGION.FILTER.ATTRACTION.SetResponseDistance(snap['geo_distance_limit']);
APP.PRICE.REGION.FILTER.ATTRACTION.SetAttraction();
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetUserChanged(snap['geo_distance_limit']?true:false);
APP.PRICE.REGION.PARTNER_BANNER.SetBlockedPartnerArray(snap['partner_filter']);
if(response)
{
APP.PRICE.REGION.FILTER.STARS.SetMaxValue(response.filter_stars, false);
//APP.PRICE.REGION.FILTER.FIELDS.InitCheckboxes();
APP.PRICE.REGION.FILTER.FIELDS.CreateHtml(response.filter_fields);
price_max=snap['price_max']==null ? response.price_max:snap['price_max'];
APP.PRICE.REGION.FILTER.PRICE.SetValue(response.price_min, response.price_max);
APP.PRICE.REGION.FILTER.PRICE.SetIncludeAll(snap['include_all']!=1);
APP.PRICE.REGION.FILTER.PRICE.SetPriceValue(price_max);
APP.PRICE.REGION.FILTER.PRICE.SetPreviewPrice();
$('filterbox_main').appear();
}
APP.PRICE.REGION.FILTER.STARS.UpdateStars();
// maximale Distanz eines Hotels(Stadtsuche), nur wenn nicht use_distance
if(!APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetUserChanged())
{
var default_distance_limit=$('default_distance_limit').isElement() ? $('default_distance_limit').value:'';
var max_distance=(response && response.max_distance) ? response.max_distance:default_distance_limit;
if(max_distance!='null')
{
APP.PRICE.REGION.FILTER.ATTRACTION.SetResponseDistance(max_distance);
}
}
APP.PRICE.REGION.FILTER.FIELDS.InitCheckboxes();
}
catch(e)
{
APP.PRICE.REGION.DEBUG.Set('func: APP.PRICE.REGION.FILTER.Update, error'+e);
}
}
//
//  switch from the the city-search to the distance-search(used only in the error-situation)
//  @param state 1 is city-search, 0 is geocode-search
//  @param setValue default geocode-max-distance-search(unit: meter)
//
this.Switch2CitySearch=function(state, setValue)
{
//page loaded?
if(APP.SNAPSHOT.Get('do_available_search') ==null)
{
if(++loading_try <=20)
{
window.setTimeout(function(){
APP.PRICE.REGION.FILTER.Switch2CitySearch(state, setValue);
}, 100);
}
return;
}
APP.SNAPSHOT.Request('geo_use_distance', 1);
APP.PRICE.REGION.FILTER.ATTRACTION.SetCityCenter();
APP.PRICE.REGION.FILTER.ATTRACTION.SetGeoDistanceLimit(setValue);
if(state)
{
APP.PRICE.REGION.FILTER.ATTRACTION.Disable();
}
else
{
//select first attraction
$("attraction").selectedIndex=0;
//use filter
APP.PRICE.REGION.FILTER.ATTRACTION.Enable();
}
}
//
//  we save every filter-configuration in the array "this.SearchCache". Maybe the user
//  has a situation with no results, than we can go one filter-step back.
//  is the array empty, than we reset the configuration(direct display-mode with prefilled filter)
//
this.LastRequest=function()
{
// load the last request
var snap=APP.PRICE.REGION.CACHE.FILTER.GetLastSnapshot();
if(snap!=null)
{
APP.SNAPSHOT.Response(snap);
APP.PRICE.REGION.Start(1);
}
}
//
// reset the filter settings and send a request to the server
//
this.ClearFilter=function()
{
//load first request
var snap=APP.PRICE.REGION.CACHE.FILTER.GetFirstSnapshot();
if(snap!=null)
{
APP.SNAPSHOT.Response(snap);
APP.PRICE.REGION.Start(1);
}
}
}
APP.PRICE.REGION.FILTER.STARS=new function()
{
//
// init class
//
this.Init=function()
{
APP.PRICE.REGION.FILTER.SLIDER.STARS.Init('stars');
APP.PRICE.REGION.FILTER.SLIDER.STARS.SetInvertHighlight(true);
APP.PRICE.REGION.FILTER.SLIDER.STARS.SetValueCount(5);
APP.PRICE.REGION.FILTER.SLIDER.STARS.StickToPosition();
APP.PRICE.REGION.FILTER.SLIDER.STARS.SetEvents(function(){APP.PRICE.REGION.FILTER.STARS.DisplayHover();}, function(){APP.PRICE.REGION.FILTER.STARS.Start();});
node  =$('js_input_price_stars');
node_preview_stars=$('js_preview_stars');
node_tooltipp =$('js_slider_tooltipp_stars');
for(var i=0; i<=5; i++)
{
node_stars[i]=$('js_star_'+i);
}
}
//
//  Start search
//
this.Start=function()
{
var value=APP.PRICE.REGION.FILTER.SLIDER.STARS.GetValue();
//nothing todo?
if(APP.SNAPSHOT.Get('category')!=value)
{
node_preview_stars.innerHTML=value+' - '+APP.PRICE.REGION.FILTER.SLIDER.STARS.GetMaxValue();
APP.SNAPSHOT.Request('category', value);
APP.SNAPSHOT.Request('offset',   0);
APP.PRICE.REGION.Start();
}
}
//
//
//
this.Set=function(val)
{
if(max_value>=val || max_value==0)
{
APP.PRICE.REGION.FILTER.SLIDER.STARS.SetPriceValue(val);
APP.PRICE.REGION.FILTER.SLIDER.STARS.StickToPosition();
this.SetPreviewText();
this.Start();
}
}
//
//
//
this.SetMaxValue=function(val)
{
max_value=val;
}
//
//
//
this.SetPreviewText=function()
{
var value=APP.PRICE.REGION.FILTER.SLIDER.STARS.GetValue();
if(max_value<value)
{
this.Set(max_value);
}
else
{
this.UpdateStars();
this.DisplayHover();
}
}
//
//
//
this.DisplayHover=function()
{
node_tooltipp.innerHTML=APP.PRICE.REGION.FILTER.SLIDER.STARS.GetValue()+' - '+APP.PRICE.REGION.FILTER.SLIDER.STARS.GetMaxValue()+' '+APP.PRICE.STRINGS.Get('stars');
}
//
//
//
this.UpdateStars=function()
{
var value=APP.PRICE.REGION.FILTER.SLIDER.STARS.GetValue();
var max=max_value==0 ? 5:max_value;
for(var i=0; i<=5; i++)
{
node_stars[i].setClass('stars star'+i+'_'+(value>i || max<i ? '2':'1'));
}
}
//
// private vars
//
var node,
node_stars=[],
node_tooltipp,
node_preview_stars,
max_value=0;
}
APP.PRICE.REGION.FILTER.QUERYSTRING=new function()
{
//
//  private vars
//
var node_query,
node_activitate_query;
//
//
//
this.Init=function()
{
var form=document.forms['hotellist_search_string'];
node_activitate_query=form['useSearchstring'];
node_query =form['search_string'];
}
//
// onclick - event on the checkbox
//
this.ClickCheckbox=function(obj)
{
if((!obj.checked) &&(APP.SNAPSHOT.Get('search_string')!=''))
{
this.Clear();
}
}
//
// update the filter
//
this.UpdateFilter=function(value)
{
node_activitate_query.checked=node_query.value.length > 0;
APP.SNAPSHOT.Request('offset', '0');
APP.SNAPSHOT.Request('search_string', this.GetQuery());
APP.PRICE.REGION.Start();
return false;
}
//
//  reset the searchstring
//
this.Clear=function()
{
this.SetQuery('');
this.UpdateFilter('');
return true;
}
//
//
//
this.GetQuery=function()
{
return node_query.value;
}
//
//
//
this.SetQuery=function(value)
{
node_query.value=(value==null ? '':value);
if(value!=null)
{
APP.SNAPSHOT.Request('search_string', value);
}
this.ChangeQuery();
return node_query.value;
}
//
//
//
this.ChangeQuery=function()
{
if(!node_query)
{
this.Init();
}
node_activitate_query.checked=(node_query.value.length>0) ? true:false;
}
};
APP.PRICE.REGION.FILTER.FIELDS=new function()
{
//
//  the user click on a filter-field-option(checkbox) in the filter-navigation.
//  The id "f_1" has a separate handling.
//  @todo: make the separate-handling to the same? in php(complete app) is this field separate too.
//
this.Click=function(id, objekt, field_id)
{
if(APP.SNAPSHOT.Get('do_available_search') ==null)
{
if(++loading_try <=20)
{
window.setTimeout(function(){
APP.PRICE.REGION.FILTER.FIELDS.Click(id, objekt, field_id);
}, 100);
}
return;
}
var fields=APP.SNAPSHOT.Get('fields');
if(fields ==null)
{
fields ={};
}
var field_name=id.split('_');
if(field_name[1] =='1')
{
fields[field_name[1]]=objekt.value=objekt.checked ? field_id:'';
}
else
{
fields[field_name[1]]=objekt.value=objekt.checked ? 1:0;
}
APP.SNAPSHOT.Request('fields', fields);
APP.SNAPSHOT.Request('offset', 0);
APP.PRICE.REGION.Start();
}
//
// create one fields-group
//
// legend:
// c: count
// p: price
// f: field
// a: attrib
// i: id
//
this.GetGroup=function(group_id, arr)
{
//empty?
if(arr.length ==0)
{
return '';
}
var retval  ="",
details,
group_selected=this.GetGroupSelected(arr),
field,
str_hotels=APP.PRICE.STRINGS.Get("hotels"),
str_more=APP.PRICE.STRINGS.Get("more"),
count   =arr.length;
for(var i=0; i<count; i++)
{
field=arr[i];
if(!field.f)
{
continue;
}
if((i ==3) &&(count>3) &&(!group_selected))
{
retval +="<div id=\"more_"+group_id+"\" class=\"more_button\">"
+ "<a href=\"javascript:void(0);\" onclick=\"$('less_"+group_id+"').appear();$('more"+group_id+"').toggle();$('more_"+group_id+"').disappear();\">"+str_more+"</a>"
+ "</div>"
+ "<div style=\"display:none;\" id=\"more"+group_id+"\">";
}
if(field.c)
{
details=" <span class=\"lighttext\">("+field.c+" "+str_hotels+(field.p ? ' - '+field.p:'')+")</span>";
}
else
{
details="";
}
retval +="<input id=\""+field.i+"\" class=\"checkbox\" type=\"checkbox\" onclick=\"APP.PRICE.REGION.FILTER.FIELDS.Click('"+field.a+"', this, '"+field.f+"');\" value=\"1\" />"
+ "<label for=\""+field.i+"\"> "
+ APP.PRICE.STRINGS.Get(((group_id ==1) ? 'value_label_1_':'field_')+field.f) // load string_name.hotel-chains have a different handling
+ details
+ "</label><br/>";
}
if(!retval)
{
return '';
}
if(count>3)
{
retval +="<div id=\"less_"+group_id+"\" class=\"more_button\" "+(group_selected ? " style=\"display:none;\"":"")+">"
+ "<a href=\"javascript:void(0);\" onclick=\"$('less_"+group_id+"').toggle();$('more_"+group_id+"').appear();$('more"+group_id+"').disappear();\">"+APP.PRICE.STRINGS.Get("less")+"</a>"
+ "</div>";
if(!group_selected)
{
retval +="</div>";
}
}
return "<div class=\"filter_group\">"+APP.PRICE.STRINGS.Get("filter_group_"+group_id)+"</div>"
+ "<div class=\"navigation_space\">"+retval+"</div>";
}
//
//
//
this.GetCompletedArray=function(group_id, arr)
{
for(var i=0, n=arr.length; i<n; i++)
{
if(group_id ==1) //hotel-chain has a different handling
{
arr[i].a='f_1';
arr[i].i='f_1_'+arr[i].f;
}
else
{
arr[i].i=arr[i].a='f_'+arr[i].f;
}
}
return arr;
}
//
// create all fields
//
this.CreateHtml=function(arr)
{
if(!arr)
{
return false;
}
var retval='',
field,
field_id;
for(var i=0, n=arr.length; i<n; i++)
{
field =arr[i];
field_id=field['id'];
field['c']=this.GetCompletedArray(field_id, field['c']);
retval +=this.GetGroup(field_id, field['c']);
}
$('filter_fields').innerHTML=retval;
this.InitCheckboxes();
}
//
//
//
this.InitCheckboxes=function()
{
var hash=APP.SNAPSHOT.Get('fields'),
key;
for(key in hash)
{
if({'function':1,'undefined':1,'object':1}[typeof hash[key]])
{
continue;
}
else
{
try
{
if(key=='1')
{
$("f_1_"+hash[key]).checked=true;
}
else if($('f_'+key))
{
if(key =="1")
{
$('f_'+key).value=hash[key];
}
else
{
$('f_'+key).checked=hash[key] ==1;
}
}
}
catch(e)
{
APP.PRICE.REGION.DEBUG.Set('func:APP.PRICE.REGION.FILTER.FIELDS.InitCheckboxes(); '+key+': '+e);
}
}
}
}
//
//
//
this.GetGroupSelected=function(arr)
{
var retval=false,
fields=APP.SNAPSHOT.Get('fields');
if(fields)
{
for(var i=0, n=arr.length; i<n; i++)
{
if(fields[arr[i].f] ==1)
{
retval=true;
break;
}
}
}
return retval;
}
//
// private vars
//
var loading_try=0;
};
APP.PRICE.REGION.FILTER.ATTRACTION=new function()
{
//
//  todo: cschmidt: comment
//
this.Enable=function()
{
var lon,
lat;
for(var i=0, n=node_attractions.length; i<n; ++i)
{
if(node_attractions.options[i].selected ==true)
{
lon=parseFloat(node_attractions.options[i].getAttribute('geo_longitude'));
lat=parseFloat(node_attractions.options[i].getAttribute('geo_latitude'));
break;
}
}
// we reload the search-result-list only, when we have
// the distance and the geo_longitude and latidute
if((lon!='') &&(lat!=''))
{
APP.PRICE.MAP.SetCenter({
'id':0,
'class':'center',
'position':'default',
'display':'marker',
'latitude':lat,
'longitude':lon
});
this.SetProperties(node_distance_limit.value, node_attractions.value, lon, lat, '1');
APP.PRICE.REGION.TOP_NAV.ChangeViewType(2);
APP.PRICE.REGION.Start();
}
}
//
//  todo: cschmidt: comment
//
this.Disable=function()
{
this.SetProperties('', '', '', '', '0');
APP.PRICE.REGION.Start();
}
//
//
//
this.SetProperties=function(geo_distance_limit, geo_distance_item, geo_longitude, geo_latitude, geo_use_distance)
{
APP.SNAPSHOT.Request('geo_distance_limit', geo_distance_limit);
APP.SNAPSHOT.Request('geo_distance_item',  geo_distance_item);
APP.SNAPSHOT.Request('geo_code::longitude',geo_longitude);
APP.SNAPSHOT.Request('geo_code::latitude', geo_latitude);
APP.SNAPSHOT.Request('offset',    '0');
APP.SNAPSHOT.Request('geo_use_distance',   geo_use_distance);
this.SetAttraction();
}
//
//
//
this.Init=function()
{
node_distance_limit=$('js_input_price_geo_distance_limit');
node_attractions =document.forms['distance_search'] && document.forms['distance_search']['geo_distance_item'] ? document.forms['distance_search']['geo_distance_item']:null;
node_preview_distance=$('js_preview_distance');
node_tooltipp  =$('js_slider_tooltipp_geo_distance_limit');
node_distance_unit =$('js_distance_unit');
if(node_distance_limit.isElement())
{
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.Init('geo_distance_limit');
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetValueCount(40);
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetValue(0, 20000);
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetPriceValue(node_distance_limit.value);
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.StickToPosition();
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetEvents(function(){APP.PRICE.REGION.FILTER.ATTRACTION.SetPreviewText();}, function(){APP.PRICE.REGION.FILTER.ATTRACTION.SliderOnfinish();});
}
}
//
//
//
this.SetCityCenter=function()
{
if(node_attractions)
{
this.SetProperties(node_distance_limit.value, node_attractions.value, parseFloat(node_attractions.options[0].getAttribute('longitude')), parseFloat(node_attractions.options[0].getAttribute('latitude')), '1');
}
}
//
//
//
this.SetAttraction=function()
{
if(node_attractions)
{
var ind=-1,
count=node_attractions.length,
form=document.forms['distance_search'],
address=''+APP.SNAPSHOT.Get('geo_address_string');
if(address!='null' &&
address.length > 0)
{
(!geo_address_focus) &&(form['distance_type'][1].checked=true);
(!geo_address_focus) &&(form['geo_address_string'].value=address);
node_attractions.selectedIndex=0;
}
else
{
var item=APP.SNAPSHOT.Get('geo_distance_item'),
lng=APP.SNAPSHOT.Get('geo_code::longitude'),
lat=APP.SNAPSHOT.Get('geo_code::latitude');
if(!geo_address_focus)
{
form['distance_type'][0].checked=true;
form['geo_address_string'].value='Adres';
$('geo_address_string').setClass('text inactive');
}
if(parseInt(item))
{
for(var i=0; i<count; ++i)
{
if(node_attractions.options[i].value ==item)
{
ind=i;
break;
}
}
}
else if(item &&
item!='' &&
parseFloat(lng) &&
parseFloat(lat))
{
if($('searchmap_dynamic_center').isElement())
{
var o=$('searchmap_dynamic_center');
}
else
{
var o=new Option('{'+lat+', '+lng+'}', 'distance', false, true);
o.setAttribute('id', 'searchmap_dynamic_center');
document.forms['distance_search']['geo_distance_item'].options[document.forms['distance_search']['geo_distance_item'].options.length]=o;
}
o.setAttribute('geo_latitude', lat);
o.setAttribute('geo_longitude', lng);
$('searchmap_dynamic_center').value=$('searchmap_dynamic_center').text=item;
ind=form['geo_distance_item'].options.length-1;
}
(!geo_address_focus) &&(node_attractions.selectedIndex=(ind < 0)? 0:ind);
}
}
}
//
//
//
this.SetGeoDistanceLimit=function(value)
{
if(node_distance_limit)
{
node_distance_limit.value=value;
}
}
//
//
//
this.SetPreviewText=function()
{
node_tooltipp.innerHTML=this.GetDistanceValue()+' '+node_distance_unit.innerHTML;
}
//
//
//
this.SetDistanceValue=function()
{
node_preview_distance.innerHTML=this.GetDistanceValue();
}
//
//
//
this.GetDistanceValue=function()
{
var min_value=APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetMinValue() / 1000,
def_value=APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetValue() / 1000;
return min_value+' - '+def_value;
}
//
//
//
this.SetResponseDistance=function(distance)
{
if(
distance &&
node_distance_limit &&
node_distance_limit.isElement() &&
!APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetUserChanged()
)
{
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetPriceValue(distance);
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.StickToPosition();
APP.PRICE.REGION.FILTER.ATTRACTION.SetDistanceValue();
}
}
//
//
//
this.SliderOnfinish=function()
{
this.SetDistanceValue();
APP.PRICE.MAP.SetDistanceChange(true);
APP.PRICE.MAP.Search(true);
}
//
//
//
this.SetGeoAddressFocus=function(val)
{
if(val)
{
document.forms['distance_search']['geo_address_string'].value='';
$('filter_distance_checkbox2').checked=true;
}
geo_address_focus=val;
}
//
// private vars
//
var node_distance_limit,
node_attractions,
node_preview_distance,
node_tooltipp,
node_distance_unit,
geo_address_focus=false,
default_distance_limit=5000;
};
APP.PRICE.REGION.FILTER.PRICE=new function()
{
//
//
//
this.Init=function()
{
node_include_all=$('include_all');
node_price_preview=$('js_preview_price');
node_tooltipp =$('js_slider_tooltipp_price_max');
if(node_price_preview.isElement())
{
APP.PRICE.REGION.FILTER.SLIDER.PRICE.Init('price_max');
}
}
//
//  display in the price-search only available hotels or
//  non-available too?
//  we use this function only in the the price-search-mode
//  and not in the non-available-mode
//
this.displayAvailableHotels=function(is_checked)
{
if(is_checked)
{
APP.SNAPSHOT.Request("include_all", '0');
}
else
{
APP.SNAPSHOT.Request('include_all', '1');
APP.SNAPSHOT.Request("input_price",($("input_price").value=""));
}
APP.SNAPSHOT.Request('offset', 0);
APP.PRICE.REGION.Start();
}
//
//
//
this.SetMaxDisplayedPrice=function(val)
{
max_displayed_price=val;
}
//
//
//
this.SetValue=function(price_min, price_max)
{
if(node_price_preview.isElement())
{
if(price_max > max_displayed_price)
{
price_max=max_displayed_price;
}
APP.PRICE.REGION.FILTER.SLIDER.STARS.SetValueCount( Math.round((price_max-price_min)/5) );
APP.PRICE.REGION.FILTER.SLIDER.PRICE.SetValue(price_min, price_max);
this.SetPreviewPrice();
}
}
//
//
//
this.LockAutoChangePrice=function()
{
APP.PRICE.REGION.FILTER.SLIDER.PRICE.LockAutoChangePrice();
}
//
//
//
this.StartRequest=function()
{
var value=APP.PRICE.REGION.FILTER.SLIDER.PRICE.GetValue();
var use_price=value ==APP.PRICE.REGION.FILTER.SLIDER.PRICE.GetMaxValue() ? false:true;
this.SetPreviewPrice();
node_include_all.checked=true;
node_include_all.value=0;
APP.SNAPSHOT.Request('price_max',   use_price ? value:'0');
APP.SNAPSHOT.Request('include_all', 0);
APP.SNAPSHOT.Request('offset',   0);
APP.PRICE.REGION.Start();
}
//
//
//
this.SetPriceValue=function(val)
{
if(val && node_price_preview.isElement())
{
APP.PRICE.REGION.FILTER.SLIDER.PRICE.SetPriceValue(val);
APP.PRICE.REGION.FILTER.SLIDER.PRICE.StickToPosition();
}
}
//
//
//
this.GetPreviewPrice=function()
{
return APP.PRICE.REGION.FILTER.SLIDER.PRICE.GetMinValue()+' - '+APP.PRICE.REGION.FILTER.SLIDER.PRICE.GetValue();
}
//
//
//
this.SetPreviewPrice=function()
{
if(node_price_preview.isElement())
{
node_price_preview.innerHTML=this.GetPreviewPrice();
}
}
//
//
//
this.SetHoverPreviewPrice=function()
{
node_tooltipp.innerHTML=this.GetPreviewPrice()+' '+$('price_currency').innerHTML;
}
//
//
//
this.SetIncludeAll=function(enabled)
{
node_include_all.checked=enabled;
}
//
//
//
var node_include_all,
node_price_preview,
node_tooltipp,
max_displayed_price;
}
APP.PRICE.REGION.SLIDER=function()
{
//
//
//
this.Init=function(name)
{
this.SetHover(false);
//init nodes
node_slider =$('js_slider_'+name);
node_highlight=$('js_slider_highlight_'+name);
node_price  =$('js_slider_input_'+name);
node_input_price=$('js_input_price_'+name);
node_tooltipp =$('js_slider_tooltipp_'+name);
node_document_main=$('document_main');
node_trans  =$('js_slider_trans_'+name);
node_all_search =$('all_search_q');
init_value=node_input_price.value;
this.SetEnvironmentVars();
//attach events
var itsMe=this;
node_price.addEvent('mousedown', function(){itsMe.MouseDown(); });
node_trans.addEvent('mousedown', function(act){itsMe.SetPosition(act);});
node_trans.addEvent('mousemove', function(act){itsMe.DisplayTooltipp(act);});
node_trans.addEvent('mouseout',  function(){itsMe.HideTooltipp();});
}
//
//
//
this.HideTooltipp=function()
{
if(event_onchange)
{
node_tooltipp.disappear();
}
}
//
//
//
this.DisplayTooltipp=function(action)
{
var posx,
sliderVal,
sliderPos,
newvalue,
cache_value=node_input_price.value;
if(event_onchange)
{
node_tooltipp.appear();
if(action.pageX)
{
posx=action.pageX;
}
else if(action.clientX)
{
var doc=document;
posx=action.clientX+doc.body.scrollLeft+doc.documentElement.scrollLeft;
}
//mouse position relativ to sliderdocument_main
sliderVal=this.GetValidatePos( posx - node_slider.getAbsLeft() );
sliderPos=(sliderwidth / value_count) * Math.round(value_count * sliderVal / sliderwidth);
newvalue =Math.round((sliderPos * scale+from) * Math.pow(10, 0)) / Math.pow(10, 0);
node_input_price.value=newvalue;
node_tooltipp.style.left=(sliderVal+20)+"px";
//The slider is only activited, than the old-value is different from the new-value
if((newvalue!=finish_old_value) &&(newvalue!=change_old_value))
{
event_onchange();
//change_old_value=newvalue;
}
node_input_price.value=cache_value;
}
}
//
//
//
this.SetEvents=function(onchange, onfinish)
{
event_onchange=onchange;
event_onfinish=onfinish;
}
//
//
//
this.MouseDown=function()
{
if(event_onchange)
{
node_tooltipp.appear();
}
node_price.style.zIndex=10;
var itsMe=this;
node_trans.addEvent('mouseup', function(){itsMe.DeactivateSlider();});
node_trans.addEvent('mouseout', function(){itsMe.OnMouseout();});
node_trans.addEvent('mousemove', function(act){itsMe.MoveSlider(act);});
this.SetHover(true);
this.LockAutoChangePrice();
}
//
//
//
this.SetPosition=function(act)
{
this.SetHover(true);
this.MoveSlider(act);
this.DeactivateSlider();
}
//
//
//
this.OnMouseout=function()
{
if(this.GetHover())
{
this.DeactivateSlider();
}
}
//
//
//
this.SetEnvironmentVars=function()
{
//Min/Max value
if(this.GetMinValue())
{
from=parseFloat(this.GetMinValue());
}
if(this.GetMaxValue())
{
to=parseFloat(this.GetMaxValue());
}
//Slider-display scale [value-change per pixel of movement].
scale=(to - from) / sliderwidth;
if(scale ==0)
{
scale=1;
}
}
//
//
//
this.GetMaxValue=function()
{
return node_input_price.getAttribute('to');
}
//
//
//
this.GetMinValue=function()
{
return node_input_price.getAttribute('from');
}
//
//
//
this.GetValue=function()
{
if(node_input_price)
{
return node_input_price.value;
}
return null;
}
//
//
//
this.SetValue=function(price_min, price_max)
{
//is price_min+price_max valid?
if((price_max==0) &&(price_min==0))
{
return false;
}
node_input_price.setAttribute('to',   price_max);
node_input_price.setAttribute('from', price_min);
if((init_value==node_input_price.value) &&(!lock_auto_change))
{
init_value=this.SetPriceValue(price_max);
}
this.SetEnvironmentVars();
this.StickToPosition();
}
//
//
//
this.LockAutoChangePrice=function()
{
lock_auto_change=true;
}
//
//
//
this.StickToPosition=function()
{
if(!node_input_price.value)
{
node_input_price.value=this.GetMaxValue();
}
var position=Math.round((node_input_price.value - from) / scale);
this.GetValidatePos( position );
this.SetPos( this.GetValidatePos( position ) );
}
//
//
//
this.MoveSlider=function(action)
{
if(!this.GetHover())
{
return;
}
var posx,
posy,
sliderPos,
newvalue,
doc=document;
if(action.pageX || action.pageY)
{
posx=action.pageX;
posy=action.pageY;
}
else if(action.clientX || action.clientY)
{
posx=action.clientX+doc.body.scrollLeft+doc.documentElement.scrollLeft;
posy=action.clientY+doc.body.scrollTop+doc.documentElement.scrollTop;
}
//mouse position relativ to sliderdocument_main
var sliderVal=this.GetValidatePos( posx - node_slider.getAbsLeft() );
this.SetPos(sliderVal);
node_tooltipp.style.left=(sliderVal+20)+"px";
sliderPos=(sliderwidth / value_count) * Math.round(value_count * sliderVal / sliderwidth);
newvalue =Math.round((sliderPos * scale+from) * Math.pow(10, 0)) / Math.pow(10, 0);
//The slider is only activited, than the old-value is different from the new-value
if((newvalue!=finish_old_value) &&(newvalue!=change_old_value))
{
node_input_price.value=newvalue;
if(event_onchange)
{
event_onchange();
change_old_value=newvalue;
}
}
}
//
//
//
this.GetValidatePos=function(value)
{
if(value > sliderwidth)
{
value=sliderwidth;
}
if(value < 0)
{
value=0;
}
return Math.round(value);
}
//
//
//
this.DeactivateSlider=function()
{
node_price.style.zIndex=12;
lastvalue=(node_input_price.value) ? node_input_price.value:0;
APP.SNAPSHOT.Request(node_input_price.name, lastvalue);
this.SetPos( this.GetValidatePos(((lastvalue - from)/(scale)) ) );
var itsMe=this;
node_trans.delEvent('mouseup', function(){itsMe.DeactivateSlider();});
node_trans.delEvent('mouseout', function(){itsMe.OnMouseout();});
node_trans.delEvent('mousemove',function(act){itsMe.MoveSlider(act);});
if(event_onfinish)
{
event_onfinish();
}
this.HideTooltipp();
this.SetHover(false);
node_all_search.focus();
state_user_changed=true;
}
//
//
//
this.GetUserChanged=function()
{
return state_user_changed;
}
//
//
//
this.SetUserChanged=function(val)
{
return state_user_changed=val;
}
//
//
//
this.SetHover=function(val)
{
mouseover=val;
}
//
//
//
this.SetPriceValue=function(val)
{
return node_input_price.value=val;
}
//
//
//
this.GetHover=function()
{
return mouseover;
}
//
//
//
this.SetPos=function(value)
{
var pos_left,
width;
node_price.style.left=(value-2)+"px";
if(!highligh_invert)
{
node_highlight.style.width=value+"px";
}
else
{
node_highlight.style.left =(pos_left=value+10)+"px";
width=sliderwidth<=pos_left ? 0:(sliderwidth - pos_left+9);
node_highlight.style.width=width+"px";
}
}
//
//
//
this.SetInvertHighlight=function(val)
{
highligh_invert=val;
}
//
//
//
this.SetValueCount=function(val)
{
if(val > 0)
{
value_count=val;
}
}
//
// private vars
//
var mouseover,
finish_old_value=-1,
change_old_value=-1,
//nodes
node_slider,
node_highlight,
node_price,
node_input_price,
node_tooltipp,
node_document_main,
node_trans,
node_all_search,
highligh_invert=false,
state_user_changed=false,
to,
from,
scale,
//configuration
value_count =100, //Allowed number of values in the interval.
sliderwidth =260,
init_value,
lock_auto_change=false,
//events
event_onfinish=false,
event_onchange=false;
};
APP.PRICE.REGION.FILTER.SLIDER   =new function(){}
APP.PRICE.REGION.FILTER.SLIDER.PRICE =new APP.PRICE.REGION.SLIDER();
APP.PRICE.REGION.FILTER.SLIDER.STARS =new APP.PRICE.REGION.SLIDER();
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE=new APP.PRICE.REGION.SLIDER();
APP.PRICE.REGION.GEODATA=new function()
{
//
//  private vars
//
var G;
//
//  build dynamic the var "this.G" related by the actual client configuration.
//  we need this var for builden the google-pointer
//  @todo make an array with objects(structure from the arr is old)
//
this.Init=function(d)
{
var baseurl='/item.php?hlpath='+APP.SNAPSHOT.Get('path')+'&item=';
G='';
for(var i=0, n=d.length; i<n; i++)
{
if(d[i] && d[i].geo && d[i].geo.lon && d[i].geo.lat)
{
G +=(i+1)+'*'+d[i].geo.lon+'*'+d[i].geo.lat+'**'+baseurl+d[i].id+'&pagetype='+((d[i].price && d[i].price.partner > 0)? 'deals':'overview');
}
G +=';';
}
}
//
//  todo: cschmidt: comment
//
this.Get=function()
{
return G;
}
//
//  todo: cschmidt: comment
//
this.Set=function(v)
{
G=v;
}
};APP.PRICE.REGION.STANDBY=new function()
{
//
// private vars
//
var n;
//
//
//
this.Init=function()
{
n=$('hoteldealsstandby');
if(!n.isElement())
{
n=false;
}
}
//
//
//
this.Hide=function()
{
n && n.disappear();
}
//
//
//
this.Show=function()
{
n && n.appear();
}
};APP.PRICE.REGION.NO_RESULTS=new function()
{
//
//
//
this.Set=function(value, css_class)
{
node_body.innerHTML=value;
node.setClass( css_class );
}
//
//
//
this.Hide=function()
{
if(!node)
{
this.Init();
}
node.disappear();
}
//
//
//
this.Show=function()
{
node.appear();
}
//
//  related by the serviceresultcount, we display the error-message. if we have more
//  than 0 items, than we break the procedure.(no error-message)
//  in the other situation we load the error-message and set the error-module css-class.
//
this.DisplayErrorMessage=function(response, serviceresultcount)
{
if(APP.PRICE.REGION.GetResultCount()!=0)
{
APP.PRICE.REGION.Finish();
return true;
}
else
{
var noresultclaim=(response && response.noresultclaim) ? response.noresultclaim:error;
this.Set(noresultclaim, 'module plain');
APP.PRICE.REGION.TRANSPARENCY.Hide();
APP.PRICE.REGION.HEADER.Hide();
APP.PRICE.REGION.NO_RESULTS.Show();
APP.PRICE.REGION.STANDBY.Hide();
APP.PRICE.REGION.TOP_NAV.Hide();
APP.PRICE.REGION.FOOTER.Hide();
APP.PRICE.REGION.PATH_ID_MULTI_AVAIL.Hide();
APP.PRICE.REGION.DESIGN.Hide();
APP.PRICE.REGION.MAP.ViewBigMap(false);
return true;
}
return false;
}
//
//
//
this.Init=function()
{
node =$('noresults');
node_body=$('module_body_noresults');
}
//
// private vars
//
var node,
node_body,
error="Åžu anda herhangi bir sonuÃ§ bulunamamaktadÄ±r. LÃ¼tfen daha sonra tekrar dene.";
};
APP.PRICE.STRINGS=new function()
{
//
// private vars
//
var S=[];
//
//
//
this.Init=function(s)
{
S=s;
}
//
//
//
this.Set=function(k, v)
{
S[ k ]=v;
}
//
//
//
this.Get=function(k)
{
if(S[ k ])
{
return S[ k ];
}
else
{
//APP.PRICE.REGION.DEBUG.Set('APP.PRICE.STRINGS.Get() key '+k+' not defined');
return false;
}
}
};APP.PRICE.REGION.MAP=new function()
{
//
//  If the status is true, when we displayed the map and load
//  the code from google
//
this.ViewBigMap=function(status)
{
if(!status)
{
node_js_searchmap_box.disappear();
}
else
{
node_js_searchmap_box.appear();
APP.PRICE.MAP.Main();
}
}
//
//  todo: cschmidt: comment
//
this.UpdateDisplayMapStatus=function(is_finished)
{
if(is_finished ||
this.GetPointerDifference() >=5)
{
this.ViewBigMap(APP.SNAPSHOT.Get('view_type')==2? true: false);
}
}
//
//
//
this.GetPointerDifference=function()
{
if(!APP.PRICE.MAP.GetMarker())
{
if(APP.PRICE.REGION.GEODATA.Get())
{
return APP.PRICE.REGION.GEODATA.Get().split(";").length;
}
return 0;
}
var m1=APP.PRICE.REGION.GEODATA.Get().split(";"),
m2=APP.PRICE.MAP.GetMarker().split(";");
var c=m1.length - m2.length;
for(var i=0, n=m1.length; i<n; i++)
{
if(!m2.hasValue(m1[i]))
{
++c;
}
}
return c;
}
//
//
//
this.Init=function()
{
node_js_searchmap_box=$('js_searchmap_box');
}
//
// private vars
//
var node_js_searchmap_box;
};
APP.PRICE.MAP=new function()
{
//
//
//
this.Switch=function(t)
{
var geo=$('geo_address_string');
APP.SNAPSHOT.Request('geo_use_distance', 1);
switch(t)
{
case 'geo_address_string':
geo.setClass('text active');
break;
case 'geo_distance_item':
default:
geo.setClass('text inactive');
break;
}
}
//
//
//
this.Listener=function()
{
if(!L)
{
L=new ListenMap_Engine({
'id':'searchmap',
'zoom':function()
{
APP.PRICE.MAP.Handle('cut_out_change');
},
'move':function()
{
APP.PRICE.MAP.Handle('cut_out_change');
},
'center_drag':function()
{
APP.PRICE.MAP.Handle('center_drag');
},
'border_description':'Ä°ÅŸaretli yeri Ã§ekerek, dairenin Ã§apÄ±nÄ± bÃ¼yÃ¼ltebilir veya kÃ¼Ã§Ã¼ltebilirsin.',
'border_drag':function()
{
APP.PRICE.MAP.Handle('border_drag');
}
});
}
return true;
}
//
//
//
this.Handle=function(t, r)
{
if(!L)
{
return null;
}
(typeof r =='undefined') &&(r=null);
switch(t)
{
case 'cut_out_change':
this.StoreMap() &&(E['cut_out_change']=true) && APP.PRICE.REGION.Start(1, 1);
break;
case 'center_drag':
(!E['cut_out_change']) && (E['distance_param_change']=true);
(E['cut_out_change']) && (E['distance_param_change']=false);
google.maps.Event.trigger(L.locator.center_marker.marker, 'mouseout');
var c=ggMaps.maps['searchmap'].locator.center_marker.marker.getLatLng();
$('filter_distance_checkbox1').click();
if($('searchmap_dynamic_center').isElement())
{
var o=$('searchmap_dynamic_center');
o.text='{'+c.lat()+', '+c.lng()+'}';
}
else
{
var o=new Option('{'+c.lat()+', '+c.lng()+'}', 'distance', false, true);
o.setAttribute('id', 'searchmap_dynamic_center');
document.forms['distance_search']['geo_distance_item'].options[document.forms['distance_search']['geo_distance_item'].options.length]=o;
}
o.setAttribute('geo_latitude', c.lat());
o.setAttribute('geo_longitude', c.lng());
o.selectedIndex=document.forms['distance_search']['geo_distance_item'].options.length-1;
ggMaps.maps['searchmap'].get_location(c,
function(r)
{
APP.PRICE.MAP.Handle('location', r);
}
);
break;
case 'border_drag':
(!E['cut_out_change']) && (E['distance_param_change']=true);
(E['cut_out_change']) && (E['distance_param_change']=false);
google.maps.Event.trigger(L.border_marker.marker, 'mouseout');
ggMaps.maps['searchmap'].locator.settings['radius']=(Math.round((ggMaps.maps['searchmap'].locator.settings['radius']*1000) / 500) * 500) / 1000;
if(ggMaps.maps['searchmap'].locator.settings['radius'] > 20)
{
ggMaps.maps['searchmap'].locator.settings['radius']=20;
}
$('js_input_price_geo_distance_limit').value=parseInt(ggMaps.maps['searchmap'].locator.settings['radius']);
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.SetPriceValue(parseInt(ggMaps.maps['searchmap'].locator.get_calculate_radius_unit(ggMaps.maps['searchmap'].locator.settings['radius'])*1000));
APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.StickToPosition();
APP.PRICE.REGION.FILTER.ATTRACTION.SetPreviewText();
APP.PRICE.REGION.FILTER.ATTRACTION.SetDistanceValue();
this.Search(true);
break;
case 'location':
if(typeof r.Placemark[0]!='undefined')
{
$('searchmap_dynamic_center').value=$('searchmap_dynamic_center').text=r.Placemark[0].address;
this.Switch('geo_distance_item');
}
L.position();
this.Search(true);
break;
case 'point':
if(r)
{
C ={
'id':0,
'class':'center',
'position':'default',
'display':'marker',
'description':document.forms['distance_search']['geo_address_string'].value+', '+document.forms['distance_search']['path_info'].value+'('+(Math.round(1000*r.lat())/1000)+','+(Math.round(1000*r.lng())/1000)+' )',
'latitude':r.lat(),
'longitude':r.lng()
};
APP.SNAPSHOT.Request('geo_distance_limit', $('js_input_price_geo_distance_limit').value);
APP.SNAPSHOT.Request('geo_distance_item',  '');
APP.SNAPSHOT.Request('geo_code::latitude', parseFloat(r.lat()));
APP.SNAPSHOT.Request('geo_code::longitude',parseFloat(r.lng()));
APP.SNAPSHOT.Request('geo_use_distance',   '1');
APP.SNAPSHOT.Request('offset',    '0');
APP.SNAPSHOT.Request('geo_address_string', document.forms['distance_search']['geo_address_string'].value);
APP.PRICE.REGION.Start();
}
else
{
document.forms['distance_search']['geo_address_string'].value='BaÅŸka bir kelimeyle aramayÄ± dene';
APP.PRICE.REGION.TRANSPARENCY.Hide();
}
break;
}
}
//
//
//
this.Init=function(p)
{
p && p.onfinish && Q.push(p.onfinish);
switch(S)
{
case 'unloaded':
S='loading';
APP.RUN.Exe('trivago.map',{'onfinish':function()
{
if(!ggMaps.maps['searchmap'])
{
ggMaps.add({
'id':'searchmap',
'rpc_markers':'none',
'onfinish':function()
{
APP.PRICE.MAP.Start('loaded');
}
});
}
else
{
APP.PRICE.MAP.Start('loaded');
}
}
});
break;
case 'loaded':
this.Start();
break;
}
}
//
//
//
this.Start=function(s)
{
(typeof s!='undefined') &&(S=s);
if(S!='loaded')
{
return null;
}
this.Listener();
var c=Q.length;
if(c > 0)
{
for(var i=0; i<c; ++i)
{
Q[i]();
}
Q=[];
}
}
//
//
//
this.GetMarker=function()
{
return M;
}
//
//
//
this.SetCenter=function(c)
{
return(C=c);
}
//
//
//
this.StoreMap=function()
{
var sw=ggMaps.maps['searchmap'].map.getBounds().getSouthWest(),
ne=ggMaps.maps['searchmap'].map.getBounds().getNorthEast();
var nb=ne.lat()+";"+ne.lng()+";"+sw.lat()+";"+sw.lng(),
ob=APP.SNAPSHOT.Get('map_bounds'),
nz=ggMaps.maps['searchmap'].map.getZoom(),
oz=APP.SNAPSHOT.Get('map_zoom'),
r=false;
if(nz!=oz)
{
r=true;
APP.SNAPSHOT.Request('map_zoom',  nz);
}
if(nb!=ob)
{
r=true;
APP.SNAPSHOT.Request('map_bounds', nb);
}
return r;
}
//
//
//
this.FixLocator=function()
{
if(L.locator)
{
if(C)
{
var c=new google.maps.LatLng(C['latitude'], C['longitude']);
}
else
{
var c=new google.maps.LatLng(ggMaps.maps['searchmap'].settings['center']['latitude'], ggMaps.maps['searchmap'].settings['center']['longitude']);
}
var r=APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetValue()/1000,
m=[],
p=[0*18, 1*18, 2*18, 2*18];
for(var i=0, n=p.length; i!=n; i++)
{
var d=L.locator.set_calculate_border(c, p[i]*360/72, r);
m.push(
{
'id':'b'+i,
'class':'border',
'position':'default',
'display':'none',
'anchor':'',
'mouseover':'',
'mouseout':'',
'description':'',
'latitude':d.lat(),
'longitude':d.lng()
}
);
}
m.length && ggMaps.maps['searchmap'].add_markers(m);
}
}
//
//
//
this.Main=function()
{
if(S!='loaded')
{
this.Init({'onfinish':function(){ APP.PRICE.MAP.Main(); }});
return;
}
this.Listener();
var all_marker=[],
elems =APP.PRICE.REGION.GEODATA.Get(),
mclass=(APP.SNAPSHOT.Get('offset') > 0) ? 'hotel':'hotelid';
// parse marker data
if(elems)
{
M=elems;
var marker_data=elems.split(';');
for(var i=0, n=marker_data.length; i<n; i++)
{
if(marker_data[i]!='')
{
var marker=marker_data[i].split('*');
if(marker[2] && marker[1])
{
all_marker.push(
{
'id':(i+1),
'class':mclass,
'position':'default',
'display':'marker',
'anchor':marker[4],
'mouseover':function(id)
{
var service_response=APP.PRICE.REGION.GetResponse();
if(service_response && service_response.items)
{
$('searchmap_detail_info').innerHTML=APP.PRICE.REGION.DESIGN.DETAIL.GetSingle(service_response.items[id -1], id-1);
}
},
'mouseout':function(){ $('searchmap_detail_info').innerHTML=''; },
'description':'',
'latitude':marker[2],
'longitude':marker[1]
}
);
}
}
}
}
if(all_marker.length > 0 ||
ggMaps.maps['searchmap'])
{
L.unlisten();
// initialize map by given markers
if(all_marker.length > 0)
{
if(ggMaps.maps['searchmap'].map)
{
APP.SNAPSHOT.Get('map_bounds') && L.fix();
ggMaps.maps['searchmap'].reset_map();
}
else
{
ggMaps.maps['searchmap'].load_map();
}
(all_marker.length ==1 || E['distance_param_change']) && this.FixLocator();
ggMaps.maps['searchmap'].add_markers(all_marker);
ggMaps.maps['searchmap'].show_markers(false, mclass);
APP.SNAPSHOT.Get('map_bounds') && L.unfix();
// show locator with given center
if(C)
{
L.locator &&(L.locator.settings['center_description']='Drag&Drop(SÃ¼rÃ¼kle&BÄ±rak) ile haritanÄ±n merkezini kolayca deÄŸiÅŸtirebilirsin.<div class="center">'+C['description']+'</div>');
L.show_locator(new google.maps.LatLng(C['latitude'], C['longitude']), APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetValue());
}
// show locator without center
else
{
var c ={};
// get center from snapshot
if(APP.SNAPSHOT.Get('geo_code::latitude') && APP.SNAPSHOT.Get('geo_code::longitude'))
{
c['latitude']=APP.SNAPSHOT.Get('geo_code::latitude');
c['longitude']=APP.SNAPSHOT.Get('geo_code::longitude');
}
// get center from map
else
{
c['latitude']=Math.round(1000*ggMaps.maps['searchmap'].settings['center']['latitude'])/1000;
c['longitude']=Math.round(1000*ggMaps.maps['searchmap'].settings['center']['longitude'])/1000;
}
ggMaps.maps['searchmap'].settings['locator']['center_description']='Drag&Drop(SÃ¼rÃ¼kle&BÄ±rak) ile haritanÄ±n merkezini kolayca deÄŸiÅŸtirebilirsin.<div class="center">('+c['latitude']+','+c['longitude']+')</div>';
L.show_locator(new google.maps.LatLng(c['latitude'], c['longitude']), APP.PRICE.REGION.FILTER.SLIDER.DISTANCE.GetValue());
}
}
// initialize world map, when no markers are given
else if(ggMaps.maps['searchmap'])
{
ggMaps.maps['searchmap'].settings['init']='automatic';
ggMaps.maps['searchmap'].load_map();
ggMaps.maps['searchmap'].settings['init']='manual';
ggMaps.maps['searchmap'].show_markers(false, mclass);
}
L.unlisten();
// load plot-config
var s;
if((s=APP.SNAPSHOT.Get('map_bounds')) &&
(s=s.split(';')) &&
s.length ==4)
{
s=new GLatLngBounds(new GLatLng(parseFloat(s[2]), parseFloat(s[3])), new GLatLng(parseFloat(s[0]), parseFloat(s[1])));
ggMaps.maps['searchmap'].map.setCenter( s.getCenter() );
}
(s=APP.SNAPSHOT.Get('map_zoom')) && ggMaps.maps['searchmap'].map.setZoom(parseInt(s));
L.position();
L.listen();
}
}
//
//
//
this.SetDistanceChange=function(b)
{
return(E['distance_param_change']=b);
}
//
//
//
this.Search=function(do_search)
{
APP.PRICE.REGION.TRANSPARENCY.Show();
if(S!='loaded')
{
this.Init({'onfinish':function(){ APP.PRICE.MAP.Search('+do_search+'); }});
return;
}
var form=document.forms['distance_search'];
(APP.SNAPSHOT.Get('view_type')!=2) && APP.PRICE.REGION.TOP_NAV.ChangeViewType(2,true);
APP.SNAPSHOT.Request('geo_distance_limit', '');
APP.SNAPSHOT.Request('geo_distance_item',  '');
APP.SNAPSHOT.Request('geo_code::latitude', '');
APP.SNAPSHOT.Request('geo_code::longitude','');
APP.SNAPSHOT.Request('geo_address_string', '');
if(E['distance_param_change'])
{
APP.SNAPSHOT.Request('map_bounds', '');
APP.SNAPSHOT.Request('map_zoom', '');
}
(do_search) && APP.SNAPSHOT.Request('geo_use_distance', 1);
if(APP.SNAPSHOT.Get('geo_use_distance') ==0)
{
C=false;
APP.PRICE.REGION.FILTER.ATTRACTION.Disable();
}
else
{
for(var i=0, m=form['distance_type'].length; i<m; ++i)
{
if(form['distance_type'][i].checked ==true)
{
switch(form['distance_type'][i].value)
{
case 'geo_address_string':
ggMaps.maps['searchmap'].geocoder(form['geo_address_string'].value+', '+form['path_info'].value,
function(p)
{
APP.PRICE.MAP.Handle('point', p);
}
);
break;
case 'geo_distance_item':
if($('js_input_price_geo_distance_limit').value!='')
{
for(var j=0, n=form['geo_distance_item'].length; j<n; ++j)
{
var o=form['geo_distance_item'].options[j];
if(o.selected ==true &&
o.getAttribute('geo_longitude') &&
o.getAttribute('geo_latitude'))
{
C ={
'id':0,
'class':'center',
'position':'default',
'display':'marker',
'description':o.text+'('+(Math.round(1000*o.getAttribute('geo_latitude'))/1000)+','+(Math.round(1000*o.getAttribute('geo_longitude'))/1000)+' )',
'latitude':o.getAttribute('geo_latitude'),
'longitude':o.getAttribute('geo_longitude')
};
APP.SNAPSHOT.Request('geo_distance_limit', $('js_input_price_geo_distance_limit').value);
APP.SNAPSHOT.Request('geo_distance_item',  form['geo_distance_item'].value);
APP.SNAPSHOT.Request('geo_code::latitude', parseFloat(o.getAttribute('geo_latitude')));
APP.SNAPSHOT.Request('geo_code::longitude',parseFloat(o.getAttribute('geo_longitude')));
APP.SNAPSHOT.Request('geo_use_distance',   '1');
APP.SNAPSHOT.Request('offset',    '0');
APP.PRICE.REGION.Start();
break;
}
}
}
break;
}
break;
}
}
}
}
//
// private vars
//
var S='unloaded', //state of map scripts
Q=[], // internal queue to excute function when loaded
L=null, // ListenMap_Engine-Object
C=null, // center marker data
M=null, // loaded marker data
E ={ 'cut_out_change':false, 'distance_param_change':false }; // actions executed by user
};APP.PRICE.REGION.TRANSPARENCY=new function()
{
//
// private vars
//
var nt,
ns;
//
//
//
this.Init=function()
{
nt=$('transparency');
ns=$('searchmap_loader');
nt.setOpacity(50);
}
//
//
//
this.Hide=function()
{
nt.disappear();
}
//
//
//
this.Show=function()
{
nt.appear();
ns.disappear();
}
};APP.PRICE.REGION.CACHE=new function(){}
APP.PRICE.REGION.CACHE.FILTER=new function()
{
//
//
//
this.GetCopyProperties=function(properties)
{
var retval=Object.prototype.constructor(),
key;
for(key in properties)
{
if({'function':1,'undefined':1,'object':1}[typeof properties[key]])
{
continue;
}
try
{
retval[key]=properties[key].valueOf();
}
catch(e)
{
APP.PRICE.REGION.DEBUG.Set('func: APP.PRICE.REGION.CACHE.FILTER.GetCopyProperties();'+key+'='+properties[key]+'-exception');
}
}
return retval;
}
//
//
//
this.Set=function(snap, request_ident)
{
arr_cache.push(this.GetCopyProperties(snap));
}
//
//
//
this.GetFirstSnapshot=function()
{
//delete all cache without the first
for(var i=arr_cache.length; i>1; i--)
{
arr_cache.pop();
}
return this.GetLastSnapshot();
}
//
//
//
this.GetLastSnapshot=function()
{
var snap=null;
if(arr_cache.length > 1)
{
arr_cache.pop();
}
// load last snap
return this.GetCopyProperties(arr_cache[arr_cache.length-1]);
}
//
// with the request_ident we flush all later steps
//
this.Flush=function(request_ident)
{
var retval=[];
// load last snap
for(var i=0, n=arr_cache.length; i<n; i++)
{
if(arr_cache[i]['request_ident'] < request_ident)
{
retval.push(arr_cache[i]);
}
}
arr_cache=retval;
}
//
// private vars
//
var arr_cache=[];
};
APP.PRICE.REGION.CACHE.RESPONSE=new function()
{
//
//
//
this.GetCopyProperties=function(properties)
{
var retval=Object.prototype.constructor(),
key;
for(key in properties)
{
if({'function':1,'undefined':1}[typeof properties[key]])
{
continue;
}
try
{
retval[key]=properties[key].valueOf();
}
catch(e)
{
APP.PRICE.REGION.DEBUG.Set('func:APP.PRICE.REGION.CACHE.FILTER.GetCopyProperties();'+key+'='+properties[key]+'-exception');
}
}
return retval;
}
//
//
//
this.GetCachedItems=function(arr_items)
{
var retval='';
if(arr_items)
{
for(var i=0, n=arr_items.length; i<n; i++)
{
retval +=(retval =='' ? '':'.')+arr_items[i].id;
if(arr_items[i].price)
{
retval +=','+arr_items[i].count_prices+','+(arr_items[i].price ? arr_items[i].price.partner:'0');
}
}
}
return retval;
}
//
//
//
this.Get=function(arr_items)
{
for(var i=0, n=arr_items.length; i<n; i++)
{
if(arr_cache[ arr_items[i].id ])
{
arr_items[i]=this.GetCopyProperties(this.MergeRecursive(arr_cache[ arr_items[i].id ], arr_items[i]));
}
arr_cache[ arr_items[i].id ]=arr_items[i];
}
return arr_items;
}
//
// private function to merge the two objects
//
this.MergeRecursive=function(obj1, obj2)
{
for(var p in obj2)
{
if({'function':1,'undefined':1}[typeof obj2[p]])
{
break;
}
try
{
// Property in destination object set; update its value.
obj1[p]=obj2[p];
}
catch(e)
{
//COM.Log('error-MergeRecursive:'+e);
APP.PRICE.REGION.DEBUG.Set('error-MergeRecursive:'+e);
// Property in destination object not set; create it and set its value.
obj1[p]=obj2[p];
}
}
return obj1;
}
//
// private vars
//
var arr_cache=new Array();
}
APP.RUN.Call("trivago.search");
