PageSourceSearch

https://www.tokyodome-hotels.co.jp/assets/common/third-party/scripts/fblib.js

js tokyodome-hotels.co.jp collected 2026-10-01 14:07:27 UTC 18,662 bytes, 599 lines download raw bytes

1/*****
2 * Copyright © FASTBOOKING  1999-2007
3 * 22/04/2009
4 *
5 * Please do NOT modify this file
6 * Please do NOT use the final IP adress for Fastbooking links:
7 *   IP address may be changed at any time
8 *
9*/
10
11// use following parameters, declared before in a fbparam.js file
12// Mandatory parameters:
13//var FBRESA = "http://www.fastbookings.biz/DIRECTORY/";
14//var FB_nb_day_delay = 7;
15// Optional parameters:
16//var FB_useGoogleAnalytics = true;
17
18if (typeof(FB_useGoogleAnalytics) == "undefined")
19	var FB_useGoogleAnalytics = false;
20//////////////////////////////////////////////////////////////
21// following code is used to optimize booking access and a better client experience
22var FB_book_image = new Image();
23FB_book_image.src = FBRESA + "trans.gif";
24
25//////////////////////////////////////////////////////////////
26// Fidelity program
27var FB_code_interface = "";
28var FB_profil = "";
29function hhotelProfil(code_interface, profil)
30{
31	FB_code_interface = code_interface;
32	FB_profil = profil;
33}
34// Form: show arrival date
35// this function to replace the traditional start function
36// in this case no update is required every year.
37function start() {
38	var nbm = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
39		
40	thisform = document.idForm;
41
42	build_year_select(thisform);
43
44	MD = new Date();
45		
46	nday = MD.getDate();
47	aday = MD.getDay();
48	amois = MD.getMonth();
49	ayear = takeYear(MD);
50	cur_year = ayear;
51			
52	nday += FB_nb_day_delay;
53
54	if(nday > nbm[amois])
55	{
56		nday -= nbm[amois];
57		amois++;
58		if(amois > 11) {
59			ayear++;
60			amois = 0;
61		}
62	}
63
64	indexDay = nday - 1;
65	indexMois = amois;
66	indexYear = ayear - cur_year;
67		
68	if(indexDay < 0 || indexDay > 30)
69		indexDay = 0;
70	if(indexMois < 0 || indexMois > 11)
71		indexMois = 0;
72	if(indexYear < 0 || indexYear > 1)
73		indexDay = 0;
74
75	thisform.fromday.selectedIndex = indexDay;
76	thisform.frommonth.selectedIndex = indexMois;
77	thisform.fromyear.selectedIndex = indexYear;
78
79	update_departure();
80}
81
82function generateSession()
83{
84	var time = new Date();
85	var sec  = time.getSeconds();
86	f = Math.floor(Math.random() * 1000000000) + '';
87	var sess = '' + sec + f;
88	return sess;
89}
90
91function transferGAdata(sessId, cname)
92{
93	var waction = FBRESA + "ga.phtml?clusterName="+cname + "&id=" + sessId;
94	pageTracker._initData();
95	new Image().src = pageTracker._getLinkerUrl(waction);
96	pageTracker._trackPageview('/FastBooking/ClicBook'); 
97}
98
99function fbOpenWindow(cname, waction, title, width, height)
100{
101	if(FB_useGoogleAnalytics)
102	{
103		sessId 	 = generateSession();
104		hhotelProfil("GoogleAnalytics", escape("SESSION=" + sessId));
105	}
106	if(FB_profil != "")
107	{
108		waction += "&code="+FB_code_interface;
109		waction += "&profil="+FB_profil;
110	}
111
112	window.open(waction, title, "toolbar=no,width=" + width + ",height=" + height +",menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
113
114	if(FB_useGoogleAnalytics)
115		transferGAdata(sessId, cname);
116}
117
118// standard booking function
119function hhotelPTC(cname, lg, codeprice, codetrack, cluster)
120{
121	hhotelResa(cname, lg, codeprice, "", "", codetrack, cluster, "", "");
122}
123
124// standard promotion function
125function hhotelPromo(cname, lg, theme)
126{
127	hhotelResa(cname, lg, "DYNPROMO", "", "", "", "", theme, "");
128}
129
130// reservation promotion function: To show one promotion
131function hhotelOnePromo(cname, lg, codeprice, codetrack, cluster)
132{
133	hhotelResa(cname, lg, codeprice, "", "", codetrack, cluster, "", "style=DIRECTPROMO");
134}
135
136// reservation page WITHOUT the individual access
137function hhotelNegociated(cname, lg, codeprice, codetrack, cluster)
138{
139	hhotelResa(cname, lg, codeprice, "", "", codetrack, cluster, "", "negociated=1");
140}
141
142// Main direct reservation function
143function hhotelResaDirect(cname, lg, codeprice, firstroom, codetrack, firstdate)
144{
145	hhotelResa(cname, lg, codeprice, firstroom, firstdate, codetrack, "", "", "style=DIRECT");
146}
147
148// standard search availabilities in a group
149function hhotelSearchGroup(cluster, lg, price, nights, title)
150{
151	hhotelSearch(cluster, lg, price, nights, title, "", "");
152}
153
154// standard search availabilities in a group for a partner
155function hhotelSearchPartner(cluster, lg, price, codetrack, title)
156{
157	if (codetrack != "") args = "&from="+codetrack;
158	else	args = "";
159	hhotelSearch(cluster, lg, price, "", title, "", args);
160}
161
162// search by giving the initial date
163function hhotelSearchPriceDate(cluster, price, nights, title, firstdate)
164{
165	// firstdate : format "YYMMDD"
166	var args="";
167	if (firstdate != "") args = "FirstDate="+firstdate;
168	hhotelSearch(cluster, "", price, nights, title, "", args);
169}
170
171function hhotelSearchPriceDateTrack(cluster, lg, price, codetrack, nights, title, firstdate)
172{
173	var args="";
174	if (codetrack != "") args = "from="+codetrack;
175	if (firstdate != "") args += "&FirstDate="+firstdate;
176	hhotelSearch(cluster, lg, price, nights, title, "", args);
177}
178
179// search by giving the initial date and persons for MSP
180function hhotelSearchAllMSP(cluster, price, nights, title, firstdate, mastercluster, cartID, adults, children)
181{
182	// firstdate : format "YYMMDD"
183	var args="";
184	if (firstdate != "") args = "FirstDate="+firstdate;
185	if (mastercluster != "") args += "&mastercluster=" + mastercluster;
186	if (cartID != "") args += "&cartID=" + cartID;
187	if (adults != "") args += "&adulteresa=" + adults;
188	if (children != "") args += "&enfantresa=" + children;
189	hhotelSearch(cluster, "", price, nights, title, "", args);
190}
191
192// search availabilities for selected promotions
193function hhotelSearchPromo(cluster, lg, theme)
194{
195	hhotelSearch(cluster, lg, "", "", "", theme, "");
196}
197
198// search availabilities with Extra Field
199function hhotelSearchExtra(cluster, lg, price, codetrack, extratitle, extraval, extrashow)
200{
201	var args = "Extrafield=" + escape(extratitle) + ";" + extraval + ";" + extrashow;
202	if (codetrack != "") args += "&from="+codetrack;
203	hhotelSearch(cluster, lg, price, "", "", "", args);
204}
205
206// go to the cancel reservation page
207function hhotelcancel(cname,lg)
208{
209	var waction = FBRESA + "cancel.phtml?state=77&Hotelnames="+cname;
210	if (lg != "") waction += "&langue="+lg;
211	fbOpenWindow(cname, waction, "reservation", 400, 350);
212	//window.open(waction,"reservation","toolbar=no,width=400,height=350,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
213}
214
215// go to the extract reservation page
216function hhotelExtract(cname, lg)
217{
218	var waction = FBRESA + "getresa.phtml?Hotelnames="+cname+"&langue="+lg;
219	fbOpenWindow(cname, waction, "getresa", 700, 300);
220	//window.open(waction, 'getresa', 'toolbar=no,width=700,height=300,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes');
221	return false;
222}
223
224// check interface
225function hhotelcheckrates(cname, lg)
226{
227	var waction = FBRESA + "crs.phtml?clusterName="+cname;
228	if (lg != "") waction += "&langue="+lg;
229	waction += "&checkPromo=1";
230	fbOpenWindow(cname, waction, "search", 800, 550);
231	//window.open(waction,"search","toolbar=no,width=800,height=550,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
232}
233
234// Main standard reservation function MSP
235function hhotelResaMSP(cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args, mastercluster, cartID)
236{
237	if (mastercluster != "") args += "&mastercluster=" + mastercluster;
238	if (cartID != "") args += "&cartID=" + cartID;
239	hhotelResa(cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args);
240}
241
242// Main Search function MSP
243function hhotelSearchMSP(cluster, lg, price, nights, title, theme, args, mastercluster, cartID)
244{
245	if (mastercluster != "") args += "&mastercluster=" + mastercluster;
246	if (cartID != "") args += "&cartID=" + cartID;
247	hhotelSearch(cluster, lg, price, nights, title, theme, args);
248}
249
250// Main standard reservation function
251function hhotelResa(cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args)
252{
253	var waction = FBRESA+"preresa.phtml?Hotelnames="+cname;
254	if (lg != "") waction += "&langue="+lg;
255	if (firstroom != "") {
256		waction += "&FirstRoomName="+firstroom;
257		if (codeprice == "")
258			codeprice = "DIRECT";
259		}
260	if (firstdate != "") {
261		waction += "&FirstDate="+firstdate;
262		if (codeprice == "")
263			codeprice = "DIRECT";
264		}
265	if (codeprice != "") waction += "&FSTBKNGCode="+codeprice;
266	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
267	if (cluster != "") waction += "&clustername="+cluster;
268	if (theme != "") waction += "&theme="+theme;
269	if (args != "" && (args.indexOf("=")!= -1) ) waction += "&"+args;
270	waction += "&HTTP_REFERER="+escape(document.location.href);
271	fbOpenWindow(cname, waction, "reservation", 400, 350);
272	//window.open(waction,"reservation","toolbar=no,width=400,height=350,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
273}
274
275// Main Search function
276function hhotelSearch(cluster, lg, price, nights, title, theme, args)
277{
278	var waction = FBRESA + "crs.phtml?clusterName="+cluster;
279	if (lg != "") waction += "&langue="+lg;
280	if (price != "") waction += "&FSTBKNGCode="+price;
281	if (nights != "") waction += "&nights="+nights;
282	if (title != "") waction += "&title="+escape(title);
283	if (theme != "") waction += "&theme="+theme;
284	if (args != "" && (args.indexOf("=")!= -1) ) waction += "&"+args;
285	fbOpenWindow(cluster, waction, "search", 1000, 700);
286	//window.open(waction,"search","toolbar=no,width=1000,height=700,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
287}
288
289// Main Search function for Multi Codes
290function hhotelSearchMultCode(cluster, lg, clecode, title, codetrack)
291{
292	var waction = FBRESA + "crs.phtml?clusterName="+cluster;
293	if (lg != "") waction += "&langue="+lg;
294	if (clecode != "") waction += "&AccessCode="+clecode;
295	if (title != "") waction += "&title="+escape(title);
296	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
297	waction += "&crossSelling=NO"; // CROSS SELLING DESACTIVATED
298	fbOpenWindow(cluster, waction, "search", 1000, 700);
299	//window.open(waction,"search","toolbar=no,width=1000,height=700,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
300}
301
302// Main Search function for Cross Selling
303
304function hhotelSearchCrossSell(cluster, lg, codetrack, crossSelling)
305{
306	var waction = FBRESA + "crs.phtml?clusterName="+cluster;
307	if (lg != "") waction += "&langue="+lg;
308	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
309	if (crossSelling != "") waction += "&crossSelling="+crossSelling;
310	fbOpenWindow(cluster, waction, "search", 1000, 700);
311	//window.open(waction,"search","toolbar=no,width=1000,height=700,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
312}
313
314// MAIN AVAILABILITY CHECK 
315function hhotelDispopriceFHP(cname, lg, codetrack, year, month, day, nights, currency)
316{
317	var waction = FBRESA+"dispoprice.phtml?clusterName="+cname+"&Hotelnames="+cname;
318	if (lg != "") waction += "&langue="+lg;
319	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
320	if (year != "") waction += "&fromyear="+year;
321	if (month != "") waction += "&frommonth="+month;
322	if (day != "") waction += "&fromday="+day;
323	if (nights != "") waction += "&nbdays="+nights;
324	if (currency != "") waction += "&CurrencyLabel="+currency;
325	waction += "&showPromotions=3";
326	fbOpenWindow(cname, waction, "reservation", 1000, 700);
327	//window.open(waction,"reservation","toolbar=no,width=1000,height=700,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
328}
329
330
331///////////////////////////////////////////////////////////////////////////////////////
332// Form functions
333// Simple form validation (used for compatibility issues)
334function hhotelDispoprice(myForm)
335{
336	hhotelFormValidation(myForm, 0);
337}
338
339// Form validation with control
340function hhotelFormValidation(myForm, mandatoryCode){
341	if (mandatoryCode == 1 && myForm.AccessCode.value == "") {
342		alert("You must type in your code ID");
343		return (false);
344	}
345	myForm.action = FBRESA + "dispoprice.phtml";
346	if (FB_useGoogleAnalytics) {	
347		sessId = generateSession();
348		profilValue = escape("SESSION=" + sessId + "&CODE=GoogleAnalytics");
349		if ((typeof myForm.profil) == "undefined") {
350			var newInput = document.createElement("input");
351			newInput.setAttribute("type", "hidden");
352			newInput.setAttribute("name", "profil");
353			newInput.setAttribute("value", profilValue);
354			myForm.appendChild(newInput);
355		} else {
356			myForm.profil.value = profilValue;
357		}
358	}
359	window.open('','dispoprice', 'toolbar=no,width=1000,height=700,menubar=no,scrollbars=yes,resizable=yes');
360	myForm.submit();
361	if (FB_useGoogleAnalytics) {
362		var cname = "";
363		if ((typeof myForm.AccountName) != "undefined" && myForm.AccountName.value != "")
364			cname = myForm.AccountName.value;
365		else 
366			cname = myForm.Clusternames.value;
367		transferGAdata(sessId, cname);
368	}
369	return (true);
370}
371
372// Form: update the selected hotel name
373function hhotelFormUpdateHotelnames(myForm)
374{
375	menuNum = myForm.HotelList.selectedIndex;
376	if (menuNum == null)
377		return;
378	myForm.Hotelnames.value = myForm.HotelList.options[menuNum].value;
379}
380
381// Form: show the cancel page
382function hhotelFormCancel(myForm){
383	var CName = myForm.Hotelnames.value;
384	var languetype = typeof myForm.langue;
385	var langue;
386	if (languetype == "undefined")
387		langue = "";
388	else
389		langue = myForm.langue.value;
390	if (CName == null || CName == 'All' || CName == ''){ alert('Please select a hotel first'); return (false); }
391	return hhotelcancel(CName, langue);
392}
393
394// Form: show the extract page
395function hhotelFormExtract(myForm)
396{
397	var CName = myForm.Hotelnames.value;
398	var languetype = typeof myForm.langue;
399	var langue;
400	if (languetype == "undefined")
401		langue = "";
402	else
403		langue = myForm.langue.value;
404	if (CName == null || CName == 'All' || CName == ''){ alert('Please select a hotel first'); return (false); }
405	return hhotelExtract(CName, langue);
406}
407
408// Form: show languages ////////////////////////////////////////////
409function hhotelShowLang(lang) 
410{
411	hhotelShowLang__(this.document, lang);
412}
413
414function hhotelShowLangOpener(lang)
415{
416	hhotelShowLang__(window.opener.document, lang);
417	window.close();
418}
419
420function hhotelShowLang__(mydoc, lang)
421{
422	mydoc.idForm.langue.value=lang;
423
424	var imgLang = hhotelLang2Img(lang);
425	if (imgLang != "") {
426		var formFlag = mydoc.selLgFlag;
427		if (formFlag != null)
428			mydoc.selLgFlag.src= "fastbooking/flags/"+imgLang+".gif";
429		var formFlag = mydoc.selLgTxt;
430		if (formFlag != null)
431			mydoc.selLgTxt.src= "fastbooking/flags/"+imgLang+"lg.gif";
432	}
433}
434
435// FastBooking language and image code
436var FBLangCode = new Array (
437	"uk", "france", "germany", "spain", "portuguese", "italy", "nether", "russian",
438	"dansk", "svensk", "islensk", "norsk", "turk", "hungria", "greek", "arab",
439	"china", "coreen", "japan","croate","czech","poland");
440var FBLangImg = new Array (
441	"grandbret", "france", "germany", "spain", "portuguese", "italy", "nether", "russia",
442	"denmark", "sweeden", "iceland", "norway", "turkey", "hungary", "greek", "arab",
443	"china", "coreen", "japan","croate","czech","poland");
444
445function hhotelLang2Img(lang)
446{
447	for(i = 0; i < FBLangCode.length; i++) {
448		if (FBLangCode[i] == lang)
449			break;
450	}
451	return FBLangImg[i];
452}
453
454function hhotelLangSelector()
455{
456	window.open('fastbooking/flags/langSelector.html', '', 'width=330,height=180');
457}
458
459
460var langcodes = new Array("en", "uk", "fr", "france", "de", "germany", "es", "spain ", "pt", "portuguese", "it", "italy", "nl", "nether", "ja", "japan ", "ko", "coreen", "zh", "china", "ar", "arab", "ru", "russian", "tr", "turk", "el", "greek", "hu", "hungria", "da", "dansk", "sv", "svensk", "is", "islensk", "no", "norsk", "hr", "croate", "cs", "czech", "pl", "poland", "iw", "hebrew");
461
462function selectLang()
463{
464	if(navigator.appName == "Microsoft Internet Explorer") UL = navigator.userLanguage.substring(0, 2);
465	else if(navigator.appName == "Netscape") UL = navigator.language;
466	else return;
467
468	for(i = 0; i < langcodes.length; i += 2)
469		if(UL == langcodes[i])
470			break;
471			
472	lang = (i < langcodes.length) ? langcodes[i+1] : "uk";
473	hhotelShowLang(lang);
474}
475
476
477// date manager ////////////////////////////////////////////
478// build year select
479function build_year_select(thisform) {
480	var cur_date = new Date();
481	var cur_year = takeYear(cur_date);
482		
483	cur_y = new Option(cur_year, cur_year, true, true);
484	thisform.fromyear.options[0] = cur_y;
485	if(thisform.toyear != null) {
486		cur_yb = new Option(cur_year, cur_year, true, true);
487		thisform.toyear.options[0] = cur_yb;
488	}
489		
490	next_y = new Option(cur_year + 1, cur_year + 1, false, false);
491	thisform.fromyear.options[1] = next_y;
492	next_yb = new Option(cur_year + 1, cur_year + 1, false, false);
493	if(thisform.toyear != null) {
494		thisform.toyear.options[1] = next_yb;
495	}
496}
497	
498// check departure date to arrival date + 1 day (every time the arrival date is changed)
499function check_departure() {
500	thisform = document.idForm;
501
502	if(thisform.today == null)
503		return;
504
505	var nbm = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
506	
507	var ar_day = parseInt(thisform.fromday.value) + 1;
508	var ar_month = parseInt(thisform.frommonth.value);
509	var ar_year = parseInt(thisform.fromyear.value);
510			
511	if(ar_day > nbm[ar_month - 1]) {
512		ar_day = 1;
513		ar_month += 1;
514		if(ar_month > 12) {
515			ar_month = 1;
516			ar_year += 1;
517		}
518	}
519			
520	var cur_date = new Date();
521	var cur_year = takeYear(cur_date);
522	
523	thisform.today.selectedIndex = ar_day - 1;
524	thisform.tomonth.selectedIndex = ar_month - 1;
525	thisform.toyear.selectedIndex = ar_year - cur_year;
526}
527
528// update departure : check 
529function update_departure() {
530	thisform = document.idForm;
531
532	if(thisform.today == null)
533		return;
534		
535	var ar_day = parseInt(thisform.fromday.value) + 1;
536	var ar_month = parseInt(thisform.frommonth.value);
537	var ar_year = parseInt(thisform.fromyear.value);
538			
539	var de_day = parseInt(thisform.today.value) + 1;
540	var de_month = parseInt(thisform.tomonth.value);
541	var de_year = parseInt(thisform.toyear.value);
542	
543	if(de_year < ar_year) {
544		check_departure();
545	} else {
546		if(de_year == ar_year) {
547			if(de_month < ar_month) {
548				check_departure();
549			} else {
550				if(de_month == ar_month) {
551					if(de_day <= ar_day) {
552						check_departure();
553					}
554				}
555			}
556		}
557	}
558}
559
560function takeYear(theDate)
561{
562	x = theDate.getYear();
563	var y = x % 100;
564	y += (y < 38) ? 2000 : 1900;
565	return y;
566}
567
568// popup for quicksearch flash
569function popup(url)
570{
571	fbOpenWindow("", url, "", 1000, 700);
572	//window.open(url,"","toolbar=no,width=1000,height=700,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes");
573}
574
575// ages chidren for quick form
576function ageschildren()
577{
578	var age = '';
579	var obj1 = '';
580	var n = document.idForm.enfantresa.options[document.idForm.enfantresa.selectedIndex].value;
581	
582	for (i = 1; i<=n; i++)
583	{
584		if (i==1)
585		{
586			obj1 = document.getElementById("agechild"+i);
587			age += obj1.options[obj1.selectedIndex].value;
588		}
589		else
590		{
591			obj1 = document.getElementById("agechild"+i);
592			age += ';';
593			age += obj1.options[obj1.selectedIndex].value;
594		}
595	}
596	document.idForm.agesval.value = age;
597}
598
599

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.