PageSourceSearch

https://www.brastel.com/GenericFiles/4.0/js/common.js

js brastel.com collected 2026-10-02 05:02:19 UTC 53,458 bytes, 1,460 lines download raw bytes

1/*
2Update history
32017-08-30 Yujiro / Get message board feeds from Blogger directly instead of from Wordpress with YQL
4						  Get News2U feeds with action=ReadExternalXML
52016-07-25 Yujiro / trackBannerClicks function to track banner clicks on home page
62016-06-22 Yujiro / Open enlarged Globe banner on home page with Magnific Popup
7						/ Would have used Nyromodal, but there was conflict with the Nyromodal used in the page footer
82016-04-14 Yujiro / Get News2U feeds on corporate home page
92015-09-18 Yujiro / Hide auto-recharge settings from online card request page
102015-02-27 Yujiro / All languages to Google Feed API instead of ReadExternalXML method
112014-11-12 Yujiro / SIM card top banner
122013-11-25 Yujiro / Bahasa Indonesia msg. board with blogger
132013-06-08 Yujiro / Note for IE8 and older
142013-06-04 Yujiro / AGEphone for Win top banner 
152013-05-28 Yujiro / Update business hours on Privacy policy's modal window
162013-05-23 Yujiro / Hide webphone top banners; redirect webphone to AGEphone for Windows
172013-05-13 Yujiro / Top banner New rates from mobile phones
182013-04-24 Yujiro / Update links to old cyberservice pages
192013-04-23 Yujiro / SMS top banner (por)
202013-04-22 Yujiro / Separate customer service business hours by language
212013-03-28 Yujiro (IRS top banner - get recharge code and values)
222012-09-27 Michael
232023-11-20 goto / Top banner Giveaway
24*/
25var domain = window.location.hostname;
26var lang = getLang()[0];
27var acr = getLang()[1];
28var langVerySign = getLang()[2];
29var page = getPage()[0];
30var pagegrp = getPage()[1];
31var ctgy = getPage()[2];
32iframeLoadCounter = 0;
33
34
35$(document).ready(function(){
36	if ( !$("body").hasClass(page) ) $("body").addClass(page);
37	if ( !$("body").hasClass(lang) ) $("body").addClass(lang);	
38	
39	// Adjust iframe height on SPC application pages
40	$(".SPC_applicationForm").on("load",function(){
41		
42		$(this).everyTime(250,"adjustFrmHeight",function(t){
43																	
44			if ( t == 1 )
45			{
46				$(this).css({
47					height:"auto"
48				})
49			}
50			
51			var h = this.contentWindow.document.body.scrollHeight;
52			$(this).css({
53					height:h,
54					overflow:"hidden"
55			});
56		});
57		
58		$(document).scrollTop(0);
59		
60	});
61	
62	// Hide auto-recharge settings from online card request page
63	if ( /401-30-00-0080/.test($(".space4").eq(4).find("tr").slice(0,1).html()) )
64	{
65		$(".space4").eq(4).find("tr").slice(0,5).hide();
66		// correct g.gif path
67		$("img[src$='../img/global/g.gif']").attr("src","/GenericFiles/cyber/img/common/g.gif");
68	}
69	// and from confirmation page
70	if ( /401-30-00-0180/.test($(".space2 .param1").eq(38).html()) )
71	{
72		$(".space2 .param1").eq(38).closest("tr").hide();
73	}
74	
75	// Open enlarged Globe banner on home page
76	if ( $('.globe_banner').length > 0 && typeof $(".globe_banner").magnificPopup == "function" ) {
77		$('.globe_banner').magnificPopup({
78			type: 'image',
79			mainClass: 'mfp-with-zoom', // this class is for CSS animation below
80			zoom: {
81				enabled: true, // By default it's false, so don't forget to enable it
82				duration: 300, // duration of the effect, in milliseconds
83				easing: 'ease-in-out', // CSS transition easing function
84				// The "opener" function should return the element from which popup will be zoomed in
85				// and to which popup will be scaled down
86				// By defailt it looks for an image tag:
87				opener: function(openerElement) {
88					// openerElement is the element on which popup was initialized, in this case its <a> tag
89					// you don't need to add "opener" option if this code matches your needs, it's defailt one.
90					return openerElement.is('img') ? openerElement : openerElement.find('img');
91				}
92			}
93		});
94	}
95	
96	setIfrSources(); // set header, menu and footer iframes' src
97	
98	// JS redirects:
99	var hrefProtAndDomain = "";
100	if ( /brastel\.com/.test(domain) ) hrefProtAndDomain = "https://www.brastel.com";
101	if ( page == "sms" )
102	{
103		redirect(hrefProtAndDomain+"/web/WIMS/Manager.aspx?xslFile=sms.xsl&Service=1&Style=personal&acr="+acr)
104	}
105	else if ( page == "recharge" )
106	{
107		redirect(hrefProtAndDomain+"/web/WIMS/Manager.aspx?xslFile=recharge.xsl&Service=1&Style=personal&acr="+acr)
108	}
109	else if ( page == "BrastelWebphone" )
110	{
111		redirect(hrefProtAndDomain+"/web/WIMS/Manager.aspx?xslFile=forpc.xsl&Service=1&Style=personal&acr="+acr)
112	}
113	else if ( page == "mobileDevices" )
114	{
115		redirect(hrefProtAndDomain+"/web/WIMS/Manager.aspx?xslFile=apps.xsl&Style=personal&Service=1&acr="+acr)
116	}
117	else if ( page == "intlRchg" )
118	{
119		redirect(hrefProtAndDomain+"/web/WIMS/Manager.aspx?action=ReturnIRSDestinationCountries&xslFile=irs.xsl&Style=personal&xmlPreview=countries.xml&acr="+acr)
120	}
121	
122	// Update links to old cyberservice pages
123	$("a[href*='cyber/New_Default.asp']").each(function(){
124		if ( /SPC_PhoneRegistrationForm\.aspx/.test($(this).attr("href")) ) // to phone registration
125		{
126			$(this).attr("href",hrefProtAndDomain+
127				"/"+lang+"/myaccount?redAct=ReturnRegisteredPhoneNumbers&redXsl=spc_settings_phone_registration.xsl")
128		}
129		else if ( /Cyber_SpeedDial\.aspx/.test($(this).attr("href")) ) // to speed dial
130		{
131			$(this).attr("href",hrefProtAndDomain+
132				"/"+lang+"/myaccount?redAct=ReturnSpeedDialNumbers&redXsl=spc_settings_speeddial.xsl")
133		}
134		else if ( /PinForm\.asp/.test($(this).attr("href")) ) // to PIN change
135		{
136			$(this).attr("href",hrefProtAndDomain+
137				"/"+lang+"/myaccount?redXsl=spc_settings_pin.xsl")
138		}
139		else
140		{
141			$(this).attr("href",hrefProtAndDomain+"/"+lang+"/myaccount") // Default
142		}
143	});
144	
145	// Correct links to My Account - Phone registration without redAct
146	// add redAct=ReturnRegisteredPhoneNumbers
147	$("a[href*='redXsl=spc_settings_phone_registration.xsl']").each(function(){
148		if ( !/redAct/.test($(this).attr("href")) ) // to phone registration
149		{
150			$(this).attr("href",$(this).attr("href")+"&redAct=ReturnRegisteredPhoneNumbers")
151		}
152	});	
153	
154	// SIM card top banner
155	if ( $("#output li.sim a").length > 0 )
156	{
157		var SIMimg = $("<img />").attr({
158												"src":"/GenericFiles/4.1/img/home/top_banners/sim/"+lang+"_main.jpg",
159												"alt":""
160											})
161		var SIMspan = $("<span />").css({
162												  "background-image":"url(/GenericFiles/4.1/img/home/top_banners/sim/"+lang+"_button.png)"
163												 })
164		//if ( lang == "kor" ) $("#output li.sim a").append(SIMimg,SIMspan);
165		$("#output li.sim a").append(SIMimg);
166	}
167	
168	// Prepaid SIM top banner
169	if ( $("#output li.prepaid_sim a").length > 0 )
170	{
171		var SIMimg = $("<img />").attr({
172												"src":"/GenericFiles/4.1/img/home/top_banners/brastelprepaidsim/"+lang+".jpg",
173												"alt":""
174											})
175		$("#output li.prepaid_sim a").append(SIMimg);
176	}
177	
178	// AGEphone for Windows
179	var AGEphoneWinBanner = $("#output li.AGEphone").find("a");
180	AGEphoneWinBanner.attr("href",hrefProtAndDomain+"/web/WIMS/Manager.aspx?xslFile=forpc.xsl&Style=personal&Service=1&acr="+acr)
181		.find(".button").css("background-image","url(/GenericFiles/4.1/img/home/top_banners/agephone_win/"+lang+"_button_details.png)")
182
183	// New rates from mobile phones
184	var fromMobBanner = $("#output li.rates_from_mobile").find("a");
185	//if ( lang == "jpn" )
186	//{
187	//	fromMobBanner.attr("href","http://www.brastel.com/Pages/jpn/garake/")
188	//	.find("span").css("background-image","url(/GenericFiles/4.1/img/home/top_banners/ratesfrommobile/"+lang+"_button_details.png?20140224)")
189	//}
190	//else
191	//{
192		fromMobBanner.attr("href",hrefProtAndDomain+"/web/WIMS/Manager.aspx?xslFile=rates_from_mobile.xsl&Style=landing&Service=1&acr="+acr)
193		.find("span").css("background-image","url(/GenericFiles/4.1/img/home/top_banners/ratesfrommobile/"+lang+"_button_details.png?20140224)")
194	//}
195	
196	// MyPayment top banner
197	if ( $("#output li.recharge a").length > 0 )
198	{
199		var myPaymentImg = $("<img />").attr({
200												"src":"/GenericFiles/4.1/img/home/top_banners/recharge/mypayment/"+lang+".jpg",
201												"alt":""
202											})
203		$("#output li.recharge a").append(myPaymentImg);
204	}
205	
206	//Introduce a friend campaign - Michael 2012-08-29
207	
208	$("#output li.friend-campaign").remove();
209	/*
210	var listItem=$("#output li.friend-campaign");
211	listItem.css("background-image","url(/GenericFiles/4.1/img/home/top_banners/friend2012/"+lang+"_main_bg.png)");
212	link=listItem.find("a");//the "Learn more" button
213	link.css("background-image","url(/GenericFiles/4.1/img/home/top_banners/friend2012/"+lang+"_button.png)");
214	link.attr("href","http://www.brastel.com/newsletters/2012/1208_ifc_"+lang+".html");//the static page linked to the button "learn more"
215	*/
216	
217	// SMS banner
218	if ( $("#output li.sms").length > 0 )
219	{
220		$("#output li.sms").css({"background-image":"url(/GenericFiles/4.1/img/home/top_banners/sms/"+lang+"_bg.png)"})
221			.find("a").css({"background-image":"url(/GenericFiles/4.1/img/home/top_banners/sms/"+lang+"_btn_details.png)"})
222	}
223	
224	// IRS banner (Portuguese only, but left it here just in case other languages need it) - Yujiro 2013/03/28
225	if ( $("#output li.irs").length > 0 )
226	{
227		var elem = $("#output li.irs");
228		var query = "";
229		switch(lang)
230		{
231			case "por":
232				query = "?country=B";
233				elem.css("background","url(/GenericFiles/4.1/img/home/top_banners/irs/"+lang+"_main_bg.png) no-repeat");
234				var href = "/personal/irs/"+lang+"/"+query;
235				elem.find("a.details").attr("href",href);
236				elem.click(function(){
237					document.location = href;
238				})
239				break;
240			default:
241				var irsImg = $("<img />").attr({
242											"src":"/GenericFiles/4.1/img/home/top_banners/irs/"+lang+".png",
243											"style":"width: 740px; height: 509px;"
244										});
245				$("#output li.irs a").append(irsImg);
246		}
247				
248		//Ajax to get recharge values (in yen and in local currencies)
249		/*** $.ajax({
250			type: "GET",
251			url: '/web/WIMS/Manager.aspx',
252			data:
253				({
254					xslFile: "get_irs_values.xsl",
255					xmlPreview : "irs.xml",
256					Style: 1, 
257					country: "brazil"
258				}),
259			success: function (res)
260			{
261				// from here on, for Portuguese only. For other languages, grammar adjustments and translations needed.
262				var elem = $("#output li.irs");
263				response = eval('(' + res + ')');
264				carrier = response.carriers;
265				var txt1 = "CR\u00C9DITO DE "; // "Credit of" (recharge (local) value of)
266				var txt2 = "R$"; // Local currency symbol
267				var txt3 = ",00" // decimals
268				var txt4 = "&yen"; // yen symbol
269				var htmlStr = '<div class="value">'+
270										'<div class="localValWrapper">'+
271											'<span class="creditOf">'+txt1+'</span>'+
272											'<span class="currencySymbol">'+txt2+'</span>'+
273											'<span class="localVal" />'+
274											'<span class="decimals">'+txt3+'</span>'+
275										'</div>'+
276										'<div class="yenValWrapper">'+
277											'<span class="yenSymbol">'+txt4+'</span>'+
278											'<span class="yenVal" />'+
279										'</div>'+
280										'<div class="rchgCode" />'+
281									'</div>';
282				var valArr = [];
283				valArr["por"] = [
284					{"name":"claro",	"code":331},
285					{"name":"oi",	"code":346},
286					{"name":"tim",	"code":321},
287					{"name":"vivo",	"code":311}
288				];
289				
290				$.each(carrier,function(){
291					var carrName = this.name.toLowerCase();
292					$.each(this.values,function(){
293						var code = this.code;
294						var localVal = this.localvalue;
295						var yenVal = this.yenvalue;
296						$.each(valArr[lang],function(){
297							if( this.name == carrName && this.code == code )
298							{
299								var $html = $(htmlStr);
300								$html
301									.attr("id",carrName)
302									.find(".localVal").html(localVal).end()
303									.find(".yenVal").html(yenVal).end()
304									.find(".rchgCode").html(code);
305								elem.append($html)
306							}
307						})
308					})
309				});
310			}
311		}); ***/
312		
313	}
314	
315	// Remove webphone top banner
316	$("#webphone_home").parent().remove();
317	
318	// Remove old FLIP top banner
319	if ( $("#output li.flip_top").length > 0 )
320	{
321		$("#output li.flip_top").remove();
322	}
323	// Set apps top banner bg image
324	if ( $("#output li.apps").length > 0 )
325	{
326		var elem = $("#output li.apps");
327		
328		if ( lang == "por" )
329		{
330			elem.css("background-image","url(/GenericFiles/4.1/img/home/top_banners/apps/por.jpg)");
331		}
332		else
333		{
334			elem.css("background-image","url(/GenericFiles/4.1/img/home/top_banners/apps/"+lang+".png)");
335		}
336		
337	}
338	
339	// Giveaway top banner
340	if ( $("#output li.giveaway a").length > 0 )
341	{
342		if ( lang == "kor" ) {
343			var giveAwayImg = $("<img />").attr({
344													"src":"/GenericFiles/4.1/img/home/top_banners/giveaway/jpn.png",
345													"style":"width: 740px; height: 509px;",
346													"alt":""
347												})
348
349		}
350		else {
351			var giveAwayImg = $("<img />").attr({
352													"src":"/GenericFiles/4.1/img/home/top_banners/giveaway/"+lang+".png",
353													"style":"width: 740px; height: 509px;",
354													"alt":""
355												})
356		}
357		$("#output li.giveaway a").append(giveAwayImg);
358	}
359	
360	// TOP SIM top banner
361	if ( $("#output li.topsim a").length > 0 )
362	{
363		var topSimImg = $("<img />").attr({
364			"src":"/GenericFiles/4.1/img/home/top_banners/topsim/"+lang+".png",
365			"style":"width: 740px; height: 509px;",
366			"alt":""
367		})
368		$("#output li.topsim a").append(topSimImg);
369	}
370	
371	// Change the brastel remit top banner and small banner bg image
372	// to the one with promotional rates image until the date in var remitPromUntilDate
373	// If the campaign is extended, the [lang]_main_bg_promotional.png amd remit_[lang]_prom.jpg images have to be changed too.
374	var remitPromUntilDate = new Date(2011,9,30) // Months from 0 to 11
375	var cashbackCampaignUtilDate = new Date(2013,1,28) // Months from 0 to 11 - Cashback campaign until Feb 25th 2013
376	if ( $("#output li.remit").length > 0 )
377	{
378		var nowDate = new Date();
379		if ( nowDate < cashbackCampaignUtilDate )
380		{
381			$("#output li.remit").css({
382				background:"url(/GenericFiles/4.1/img/home/top_banners/remit/cashback/"+lang+"_banner.png) no-repeat"
383			});
384		}
385	}
386	if ( $("#remitBanner").length > 0 )
387	{
388		var nowDate = new Date();
389		if ( nowDate < remitPromUntilDate )
390		{
391			$("#remitBanner").attr({
392				src:"/GenericFiles/4.1/img/home/banners/remit_"+lang+"_prom.png"
393			});
394		}
395	}
396	
397	// Show GlobalWifi banner until 2012/09/09
398	if ( $(".corp_banner.globalwifi").length > 0 )
399	{
400		$(".corp_banner.globalwifi img").load(function(){
401			var nowDate = new Date();
402			var showUntil = new Date(2012,8,10);
403			if ( nowDate < showUntil ) $(".corp_banner.globalwifi").show();
404		});
405	}
406	
407	// Set message board height to match the that of the banners on its right side.
408	$(window).load(function(){
409		if ( page=="home" && ctgy=="personal" ) setMsgBoardH();
410	});
411	
412	if ( page=="gift" )
413	{
414		var myAccUrl = hrefProtAndDomain+"/web/WIMS/Manager.aspx?style=1&service=1&xslFile=cyber_login.xsl&redXsl=spc_services_international_gift_service.xsl&redAct=ReturnGiftVoucherInfo&acr="+acr;
415		$("#bodyContent_main .simplelist li a").attr({"href":myAccUrl,"target":"_myaccount"});
416		if ( lang=="jpn") $("#bodyContent_main li a").attr({"href":myAccUrl,"target":"_myaccount"});
417	}
418	
419	if ( page == "about" )
420	{
421		if (lang == "eng" )
422		{
423			$("table.factsfigures td:odd").each(function(){
424				var _html = $(this).html();
425				_html = _html.replace("03‐5637‐5900","050-6860-1900");
426				$(this).html(_html)
427			});
428		}
429		else if (lang == "jpn" )
430		{
431			$("#bodyContent_main table td:odd").each(function(){
432				var _html = $(this).html();
433				_html = _html.replace("03‐5637‐5490","050-6860-1900");
434				$(this).html(_html)
435			});
436		}
437	}
438	
439	$("#ifrFooterPrivacy").css("display","none");
440	if ( window.parent.location == window.location ) window.name = "brMain"; // Name window
441	
442	if ( !$("body").hasClass(lang) ) $("body").addClass(lang);
443	
444	var showImtSurvey = false;
445	
446	if ( $("#ifrHeader").length > 0 && showImtSurvey )
447	{
448		var parentDiv = $("div.corp_banner:first").parent("div");
449		$("div.corp_banner:visible").each(function(i){
450			if ( i > 1 )
451			{
452				$(this).hide();
453			}
454		});
455		var src = "/web/WIMS/Manager.aspx?xslFile=survey_imt.xsl&Service=1&Style=1&acr="+acr;
456		$('<iframe id="imt_survey" height="130" width="230" scrolling="no" frameborder="0" />')
457			.attr("src",src)
458			.css("margin-bottom","10px")
459			.prependTo(parentDiv);
460	}
461	
462	// Set css lang
463	$("#langCss").attr("href", "//" + domain + "/GenericFiles/4.0/css/styles_"+ lang /*cssLang*/ + ".css")
464	$("#fontsCss").attr("href", "//" + domain + "/GenericFiles/4.0/css/fonts/fonts_"+ lang /*cssLang*/ + ".css")
465	
466	// Remove border from links when clicked or focused
467	var links = document.getElementsByTagName("a");
468	for (var i = 0; i < links.length; i++) { 
469		links[i].onfocus=function(){this.blur()}
470	}
471	
472	$('.hdg2Link').click(function(){
473		var $h2Contents = $(this).next("div.hdg2ContentsHidden");
474		var $target = $(this);
475		var $target2 = $("h2:first");
476		if ($h2Contents.is(":visible")){
477			$h2Contents.animate({opacity:0}
477,500).slideUp(500,function(){
478				if ( $target2.is(":above-the-top") ){
479					$.scrollTo($target2,700);}
480			}).animate({opacity:1},500);}
481		else
482			{
483				if ($("div.hdg2ContentsHidden:visible").length)
484					{	
485						var $visibleDiv = $("div.hdg2ContentsHidden:visible");
486						var $indexOfClicked = $("h2.hdg2Link").index(this);
487						var $prevH2 = $("div.hdg2ContentsHidden:visible").prevAll(".hdg2Link:first");
488						var $indexOfVisible = $("h2.hdg2Link").index($prevH2) ;
489						var $visibleDivHeight = $visibleDiv.height();
490						var $h2ContentsHeight = $h2Contents.height();
491						
492						if ( $indexOfClicked > $indexOfVisible )
493							{
494								var $nextTitles = $visibleDiv.nextAll("h2.hdg2Link");
495								
496								if ($visibleDivHeight>$h2ContentsHeight)
497									{
498										var $difference = $visibleDivHeight - $h2ContentsHeight;
499										$("div#adjuster").height($difference).animate({opacity:1},500).show(1);
500									}
501								
502								$nextTitles.animate({opacity:0},500);
503								$(this).animate({opacity:0}
503,500).animate({opacity:1},500);
504								$visibleDiv.animate({opacity:0},500).hide(1).animate({opacity:1},500);
505								$h2Contents.animate({opacity:0},500).show(1);
506								$("h2.hdg2Link:first").fadeTo(1000,1,function(){
507									$.scrollTo($target,500);
508									$("h2.hdg2Link:first").fadeTo(500,1,function(){
509										$h2Contents.animate({opacity:1},500);
510										$("h2.hdg2Link").animate({opacity:1},500);
511										$("div#adjuster").hide(1000);
512									});
513								});
514							}
515						else
516							{
517								$h2Contents.fadeIn(500);
518								$visibleDiv.hide();
519							}							
520					}
521				else
522					{
523						$h2Contents.fadeIn(500);
524					}
525			}
526	});
527	
528	// close special holidays calendar
529	$("div.specialHolidaysP img.close").live("click",function() {
530		$("div.specialHolidaysP").slideUp();
531	});
532	// close customer service language menu
533	$("div#csvLangMenu img.close").live("click",function() {
534		$("div#csvLangMenu").slideUp();
535	});
536	
537	// show brastel location menu
538	if (typeof SWFAddress != 'undefined') {
539		 // variable is undefined
540		var hashval = SWFAddress.getValue().replace(/\/*(.*)\/*/,"$1");
541		var selectedLocation = $.cookie("brastel_selected_loc");
542		if ( hashval == "location" && !selectedLocation ) {
543			$("body").prepend('<div id="selCountrySpacer"></div><div id="selectCountry"><div class="_wrapper"><img src="/GenericFiles/4.0/img/country_sel/logo.png" alt="Brastel Telecom" class="logo" /></div></div>');
544			$("div#selectCountry div._wrapper").append('<img class="text" src="/GenericFiles/4.0/img/country_sel/select_location.png" alt="Select your location" />');
545			$("div#selectCountry div._wrapper").append('<div class="buttons"></div>');
546	
547			var buttons = '<div id="selCountryHelpBtn" class="btnHelp"></div>' +
548			//'<div id="selectUSA" class="button"></div>' +
549			'<div id="selectBrazil" class="button"></div>' +
550			'<div id="selectJapan" class="button"></div>';
551			$("div#selectCountry div._wrapper div.buttons").append(buttons);
552			
553			$("body").append('<div id="opaqueBg"></div>');
554			$("div#opaqueBg").animate({opacity:0}
554);
555			var bodyHeight = $("body").outerHeight();
556			var selCountryHeight = $("div#selectCountry").height();
557			
558			$(document).oneTime(6000,function(){
559				$("div#selectCountry").slideDown();
560				$("div#selCountrySpacer").slideDown();
561				$("div#header_bg").slideUp();
562				$("div#opaqueBg").oneTime(700,function(){
563				$(this).show().css({"top":selCountryHeight+1,"height":bodyHeight-selCountryHeight}).animate({opacity:0.7},500);
564				});
565			});
566			
567			var helpHtml = 	'<div id="selCountryHelp">'+
568								'<div class="_wrapper">'+
569									'<img class="arrowUp" src="/GenericFiles/4.0/img/country_sel/arrow_up.png" alt="">'+
570									'<img class="close" src="/GenericFiles/4.0/img/common/close.png" alt="" />'+
571									'<div class="contents">'+
572										'<p class="text">Select the country where your Brastel Card was issued.<br />'+
573										'If you do not have a Brastel Card yet, select the country where you reside.</p>'+
574										'<div class="langMen">'+
575											'<div class="menu selected eng">English<span>Select the country where your Brastel Card was issued.<br />If you do not have a Brastel Card yet, select the country where you reside.</span></div>'+
576											'<div class="menu por">Português<span>Selecione o país onde seu Cartão Brastel foi emitido.<br />Se você ainda não possui um Cartão Brastel, selecione o país onde você mora.</span></div>'+
577											'<div class="menu jpn">日本語<span>現在お住まいの国またはブラステルカードの発行国をお選びください。</span></div>'+
578											'<div class="menu ind">Indonesia<span>Pilih negara dimana Kartu Brastel anda diterbitkan.<br />Jika anda belum memiliki Kartu Brastel, pilih negara dimana anda bertempat tinggal.</span></div>'+
579											'<div class="menu esp">Español<span>Seleccione el país donde su Brastel Card fue emitida. <br />i aún no tiene una Brastel Card, seleccione el país en donde reside.</span></div>'+
580											/*'<div class="menu chi">中國語<span></span></div>'+*/
581											'<div class="menu rus">Русский<span>Выберите страну, в которой Вы приобрели карточку Брастел. Если у Вас еще нет карточки Брастел, выберите страну проживания.</span></div>'+
582											'<div class="menu tha">ไทย<span>เลือกประเทศที่คุณทำการออกบัตรบรัสเทล<br />หากคุณยังไม่มีบัตรบรัสเทล กรุณาเลือกประเทศที่คุณอาศัยอยู่</span></div>'+
583											'<div class="menu kor">한국어<span>브라스텔 카드가 발행된 국가를 선택해 주십시오.<br />브라스텔 카드가 없는 고객은 거주하고 계신 국가를 선택해 주십시오.</span></div>'+
584											'<div class="menu tag">Tagalog<span>Piliin ang bansa kung saan ang inyong Brastel Card ay na-issue.<br />Kung kayo ay wala pang Brastel Card, piliin lamang ang bansa kung saan kayo ay naninirahan.</span></div>'+
585											/*'<div class="menu vie">Tiếng Việt<span></span></div>'+*/
586											/*'<div class="menu fre">Français<span></span></div>'+*/
587											/*'<div class="menu rom">Română<span></span></div>'+*/
588											/*'<div class="menu tur">Türkçe<span></span></div>'+*/
589										'</div>'+
590									'</div><br style="clear:both" />'+
591								'</div>'+
592							'</div>';
593			$("body").append(helpHtml);
594			$("div#selCountryHelp").css({"top":selCountryHeight-8});
595		}
596		else if ( hashval == "location" && selectedLocation == "br" ) {
597			$.cookie("brastel_selected_loc","br", {expires: 365, path: '/'});
598			window.location.href = ("http://www.brastel.com.br/")
599		}
600		else if ( hashval == "location" && selectedLocation == "us" ) {
601			$.cookie("brastel_selected_loc","us", {expires: 365, path: '/'});
602			window.location.href = ("http://www.brastel.net/")
603		}
604		else {
605			$.cookie("brastel_selected_loc","jp", {expires: 365, path: '/'});
606		}
607	}
608		
609	$("div#opaqueBg").click(function(){
610		hideCountrySel();
611		$.cookie("brastel_selected_loc","jp", {expires: 365, path: '/'});
612	});
613	
614	$("div#selCountryHelpBtn").click(function(){
615		$("div#selCountryHelp").fadeIn();
616	});
617	$("#selCountryHelp .menu").mouseover(function(){
618		var txt = $(this).find("span").html();
619		$("#selCountryHelp p.text").animate({opacity:0},150).oneTime(150,function(){
620			$(this).html(txt).animate({opacity:1},1)
621		});
622		$("#selCountryHelp .menu.selected").toggleClass("selected");
623		$(this).toggleClass("selected");
624	});
625	$("#selCountryHelp img.close").click(function(){
626		$("div#selCountryHelp").hide();
627	});
628	
629	//Set event gallery iframe src
630	var eventGalleryIfrSrc = "http://" + domain + "/web/WIMS/Manager.aspx?xslFile=event_gallery.xsl&xmlPreview=event_gallery.xml&Style=1&Service=1&acr=" + acr;
631	$("iframe#eventGalleryIfr").attr("src",eventGalleryIfrSrc)
632	
633
634	$("img[src$='mobile1.jpg']").parent().css("position","relative").append('<img src="/GenericFiles/4.0/img/common/mobile/sold_out.png" alt="sold out" class="soldOut" /><img src="/GenericFiles/4.0/img/common/mobile/sold_out.png" alt="sold out" class="soldOut2" />');
635	
636	if ($("img[src$='FlipPhoneACT.jpg']").length > 0)
637	{
638		var actImgParent = $("img[src$='FlipPhoneACT.jpg']").parent()[0].nodeName.toLowerCase();
639		if ( actImgParent = "a" )
640		{
641			$("img[src$='FlipPhoneACT.jpg']").parent().css({"position":"relative","display":"block"}).append('<img src="/GenericFiles/4.0/img/common/mobile/sold_out.png" alt="sold out" class="soldOutACT" />');
642		}
643		else
644		{
645			$("img[src$='FlipPhoneACT.jpg']").parent().css("position","relative").append('<img src="/GenericFiles/4.0/img/common/mobile/sold_out.png" alt="sold out" class="soldOutACT" />');
646		}
647		$("img.soldOutACT").css({
648			"position":"absolute",
649			"top":"45px",
650			"left":"50px",
651			"border":"0"
652		});
653	}
654	if ($("img[src$='FlipPhone_.jpg']").length > 0)
655	{
656		var actImgParent = $("img[src$='FlipPhone_.jpg']").parent()[0].nodeName.toLowerCase();
657		if ( actImgParent = "a" )
658		{
659			$("img[src$='FlipPhone_.jpg']").parent().css({"position":"relative","display":"block"}).append('<img src="/GenericFiles/4.0/img/common/mobile/sold_out.png" alt="sold out" class="soldOutFlipPhone" />');
660		}
661		else
662		{
663			$("img[src$='FlipPhoneACT.jpg']").parent().css("position","relative").append('<img src="/GenericFiles/4.0/img/common/mobile/sold_out.png" alt="sold out" class="soldOutFlipPhone" />');
664		}
665		$("img.soldOutFlipPhone").css({
666			"position":"absolute",
667			"top":"45px",
668			"left":"50px",
669			"border":"0"
670		});
671	}
672	
673	// Set FLIP, Webphone, Brastel Mobile rates iframe source
674	if ($("iframe.ratesIfr").length > 0)
675	{
676		setRatesIfrSrc(acr);
677	}
678	if ( $("iframe.smsIfr").length > 0 )
679	{
680		$("iframe.smsIfr").attr("src","/web/WIMS/Manager.aspx?xslFile=sms.xsl&Service=1&Style=1&xmlPreview=sms.xml&acr="+acr);
681	}
682	
683	if ( page == "spcrates" )
684	{
685		$("#bodyContent_main iframe").attr("height",1300)
686	}
687	
688	if ( lang == "jpn" && page == "home" )
689	{
690		var dateFrom = new Date();
691		var dateUntil = new Date();
692		dateFrom.setFullYear(2010,10,29);
693		dateUntil.setFullYear(2010,11,25);
694		var today = new Date();
695		
696		if ( today >= dateFrom && today <= dateUntil )
697		{
698			$("div.corp_banner.igsXmas").show()
699		}
700	}
701	
702	var xMas = xMasSeason();
703	var newYear = newYearSeason();
704	if ( xMas )
705	{
706		$("div#header_bg").css({
707			"background-image": 'url("/GenericFiles/4.1/img/common/bg_sprite_x.png?131224")',
708			"background-position":"0 -150px"
709		})
710	}
711	if ( newYear )
712	{
713		$("div#header_bg").css({
714			"background-image": 'url("/GenericFiles/4.1/img/common/bg_sprite_x.png?140101")',
715			"background-position":"0 -300px"
716		})
717	}
718	
719	// Replace "www2" with "www" in all links
720	$("a").each(function(){
721		if ( $(this).attr("href") )
722		{
723			var _href = $(this).attr("href").replace("www2\.brastel","www\.brastel");
724			$(this).attr("href",_href);
725		}
726		if ( $(this).attr("onclick") )
727		{
728			var _onclick = $(this).attr("onclick").replace("www2\.brastel","www\.brastel");
729			$(this).attr("onclick",_onclick);
730		} 
731	});
732	// Replace "www2" with "www" in all links within iframes
733	$("iframe").each(function(i){
734		var oldsrc=$(this).attr("src");
735		var newifrsrc = (oldsrc) ? oldsrc.replace(/.*www\d*\.brastel\.com/,"") : "";
736		$(this).attr("src",newifrsrc);
737		$(this).load(function(){
738			$(this).contents().find("a").each(function(i){
739				if ( $(this).attr("href") )
740				{
741					var _href = $(this).attr("href").replace("www2\.brastel","www\.brastel");
742					$(this).attr("href",_href);
743				}
744				if ( $(this).attr("onclick") )
745				{
746					var _onclick = $(this).attr("onclick").replace("www2\.brastel","www\.brastel");
747					$(this).attr("onclick",_onclick);
748				} 
749			});
750		});
751	});
752	
753	// to adjust "how to call from other countries" iframe height
754	var pageHref = window.location.href;
755	if (/itfs_rates\.aspx/i.test(pageHref))
756	{
757		$("#bodyContent_main iframe",top.document).attr("height",3300);
758	}
759	
760	// Gets the href attribute of all <a> tags with class openNewWindow and calls popUp() to open a new window.
761	// The new window name is the last class name that ends with an underscore (_), or "_blank" is none
762	$(".openNewWindow").click(function(e){
763		e.preventDefault();
764		var url = $(this).attr("href");
765		var elemClass = $(this).attr("class");
766		var windowName = /_/.test(elemClass) ? elemClass.replace(/.*(_\S*)\s*.*/,"$1") : "_blank";
767		popUp(url,windowName,"");
768	});
769	
770	// Special message on home page
771	if ( page == "home" )
772	{
773		$.ajax({
774		  url: "/ajax/ajax/"+lang,
775		  data: {
776			  msg_check: "check",
777			  callbackfn: "splMsgCheckCallBack"
778		  },
779		  dataType: "jsonp"
780		});
781	}
782	
783	// Kumamoto donations banner
784	// Show earthquake condolences until 2012/07/31
785	/*
786	if ( page == "home" && parent.document.location == document.location )
787	{
788	*/
789		/**
790		* Function that tracks a click on an outbound link in Analytics.
791		* This function takes a valid URL string as an argument, and uses that URL string
792		* as the event label. Setting the transport method to 'beacon' lets the hit be sent
793		* using 'navigator.sendBeacon' in browser that support it.
794		*/		
795	/*
796		var trackOutboundLink = function(url,category) {
797			ga('send', 'event', category, url, lang, {
798			  'transport': 'beacon',
799			  'hitCallback': function(){document.location = url;}
800			});
801		}
802		
803		var donations = $('<a id="donationsToRedCross" target="rcj" />');
804		var _link = "http://www.jrc.or.jp/english/relief/160420_004225.html";
805		if ( lang == "jpn" || lang == "kor" || lang == "chi" ) _link = "http://www.jrc.or.jp/contribute/help/28/"
806		donations.attr({
807			"href":_link,
808			"onclick": "trackOutboundLink('"+_link+"','Home page outbound links'); return false;"
809		});
810		
811		var rcj = $('<img src="/GenericFiles/4.1/img/home/banners/rcj.jpg" alt="Red Cross Japan" />');
812		var t_jpn = $('<span class="t_jpn" />').text("平成28年熊本地震災害義援金のご協力をお願い致します。");
813		var t_eng = $('<span class="t_eng" />').text("You can help the victims of the 2016 Kumamoto Earthquake. Click here to donate.");
814		var span = $('<span />').append(t_jpn,'<br />',t_eng);
815		donations.append(rcj,span)
816		$("#bodyContent").prepend(donations)
817		
818		var dateNow = new Date();
819		var until = new Date(2012,7,1);
820		if ( dateNow < until )
821		{
822			var condolenceTxt = [];
823			condolenceTxt["por"] =  "O prazo das doações para as vítimas do terremoto que ocorreu na região nordeste do Japão se encerra "+
824											"em 31 de julho de 2012. A Brastel e seus funcionários gostariam de expressar sua sincera gratidão a "+
825											"todos os clientes que apoiaram esta campanha.";
826			condolenceTxt["esp"] =  "Las donaciones para los damnificados del \"Terremoto de la Costa del Pacífico en la Región de "+
827											"Tohoku\" serán aceptadas hasta el 31 de julio de 2012.  Tanto Brastel como sus funcionarios, "+
828											"deseamos expresar nuestro sincero agradecimiento por su apoyo.";
829			condolenceTxt["jpn"] = 	"東日本大震災支援プロジェクト「ALL FOR JAPAN,JAPAN FOR ALL」の義援金受付を2012年7月31日を持ちまして終了いたします。"+
830											"ご協力いただきまして誠にありがとうございます。ブラステル一同、心よりお礼申し上げます。";
831			condolenceTxt["eng"] = 	"Donation acceptance for the Northeastern Pacific Coast Earthquake will end on July 31st 2012. "+
832											"Brastel and its staff would like to express our sincere appreciation for the kind support.";
833			condolenceTxt["tag"] = 	"Ang pagtanggap ng donation para sa Norteastern Pacific Coast Earthquake ay hanggang July 31, 2012 "+
834											"na lamang. Ang Brastel at buong staff nito ay lubos na nagpapasalamat sa inyong taos pusong "+
835											"pagsuporta.";
836			condolenceTxt["chi"] = 	"有關東北・關東大地震的捐款將於2012年7月31日截止。 感謝您熱心的支持, 博朗思特全體同仁致上最高敬意。";
837			condolenceTxt["kor"] = 	"동북지방 태평양 지진에 대한 기증을 2012년 7월 31일로 종료하겠습니다.<br />"+
838											"브라스텔 일동은 기부에 참여해 주신 고객분께 깊은 감사의 마음을 표합니다.";
839			condolenceTxt["tha"] = 	"ใน วันที่ 31 กรกฏาคม 2555 นี้ จะสิ้นสุดการรับบริจาคเงินช่วยเหลือผู้ประสบภัยจากเหตุการณ์แผ่นดินไหว และ "+
840											"คลื่นสึนามิทางภาคตะวันออกเฉียงเหนือชายฝั่งแปซิฟิกของประเทศญี่ปุ่น "+
841											"ทางบริษัทบรัสเทลและพนักงาน ขอขอบพระคุณด้วยความจริงใจกับผู้บริจาคทุกท่านที่ได้ร่วมกันบริจาคเงินเพื่อ ช่วยเหลือผู้ประสบภัยในครั้งนี้";
842			condolenceTxt["rus"] = 	"Принятие пожертвований в помощь пострадавшим от "+
843											"Северо-Восточного землетрясения Тиоокеанского побережья "+
844											"закончится 31 июля 2012 года.Сотрудники компании Брастел "+
845											"выражают сердечную признательность за поддержку в "+
846											"данной акции.";
847			condolenceTxt["vie"] = 	"Hạn cuối nhận quyên góp cho các nạn nhân động đất tại vùng Đông Bắc Thái Bình Dương là: 31/07/2012. "+
848											"Chúng tôi xin tỏ lòng biết ơn chân thành đến các các tấm lòng hảo tâm.";
849			condolenceTxt["ind"] = 	"Penerimaan donasi untuk Gempa Timur Laut Pasifik akan berakhir pada 31 Juli 2012. Brastel "+
850											"beserta staf ingin menyampaikan rasa terima kasih yang sebesar-besarnya atas semua dukungan anda.";
851			condolenceTxt["fre"] = 	"L'Acceptation de dons pour le séisme de la côte Pacifique Nord-Est prendra fin le 31 Juillet 2012. "+
852											"Brastel et son personnel tiennent à exprimer leur sincère gratitude pour le soutien apporté.";
853		
854			$('<div class="condolences before" />').html(condolenceTxt[lang]).insertBefore("#feature_list");
855		}
856		else
857		{
858			$("#output .donation").remove();
859		}
860	}
861	// Donations link
862	if ( $("#output li.donation").length > 0 )
863	{
864		showDonationsLink();
865		$("div.condolences").live("click",function(){
866			openDonationPage();
867			pageTracker._trackPageview('/clicks/home/top_banner/'+lang+'/earthquake_donations_text_msg');
868		});
869		$("li.donation").click(function(){
870			openDonationPage();
871			pageTracker._trackPageview('/clicks/home/top_banner/'+lang+'/earthquake_donations_banner');
872		});
873	}
874	*/
875	
876	// Add top banner navigation buttons on the bottom-right corner.
877	// For each <li> in ul#output, it adds a <li> to ul#tabs
878	if ( $("#output").length > 0 )
879	{
880		$("#tabs").html("");
881		$("#output li").each(function(i){
882			var a = $('<a class="navIndex" href="javascript:void(0);" />').text(i+1);
883			var li = $('<li />').append(a);
884			$("#tabs").append(li);
885		});
886	}
887	// for Home page featureList
888	if ( $("#tabs li a").length > 0 )
889	{
890		$('#tabs li a').featureList({
891			output				:	'#output li',
892			start_item			:	0,
893			transition_interval	: 	18000,
894			first_interval		:	18000
895		});
896	}
897	
898	// Corporate page footer, change phone number.
899	if ( ctgy == "business" )
900	{
901		if ( $("#ifrFooter").length > 0 )
902		{
903			$("#ifrFooter").load(function(){
904				var elem = $("#phoneNumbers #jpn .fax");
905				elem.html("03-6277-7300");
906				$("#ifrFooter").contents().find("#fax").html("03-6277-7300");
907			});
908		}
909	}
910	
911	if ( lang == "jpn" && page == "home" )
912	{
913		var a = $(".corp_banner.newRatesFromMob").find("a");
914		var _href = a.attr("href");
915		a.attr("href",hrefProtAndDomain+_href);
916	}
917		
918	// Message board with Google Feed after ReadExternalXML broke
919		// Edit message board HTML
920		if ( $("#msgBoard").length == 0 && page == "home" && ctgy == "personal" )
921		{
922			//if ( lang != "jpn" )
923			//{
924				var msgBoardTitle = $("#bodyContent_main2").find("h3").text();
925				var msgBoardDiv = $('<div id="msgBoard" />');
926				var msgBoardTitleDiv = $('<div class="msgBoardTitle" />').text(msgBoardTitle);
927				var msgBoardFeedsDiv = $('<div id="msgBoardFeeds" />');
928				msgBoardDiv.append(msgBoardTitleDiv,msgBoardFeedsDiv)
929				$("#bodyContents").after(msgBoardDiv).remove();
930			//}
931		}
932		if ( page == "home" && ctgy == "personal" ) messageBoard();
933		
934	
935	// Adjust ITFS iframe's height
936	if ( page == "fromOther" && !/192\.168/.test(domain) )
937	{
938		$(document).everyTime(200,function(){
939			var ifrContentsHeight = $("#bodyContent_main iframe").contents().height();
940			$("#bodyContent_main iframe").css("height",ifrContentsHeight)
941		})
942	}
943	
944	// Correct Gunma branch fax number
945	$(".factsfigures tr:last-child td:last-child").each(function(){
946		$(this).html($(this).html().replace("050-6860-2073","050-6860-1694"))
947	})
948	
949	// Replace "Emobile" and "Willcom" with "Y!mobile"
950	$(".hdg2Link").next("div").html(
951		function(){
952			return $(this).html().replace(/emobile(?!\/)|[^\/]willcom|イー・モバイル|ウィルコム/gi,"Y!mobile");
953		}
954	);
955	
956	// If corporate home page, get News2U feeds
957	if ( lang == "jpn" && page == "home" )
958	{		
959		$.ajax({
960			type:			"GET",
961			url: 			"/web/WIMS/Manager.aspx",
962			dataType:	"json",
963			data:({
964				xslfile:		"feed_reader.xsl",
965				action:		"ReadExternalXML",
966				style:		"Ajax",
967				url:			"http://www.news2u.net/feed/corporations/CR2006663",
968				service:		"1",
969				site:			"news2u"
970			}),
971			success: function(response)
972			{
973				news2U_feeds(response);
974			}
975		});
976		
977		$(".corp_news, #news2u").on("click", ".openNews2U", function(e){
978			e.preventDefault();
979			var url = $(this).attr("href");
980			popUp(url,"news2u")
981		});		
982	}
983	
984}); //-- $(document).ready end
985
986// Parses response from YQL and displays the News2U feeds
987function news2U_feeds(o){ 
988	var items = o.feed;  
989	var no_items=items.length;  
990	var table = $('<table class="updatesTbl newsReleases" cellpadding="0" cellspacing="0" />');
991
992	for(var i=0;i<no_items;i++){  
993		// Feed info
994		var title = items[i].title; // feed title
995		var feedUrl = items[i].feed_href; // feed link
996		var date = items[i].pubDate; // feed date
997		
998		// Build <tr /> and append to table
999		var tr = $('<tr class="feedRow" />'); 
1000		var td_date = $('<td class="date">'+moment(date).format("YYYY/MM/DD")+'</td>');
1001		var td_feed = $('<td class="feed" />');
1002		var a = $('<a class="openNews2U" />').attr("href",feedUrl).html(title);
1003		td_feed.append(a);
1004		tr.append(td_date,td_feed);
1005		table.append(tr);
1006	}
1007	$("#loadingFeeds").hide();
1008	// Append table to div#news2u
1009	$("#news2u").append(table)
1010} 
1011
1012function getFeeds(subDomain)
1013{
1014	/*
1015		Get message board feeds in JSON format from Blogger
1016	*/
1017	
1018	var d = new Date();
1019	var t = d.getTime();
1020		
1021	var bloggerSubdomain = subDomain + "-english";
1022	switch(lang){
1023		case "ind": bloggerSubdomain = subDomain + "-bahasaindonesia"; break;
1024		case "rus": bloggerSubdomain = subDomain + "-russian"; break;
1025		case "por": bloggerSubdomain = subDomain + "-portuguese"; break;
1026		case "esp": bloggerSubdomain = subDomain + "-spanish"; break;
1027		case "tag": bloggerSubdomain = subDomain + "-tagalog"; break;
1028		case "chi": bloggerSubdomain = subDomain + "-chinese"; break;
1029		case "kor": bloggerSubdomain = subDomain + "-korean"; break;
1030		case "tha": bloggerSubdomain = subDomain + "-thai"; break;
1031		case "vie": bloggerSubdomain = subDomain + "-vietnamese"; break;
1032		case "jpn": bloggerSubdomain = subDomain + "-japanese"; break;
1033	};
1034	
1035	var max_results = 30;
1036	
1037	var yql = "https://"+bloggerSubdomain+".blogspot.com/feeds/posts/default?alt=json&callback=bloggerCallBack&max-results="+max_results+"&ts="+t;
1038	
1039	$.ajax({
1040		type:			"GET",
1041		url: 			yql,
1042		dataType:	"jsonp"
1043	});
1044	
1045}
1046
1047function bloggerCallBack(json)
1048{
1049	
1050	var container = $("#msgBoardFeeds");
1051	//if ( lang == "jpn" )
1052	//{
1053	//	container = $("#tabs-1");
1054	//}
1055	var table = $('<table class="updatesTbl" />');
1056	
1057	var items = json.feed.entry;  
1058	var no_items=items.length; 
1059	
1060	for (var i = 0; i < no_items; i++)
1061	{
1062		var tr = $('<tr class="feedRow" />');
1063		var entry = items[i];
1064		var td_date = $('<td class="date">'+moment(entry.published.$t).format("YYYY/MM/DD")+'</td>');
1065		var td_feed = $('<td class="feed" />');
1066		var div_ctgy = $('<div class="ctgy" />');
1067		var div_title = $('<div class="feedTitle" />').html(entry.title.$t);
1068		var div_titleWrap = $('<div class="titleWrapper" />').append(div_ctgy, div_title);
1069		
1070		var _content = entry.content.$t;
1071				
1072		var feedCont = $('<div style="margin-top:0.5em;" />').html(_content)					
1073		var div_cont = $('<div class="feedContent" />').html(feedCont).append('<span class="feedEnd" />');
1074		
1075		var categoryArr = []; // Array to store the post's categories
1076		
1077		if ( typeof entry.category != "undefined" ) // Users sometimes leave the category field blank
1078		{
1079			$.each( entry.category, function( index, obj ) {
1080				categoryArr.push(obj.term)
1081			});
1082		}
1083		
1084		var postHasCtgyBrastel = $.inArray('Brastel',categoryArr) != -1;
1085		
1086		if ( (lang == "jpn" && postHasCtgyBrastel) || lang != "jpn" )
1087		{
1088			td_feed.append(div_titleWrap, div_cont);
1089			tr.append(td_date,td_feed);
1090			table.append(tr);
1091		}
1092	}
1093	container.append(table)
1094	
1095}
1096
1097function fillMsgBoard(o,site)
1098{
1099	var container = $("#msgBoardFeeds");
1100	//if ( lang == "jpn" )
1101	//{
1102	//	container = $("#tabs-1");
1103	//}
1104	var table = $('<table class="updatesTbl" />');
1105	
1106	var items = o.query.results.item;  
1107	var no_items=items.length; 
1108	
1109	
1110	for (var i = 0; i < no_items; i++)
1111	{
1112		var tr = $('<tr class="feedRow" />');
1113		var entry = items[i];
1114		var td_date = $('<td class="date">'+moment(entry.pubDate).format("YYYY/MM/DD")+'</td>');
1115		var td_feed = $('<td class="feed" />');
1116		var div_ctgy = $('<div class="ctgy" />');
1117		var div_title = $('<div class="feedTitle" />').html(entry.title);
1118		var div_titleWrap = $('<div class="titleWrapper" />').append(div_ctgy, div_title);
1119		
1120		var _content = site == "blogger" ? entry.description : entry.encoded;
1121		_content = _content.replace(/\<a rel="nofollow".*\/\>$/,"");
1122		
1123		var feedCont = $('<div style="margin-top:0.5em;" />').html(_content)					
1124		var div_cont = $('<div class="feedContent" />').html(feedCont).append('<span class="feedEnd" />');
1125		
1126		td_feed.append(div_titleWrap, div_cont)
1127		tr.append(td_date,td_feed)
1128		table.append(tr)
1129	}
1130	container.append(table)
1131}
1132
1133
1134function messageBoard()
1135{
1136	// Load Blogger feeds for msg. board
1137	getFeeds("brastel-msgboard");
1138	
1139	//if ( lang != "jpn" )
1140	//{
1141		// Show hide feed content
1142		$("body").on("click","#msgBoardFeeds tr.feedRow",function(){
1143			var row = $(this);
1144			var scrollH = $("#slides").height();
1145			row.find(".feedContent").slideToggle(200,function(){
1146				row.toggleClass("sel");
1147				$("#msgBoardFeeds").scrollTo(row,100,{easing:"linear"})
1148			});
1149			
1150			
1151			//$(this).siblings(".sel").find(".feedContent:visible").slideUp(200).end().removeClass("sel");
1152			
1153			$(this).siblings(".sel").find(".feedContent:visible").hide().end().removeClass("sel");
1154			
1155		})
1156	//}
1157	//else
1158	//{
1159		// Show hide feed content
1160		//$("body").on("click","#tabs-1 tr.feedRow",function(){
1161		//	var row = $(this);
1162		//	var scrollH = $("#slides").height();
1163		//	row.find(".feedContent").slideToggle(200,function(){
1164		//		row.toggleClass("sel");
1165		//		$("#tabs-1").scrollTo(row,100,{easing:"linear"})
1166		//	});
1167		//	$(this).siblings(".sel").find(".feedContent:visible").hide().end().removeClass("sel");
1168		//})
1169	//}
1170}
1171
1172function redirect(url)
1173{
1174	window.location.replace(url);
1175}
1176
1177function xMasSeason()
1178{
1179	var dateFrom = new Date();
1180	var dateUntil = new Date();
1181	dateFrom.setFullYear(2014,11,8);
1182	dateUntil.setFullYear(2014,11,31);
1183	var today = new Date();
1184	
1185	if ( today >= dateFrom && today <= dateUntil )
1186	{
1187		return true;
1188	}
1189	else
1190	{
1191		return false;
1192	}
1193}
1194function newYearSeason()
1195{
1196	var dateFrom = new Date();
1197	var dateUntil = new Date();
1198	dateFrom.setFullYear(2015,0,1);
1199	dateUntil.setFullYear(2015,0,15);
1200	var today = new Date();
1201	
1202	if ( today >= dateFrom && today <= dateUntil )
1203	{
1204		return true;
1205	}
1206	else
1207	{
1208		return false;
1209	}
1210}
1211
1212function setRatesIfrSrc(acr)
1213{
1214	var ifrsrc = "/web/WIMS/Manager.aspx?xslFile=rates.xsl&Style=1";
1215	var acr = "&acr="+acr;
1216	var rateSystemCode = "&rateSystemCode=";
1217	var subSystem = "";
1218	var dest = getParamVal("dest") == "" ? "" : "&dest="+getParamVal("dest");
1219	if ( page == "ratesWebphone" ) rateSystemCode += "SPCWEBINT";
1220	else if ( page == "ratesFlip" ) rateSystemCode += "SPCFLIP";
1221	else if ( page == "bmobilerates" ) rateSystemCode += "SPCEMC";
1222	else if ( page == "ratesAppsForSmartphones" )
1223	{
1224		rateSystemCode += "SPCWEBINT";
1225		subSystem = "&sub=app";
1226	}
1227	
1228	$("iframe.ratesIfr").attr("src",ifrsrc+acr+rateSystemCode+subSystem+dest);
1229}
1230function hideCountrySel(){
1231	$("div#selCountryHelp").hide();
1232	$("div#opaqueBg").animate({opacity:0}
1232,500).hide()
1233	$("div#selectCountry").slideUp();
1234	$("div#selCountrySpacer").slideUp();
1235	$("div#header_bg").slideDown();
1236}
1237
1238function setIfrSources()
1239{
1240	var langParam = "lang=" + lang;
1241	var acrParam = "acr=" + acr;
1242	var langVerySignParam = "lang=" + langVerySign;
1243	var pageParam = "page=" + page;
1244	//var pagegrpParam = "pagegrp=" + pagegrp;
1245	var categoryParam = "category=" + ctgy;
1246	
1247	function previewMode() {
1248		if (getParentParamNames()[0] == "qsPageCD") return true; else return false;
1249	}
1250	
1251	var inPreviewMode = previewMode();
1252	if ( 	previewMode() )
1253	{
1254		return false;
1255		//domain = "192.168.1.2"
1256	}
1257	
1258	if ($("#ifrHeader").length > 0)
1259	{
1260		$("iframe#ifrHeader").attr({src: "//" + domain + "/web/WIMS/Manager.aspx?xslFile=header.xsl&xmlPreview=languages.xml&Style=1&Service=1&" + acrParam + "&" + pageParam + "&" + categoryParam});
1261	}
1262	if ($("#ifrMainMenu").length > 0)
1263	{
1264		var src = "//" + domain +"/web/WIMS/Manager.aspx?xslFile=main_menu.xsl&style=1&service=1&acr="+acr+"&"+pageParam+"&"+categoryParam;
1265		$("iframe#ifrMainMenu").attr({
1266			"src":src,
1267			"height":1000
1268		})
1269	}
1270	if ($("#ifrFooter").length > 0)
1271	{
1272		$("iframe#ifrFooter").attr({
1273			src: "//" + domain + "/web/WIMS/Manager.aspx?xslFile=footer.xsl&xmlPreview=languages.xml&Style=1&Service=1&" + acrParam,
1274			name:"ifrFooter"
1275		});
1276	}
1277}
1278
1279// Pops up a new window, or focuses on it if already opened 
1280// focus() does not work with FF tabs if the tab has been already opened.
1281function popUp(url,name,specs) {
1282	if ( window.parent.location == window.location ) window.name = "brMain"; // Name window
1283	if ( typeof specs == "undefined" ) specs = "";
1284	if ( typeof popUp.winName == 'undefined' ) popUp.winName = {};
1285	if ( typeof popUp.winName[name] == 'undefined' || popUp.winName[name].closed )
1286	{
1287		popUp.winName[name] = window.open(url,name,specs);
1288		popUp.winName[name].focus();
1289		popUp.winName["url"] = url;
1290	}
1291	else
1292	{
1293		popUp.winName[name].focus();
1294		popUp.winName[name].location = url;
1295	}
1296}
1297function chatCafe(){
1298 var timer;
1299		jQuery(function($) {
1300        timer = setTimeout(Dialog, 100);
1301	});
1302
1303	function Dialog() {
1304        $("#dialog_1").animate({marginTop: "-145px"}, 200).animate({marginTop: "-135px"}, 400, "linear", function() {
1305                timer = setTimeout(Dialog, 500);
1306        });
1307}
1308
1309var timer;
1310		jQuery(function($) {
1311        timer = setTimeout(Dialog1, 200);
1312	});
1313
1314	function Dialog1() {
1315        $("#dialog_2").animate({marginTop: "-360px"}, 200).animate({marginTop: "-350px"}, 400, "linear", function() {
1316                timer = setTimeout(Dialog1, 500);
1317        });
1318}
1319
1320var timer;
1321		jQuery(function($) {
1322        timer = setTimeout(Dialog2, 500);
1323	});
1324
1325	function Dialog2() {
1326        $("#dialog_3").animate({marginTop: "-360px"}, 200).animate({marginTop: "-350px"}, 400, "linear", function() {
1327                timer = setTimeout(Dialog2, 500);
1328        });
1329}
1330}
1331
1332function showDonationsLink()
1333{
1334	var _href = "/"+lang+"/allforjapan";
1335	var _img = $('<img src="/GenericFiles/4.0/img/all4Japan/badge.png" alt="" />');
1336	$('<a class="all4JapanLink" />')
1337		.attr("href",_href).html(_img)
1338		.appendTo("div.condolences")
1339		.click(function(){
1340			openDonationPage();
1341			pageTracker._trackPageview('/clicks/home/top_banner/'+lang+'/earthquake_donations_badge');
1342			return false;
1343		}).hover(
1344			function(){$("div.condolences").addClass("underline")},
1345			function(){$("div.condolences").removeClass("underline")}
1346		);
1347}
1348function openDonationPage()
1349{
1350	var lang = getLang()[0];
1351	var _href = "/"+lang+"/allforjapan";
1352	var w=window.open(_href,'_allforjapan','width=960, height=800, scrollbars=1');
1353	w.focus();
1354	return false;
1355}
1356function hideDeltaSlide()
1357{
1358	$("#delta_campaign").animate({bottom:-209},1000,function(){
1359		$("#delta_campaign .open_close .tab_arrow").css("background-position","0 0");
1360	});
1361	$.cookie("closeDeltaSlide","yes", {expires:7,path: '/'});
1362}
1363function showDeltaSlide()
1364{
1365	$("#delta_campaign").animate({bottom:0},1000,function(){
1366		$("#delta_campaign .open_close .tab_arrow").css("background-position","0 bottom");
1367	});
1368	$.cookie("closeDeltaSlide","no", {expires:7,path: '/'});
1369}
1370function openDeltaPage()
1371{
1372	hideDeltaSlide();
1373	popUp("http://www.brastel.com/newsletters/brastel_delta_email_"+lang
1373+"_winners.html","delta","width=750, height=900, location=0, directories=0, toolbar=0, directories=0, resizable=1, status=0, scrollbars=1")
1374}
1375function setMsgBoardH() // adjust msg board's height according to the banners on its right
1376{
1377	var h = $("div.corp_banner").parent().outerHeight();
1378	
1379	//if ( lang != "jpn" )
1380	//{
1381		var dif = h - $("#msgBoard").outerHeight();
1382		$("#msgBoardFeeds").height(dif);
1383		
1384	//}
1385	
1386}
1387
1388var trackBannerClicks = function(category, banner, elem) {
1389	var url = elem.attr("href");
1390	if ( elem.hasClass("openNewWindow") )
1391	{
1392		ga('send', 'event', category, banner, lang);
1393	}
1394	else
1395	{
1396		ga('send', 'event', category, banner, lang, {
1397		  'transport': 'beacon',
1398		  'hitCallback': function(){document.location = url;}
1399		});
1400	}
1401}
1402
1403function splMsgCheckCallBack(json)
1404{
1405	if ( json.display )
1406	{
1407		$.ajax({
1408		  url: "/ajax/ajax/"+lang,
1409		  data: {
1410			  msg: json.msg_ID,
1411			  callbackfn: "showSpecialMsg"
1412		  },
1413		  dataType: "jsonp"
1414		});
1415	}
1416}
1417
1418function showSpecialMsg(json)
1419{
1420	// Modal HTML
1421	var $div = $('<div id="splMsgDiv" style="display: none;" />').html(json.message);
1422	var $a = $('<a href="#splMsgDiv" class="splMsgModal" />');
1423	var $s = $('<span />').text(json.title);
1424	
1425	$a.append($s);
1426	
1427	// Logo images
1428	var $logo_br = $('<img />')
1429							.attr({
1430								"class"	:"brastel",
1431								"src"		:"/GenericFiles/4.1/img/common/brastel_logo.svg"	
1432							});
1433	var $logo_rm = $('<img />')
1434							.attr({
1435								"class"	:"remit",
1436								"src"		:"https://brastelremit.jp/GenericFiles/IMT/img/external/logo/brastelremit.svg"	
1437							});
1438	var $logo_bx = $('<img />')
1439							.attr({
1440								"class"	:"basix",
1441								"src"		:"https://basix.jp/5.0/img/common/basix_logo.svg"	
1442							});
1443	
1444	var $imgHolder = $('<div class="logoHolder" />');
1445	
1446	$imgHolder.append( $logo_br, $logo_rm, $logo_bx);
1447	$div.append($imgHolder);
1448	
1449	// Append HTML to body
1450	$("#bodyContent").prepend($div);
1451	$("#bodyContent").prepend($a);
1452	
1453	// Set modal
1454	$(".splMsgModal").nyroModal({
1455		closeButton: '<a href="#" class="nyroModalClose nyroModalCloseButton nmReposition" title="close"><span class="bgSprite"><!--&nbsp;--></span></a>',
1456		wrap: {
1457			div: '<div class="nmTermsWrapper splMsg"></div>'
1458		}
1459	});	
1460}

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.