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":"\u8be6\u7ec6","opinions":"\u70b9\u8bc4","map":"\u5730\u56fe","hotels":"\u9152\u5e97","more":"\u66f4\u591a","less":"\u66f4\u5c11","count_image":"\u56fe\u7247","more_prices":"\u6240\u6709\u4ef7\u683c","deals_forward":"\u8f6c\u5230\u4f9b\u5e94\u5546","certificates":"\u83b7\u5f97\u5956\u9879","best_price":"\u6700\u597d\u7684\u4ef7\u683c","room_details":"\u4ef7\u683c&\u623f\u95f4\u63cf\u8ff0","available_offers":"\u53ef\u5728$count \u4e2a\u7f51\u7ad9\u9884\u8ba2","available_offer":"\u53ef\u57281\u4e2a\u7f51\u7ad9\u9884\u8ba2","deals_partner":"\u5408\u4f5c\u4f19\u4f34","partner_no_answer":"\u65e0\u4f9b\u5e94","partner_loading":"\u52a0\u8f7d\u4e2d","partners_deals_from":"\u9152\u5e97\uff1a","deals_proof":"\u67e5\u8be2","not_rated_yet":"\u6682\u65e0\u70b9\u8bc4","all_notices":"\u663e\u793a\u5168\u90e8","stars":"\u661f\u7ea7","filter_group_14":"\u9152\u5e97\u7c7b\u578b","filter_group_8":"\u7279\u522b\u9002\u5408","filter_group_2":"\u9152\u5e97\u8bbe\u65bd","filter_group_6":"\u4f53\u80b2\u8bbe\u65bd","filter_group_3":"\u623f\u95f4\u8bbe\u65bd","filter_group_9":"\u4f4f\u5bbf\u7c7b\u578b","filter_group_1":"\u54c1\u724c\u8fde\u9501\u9152\u5e97","value_label_1_39":"Bastion","value_label_1_43":"\u6700\u4f73\u897f\u65b9\u9152\u5e97","value_label_1_62":"City Partner Hotels","value_label_1_66":"Comfort","value_label_1_87":"Dorint Hotels & Resorts","value_label_1_101":"Familotel","value_label_1_113":"\u56db\u5b63\u9152\u5e97","value_label_1_116":"Golden Tulip","value_label_1_127":"\u5e0c\u5c14\u987f\u9152\u5e97","value_label_1_128":"Hipotels","value_label_1_129":"\u5047\u65e5\u9152\u5e97","value_label_1_135":"\u51ef\u60a6\u9152\u5e97\u53ca\u5ea6\u5047\u6751\u96c6\u56e2","value_label_1_136":"Iberostar","value_label_1_137":"\u5b9c\u5fc5\u601d","value_label_1_143":"\u6d32\u9645\u9152\u5e97","value_label_1_155":"\u51ef\u5bbe\u65af\u57fa\u9152\u5e97","value_label_1_161":"\u827e\u7f8e","value_label_1_166":"LTI International","value_label_1_170":"\u4e07\u8c6a\u56fd\u9645\u9152\u5e97","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":"\u8bfa\u5bcc\u7279","value_label_1_210":"Quality","value_label_1_212":"\u4e3d\u7b19\u9152\u5e97","value_label_1_214":"\u534e\u7f8e\u8fbe\u9152\u5e97","value_label_1_224":"\u91cc\u5179\u5361\u5c14\u987f\u996d\u5e97","value_label_1_225":"RIU","value_label_1_226":"Robinson Club","value_label_1_240":"\u559c\u6765\u767b\u9152\u5e97","value_label_1_246":"\u7d22\u83f2\u7279\u9152\u5e97","value_label_1_247":"Sol","value_label_1_254":"\u53f2\u8482\u6839\u4f2f\u683c\u9152\u5e97","value_label_1_261":"\u745e\u58eb\u9152\u5e97","value_label_1_270":"Tryp","value_label_1_275":"\u5a01\u65af\u6c40\u9152\u5e97","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":"\u4e3a\u4f60\u9152\u5e97\u9884\u8ba2\u7f51","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":"\u6d32\u9645\u9152\u5e97\u96c6\u56e2","partner_14":"\u96c5\u9ad8","partner_15":"\u5168\u7403\u8ba2\u623f\u7f51","partner_16":"\u6700\u4f73\u897f\u65b9\u9152\u5e97","partner_17":"Golden Tulip","partner_18":"Choice Hotels","partner_19":"\u4e07\u8c6a\u9152\u5e97","partner_20":"One Travel","partner_21":"eDreams","partner_22":"AsiaRooms","partner_23":"iff","partner_24":"HotelPronto","partner_25":"RatesToGo","partner_26":"\u5e0c\u5c14\u987f","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":"\u5230\u5230","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_70":"Certified Business Hotels","partner_72":"Rural Gest","partner_73":"\u7687\u51a0\u5047\u65e5\u9152\u5e97","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":"\u9152\u5e97","item_group_2":"\u9152\u5e97","item_group_3":"\u5e8a & \u65e9\u9910","item_group_4":"\u5ba2\u6808","item_group_5":"\u6c7d\u8f66\u65c5\u9986","item_group_6":"\u673a\u573a\u9152\u5e97","item_group_7":"\u5ea6\u5047\u6751","item_group_8":"\u5ea6\u5047\u522b\u5885\/\u516c\u5bd3","item_group_9":"\u9752\u5e74\u65c5\u793e","item_group_10":"\u5ba2\u623f","item_group_11":"\u9732\u8425\u533a","item_group_12":"\u5916\u666f","item_group_13":"\u9152\u5427\/\u9152\u9986","item_group_14":"\u4e58\u8239\u6e38\u89c8","item_group_15":"\u7eaa\u5ff5\u7891\/\u7eaa\u5ff5\u9986","item_group_16":"\u8fea\u65af\u79d1\/\u591c\u603b\u4f1a","item_group_17":"\u5efa\u7b51\u7269","item_group_18":"\u9ad8\u5c14\u592b\u7403\u573a","item_group_19":"\u8d4c\u573a","item_group_20":"\u7535\u5f71\u9662","item_group_21":"\u6559\u5802\/\u5927\u6559\u5802\/\u5bfa\u9662","item_group_22":"\u8dd1\u9053","item_group_23":"\u535a\u7269\u9986\/\u5c55\u89c8\u9986","item_group_24":"\u81ea\u7136\u666f\u70b9","item_group_25":"\u516c\u56ed\/\u690d\u7269\u56ed","item_group_26":"\u8857\u9053\/\u6b65\u884c\u8857","item_group_27":"\u81ea\u884c\u8f66\/\u6e9c\u51b0","item_group_28":"\u6d3b\u52a8\/\u5e86\u5178","item_group_29":"\u9910\u5385","item_group_30":"\u6b65\u884c\u8857","item_group_31":"\u5bab\u6bbf\/\u57ce\u5821","item_group_32":"\u8d2d\u7269\u4e2d\u5fc3","item_group_33":"\u6ed1\u96ea\u80dc\u5730","item_group_34":"\u4f53\u80b2\u8bbe\u65bd\/\u4f53\u80b2\u9986","item_group_35":"\u6d77\u6ee9","item_group_36":"\u6f5c\u6c34\u80dc\u5730","item_group_37":"\u620f\u5267\/\u6b4c\u5267","item_group_38":"\u8fdc\u8db3\/\u767b\u5c71","item_group_39":"\u6e29\u6cc9","item_group_40":"\u98ce\u5e06\u51b2\u6d6a","item_group_41":"\u52a8\u7269\u56ed\/\u6c34\u65cf\u9986","item_group_42":"\u6e38\u4e50\u56ed","item_group_43":"\u5176\u5b83\u666f\u70b9","item_group_44":"\u81ea\u7136\u9057\u4ea7","item_group_45":"\u673a\u573a\/\u706b\u8f66\u7ad9\/\u7801\u5934","field_1":"\u54c1\u724c\u8fde\u9501\u9152\u5e97","field_2":"\u4e16\u754c\u6392\u540d\u9152\u5e97","field_3":"Relais & Ch\u00e2teaux","field_4":"Ring hotels","field_5":"\u6d6a\u6f2b\u578b\u9152\u5e97","field_6":"\u5c0f\u578b\u8c6a\u534e\u4e16\u754c\u9152\u5e97","field_7":"The Luxury Collection","field_8":"\u6742\u9879\uff0d\u5220\u9664","field_9":"\u65e0\uff0d\u5220\u9664","field_10":"\u7f8e\u5bb9\u4e2d\u5fc3","field_11":"\u6b8b\u75be\u4eba\u8bbe\u65bd","field_12":"\u821e\u53f0","field_13":"\u5546\u52a1\u4e2d\u5fc3","field_14":"\u5496\u5561\u5385\/\u9152\u5427","field_15":"\u84b8\u6c14\u6d74","field_16":"\u5546\u573a\/\u7535\u5b50\u6e38\u620f","field_17":"\u8fea\u65af\u79d1\/\u591c\u603b\u4f1a","field_18":"\u5927\u5385\/\u5927\u5802","field_19":"\u5feb\u901f\u5165\u4f4f\/\u9000\u623f","field_20":"\u7535\u68af","field_21":"\u7535\u89c6\u4f11\u606f\u5ba4","field_22":"\u706b\u707e\u63a2\u6d4b\u5668","field_23":"\u5065\u8eab\u623f","field_24":"\u7f8e\u53d1\u5e08","field_25":"\u505c\u8f66\u573a","field_26":"\u82b1\u56ed\u6216\u516c\u56ed","field_27":"\u9633\u53f0","field_28":"\u95e8\u623f\u670d\u52a1","field_29":"\u79c1\u4eba\u9ad8\u5c14\u592b\u7403\u573a","field_30":"\u53ef\u5e26\u5ba0\u7269","field_31":"\u9152\u5e97\u9152\u5427","field_32":"\u9152\u5e97\u6d77\u6ee9\u9152\u5427","field_33":"\u9152\u5e97\u89c2\u666f\u9152\u5427\uff08\u9876\u5c42\uff09","field_34":"\u6cf3\u6c60\u9152\u5427","field_35":"\u5ba4\u5916\u6e38\u6cf3\u6c60","field_36":"\u5ba4\u5185\u6e38\u6cf3\u6c60","field_37":"\u9152\u5e97\u4fdd\u9669\u7bb1","field_38":"\u513f\u7ae5\/\u5a74\u513f\u5e8a","field_39":"\u513f\u7ae5\u770b\u62a4\/\u5a74\u513f\u62a4\u7406","field_40":"\u8ff7\u4f60\u5e02\u573a\/\u62a5\u520a\u4ead","field_41":"\u4f1a\u8bae\/\u4f1a\u8bae\u5ba4","field_42":"\u6309\u6469","field_43":"\u591c\u95f4\u529e\u4e8b\u5458","field_44":"\u65e0\u70df\u623f","field_45":"\u4e92\u8054\u7f51\u63a5\u5165","field_46":"\u8d4c\u573a","field_47":"\u9910\u5385","field_48":"24\u5c0f\u65f6\u63a5\u5f85","field_49":"\u8f6e\u6905","field_50":"\u9759\u97f3\u623f","field_51":"\u6851\u62ff","field_52":"\u9152\u5e97\u8d2d\u7269\u5e7f\u573a","field_53":"\u5c0f\u5403\u5e97","field_54":"\u65e5\u5149\u6d74\u573a","field_55":"\u76f4\u63a5\u8fde\u63a5\u6d77\u6ee9","field_56":"\u906e\u9633\u4f1e","field_57":"\u8eba\u6905","field_58":"\u6e38\u6cf3\u6c60\/\u6cf3\u6ee9\u6bdb\u5dfe","field_59":"\u6d17\u8863\u670d\u52a1","field_60":"\u6c34\u7597\u4e2d\u5fc3\/\u6e29\u6cc9","field_61":"\u6f29\u6da1\u6c60\/\u6309\u6469\u6d74\u7f38","field_62":"\u9152\u5e97\u5185\u65e0\u7ebf\u5c40\u57df\u7f51","field_63":"\u5ba2\u623f\u670d\u52a1","field_64":"24\u5c0f\u65f6\u5ba2\u623f\u670d\u52a1","field_65":"\u623f\u95f4\u5e26\u9633\u53f0\/\u9732\u53f0","field_66":"\u5e73\u623f","field_67":"\u64e6\u978b\u6e05\u6d01\u670d\u52a1\/ -\u81ea\u52a8","field_68":"\u623f\u95f4\u53f7\u7801\uff0d\u5220\u9664","field_69":"\u7089\u7076\uff08\u5ea6\u5047\u522b\u5885\/\u516c\u5bd3\uff09","field_70":"\u6d17\u7897\u673a\uff08\u5ea6\u5047\u522b\u5885\/\u516c\u5bd3\uff09","field_71":"\u6d17\u8863\u673a","field_72":"\u79df\u8239","field_73":"\u6742\u9879\uff0d\u5220\u9664","field_74":"\u6d74\u5ba4\u5e26\u6d74\u7f38","field_75":"\u6d74\u5ba4\u5e26\u6dcb\u6d74","field_76":"\u901a\u98ce","field_77":"\u71a8\u6597\/\u71a8\u8863\u677f","field_78":"\u4f20\u771f\/\u5bbd\u5e26","field_79":"\u7a97\u53e3\u6253\u5f00","field_80":"\u7535\u89c6\u673a","field_81":"\u706b\u707e\u63a2\u6d4b\u5668","field_82":"\u7535\u5439\u98ce","field_83":"\u6696\u6c14","field_84":"\u88e4\u5b50\u71a8\u70eb","field_85":"\u7535\u6c34\u58f6\/\u5496\u5561\u673a","field_86":"\u7a7a\u8c03","field_87":"\u5316\u5986\u955c","field_88":"\u566a\u58f0\u9632\u62a4\u7a97","field_89":"\u8ff7\u4f60\u9152\u5427","field_90":"\u4ed8\u8d39\u7535\u89c6","field_91":"\u65e0\u7ebf\u7535","field_92":"\u536b\u661f\u7535\u89c6","field_93":"\u529e\u516c\u684c","field_94":"\u5c0f\u4f11\u606f\u5ba4","field_95":"\u7535\u8bdd","field_96":"\u9065\u63a7\u7535\u89c6\u673a","field_97":"\u5185\u7f6e\u4fdd\u9669\u7bb1","field_98":"DVD\u64ad\u653e\u673a\/\u5f55\u50cf\u673a","field_99":"\u97f3\u54cd\u7cfb\u7edf\/ CD\u64ad\u653e\u673a","field_100":"\u7535\u8111\u6e38\u620f\/\u6e38\u620f","field_101":"\u6709\u7ebf\u7535\u89c6","field_102":"\u4e3b\u9910\u7740\u88c5","field_103":"\u81ea\u52a9\u9910","field_104":"\u4e3b\u83dc\u5355","field_105":"\u516c\u8def","field_106":"\u673a\u573a","field_107":"\u706b\u8f66\u7ad9","field_108":"\u8d38\u6613\/\u4f1a\u5c55\u4e2d\u5fc3","field_109":"\u516c\u4ea4","field_110":"\u5e02\u4e2d\u5fc3","field_111":"\u6d77\u6ee9","field_112":"\u7fbd\u6bdb\u7403","field_113":"\u6392\u7403\/\u6c99\u6ee9\u6392\u7403","field_114":"\u684c\u7403","field_115":"\u5c04\u7bad\/\u5c04\u51fb","field_116":"\u8239\u79df","field_117":"\u4fdd\u9f84\u7403","field_118":"\u79df\u81ea\u884c\u8f66","field_119":"\u9ad8\u5c14\u592b\u7403\u573a","field_120":"\u5065\u8eab\/\u5065\u7f8e\u64cd","field_121":"\u8dd1\u6b65\/\u6e9c\u51b0","field_122":"\u8ff7\u4f60\u9ad8\u5c14\u592b","field_123":"\u9a91\u9a6c","field_124":"\u5e06\u8239","field_125":"\u6ed1\u96ea","field_126":"\u58c1\u7403","field_127":"\u51b2\u6d6a","field_128":"\u7f51\u7403\u5ba4","field_129":"\u7f51\u7403\u573a","field_130":"\u8fdc\u8db3","field_131":"\u73b0\u91d1","field_132":"\u652f\u7968","field_133":"\u516c\u53f8\u7ed3\u8d26","field_134":"EC\/ Maestro","field_135":"\u7f8e\u56fd\u8fd0\u901a\u5361","field_136":"\u5927\u6765\u5361","field_137":"Eurocard\/ Mastercard","field_138":"JCB Intl.","field_139":"Visa","field_140":"\u8fd0\u52a8\u7231\u597d\u8005","field_141":"\u51ac\u5b63\u8fd0\u52a8\u7231\u597d\u8005","field_142":"\u80cc\u5305\u5ba2","field_143":"\u4f11\u95f2\u7231\u597d\u8005","field_144":"\u5065\u8eab\u7231\u597d\u8005","field_145":"\u9ad8\u5c14\u592b\u7231\u597d\u8005","field_146":"\u7f8e\u98df\u5bb6","field_147":"\u6587\u5316\u827a\u672f\u7231\u597d\u8005","field_148":"\u821e\u4f1a\u7231\u597d\u8005","field_149":"\u6f5c\u6c34\u7231\u597d\u8005","field_150":"\u6e38\u8247\u9a7e\u9a76\u7231\u597d\u8005","field_151":"\u65e5\u5149\u6d74\u7231\u597d\u8005","field_152":"\u7ecf\u6d4e\u6d88\u8d39\u7231\u597d\u8005","field_153":"\u6df1\u6c34\u6f5c\u6c34\u7231\u597d\u8005","field_154":"\u65c5\u6e38\u534f\u4f1a\/\u4ff1\u4e50\u90e8","field_155":"\u8fdc\u8db3\u7231\u597d\u8005","field_156":"\u6e38\u6cf3\u7231\u597d\u8005","field_157":"\u6e29\u6cc9\u6d74\u7231\u597d\u8005","field_158":"\u98ce\u5e06\u7231\u597d\u8005","field_159":"\u5546\u754c\u4eba\u58eb","field_160":"\u9152\u5e97","field_161":"\u5e8a\u548c\u65e9\u9910","field_162":"\u5ba2\u6808","field_163":"\u6c7d\u8f66\u65c5\u9986","field_164":"\u516c\u5bd3\u9152\u5e97","field_165":"\u5ea6\u5047\u6751","field_166":"\u5ea6\u5047\u522b\u5885\/\u516c\u5bd3","field_167":"\u9752\u5e74\u65c5\u793e","field_168":"\u5ba2\u623f","field_169":"\u5916\u666f","field_170":"\u9152\u5427\/\u4ff1\u4e50\u90e8","field_171":"\u4e58\u8239\u6e38\u89c8","field_172":"\u7eaa\u5ff5\u7891\/\u7eaa\u5ff5\u9986","field_173":"\u8fea\u65af\u79d1\/\u591c\u603b\u4f1a","field_174":"\u5efa\u7b51\u7269","field_175":"\u9ad8\u5c14\u592b\u7403\u573a","field_176":"\u8d4c\u573a","field_177":"\u7535\u5f71\u9662","field_178":"\u6559\u5802\/\u5927\u6559\u5802\/\u5bfa\u9662","field_179":"\u8dd1\u9053","field_180":"\u535a\u7269\u9986\/\u5c55\u89c8\u9986","field_181":"\u81ea\u7136\u666f\u70b9","field_182":"\u516c\u56ed\/\u690d\u7269\u56ed","field_183":"\u8857\u9053\/\u6b65\u884c\u8857","field_184":"\u81ea\u884c\u8f66\/\u6e9c\u51b0","field_185":"\u6d3b\u52a8\/\u5e86\u5178","field_186":"\u9910\u5385","field_187":"\u6b65\u884c\u8857","field_188":"\u5bab\u6bbf\/\u57ce\u5821","field_189":"\u8d2d\u7269\u4e2d\u5fc3","field_190":"\u6ed1\u96ea\u80dc\u5730","field_191":"\u4f53\u80b2\u8bbe\u65bd\/\u4f53\u80b2\u9986","field_192":"\u6d77\u6ee9","field_193":"\u6f5c\u6c34\u80dc\u5730","field_194":"\u620f\u5267\/\u6b4c\u5267","field_195":"\u8fdc\u8db3\/\u767b\u5c71","field_196":"\u6c34\u7597\u4e2d\u5fc3\/\u6e29\u6cc9","field_197":"\u98ce\u5e06\u51b2\u6d6a","field_198":"\u52a8\u7269\u56ed\/\u6c34\u65cf\u9986","field_199":"\u7535\u8bdd","field_200":"\u624b\u673a","field_201":"\u4f20\u771f","field_202":"\u5730\u5740","field_203":"\u90ae\u653f\u7f16\u7801","field_204":"\u901a\u8baf","field_205":"\u8bad\u7ec3","field_206":"Household Net Income","field_207":"\u57ce\u5e02\u5927\u5c0f","field_208":"\u5c31\u4e1a","field_209":"\u5bb6\u5ead\u6210\u5458\u4eba\u6570","field_210":"\u5a5a\u59fb\u72b6\u51b5","field_211":"\u5e02\u573a\u7814\u7a76\u8c03\u67e5","field_212":"\u6807\u51c6\u9152\u5e97","field_213":"\u6807\u51c6\u666f\u70b9","field_214":"\u4e3b\u8981\u6536\u5165\u6765\u6e90","field_215":"\u5168\u5305\u9152\u5e97\/\u4ff1\u4e50\u90e8","field_216":"\u5168\u5957\u623f\u9152\u5e97","field_217":"\u516c\u8def\u9152\u5e97","field_218":"\u9ad8\u6027\u4ef7\u6bd4\u9152\u5e97","field_219":"\u4ff1\u4e50\u90e8\/\u4ff1\u4e50\u90e8\u9152\u5e97","field_220":"\u8bbe\u8ba1\u578b\u9152\u5e97","field_221":"\u666f\u70b9\u9152\u5e97","field_222":"\u5047\u65e5\/\u5ea6\u5047\u9152\u5e97","field_223":"\u673a\u573a\u9152\u5e97","field_224":"\u5546\u52a1\u9152\u5e97","field_225":"\u9ad8\u5c14\u592b\u9152\u5e97","field_226":"\u7597\u517b\u80dc\u5730\/\u5eb7\u590d\u9152\u5e97","field_227":"\u8c6a\u534e\u9152\u5e97","field_228":"\u9a91\u58eb\u9152\u5e97","field_229":"\u4f53\u80b2\u5bbe\u9986","field_230":"\u57ce\u5e02\u9152\u5e97\uff08\u4f4d\u4e8e\u5e02\u4e2d\u5fc3\uff09","field_231":"\u6d77\u6ee9\u9152\u5e97","field_232":"\u4f1a\u8bae\u5927\u9152\u5e97","field_233":"\u7f51\u7403\u9152\u5e97","field_234":"\u6e29\u6cc9\u9152\u5e97","field_235":"\u6ed1\u96ea\u80dc\u5730\u9152\u5e97","field_236":"\u6742\u9879\u2014\u5220\u9664","field_237":"\u623f\u95f4\u53f7\u7801","field_238":"\u65c5\u884c\u652f\u7968","field_239":"\u5df2\u5173\u95ed","field_240":"\u5411\u5bfc_\u7b49\u7ea7","field_241":"\u4fe1\u606f\u6765\u6e90_1","field_242":"\u4fe1\u606f\u6765\u6e90_2","field_243":"\u4fe1\u606f\u6765\u6e90_3","field_244":"\u8bc4\u8bba_\u786e\u8ba4","field_245":"\u9632\u8fc7\u654f\u623f","field_246":"\u6d3b\u52a8","field_247":"\u9152\u5e97\u533b\u751f","field_248":"\u9152\u5e97\u79df\u8f66\u670d\u52a1","field_249":"\u793c\u5bbe\u670d\u52a1","field_250":"\u513f\u7ae5\u6e38\u4e50\u573a","field_251":"\u9605\u89c8\u5ba4","field_252":"\u8ff7\u4f60\u4ff1\u4e50\u90e8","field_253":"\u5bbd\u5e26","field_254":"\u65e0\u7ebf\u5c40\u57df\u7f51","field_255":"\u53a8\u623f","field_256":"\u5fae\u6ce2\u7089","field_257":"\u7535\u51b0\u7bb1","field_258":"\u98ce\u6247","field_259":"\u6f5c\u6c34","field_260":"\u4e52\u4e53\u7403","field_261":"\u8fc7\u5ba2","field_262":"\u871c\u6708\u65c5\u884c","field_263":"\u5355\u4eba","field_264":"\u5bb6\u5ead","field_265":"\u6e38\u5ba2","field_266":"\u5927\u578b\u56e2\u4f53","field_267":"\u5b66\u751f","field_268":"\u5ea6\u5047\u7231\u597d\u8005","field_269":"\u63a2\u9669\u7231\u597d\u8005","field_270":"\u9732\u8425\u533a","field_271":"\u6e38\u4e50\u56ed","field_272":"\u5176\u5b83\u666f\u70b9","field_273":"\u81ea\u7136\u9057\u4ea7","field_274":"\u4e61\u6751\u9152\u5e97","field_275":"\u519c\u5e84","field_276":"\u5bb6\u5ead\u65c5\u9986","field_277":"\u60a8\u5982\u4f55\u770b\u5f85 trivago\uff1f","field_278":"\u8d26\u6237\u540d","field_279":"\u94f6\u884c\u4ee3\u7801","field_280":"\u94f6\u884c\u540d\u79f0","field_281":"\u8d26\u53f7","field_282":"\u673a\u573a\/\u706b\u8f66\u7ad9\/\u7801\u5934","field_283":"\u8d1d\u5b9d EMail","field_284":"\u4ed8\u6b3e\u65b9\u5f0f","field_330":"Certified Business Hotels","field_331":"\u51ac\u5b63\u8fd0\u52a8\u7231\u597d\u8005","field_332":"Gays","field_333":"\u6c34\u4e0a\u8fd0\u52a8\u7231\u597d\u8005","field_334":"\u5ba0\u7269\u7231\u597d\u8005","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();
}
// Stdteliste
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\">上一页</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\">下一页</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='地址';
$('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="没有可用结果，请稍后重新要求。";
};
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':'拖拉标记以增加/减少半径',
'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='请用不同的搜索字符重试';
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']='您可以使用拖放轻易地变更地图的中心<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']='您可以使用拖放轻易地变更地图的中心<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");
