<!doctype html>
<html>
<head>
	<title>California braces for record-setting heatwave, more fires</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="" />
	<meta name="description" content="LOS ANGELES - California is bracing for  record-breaking temperatures and dangerous fire weather conditions this Labor Day weekend, with the National Weather Service urging people to limit outdoor activity and to stay hydrated." />
	<meta name="author" content="Bangkok Post Public Company Limited" />
	<meta name="rating" content="General" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta property="fb:pages" content="133643127712" />
	<meta name="robots" content="index,follow,NOODP" />
	<meta name="twitter:card" content="summary_large_image">
	<meta name="twitter:site" content="@BangkokPostNews">

	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

	<link rel="dns-prefetch" href="//static.bangkokpost.com">
	<link rel="dns-prefetch" href="//www.googletagservices.com">
	<link rel="dns-prefetch" href="//scdn.cxense.com/cx.js">
	<link rel="dns-prefetch" href="//lvs.truehits.in.th">
	<link rel="dns-prefetch" href="//adservice.google.co.th">
	<link rel="dns-prefetch" href="//adservice.google.com">
	<link rel="dns-prefetch" href="//connect.facebook.net">
	<link rel="dns-prefetch" href="//ads3.bangkokpost.co.th">
	<link rel="dns-prefetch" href="//www.instagram.com">
	<link rel="dns-prefetch" href="//widgets.outbrain.com">

	<meta name="apple-mobile-web-app-title" content="Bangkok Post Website" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
	<meta name="msapplication-TileColor" content="#213c70" />
	<meta name="msapplication-TileImage" content="https://bangkokpost.com/newdesign/assets/images/app_icon/icon-144x144.png" />
	<meta name="theme-color" content="#213c70" />

	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
	<link rel="icon" href="/favicon.ico" type="image/x-icon">

	<link rel="manifest" href="/manifest.json" />

	
	<!-- Google Tag Manager -->
	<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
	new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
	j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
	'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
	})(window,document,'script','dataLayer','GTM-MLF6WTD');</script>
	<!-- End Google Tag Manager -->

	<!-- Andbeyond start -->
			
		<script src="https://rtbcdn.andbeyond.media/prod-global-410424.js" async></script>
		
		<!-- Andbeyond end -->
	
		<meta property="og:title" content="California braces for record-setting heatwave, more fires" />
		<meta property="og:type" content="article" />
		<meta property="og:url" content="https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires" />
		<meta property="og:image" content="https://static.bangkokpost.com/media/content/20200905/c1_3740639_700.jpg" />
		<meta property="og:site_name" content="https://www.bangkokpost.com" />
		<meta property="og:description" content="LOS ANGELES - California is bracing for  record-breaking temperatures and dangerous fire weather conditions this Labor Day weekend, with the National Weather Service urging people to limit outdoor activity and to stay hydrated." />
		<meta property="fb:app_id" content="476233699157604" />

			<link rel="canonical" href="https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires" />
	
	<link rel="shortcut icon" href="https://static.bangkokpost.com/newdesign/assets/images/bp-icon.png" type="image/x-icon">

	<!-- HTML5 Shim for IE -->
	<!--[if IE]>
    <script src="https://static.bangkokpost.com/newdesign/assets/js/html5.js"></script>
  	<![endif]-->

  	<script type="text/javascript">
		if ('serviceWorker' in navigator) {
			window.addEventListener('load', function() {
				navigator.serviceWorker.register('/service-worker.js?v=6').then(function(registration) {
					// Registration was successful
					// console.log('Registration was successful');
				}, function(err) {
					// registration failed :(
					// console.log('registration failed');
				});
			});
		}
	</script>


	<!-- Begin Insider -->
	<!-- <script type="text/javascript" src="https://www.bangkokpost.com/insider-sw-sdk.js"></script> -->
	<!-- End Insider -->


	<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/js/jquery.min.js?v=0.033"></script>

	<link href="https://static.bangkokpost.com/newdesign/assets/bootstrap/css/bootstrap.min.css?v=0.074" rel="stylesheet">
	<script src="https://static.bangkokpost.com/newdesign/assets/bootstrap/js/bootstrap.min.js?v=0.033"></script>
	<link href="https://static.bangkokpost.com/newdesign/assets/css/animate.min.css?v=0.074" rel="stylesheet">
	<link href="https://static.bangkokpost.com/newdesign/assets/fontawesome-5.6.3/css/all.min.css?v=0.074" rel="stylesheet">
	<!-- Owl Stylesheets -->
	<link href="https://static.bangkokpost.com/newdesign/assets/plugins/owlcarousel/assets/owl.carousel.min.css?v=0.074" rel="stylesheet">
	<link href="https://static.bangkokpost.com/newdesign/assets/plugins/owlcarousel/assets/owl.theme.default.min.css?v=0.074" rel="stylesheet">
	<script defer src="https://static.bangkokpost.com/newdesign/assets/plugins/owlcarousel/owl.carousel.min.js?v=0.033"></script>

		<!-- smartphoto -->
	<link rel="stylesheet" href="https://static.bangkokpost.com/newdesign/assets/plugins/smartphoto/css/smartphoto.min.css?v=0.074" />
	<script defer src="https://static.bangkokpost.com/newdesign/assets/plugins/smartphoto/js/jquery-smartphoto.min.js?v=0.033"></script>
	
	<!-- bxslider -->
	<link href="https://static.bangkokpost.com/newdesign/assets/plugins/bxslider/jquery.bxslider.min.css?v=0.074" rel="stylesheet" />
	<script defer src="https://static.bangkokpost.com/newdesign/assets/plugins/bxslider/jquery.bxslider.min.js?v=0.033"></script>

	<link href="https://static.bangkokpost.com/newdesign/assets/css/custom.min.css?v=0.074" rel="stylesheet" type="text/css">
	<link href="https://static.bangkokpost.com/newdesign/assets/css/component.min.css?v=0.074" rel="stylesheet" type="text/css">
	<link href="https://static.bangkokpost.com/newdesign/assets/css/style.min.css?v=0.074" rel="stylesheet" type="text/css">

		<!-- only article -->
	<link href="https://static.bangkokpost.com/newdesign/assets/css/gallery.min.css?v=0.074" rel="stylesheet" type="text/css">
			<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/js/scripts.js?v=0.033"></script>

		<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/js/moment.min.js?v=0.033"></script>
	<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/js/moment-timezone.min.js?v=0.033"></script>
	

	<!-- CXENSE -->
			<meta name="cXenseParse:pageclass" content="article"/>
		<meta name="cXenseParse:articleid" content="1980311"/>
		<meta name="cXenseParse:recs:publishtime" content="2020-09-05T09:45:08+07:00" />		<meta name="cXenseParse:bpp-headline" content="California braces for record-setting heatwave, more fires"/><meta name="cXenseParse:bpp-intro" content="LOS ANGELES - California is bracing for  record-breaking temperatures and dangerous fire weather conditions this Labor Day weekend, with the National Weather Service urging people to limit outdoor activity and to stay hydrated."/><meta property="cXenseParse:author" content="AFP "/><meta name="cXenseParse:bpp-author_url" content="https://www.bangkokpost.com/opinion/columnist/126"/><meta name="cXenseParse:bpp-author_image" content="https://www.bangkokpost.com/media/columnist/1466565766.jpg"/><meta name="cXenseParse:bpp-contentsource" content="digital"/><meta name="cXenseParse:bpp-contentform" content="long"/>			<script type="text/javascript" class="teads" src="//a.teads.tv/page/85419/tag" async="true"></script>
		<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/custom/js/jquery.lazy.min.js?v=0.033"></script>

	<!-- <script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script> -->

	<script>
	var initGPT = function() {
		var gads = document.createElement("script");
		gads.async = true;
		gads.type = "text/javascript";
		var useSSL = "https:" == document.location.protocol;
		gads.src = (useSSL ? "https:" : "http:") + "//securepubads.g.doubleclick.net/tag/js/gpt.js";
		var node = document.getElementsByTagName("script")[0];
		node.parentNode.insertBefore(gads, node);
			/* todo */
		googletag.cmd.push(function() {
			googletag.pubads().disableInitialLoad();
		});


		if ($(window).width() < 659) {
			pbjs.bidderSettings = {
				audienceNetwork: {
					adserverTargeting: [{
							key: "fb_bidid",
							val: function(bidResponse) {
								return bidResponse.fb_bidid;
							}
						},
						{
							key: "hb_bidder",
							val: function(bidResponse) {
								return bidResponse.bidderCode;
							}
						},
						{
							key: "hb_pb_audienceNetwor",
							val: function(bidResponse) {
								return bidResponse.pbMg;
							}
						},
					],
				}
			};
		}
		pbjs.que.push(function() {
			pbjs.setConfig({
				priceGranularity: "dense",
				enableSendAllBids: true
			})
		})

		/* todo */
	};
	</script>
		
	<script>
		var time = 0 ;
		/* App nexus 2 (initial) */
		var PREBID_TIMEOUT = 700;
		var pbjs = pbjs || {};
		pbjs.que = pbjs.que || [];

		setTimeout(initGPT, 100);
	</script>	

	<script type="text/javascript">

		/**
		* Get the URL parameters
		* @param  {String} url The URL
		* @return {Object}     The URL parameters
		*/
		var getParams = function (url) {
			var params = {};
			var parser = document.createElement('a');
			parser.href = url;
			var query = parser.search.substring(1);
			var vars = query.split('&');
			for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split('=');
				params[pair[0]] = decodeURIComponent(pair[1]);
			}
			return params;
		};


		// Global variable
		// var g_page_type = 'article';
		var g_section = '';
		var g_sub_section = '';
		var g_content_id = '1980311';
		var g_topic_id = '';
		var g_url_path = window.location.pathname.split('/');
		var g_window_width = window.innerWidth;
		var g_url_params = getParams(window.location.href);

		// Initial g_url_path index
		for (i = 0; i <= 5; i++) {
			if(typeof g_url_path[i] === 'undefined') g_url_path[i] = '';
		}

		if (g_content_id != '') {
			g_page_type = 'article';
			g_section = g_url_path[1];
			g_sub_section = g_url_path[2];
		} else if (g_url_path[1] == '') {
			g_page_type = 'homepage';
			g_section = 'homepage';
		} else if (g_url_path[2] != '') {
			g_page_type = 'sub_section';
			g_section = g_url_path[1];
			g_sub_section = g_url_path[2];
		} else {
			g_page_type = 'section';
			g_section = g_url_path[1];
		}

		var g_ad = {
			ad_type: '',
			get_ad_type : function() {
				var _t = this;
					var _width = g_window_width;
					if (_width >= 950) {
						_t.ad_type = "desktop";
					} else if (_width < 950 && _width >= 768) {
						_t.ad_type = "tablet";
					} else if (_width < 768 && _width >= 336) {
						_t.ad_type = "mobile";
					} else if (_width < 336) {
						_t.ad_type = "other";
					}
				return _t.ad_type;
			},
			get_gpt_slot : function(position, section) {

				var _t = this;
				var _slot = [];
				return _slot;
			},
			get_ad_section : function() {
				ad_section = g_section;
				if (ad_section == 'sports') {
					ad_section = 'sport';
				} else if (ad_section == 'vdo') {
					ad_section = 'video';
				} else if (ad_section == 'most-recent') {
					ad_section = 'mostrecent';
				} else if (ad_section == 'topstories') {
					ad_section = 'others';
				}
				return ad_section;
			}
		}


		var gptadslots = [];
		var googletag = googletag || {cmd:[]};
		var g_ad_type = g_ad.get_ad_type();
		// window.googletag = window.googletag || {cmd: []};
		var ad_section = g_ad.get_ad_section();

		
		var ad_slot_multi_0 = [];
		var add_size_inread_0 = [];
		var add_size_inread_1 = [];
		var add_size_inread2_0 = [];
		var add_size_inread2_1 = [];
		var add_size_multi_0 = [];
		var add_size_multi_1 = [];
		var ad_slot_inread_0 =[];
		var ad_slot_inread_1 =[];
		var add_size_leaderboard_0 = [];
		var add_size_hybrid_0 = [];
		var ad_slot_hybrid_0 = [];
		if (ad_section == 'homepage') {

				add_size_sticky_0 = [[336,280],[300,250]];
				add_size_sticky_1 = [[336,280],[300,250]];

				add_size_multi_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				add_size_multi_1 = [[336,280],[300,250]];
				add_size_hybrid_1 = [[336,280],[300,250]];
				ad_slot_leaderboard_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				ad_slot_hybrid_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				if (g_ad.get_ad_type() == 'tablet') {
					ad_slot_hybrid_0 = [[728,90]];
					add_size_hybrid_0 = [[728,90]];
					add_size_leaderboard_0 = [[728,90]];

				}else if (g_ad.get_ad_type() == 'desktop'){
					ad_slot_hybrid_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
					add_size_hybrid_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
					add_size_leaderboard_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				}
				ad_slot_multi_0 = [[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				ad_slot_sticky_0 = [[336,280],[300,250]];
			}else {

				add_size_hybrid_1 = [[1,1],[336,280],[300,250]];

				add_size_sticky_0 = [[1,1],[336,280],[300,600],[300,250]];
				add_size_sticky_1 = [[1,1],[336,280],[300,250]];

				ad_slot_leaderboard_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				if (g_ad.get_ad_type() == 'tablet') {
					ad_slot_hybrid_0 = [[1,1],[728,90]];
					add_size_hybrid_0 = [[1,1],[728,90]];
					add_size_leaderboard_0 = [[1,1],[728,90]];
				}else if (g_ad.get_ad_type() == 'desktop'){
					ad_slot_hybrid_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
					add_size_hybrid_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
					add_size_leaderboard_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
				}
				ad_slot_sticky_0 = [[1,1],[336,280],[300,600],[300,250]];

				add_size_inread_0 = [[1,1],[336,280],[300,250],[640,360]];
				add_size_inread_1 = [[1,1],[300,250],[336,280]];

				add_size_inread2_0 = add_size_inread_0;
				add_size_inread2_1 = add_size_inread_1;
				ad_slot_inread_0 = [[1,1],[336,280],[300,250]];

				if (ad_section == 'business') {

					add_size_hybrid_1 = [[1,1],[336,280],[300,250]];

					add_size_sticky_0 = [[1,1],[336,280],[300,600],[300,250]];
					add_size_sticky_1 = [[1,1],[336,280],[300,250]];

					ad_slot_leaderboard_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90],[1600,250]];
					if (g_ad.get_ad_type() == 'tablet') {
						ad_slot_hybrid_0 = [[1,1],[728,90]];
						add_size_hybrid_0 = [[1,1],[728,90]];
						add_size_leaderboard_0 = [[1,1],[728,90]];
					}else if (g_ad.get_ad_type() == 'desktop'){
						ad_slot_hybrid_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90],[1600,250]];
						add_size_hybrid_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90],[1600,250]];
						add_size_leaderboard_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90],[1600,250]];
					}
					ad_slot_sticky_0 = [[1,1],[336,280],[300,600],[300,250]];

				}else
				if (ad_section == 'life' || ad_section == 'travel') {
					add_size_inread_0 = [[336,280],[300,250]];
					add_size_inread_1 = [[320,100],[300,250],[336,280],[250,250]];
					add_size_inread2_0 = add_size_inread_0;
					add_size_inread2_1 = add_size_inread_1;
					ad_slot_inread_0 = [[336,280],[300,250]];

				}

				if (g_page_type == 'article' && ad_section != 'video' && ad_section != 'photo' && g_url_path[2] != 'postbag') {
					// hybrid article
					//console.log('hybrid article : business');
					add_size_hybrid_0 = [[1,1],[336,280],[300,600],[300,250]];
					add_size_hybrid_1 = [[1,1],[336,280],[300,250]];
					ad_slot_hybrid_0 = [[1,1],[336,280],[300,600],[300,250]];

				}
				if (g_page_type == 'article' && ad_section == 'life' || ad_section == 'travel'){

						add_size_hybrid_1 = [[1,1],[336,280],[300,250]];
						if (g_ad.get_ad_type() == 'tablet') {
							ad_slot_hybrid_0 = [[728,90]];
							add_size_hybrid_0 = [[1,1],[728,90]];
						}else if (g_ad.get_ad_type() == 'desktop'){
							ad_slot_hybrid_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
							add_size_hybrid_0 = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
						}
				}
				if(ad_section == 'life' && g_ad.get_ad_type() == 'mobile'){
					ad_slot_hybrid_0 = [[1,1],[336,280],[300,600],[300,250]];
				}
			}
		googletag.cmd.push(function() {
			var adUnits = [];
			/* Start size mapping, remove unused ad type */
			if (g_page_type == 'homepage'){
				var mappingleaderboard = googletag.sizeMapping()
									.addSize([800,600],add_size_leaderboard_0)
									.addSize([0,0],[320,100])
									.build();
			}else {
				var mappingleaderboard = googletag.sizeMapping()
									.addSize([800,600],add_size_leaderboard_0)
									.addSize([0,0],[320,100])
									.build();
				var mappingleaderboard1 = googletag.sizeMapping()
                            .addSize([800,600],[[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]])
                            .addSize([0,0],[[1,1],[300,250]])
                            .build();
			}

			 var mappinghybrid = googletag.sizeMapping()
									.addSize([800,600],add_size_hybrid_0)
									.addSize([0,0],add_size_hybrid_1)
									.build();

			var mappingsticky = googletag.sizeMapping()
									.addSize([800,600],add_size_sticky_0)
									.addSize([0,0],add_size_sticky_1)
									.build();

		   var mappinginread = googletag.sizeMapping()
								   .addSize([800,600],add_size_inread_0)
								   .addSize([0,0],add_size_inread_1)
								   .build();

			var mappinginread2 = googletag.sizeMapping()
								   .addSize([800,600],add_size_inread2_0)
								   .addSize([0,0],add_size_inread2_1)
								   .build();

			var mappingmulti = googletag.sizeMapping()
									.addSize([800,600],add_size_multi_0)
									.addSize([0,0],add_size_multi_1)
									.build();

			/* End size mapping */

			// leader board

			var leaderboard_size;
			if (g_ad_type == 'tablet') {
				leaderboard_size = [[728,90]];
			}else if (g_ad_type == 'desktop'){
				leaderboard_size = [[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]];
			}

			if(g_topic_id =='1752179'){
				//console.log('=>bkp_edu2019_lb');
				gptadslots.push(googletag.defineSlot('/2776261/bkp_edu2019_lb',
				leaderboard_size, 'div-gpt-ad-leaderboard-0')
				.setTargeting('unit_type', ['leaderboard'])
				.defineSizeMapping(mappingleaderboard)
				.addService(googletag.pubads()));

			} else if(g_topic_id =='1802499'){

				//console.log('topics lb bangkokpost_event : topic_id 1802499');
				gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_event/leaderboard',
				leaderboard_size, 'div-gpt-ad-leaderboard-0')
				.setTargeting('unit_type', ['leaderboard'])
				.defineSizeMapping(mappingleaderboard)
				.addService(googletag.pubads()));

			} else if(g_topic_id =='1824599'){

				// console.log('mappingleaderboard: ' + mappingleaderboard);
				// console.log('topics lb bangkokpost_wsj/WSJ_BP_LB1 : topic_id 1824599');
				gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_wsj/WSJ_BP_LB1', [[728, 90], [970, 90], [1200, 90], [970, 250], [1, 1], [1200, 250]], 'div-gpt-ad-leaderboard-0')
				.setTargeting('unit_type', ['leaderboard'])
				.defineSizeMapping(mappingleaderboard)
				.addService(googletag.pubads()));
				if (g_ad.get_ad_type() == 'desktop'){
					// console.log('topics lb bottom div-gpt-ad-leaderboard-1 : bangkokpost_wsj/WSJ_BP_LB2');
					gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_wsj/WSJ_BP_LB2',  [[1,1],[300,250]], 'div-gpt-ad-leaderboard-1')
					.setTargeting('unit_type', ['leaderboard'])
					.defineSizeMapping(mappingleaderboard1)
					.addService(googletag.pubads()));
				}
			} 
			else 
				if(g_section == "specials" && (g_url_path[2] == "delivery" || g_url_path[2] == "covid19") ){
				
				console.log('leaderboard specials : delivery covid19');
				
				gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_COVID-19/leaderboard', 
				leaderboard_size, 'div-gpt-ad-leaderboard-0')
				.setTargeting('unit_type', ['leaderboard'])
				.defineSizeMapping(mappingleaderboard) 
				.addService(googletag.pubads()));
				
			}
			else {
								 // console.log('normal lb section :  bangkokpost_' + ad_section + '/leaderboard');
				gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/leaderboard',
				[[1,1],[970,250],[970,90],[970,70],[728,90],[1200,250],[1200,90]], 'div-gpt-ad-leaderboard-0')
				.setTargeting('unit_type', ['leaderboard'])
				.defineSizeMapping(mappingleaderboard)
				.addService(googletag.pubads()));
							}

			// sticky
			// - ???? homepage & main section sticky ad ?? desktop size ???????? ad ?????????? size ?????
			// - ???? section video & photo ????????? sticy ad
			// - ???? sub_section video & photo ????????? sticy ad
			// - ???? article section life & travel ????????? sticky ad
			// - ???? article ??? sub_section ?????????? postbag
			if (g_page_type == 'homepage'
				|| g_page_type == 'section'
				&& (ad_section != 'video' && ad_section != 'photo' && ad_section != 'others' && ad_section != 'mostrecent')
				) {
	 				if(g_page_type == 'homepage' && g_page_type != 'section'){
						//console.log('page : '+ ad_section + ' only ');
						gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/rec2',
						ad_slot_sticky_0, 'div-gpt-ad-sticky-0-2')
						.setTargeting('unit_type', ['sticky'])
						.defineSizeMapping(mappingsticky)
						.addService(googletag.pubads()));
						}
				if (g_ad_type != 'desktop') {
					// ?????????? desktop
					gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/sticky',
					ad_slot_sticky_0, 'div-gpt-ad-sticky-0-0')
					.setTargeting('unit_type', ['sticky'])
					.defineSizeMapping(mappingsticky)
					.addService(googletag.pubads()));
				} else {
					// ???? desktop
					gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/sticky',
					ad_slot_sticky_0, 'div-gpt-ad-sticky-0-1')
					.setTargeting('unit_type', ['sticky'])
					.defineSizeMapping(mappingsticky)
					.addService(googletag.pubads()));
				}
			} else if ((g_page_type == 'sub_section' && (ad_section != 'video' && ad_section != 'photo' && g_url_path[2] != 'columnist'))
						|| (g_page_type == 'article' && (g_url_path[2] != 'postbag' && ad_section != 'travel' && ad_section != 'life' && ad_section != 'photo' && ad_section != 'video'))
						) {

							if(g_topic_id =='1752179'){
								//console.log('topics sticky 0-0 : topic_id 1752179');
								gptadslots.push(googletag.defineSlot('/2776261/bkp_edu2019_sticky', ad_slot_sticky_0, 'div-gpt-ad-sticky-0-0')
								.setTargeting('unit_type', ['sticky'])
								.defineSizeMapping(mappingsticky)
								.addService(googletag.pubads()));

							} else if(g_topic_id =='1802499'){
								//console.log('topics sticky 0-0 : topic_id 1802499');
								gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_event/sticky', ad_slot_sticky_0, 'div-gpt-ad-sticky-0-0')
								.setTargeting('unit_type', ['sticky'])
								.defineSizeMapping(mappingsticky)
								.addService(googletag.pubads()));

							} else if(g_topic_id =='1824599'){
									console.log('topics sticky 0-0 : topic_id 1824599');
									gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_wsj/WSJ_BP_Sticky', [[1, 1], [300, 600], [300, 250]], 'div-gpt-ad-sticky-0-0')
									.setTargeting('unit_type', ['sticky'])
									.defineSizeMapping(mappingsticky)
									.addService(googletag.pubads()));
							} else {

																
								if(g_section != "specials" ){
									gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/sticky', 	ad_slot_sticky_0, 'div-gpt-ad-sticky-0-0')
									.setTargeting('unit_type', ['sticky'])
									.defineSizeMapping(mappingsticky)
									.addService(googletag.pubads()));
									 // console.log('normal sticky-0-0 : bangkokpost_' + ad_section +'/sticky');
								}
								
															}

						}
			// inread
			if (g_page_type == 'article' && ad_section != 'video' && ad_section != 'photo' && g_url_path[2] != 'postbag') {

				$(function(){
					var _index_p1 = 0;
					var _index_p2 = 0;
					var p2_img = 0;
					var article_p = $('.articl-content p');
					var paragraph_inread1 = false;
					var paragraph_inread2 = false;
 						if (article_p.eq(3).length) {
						_index_p1 = 3;
						$('.articl-content p').eq(3).nextAll().each(function( index ) {
							if(index == 0 ){
								if($(this).find("a.js-img-viwer.gallery-icon img").length){
									_index_p1--;
								}
							}

						});
					}
					if (article_p.eq(6).length) {
						_index_p2 = 6;

						$('.articl-content p').eq(6).nextAll().each(function( index ) {
							if(index == 0 ){
								if($(this).find("a.js-img-viwer.gallery-icon img").length){
									_index_p2--;
									 p2_img = _index_p2;
								}
							}
						});
					}
					 else if (article_p.eq(5).length) {
							_index_p2 = 5;
							 p2_img = _index_p2;
					}
					if (article_p.eq(_index_p1).parent().attr('class') != 'articl-content') {
						_index_p1--;
					}
					if(_index_p1 > 0 ){
						paragraph_inread1 = article_p.eq(_index_p1);
					}

					if(_index_p2 > 0 ){
						if (article_p.eq(_index_p2).parent().attr('class') != 'articl-content') {
							_index_p2--;
						}
						paragraph_inread2 = article_p.eq(_index_p2);
					}

					if (paragraph_inread1 != false && ad_section !='business' ) {
							//console.log('inread1');
							gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/inread',
							ad_slot_inread_0, 'div-gpt-ad-inread-0')
							.setTargeting('unit_type', ['inread'])
							.defineSizeMapping(mappinginread) //delete line if not responsive
							.addService(googletag.pubads()));


						 if(_index_p1 == 2){
							 paragraph_inread1.after(
								'<div class="ads ads-boombox" id="ads-inread-0">\
									<div id="div-gpt-ad-inread-0"></div>\
								</div>'
							);
						 }else{

							paragraph_inread1.before(
								'<div class="ads ads-boombox" id="ads-inread-0">\
									<div id="div-gpt-ad-inread-0"></div>\
								</div>'
							);
						 }

						inread_element_1 = $('#ads-inread-0');
						// Hide ad inread
						inread_element_1.css({ "visibility": "hidden", "height": "0","padding": "0","margin": "0"});
					}
				//=====wjs =====
								//=====wsj =====
				/*
				// close inread2 by CR  
					if (paragraph_inread2 != false && ad_section !='business') {
						//console.log('inread2');
						gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/inread2',
						ad_slot_inread_0, 'div-gpt-ad-inread-1')
						.setTargeting('unit_type', ['inread'])
						.defineSizeMapping(mappinginread) //delete line if not responsive
						.addService(googletag.pubads()));


						if(_index_p2 == p2_img){
							//console.log(' paragraph_inread2  after :' +_index_p2);
							paragraph_inread2.after(
							'<div class="ads ads-boombox" id="ads-inread-1">\
								<div id="div-gpt-ad-inread-1"></div>\
							</div>'
							);
						}else{
							//console.log(' paragraph_inread2  before :' +_index_p2);
							paragraph_inread2.before(
								'<div class="ads ads-boombox" id="ads-inread-1">\
									<div id="div-gpt-ad-inread-1"></div>\
								</div>'
							);
						}

						inread_element_2 = $('#ads-inread-1');
						// Hide ad inread
						inread_element_2.css({ "visibility": "hidden", "height": "0","padding": "0","margin": "0"});
					}
					*/
						$(document).scroll(function() {

						if ($('#ads-inread-0').length && paragraph_inread1 != false && ad_section !='business') {

							var scroll = $(window).scrollTop();
							position_check_ads = ($(window).height() / 2) + scroll;
							var currentAdsBox = inread_element_1.offset().top;
							inread_element_1 = $('#ads-inread-0');
							if (!inread_element_1.hasClass("active")) {

								if (position_check_ads > currentAdsBox) {

									googletag.cmd.push(function(){ googletag.display("div-gpt-ad-inread-0");});

									// Show ad inread
									inread_element_1.addClass('active');
									inread_element_1.css({'height':'0' ,'opacity': 0, 'visibility': "visible", 'padding-bottom': "10px", 'padding-top': "10px", 'margin-bottom' : 20}).animate({'height':'100%','opacity': 1}, 500);
									// inread_element_1.css({'height':'0' ,'opacity': 0, 'visibility': "visible", 'margin-bottom' : 20}).animate({'height':'200','opacity': 1}, 500);
								}
							}

						}
						/* close inread2 by CR 
						if ($('#ads-inread-1').length && paragraph_inread2 != false && ad_section !='business') {

							var scroll = $(window).scrollTop();
							position_check_ads = ($(window).height() / 2) + scroll;
							var currentAdsBox = inread_element_2.offset().top;
							inread_element_2 = $('#ads-inread-1');
							if (!inread_element_2.hasClass("active")) {

								if (position_check_ads > currentAdsBox) {

									googletag.cmd.push(function(){ googletag.display("div-gpt-ad-inread-1");});

									// Show ad inread
									inread_element_2.addClass('active');
									inread_element_2.css({'height':'0' ,'opacity': 0, 'visibility': "visible", 'padding-bottom': "10px", 'padding-top': "10px", 'margin-bottom' : 20}).animate({'height':'100%','opacity': 1}, 500);
									// inread_element_2.css({'height':'0' ,'opacity': 0, 'visibility': "visible", 'margin-bottom' : 20}).animate({'height':'200','opacity': 1}, 500);
								}
							}
						}
					*/
						//=====wsj =====
												//=====wsj=====
					});
				});
			}

			// hybrid
				// show in homepage, section, photo article
				//console.log('g_page_type',g_page_type);
				//console.log('ad_section',ad_section);
			if ((g_page_type == 'sub_section' && ad_section == 'opinion')
				|| (g_page_type == 'section' && ad_section == 'mostrecent')
				|| (g_page_type == 'section' && ad_section == 'others')
				|| (g_page_type == 'article' && ad_section == 'opinion')
                ) {
				gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/sticky',
					ad_slot_sticky_0, 'div-gpt-ad-sticky-0-0')
					.setTargeting('unit_type', ['sticky'])
					.defineSizeMapping(mappingsticky) //delete line if not responsive
					.addService(googletag.pubads()));
					//console.log(' div-gpt-ad-sticky-0-0 : ' + '/2776261/bangkokpost_' + ad_section + '/sticky');
					//console.log('mappingsticky : ' + mappingsticky);
					//console.log('ad_slot_sticky_0 : ' + ad_slot_sticky_0);

			}

			if (g_page_type == 'article' && ad_section != 'video' && ad_section != 'opinion') {
				// gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/hybrid',
					// ad_slot_hybrid_0, 'div-gpt-ad-hybrid-0')
					// .setTargeting('unit_type', ['hybrid'])
					// .defineSizeMapping(ad_slot_hybrid_0) //delete line if not responsive
					// .addService(googletag.pubads()));
										gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/hybrid',
							ad_slot_hybrid_0, 'div-gpt-ad-hybrid-0')
							.setTargeting('unit_type', ['hybrid'])
							.defineSizeMapping(ad_slot_hybrid_0) //delete line if not responsive
							.addService(googletag.pubads()));
							//console.log(' normal div-gpt-ad-hybrid-0 article : bangkokpost_' + ad_section + '/hybrid');
							}

			if(g_page_type == 'homepage' || (g_page_type == 'section' && ad_section != 'photo' && ad_section != 'video' && ad_section != 'mostrecent') && ad_section != 'others'){
				if (typeof ad_slot_hybrid_0 !== 'undefined') {
					gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/hybrid',
						ad_slot_hybrid_0, 'div-gpt-ad-hybrid-0')
						.setTargeting('unit_type', ['hybrid'])
						.defineSizeMapping(mappinghybrid) //delete line if not responsive
						.addService(googletag.pubads()));
						// console.log('  div-gpt-ad-hybrid-0 : ' + ad_section);
				}
			}
			if (g_page_type == 'homepage') {
				// multi
				gptadslots.push(googletag.defineSlot('/2776261/bangkokpost_' + ad_section + '/multi',
				ad_slot_multi_0, 'div-gpt-ad-multi-0')
				.setTargeting('unit_type', ['multi'])
				.defineSizeMapping(mappingmulti) //delete line if not responsive
				.addService(googletag.pubads()));

			}

			/*googletag.pubads().enableSingleRequest(); */
			googletag.pubads().setTargeting('page_type', ['bangkokpost_' + ad_section]);

			googletag.pubads().setCentering(true);


			for(let x = 0;x < gptadslots.length;x++){
				if(new RegExp("leaderboard").test(gptadslots[x].getAdUnitPath())){
					adUnits.push({
						code: gptadslots[x].getSlotElementId(),
						sizes: ad_slot_leaderboard_0,
						bids: [
							{bidder: 'appnexus',params: {placementId: '17017724'}}
						]
					});
				}else if(new RegExp("hybrid").test(gptadslots[x].getAdUnitPath())){
					adUnits.push({
						code: gptadslots[x].getSlotElementId(),
						sizes: ad_slot_hybrid_0,
						bids: [
							{bidder: 'appnexus',params: {placementId: '17017808'}},
							{bidder: 'audienceNetwork',params: {placementId: '971797679667917_985678461613172'}}
						]
					});
				}else if(new RegExp("sticky").test(gptadslots[x].getAdUnitPath())){
					adUnits.push({
						code: gptadslots[x].getSlotElementId(),
						sizes: ad_slot_sticky_0,
						bids: [
							{bidder: 'appnexus',params: {placementId: '17017809'}},
							{bidder: 'audienceNetwork',params: {placementId: '971797679667917_985678078279877'}}
						]
					});
				}else if(new RegExp("multi").test(gptadslots[x].getAdUnitPath())){
					adUnits.push({
						code: gptadslots[x].getSlotElementId(),
						sizes: ad_slot_multi_0,
						bids: [
							{bidder: 'appnexus',params: {placementId: '12857681'}},
							{bidder: 'audienceNetwork',params: {placementId: '971797679667917_1365288413652173'}}
						]
					});
				}else if(new RegExp("inread").test(gptadslots[x].getAdUnitPath())){
					adUnits.push({
						code: gptadslots[x].getSlotElementId(),
						sizes: ad_slot_inread_0,
						bids: [
							{bidder: 'appnexus',params: {placementId: '12862184'}},
							{bidder: 'audienceNetwork',params: {placementId: '971797679667917_1072039029643781'}}
						]
					});
				}
			}
			pbjs.adserverRequestSent = false;
			pbjs.adUnits = [];
			// console.log(adUnits);
			pbjs.que.push(function() {
				pbjs.addAdUnits(adUnits);
				pbjs.requestBids({
					bidsBackHandler: sendAdserverRequest
				});
			});


			if (typeof cX.getUserSegmentIds !== "undefined") googletag.pubads().setTargeting("CxSegments",cX.getUserSegmentIds({persistedQueryId:"10e5dfb6eaedc4830f2907303add881df700be72"}));
			googletag.pubads().collapseEmptyDivs();

			setTimeout(function() {
				sendAdserverRequest();
			}, PREBID_TIMEOUT);
			googletag.enableServices();
			googletag.pubads().addEventListener('slotRenderEnded', function(event){
				if(event.isEmpty){
					googletag.pubads().refresh([event.slot], {changeCorrelator: false});
				}
				if(event.size && event.size[0] == 1 && event.size[1] == 1 ){
					$(event.slot.getHtml()).each(function(index, obj){
						if($(obj).find('.teads').length){
							insertAds(event.slot);
						}

					});

				}
			});
		});


		var insertAds = function(event_slot){
			if($('.teads-inread').height() > 0){
				time = 10;
			}
			time++;
			if(time && time != null && time < 10){
				setTimeout(function(){
					insertAds(event_slot);
				}, 400);
			}
			if(time == 10){
				googletag.pubads().refresh([event_slot], {changeCorrelator: false});
			}
		}
				var g_obj_bp = {
			escape_html: function(text) {
				var map = {
					'&': '&',
					'<': '|',
					'>': '|',
					'"': ''',
					"'": '''
				};
				return text.replace(/[&<>"']/g, function(m) { return map[m]; });
			}
		}
		var g_cxense = {
			_get_exclude_content_id : function() {
				if ($('.cx-exclude-id').length) {
					$('.cx-exclude-id').each(function(){
						if ($(this).data('cx-exclude-id') != '') {
							cxense_exclude_content_id += $(this).data('cx-exclude-id') + ' ';
						}
					});
				}
			},
			_get_recommended_item_template : function(item) {

				if(item['og-image'] == undefined){
					item['og-image'] = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
				}
				if(item.intro == undefined){
					item.intro = item.title;
				}
				var _html = '\
					<div class="item">\
						<div class="list-v">\
						<figure class="item-photo">\
							<a href="' + item.click_url + '"><img src="' + item['og-image'] + '" alt="' + item.intro + '"></a>\
						</figure>\
						<div class="list-detail-mt">\
							<h3><a href="' + item.click_url + '">' + item.title + '</a></h3>\
						</div>\
						</div>\
					</div>\
				';

				return _html;
			},
			_get_highlight_homepage_topstories : function(item) {

				var _html_image = '';
				var _class_no_image = '';
				if(item['og-image'] == undefined){
					item['og-image'] = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
				}
				// highlights-list-noimage
				if (item['og-image'] != '') {
					_html_image = '<figure><a href="' + item.click_url + '"><img src="' + item['og-image'] + '" alt=""></a></figure>';
				} else {
					_class_no_image = 'highlights-list-noimage';
				}

				var _html = '\
					<div class="col-15 col-md-5 box-highlights-list ' + _class_no_image + '">\
							<div class="list-v">\
							<div class="list-detail">\
									<div class="h-line"></div>\
									<h3><a href="' + item.click_url + '">' + item.title + '</a></h3>\
									<p class="cx_intro_topstories">' + item.description + '</p>\
									<div class="f-icon">\
										<span>' + moment(item['recs-publishtime']).format('D MMM YYYY') + '</span>\
									</div>\
							</div>\
								' + _html_image + '\
							</div>\
					</div>\
				';

				return _html;
			},
			get_recommended : function() {

				var _t = this;
				// default cxense widget id (homepage)
				var _widget_id = '7557254f330d0695849e05ed72652ebceaaf3a9b';

				if (g_page_type == 'section' && ad_section == 'opinion') {
					_widget_id = 'cf5bbdd035ca3df725dfb4c86660ae2ea5a354c5';
				} else if (g_page_type == 'section' && ad_section == 'sport') {
					_widget_id = '8a40523e9bbc613226a67db32253943e8d52393d';
				} else if (g_page_type == 'section' && ad_section == 'auto') {
					_widget_id = '9e9a7dbc8ca3758977f9e439caeebc5b3bf42523';
				} else if (g_page_type == 'section' && ad_section == 'life') {
					_widget_id = '1c0077b798218c3853570932bda89c34e91defd6';
				} else if (g_page_type == 'section' && ad_section == 'travel') {
					_widget_id = '39d9cb1de5bf86da2904ba53580859ae9e7180c8';
				} else if (g_page_type == 'section' && ad_section == 'tech') {
					_widget_id = 'c52271cc5e06bfbf9a59279fd8f1fd7ba37985ca';
				} else if (g_page_type == 'section' && ad_section == 'property') {
					_widget_id = 'fa6c26f85e3b86310abc2370fea7a5b801202e25';
				} else if (g_page_type == 'section' && ad_section == 'business') {
					_widget_id = 'a0784240b98507608cd8e4c752c5876ef01c8ba0';
				} else if (g_page_type == 'section' && ad_section == 'thailand') {
					_widget_id = '1d3bc62a7caa019eb9ac0bf6a537f28be5690ea1';
				} else if (g_page_type == 'section' && ad_section == 'world') {
					_widget_id = '0334b35871c2ef20863f01be0ce7e77d81595759';
				} else if (g_page_type == 'section' && ad_section == 'life') {
					_widget_id = '1c0077b798218c3853570932bda89c34e91defd6';
				}




				_t._get_exclude_content_id();

				cX.callQueue.push(['insertWidget',{
				widgetId: _widget_id,
				renderFunction: function(data, context) {

					var cx_output_recommended = '';
					var cx_output_highlight_topstories = '';

					if (data.response.items) {
						var count_cx_data = data.response.items.length;
						var _recommended_container = '';

						if ($('.section-recommend').length) {
							// section page
							_recommended_container = $('.section-recommend');
						} else if ($('.home-recommend').length) {
							// homepage
							_recommended_container = $('.home-recommend');
						}

						var _count_added_item = 0;
						for(i = 0; i < count_cx_data; i++) {
							var item = data.response.items[i];
							if (item.title != '') {

								// ???????? homepage, 3 item ??? ???????????????? topstories highlight
								if (g_page_type == 'homepage' && _count_added_item <= 2) {
									cx_output_highlight_topstories += _t._get_highlight_homepage_topstories(item);
								} else {
									cx_output_recommended += _t._get_recommended_item_template(item);
								}
								_count_added_item++;
							}
						}

						if (g_page_type == 'homepage') {
							$('.highlights-list').html(cx_output_highlight_topstories);
						}

						if (_recommended_container.length) {
							_recommended_container.html(
								'<div class="container">\
										<article>\
										<div class="box-border-top">\
										<div class="chanel">recommended</div>\
										<div class="owl-carousel owl-theme owl-recommended">\
										' + cx_output_recommended + '\
										</div>\
									</div>\
									</article>\
								</div>'
							);

							// Render owl
							if ($('.owl-recommended').length) {
								$('.owl-recommended').owlCarousel({
									margin: 30,
									loop: false,
									responsiveClass: true,
									nav: false,
									dots: false,
									mouseDrag: false,
									items: 5,
									slideBy: 1,
									responsive: {
										0: {
											items: 1,
											stagePadding: 30,
											loop: false,
											mouseDrag: true,
											//dots:true,
											nav: false,
										},
										768: {
											items: 3,
											mouseDrag: true,
											//dots:true,
											nav: true,
										},
										992: {
											items: 5,
										}
									}
								});

								$(".owl-recommended").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
									if (!e.namespace) return;
									var carousel = e.relatedTarget,
										current = carousel.current();
									if (current === carousel.maximum()) {
									 $(".owl-recommended.owl-carousel .owl-stage").addClass("pos-right");
									}else if (current === carousel.minimum()){
										$(".owl-recommended.owl-carousel .owl-stage").removeClass("pos-right");
									}
									if ($('.owl-recommended .item').length <= 1) {
									   $(".owl-recommended.owl-carousel .owl-stage").addClass("item1");
									}
								});
								/* openx step 2 (for cxense) */
								if(g_page_type == "homepage"){
									// oa_show_openx(2962, 'homepage', 'recommended'); // move to cxense
								}
								/* openx step 2 (for cxense) */

							}
						}

						if ($('.cx_intro_topstories').length) {
							$('.cx_intro_topstories').ellipsis({
								row: 3,
								onlyFullWords: true
							});
						}
					}
				}
				},{
					context: {"parameters": [{"key": "article", "value": cxense_exclude_content_id}]}
				}]);
			},
			get_article : function() {

				var _t = this;

				cX.callQueue.push(['insertWidget',{
				widgetId: '42aef102107223cba421bb8dc15b0873f8b9d0cf',
				renderFunction: function(data, context) {

					var cx_output_similar = '';
					var cx_output_recommended = '';

					if (data.response.items) {
						count_cx_data = data.response.items.length;
						var count_similar = 0;
						var count_inline = 0;

						for(i = 0; i < count_cx_data; i++) {
							var item = data.response.items[i];
							if (item.title == '') continue;
							var set_content_to = '';
							if (count_inline >= 6) {
								set_content_to = 'similar';
							} else if (count_similar >= 4) {
								set_content_to = 'inline';
							}
							if (set_content_to == '') set_content_to = item.source;

							if (set_content_to == 'similar') {
								cx_output_similar += _t._get_article_relate_item_template(item);
								count_similar++;
							} else {
								cx_output_recommended += _t._get_article_recommended_item_template(item);
								count_inline++;
							}
						}

						$('#cx-output-related').html(
							'<article>\
								<div class="box-bordertop-list article-list-related">\
									<div class="chanel">RELATED</div>\
									<div class="row">\
										' + cx_output_similar + '\
									</div>\
								</div>\
							</article>'
						);

						$('#recommended-stories').html(
							'<article>\
								<div class="box-bordertop-list list-group-article">\
									<div class="chanel">RECOMMENDED</div>\
									<ul class="list-group">\
										' + cx_output_recommended + '\
									</ul>\
								</div>\
							</article>'
						);

					}
					}
				},{
					context: {"parameters": [{"key": "article", "value": ""}]}
				}]);


			},
			_get_article_relate_item_template : function(item) {
				if(item['og-image'] == undefined){
					item['og-image'] = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
				}

				var _html = '\
					<div class="col-15 col-md-50">\
						<div class="list-v">\
							<figure class="item-photo">\
								<a href="' + item.click_url + '"><img src="' + item['og-image'] + '" alt=""></a>\
							</figure>\
							<div class="list-detail">\
								<h3><a href="' + item.click_url + '">' + item.title + '</a></h3>\
							</div>\
						</div>\
					</div>\
				';

				return _html;
			},
			_get_article_recommended_item_template : function(item) {
				var _html = '<li><a href="' + item.click_url + '">' + item.title + '</a></li>';
				return _html;
			}
		}

		var g_member = {
			_callback_login: [],

			/**
			 * 0 ????????? call
			 * 1 ????? call
			 * 2 call ?????????????
			 */
			_is_get_login_calling: 0,

			is_member_login: false,
			id: '',
			usrename: '',
			name: '',
			lastname: '',
			email: '',
			avatar: '',
			get_url_login: function() {
				return 'https://member.bangkokpost.com/login.php';
			},
			get_url_logout: function() {
				return 'https://www.bangkokpost.com/global_member/cw.php?xType=logout';
			},
			get_login_template: function() {

				var _t = this;

				_t.get_member_login(function() {
					if (_t.is_member_login) {
						// <a href="/member/profile"></a>
						// <a href="/member/profile">My profile</a> |
						$('#signin-container').html('<span class="box-signout"><i class="icon-sign-in"></i><span><a href="/member/profile">' + _t.usrename + '</a></span><a href="' + _t.get_url_logout() + '" id="signout">SIGN OUT</a></span>');
						$('#signin-container2').html(
							'<div class="box-btnsingout">\
								<i class="icon-sign-in"></i> <a href="/member/profile">' + _t.usrename + '</a>\
								<div class="box-signout-link">\
									<a href="' + _t.get_url_logout() + '">Sign out</a>\
								</div>\
							</div>'
						);
					} else {
						$('#signin-container').html('<span class="box-signin"><i class="icon-sign-in"></i><a href="' + _t.get_url_login() + '" id="signin">SIGN IN</a></span>');
						$('#signin-container2').html('<div class="box-btnsingin"><a href="https://member.bangkokpost.com/login.php" class="btn-signin" title="SIGN IN" ><i class="icon-sign-in"></i> SIGN IN</a></div>');
					}
				});

			},
			get_member_login: function(_callback) {

				var _t = this;

				if (typeof _callback == 'function') {
					_t._callback_login.push(_callback);
				}

				// call ????
				if (_t._is_get_login_calling == 2) {
					// Callback all
					$.each(_t._callback_login, function(k, v) {
						v();
					});
					_t._callback_login = [];
					return true;
				}

				if (_t._is_get_login_calling <= 0) {
					_t._is_get_login_calling = 1;
					$.get("/member/get_member_login", function(data) {

						if (typeof data.userID != 'undefined') {
							_t.id = data.userID;
							_t.usrename = data.user_display_name;
							_t.name = data.user_name;
							_t.lastname = data.user_surname;
							_t.email = data.user_email;
							_t.avatar = data.user_avatar;

							_t.is_member_login = true;
						}

						_t._is_get_login_calling = 2;

						// Callback all
						$.each(_t._callback_login, function(k, v) {
							v();
						});
						_t._callback_login = [];

					}, "json");
				}
			}
		}

		g_member.get_member_login();


					var g_gallery = {

				initial_gallery: function() {
					var _i = 0;
					$('.articl-content img').each(function(index) {
						var _elm = $(this);
						var caption_str = _elm.parent().text();
						// _elm.hide();

						if (typeof _elm.data('img-highlight') === 'undefined') {


							// Render image gallery


							// var _width = $(this).width();
							// var _height = $(this).height();
							// if (((_width - _height) / _width) * 100 < 20) {
							// 	$(this).css('width', '336px');
							// }

							// var _img = $(this);
							$("<img>").attr("src", _elm.attr("src")).load(function(){
								// var _t = $(this);
								var _width = this.width;
								var _height = this.height;
								var _article_container_width = $('.article-news').width();
								var _elm_caption = _elm.parent().next();

								if (_width <= 336) {
									// console.log('<=336');
									_elm.css('width', _width + 'px');
									_elm_caption.css('width', _width + 'px');
								// } else if (((_width - _height) / _width) * 100 < 20) {
								} else if (_height > _width) {
									// ??????????
									_elm.css('width', '336px');
									_elm_caption.css('width', '336px');
								} else if (_width < _article_container_width) {
									// ??????????????? ???????? ???????????? article container
									_elm.css('width', _width + 'px');
									_elm_caption.css('width', _width + 'px');
								} else {
									_elm.css('width', '100%');
									_elm_caption.css('width', '100%');
								}

								// set width caption
								// if (_elm.parent().next().is('p')) {
								// } else {
								// 	console.log('else else');
								// }
								// _elm.parent().next().css('width', _width + 'px');

								// if (_width <= 336) {
									// disable gallery
									// if (_elm.parent().is('a')) {
										// _elm.parent().removeClass('gallery-icon');
										// _elm.unwrap();
									// }
								// }

								// _elm.show();
								// _elm.parent().show();

							});

							_elm.attr('border', 0);
							_elm.attr('hspace', 0);
							_elm.attr('vspace', 0);
							_elm.wrap('<a href="'+ _elm.attr("src") +'" data-caption="' + caption_str + '" class="js-img-viwer gallery-icon" ></a>');
							_i++;
						}
					});

					$(function(){
						$(".js-img-viwer").SmartPhoto({
							nav: false
						});

					});
				}
		};

		

		
		var g_comment = {
			_is_open: false, // Is comment box open or not
			use_id: g_content_id,
			paging: 0,
			username: '',
			avatar: '',
			count_post: '',
			country_code: '',
			country_name_en: '',
			content_headline: '',
			content_url: 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires',
			timing: false,
			reply_for_comment_id: false,
			first_access: true,
			member_id: '',
			get_commnet_ajax_requrest: false,
			order: 'latest',
			text_comment_limit: 650,
			time_interval: null,
			initial_comment: function() {

				var _t = this;

				$('body').append(
					'<div class="box-comment" id="popup-comment">\
						<div class="box-list-comment">\
							<div class="h-comment">COMMENT</div>\
							<div class="box-btn" id="close-comment"><i class="icon-close"></i></div>\
							<p>\
								Readers are urged not to submit comments that may cause legal dispute including slanderous, vulgar or violent language, incorrectly spelt names, discuss moderation action, quotes with no source or anything deemed critical of the monarchy. More information in our <a href="/policy/" class="link-terms">terms of use.</a>\
							</p>\
							<div id="comment_container"></div>\
							<div class="box-more">\
								<a href="javascript:;" onclick="g_comment.get_comment();">view more comments</a>\
							</div>\
						</div>\
						<div class="box-add-comment"></div>\
					</div>'
				);

				$('.open-comment').click(function(){
					// Add event click on body for close comment box

					$('body').on('click', function(e) {
                        if($(e.target).closest('#popup-comment').length == 0) {
                            if (_t._is_open) {
                                _t.close_popup_comment();
                            } else {
								_t.open_popup_comment();
							}
                        }
					});
				});

				$('#close-comment').click(function(){
					_t.close_popup_comment();
				});

				if($(window).width() < 768){
					$('.open-comment').click(function(){
						$('#popup-comment').addClass('boxOpen');
					});
					$('#close-comment').click(function(){
						$('#popup-comment').removeClass('boxOpen');
					});
				}

				$('a.open-comment').hover(function() {
					$('.open-comment i').removeClass('icon-comment')
					$('.open-comment i').addClass('icon-comment-article-hover')
				}, function() {
					$('.open-comment i').removeClass('icon-comment-article-hover')
					$('.open-comment i').addClass('icon-comment')
				});

			},
			open_popup_comment: function() {
				var _t = this;
				$('#popup-comment').addClass('boxOpen');
                _t._is_open = true;
			},
			close_popup_comment: function() {
				var _t = this;
				_t._is_open = false;
				$('#popup-comment').removeClass('boxOpen');
				$( "body").unbind( "click" );
			},
			show_comment: function() {
				var _t = this;
				if (_t.first_access) {
					_t.get_comment();
					_t.get_template_post_comment();
				}
			},
			get_comment: function() {

				var _t = this;

				if (typeof(_t.get_commnet_ajax_requrest) == 'object') {
					_t.get_commnet_ajax_requres_t.abort();
				}

				_t.get_commnet_ajax_requrest = $.get("/comment/process", {
					'use_id': _t.use_id,
					act: 'get_comment',
					order: _t.order,
					paging: _t.paging
				}, function(data) {
					// console.log(data);
					if (_t.paging == 0) {
						var isFirst = true;
					} else {
						var isFirst = false;
					}

					_t.paging = data.paging;

					var _html = _t.get_template_comment(data);

					if (isFirst) {
						$('#comment_container').html(_html);
					} else {
						$('#comment_container').append(_html);
					}

					if (_t.first_access) {
						// _t.goToComment();
						_t.first_access = false;
					}
					_t.get_commnet_ajax_requrest = false;

				}, 'JSON');
			},
			show_form_comment_thankyou: function(mode) {

				var _t = this;

				mode = (mode == undefined) ? 'comment' : mode;

				if (mode == 'comment') {
					var _elm = $('.box-add-comment');
					_elm.hide();
					_elm.html(_t.get_template_thankyou());
					_elm.fadeIn(500);
					_t.time_interval = setInterval(function(){_t.hide_form_comment_thankyou()},5000);
				} else if (mode == 'reply') {
					var _elm = $('.box-reply');
					_elm.hide();
					_elm.html(_t.get_template_thankyou());
					_elm.fadeIn(500);
					_t.time_interval = setInterval(function(){_t.hide_form_comment_thankyou('reply')},5000);
				}

			},
			hide_form_comment_thankyou: function(mode) {

				var _t = this;

				mode = (mode == undefined) ? 'comment' : mode;

				if (mode == 'comment') {
					var _elm = $('.box-add-comment');
					_elm.hide();
					_t.get_template_post_comment();
					_elm.fadeIn(500);
				} else if (mode == 'reply') {
					var _elm = $('.box-reply');
					_elm.slideUp(function() {
						// Animation complete.
						_elm.remove();
					});
				}
				clearInterval(_t.time_interval);
			},
			get_template_thankyou: function() {
				var _html = '<div class="comment-notlogin">\
								<div style="margin-bottom:5px;" class="h-notlogin"><b>Thank you for sharing your comment</b></div>\
								<div class="h-notlogin">Please be aware that all comments will be looked at by the web moderating team and we reserve the right to approve or reject comments at our discretion.</div>\
							</div>';
				return _html;
			},
			post_comment : function (mode) {
				var _t = this;

				mode = (mode == undefined) ? 'comment' : 'reply';
				global_comment_src = (typeof(global_comment_src) == 'undefined') ? '' : global_comment_src;

				if (mode == 'comment') {
					txt_comment = $('#body_comment').val();
					// check_facebook = ($('#check_facebook')[0].checked == true) ? 1 : 0;

					$.post( "/comment/process", { 'use_id':_t.use_id,'src':'CON',act:'post_comment',body_comment:txt_comment,content_headline:_t.content_headline,content_url:_t.content_url},function(data){
						if (data.status == 'success') {

							_t.show_form_comment_thankyou();
							return true;
						}
					},'JSON');
				} else if (mode == 'reply') {


					txt_comment = $('#body_reply').val();
					// check_facebook_reply = ($('#check_facebook_reply')[0].checked == true) ? 1 : 0;
					$.post( "/comment/process", { 'use_id':_t.use_id,'src':'CON',act:'post_comment',body_comment:txt_comment,content_headline:_t.content_headline,content_url:_t.content_url,parent_id:_t.reply_for_comment_id},function(data){
						if (data.status == 'success') {
							_t.show_form_comment_thankyou('reply');
							return true;
						}
					},'JSON');
				}
			},
			clear_form_comment : function() {
				$('#body_comment').val('');
			},
			validate_comment : function(mode) {
				var _t = this;

				mode = (mode == undefined) ? 'comment' : mode;

				if (mode == 'comment') {
					txt_comment = $('#body_comment').val();
					txt_comment = txt_comment.replace(/^\s+|\s+$/gm,'');
					if (txt_comment == '') {
						return false;
					}

					// if ($('#check_comment_agree')[0].checked != true) {
						//alert('Please check agreement.');
					// 	$('#check_comment_agree').parent().next().children().show();
					// 	return false;
					// }

					// if ($('#check_facebook')[0].checked == true && !is_facebook_login) {
						// goProcessFacebook('post_comment_v2');
						// return false;
					// }
					_t.post_comment();
				} else if (mode == 'reply') {
					txt_comment = $('#body_reply').val();
					txt_comment = txt_comment.replace(/^\s+|\s+$/gm,'');
					if (txt_comment == '') {
						return false;
					}

					// if ($('#check_reply_agree')[0].checked != true) {
						//alert('Please check agreement.');
					// 	$('#check_reply_agree').parent().next().children().show();
					// 	return false;
					// }

					// if ($('#check_facebook_reply')[0].checked == true && !is_facebook_login) {
						// goProcessFacebook('post_comment_reply');
						// return false;
					// }
					_t.post_comment('reply');
				}
			},
			get_template_post_comment: function() {
				var _t = this;

				// ??? member login ??? g_member
				g_member.get_member_login(function(){
					var _elm = $('.box-add-comment');
					if (g_member.is_member_login) {
						_elm.html(
							'<div class="comment-login">\
								<div class="h-comment">\
									WHAT’S YOUR COMMENT?\
								</div>\
								<textarea name="body_comment" id="body_comment" class="text-comment"></textarea>\
								<div class="box-add">\
									<a href="javascript:;" onclick="g_comment.validate_comment();">submit comment</a>\
								</div>\
							</div>'
						);

						$('#body_comment').keyup(function(){
							g_comment.check_comment_limit();
						});

					} else {
						_elm.html(
							'<div class="comment-notlogin">\
								<div class="h-notlogin">Please sign in for an account to share your valuable thoughts to the world. </div>\
								<div class="box-add btn-for-signin">\
									<a href="' + g_member.get_url_login() + '">sign in</a>\
								</div>\
							</div>'
						);
					}
				});
			},
			get_template_post_reply: function(obj) {

				var _t = this;

				g_member.get_member_login(function(){

					var _count_box_reply = obj.parent().parent().parent().find($('.box-add')).length;

					if ($('#body_reply').length) {
						$('#body_reply').unbind('keyup');
					}

					// $('.box-reply').remove();
					$('.box-reply').slideUp(function() {
						// Animation complete.
						$(this).remove();
					});

					if (g_member.is_member_login) {
						if (_count_box_reply == 0) {
							$(
								'<div class="box-reply" style="display:none;">\
									<textarea class="text-comment" name="body_reply" id="body_reply"></textarea>\
									<div class="box-add">\
										<a href="javascript:;" onclick="g_comment.validate_comment(\'reply\')">submit comment</a>\
									</div>\
								</div>'
							).insertAfter(obj.parent().parent());
							_t.reply_for_comment_id = obj.data('comment_id');

							$('.box-reply').slideDown();

							$('#body_reply').keyup(function(){
								g_comment.check_comment_limit('reply');
							});
						}
					} else {
						if (_count_box_reply == 0) {
							$(
								'<div class="box-reply" style="display:none">\
									<div class="comment-notlogin">\
										<div class="h-notlogin">Please sign in for an account to share your valuable thoughts to the world. </div>\
										<div class="box-add btn-for-signin">\
											<a href="' + g_member.get_url_login() + '">sign in</a>\
										</div>\
									</div>\
								</div>'
							).insertAfter(obj.parent().parent());
							$('.box-reply').slideDown();
						}
					}

				});


			},
			get_template_comment: function(data) {
				var _t = this;
				var _d = data.comment_data;
				var _html = "";

				// not have comment anymore
				if (_d.length <= 0) $('.box-more').hide();

				_html = '<ul>';

				$.each(_d, function(k, v) {

					if (v.count_like == null) v.count_like = 0;
					if (v.count_unlike == null) v.count_unlike = 0;
					if (v.count_reply == null) v.count_reply = 0;

					// there are reply items
					var _html_reply = '';
					if (typeof v.reply_data == 'object') {
						_html_reply = _t.get_template_reply(v.reply_data);
					}


					var _html_count_post = '';
					if (typeof v.count_post != 'undefined') _html_count_post = 'Posted : ' + v.count_post;

					var _html_country_name_en = '';
					if (v.country_name_en != null) _html_country_name_en = '<span class="nation"><img src="/common/img/flag_icons/gif/' + v.country_code + '.gif" alt="' + v.country_name_en + '" title="' + v.country_name_en + '"></span>';

					_html += '	<li>\
									<div class="img-profile">\
										<img src="' + v.avatar + '" alt="">\
									</div>\
									<div class="box-info">\
										<div class="top-info">\
											<a href="' + v.member_link + '"><span class="user-name">' + v.username + '</span></a>\
											' + _html_country_name_en + '\
											<span class="post-info">' + _html_count_post + ' | ' + v.created + '</span>\
										</div>\
										<h5>' + v.comment_body + '</h5>\
										<div class="f-comment">\
											<div class="f-left"> \
												<span><a href="javascript:;" onclick="g_comment.set_like_unlike(' + v.comment_id + ',1,$(this))"><i class="icon-like"></i>' + v.count_like + '</a></span>\
												<span><a href="javascript:;" onclick="g_comment.set_like_unlike(' + v.comment_id + ',0,$(this))"><i class="icon-unlike"></i>' + v.count_unlike + '</a></span>\
												<span><a href="javascript:;" class="a-report" data-comment_id="' + v.comment_id + '" onclick="g_comment.report_abuse(' + v.comment_id + ',$(this))"><i class="icon-report"></i>Report abuse</a></span>\
											</div>\
											<div class="f-right">\
												<a href="javascript:;" data-comment_id="' + v.comment_id + '" onclick="g_comment.get_template_post_reply($(this));">Reply</a>\
											</div>\
										</div>\
									</div>\
									<div class="clearfix"></div>\
									' + _html_reply + '\
								</li>';
				});

				_html += '</ul>';

				return _html;
			},
			get_template_reply: function(data_reply) {

				var _html = '<ul>';

				$.each(data_reply, function(k, v) {

					if (v.comment_reply_count_like == null) v.comment_reply_count_like = 0;
					if (v.comment_reply_count_unlike == null) v.comment_reply_count_unlike = 0;

					var _html_comment_reply_country_name_en = '';
					if (v.comment_reply_country_name_en != null) {
						_html_comment_reply_country_name_en = '<span class="nation"><img src="/common/img/flag_icons/gif/' + v.comment_reply_country_code + '.gif" alt="' + v.comment_reply_country_name_en + '" title="' + v.comment_reply_country_name_en + '"></span>';
					}

					var _html_reply_count_post = '';
					if (typeof v.count_post != 'undefined') _html_reply_count_post = 'Posted : ' + v.count_post;

					_html += 	'<li>\
									<div class="img-profile">\
										<img src="' + v.comment_reply_avatar + '" alt="">\
									</div>\
									<div class="box-info">\
										<div class="top-info">\
											<a href="' + v.comment_reply_member_link + '"><span class="user-name">' + v.comment_reply_username + '</span></a>\
											' + _html_comment_reply_country_name_en + '\
											<span class="post-info">' + _html_reply_count_post + ' | ' + v.comment_reply_created + '</span>\
										</div>\
										<h5>' + v.comment_reply_body + '</h5>\
										<div class="f-comment">\
											<div class="f-left">\
												<span><a href="javascript:;" onclick="g_comment.set_like_unlike(' + v.bkp_comment_reply_id + ',1,$(this))"><i class="icon-like"></i>' + v.comment_reply_count_like + '</a></span>\
												<span><a href="javascript:;" onclick="g_comment.set_like_unlike(' + v.bkp_comment_reply_id + ',0,$(this))"><i class="icon-unlike"></i>' + v.comment_reply_count_unlike + '</a></span>\
												<span><a href="javascript:;" class="a-report" data-comment_id="' + v.bkp_comment_reply_id + '" onclick="g_comment.report_abuse(' + v.bkp_comment_reply_id + ',$(this))"><i class="icon-report"></i>Report abuse</a></span>\
											</div>\
										</div>\
									</div>\
								</li>';
					});

					_html += '</ul>';

					return _html;
				},
				set_like_unlike : function (comment_id,status,obj) {


					$.post( "/comment/process", { 'use_id':comment_id,act:'setLikeUnlike',status:status},function(data){
						if (data.status == 'success') {

							var _current_like_unlike_count = obj.text();
							_current_like_unlike_count++;
							if (status == 1) {
								obj.html('<i class="icon-like"></i>' + _current_like_unlike_count);
							} else {
								obj.html('<i class="icon-unlike"></i>' + _current_like_unlike_count);
							}

							return true;
						}
					},'JSON');

				},
				is_auto_show_comment: function () {
					$('.open-comment').trigger('click');
				},
				check_comment_limit: function(mode) {
					var _t = this;

					mode = (typeof mode == 'undefined') ? 'comment' : mode;

					if (mode == 'comment') {
						var _elm = $('#body_comment');
						var _txt = _elm.val();
						if (_txt.length > _t.text_comment_limit) {
							_elm.val(_txt.substring(0, _t.text_comment_limit));
						}
					} else {
						var _elm = $('#body_reply');
						var _txt = _elm.val();
						if (_txt.length > _t.text_comment_limit) {
							_elm.val(_txt.substring(0, _t.text_comment_limit));
						}
					}
				} ,
				report_abuse: function(id,obj) {
					var _t = this;
					g_member.get_member_login(function(){

					var _count_box_reply = obj.parent().parent().parent().parent().find($('.comment-report')).length;
						$('.box-reply').slideUp(function() {
							// Animation complete.
							 $(this).remove();
							 // console.log('box-reply remove : ' + _count_box_reply);
						});

					if (g_member.is_member_login) {
						
						 // console.log('comment-report count : ' + _count_box_reply);
						if (_count_box_reply == 0) { // confirm 
								
								$('<div class="box-reply" style="display:none">\
									<div class="comment-report">\
										<div class="h-notlogin">Are you sure you want to report this comment as inappropriate?</div>\
										<div class="box-add btn-for-report">\
											<a href="javascript:void(0);" onclick="g_comment.get_report_comment('+id+',$(this) );">YES</a>\
											<a href="javascript:void(0);" onclick="g_comment.get_hide_abuse();">NO, I CHANGED MY MIND</a>\
										</div>\
									</div>\
								</div>'
								).insertAfter(obj.parent().parent().parent());
								if (_count_box_reply == 0) {
								$('.box-reply').slideDown(function(event) {
									 // console.log('report_abuse show' );
								});
								}
								event.stopPropagation();
								event.preventDefault();
						
						}
						event.stopPropagation();
						event.preventDefault();

					} else {
						var _count_box_login = obj.parent().parent().parent().parent().find($('.comment-notlogin')).length;
						 // console.log('not login count : ' + _count_box_login);
						if (_count_box_login == 0) {
							$('<div class="box-reply" style="display:none">\
									<div class="comment-notlogin">\
										<div class="h-notlogin">Please sign in for an account before report this comment.</div>\
										<div class="box-add btn-for-signin">\
											<a href="' + g_member.get_url_login() + '">sign in</a>\
										</div>\
									</div>\
								</div>'
							).insertAfter(obj.parent().parent().parent());
							$('.box-reply').slideDown();
						}
					}
				});
				} , // report_abuse 
				get_report_comment: function(id,obj) {
					var _t = this;
					var _comment_txt = obj.parent().parent().parent().parent(); 
					var h5 = $(_comment_txt).find("h5");
					var txt_comment = h5.text();
					var _count_box_reply = obj.parent().parent().parent().parent().find($('.comment-report')).length;
					
					$('.box-reply').slideUp(function() {
						
						// console.log('remove  box-reply '+ _count_box_reply);
						$(this).remove();
					});
					
					//if (_count_box_reply == 0) {
					$('<div class="box-reply" style="display:none">\
							<div class="text-center"><i class="fas fa-spinner fa-spin"></i></div>\
						</div>').insertAfter(obj.parent().parent().parent());
					$('.box-reply').slideDown();
					//}
					//console.log('setReportAbuse url ' + _t.content_url);
					
					$.post( "/comment/process", {comment_id:id,content_url:_t.content_url,act:'setReportAbuse',body_comment:txt_comment },function(data){
						if (data.status == 'success') {
								
						return false;
						}
						
					},'JSON'); 
			
					$('.box-reply').slideUp(function(event) {
						 $('div.box-reply div.text-center i.fas.fa-spinner.fa-spin').remove();
						 $(this).remove();
						 
						 // console.log('get_report_comment 1' );
						 //event.stopPropagation();
					});
					
					$('<div class="box-reply" style="display:none">\
						<div class="h-notlogin">\
						<span>Thank you for reporting this comment.</span>\
						We\'ll double check this comment to make sure it complies<br>with our rules.\
						</div>\
						<div class="box-add btn-for-signin">\
						<a  href="javascript:void(0);" onclick="g_comment.get_hide_abuse();" >Close</a>\
						</div>\
					</div>').insertAfter(obj.parent().parent().parent());
					
					//$('.box-reply').slideDown();
					
					$('.box-reply').slideDown(function(event) {
						// console.log('get_report_comment 3' );
					});
					
					event.preventDefault();
					event.stopPropagation();
				} ,
				get_hide_abuse: function() {
					$('.box-reply').slideUp(function() {
						// Animation complete.
						 $(this).remove();
					});
				}
			}

			$(function(){
				g_comment.initial_comment();
				if (window.location.href.indexOf('view_comment=1') != -1) {
					g_comment.is_auto_show_comment();
				}
			});

			
			/* ????|???? title ??? social share ????? scroll mouse ????|?? */
			$(function(){
				if($(window).width() > 991){
					var position = $('#position-set').offset();
					$(window).scrPosition(function(a){
						if(a == "up"){
							var getScrollTop = $(this).scrollTop();
							if(getScrollTop > position.top) {
								$(".article-headline-fixed").show();
								$("header.sticky .menu-list ul li:last-child").css('z-index','-1');
							}
						}else{
							$(".article-headline-fixed").hide();
							$("header.sticky .menu-list ul li:last-child").css('z-index','1');
						}
					});
				}
			});

			(function(j,d,w){
			j.fn.scrPosition = function(callback){
				var position;
				var scrollPosition = j(this).scrollTop();
				j(this).scroll(function(){
				var scrollTop = j(this).scrollTop();
				if(scrollPosition < scrollTop)
					position = "up"
				else
					position = "down"
				scrollPosition = scrollTop;
				callback(position);
				});
			};
			})(jQuery,document,window);

				if(g_page_type == 'article'){
			var g_like_article = {
			fn_like_unlike : function (src_id , status){


				if (src_id == '' && status == '') {
					//console.log('content :' +src_id +' >> return false ');
					return false;
				}

				if (typeof status === 'undefined') {
					// only show like/unlike (not set)
					//console.log('content >> undefined ');
					status = 99;
				}
				$.post("/ajax/_getLikeUnlike.php", { src_id : src_id , status : status , act : 'CONV3'},
					function(data) {
						//console.log('data =>' + data);
						if (data != '') {

							$('div#like-dislike-article.f-comment').html(data);
						}
						return false;
				});

			},
			fn_show_block : function (content_id){

				this.fn_like_unlike(content_id);
				// this.fn_like_unlike(content_id,1);
				// this.fn_like_unlike(content_id,0);
			}

		}

		}
	</script>
	<script type="text/javascript">
	if (ad_section == 'world') {
		//console.log('==>  header bidding AdAsia');
		var script_tag = document.createElement('script');
		script_tag.type = 'text/javascript';
		script_tag.src = '//storage.googleapis.com/adasia-ad-network-origin/atm/library/avmLibrary.js';
		script_tag.async = true;
		script_tag.onload = function() {
			var adAsiaTM = window.adAsiaTM || adAsiaTM, zoneList = [];
			adAsiaTM.init(zoneList);
		};
		document.head.appendChild(script_tag);
	}
	</script>

	<!-- Cxense script begin -->
	<script type="text/javascript">

		var cxense_exclude_content_id = '';

		var cX = window.cX = window.cX || {}; cX.callQueue = cX.callQueue || [];
		cX.CCE = cX.CCE || {}; cX.CCE.callQueue = cX.CCE.callQueue || [];
		// cX.CCE.callQueue.push(['sendPageViewEvent', { useAutoRefreshCheck: false }]);

		 
		// Get member login
		g_member.get_member_login(function(){
			
			// Send member id to cxense
			if (typeof g_url_params._extid !== 'undefined' && g_url_params._extid.indexOf('subscriber') !== -1) {
				// User from EDM
				console.log('[EDM] Send member id to cxense', g_url_params._extid);
				cX.callQueue.push(['addExternalId', { 'id': g_url_params._extid, 'type': 'bpp'}]);				
			} else if (g_member.is_member_login) {
				console.log('[LOGIN] Send member id to cxense', 'subscriber' + g_member.id);
				cX.callQueue.push(['addExternalId', { 'id': 'subscriber' + g_member.id, 'type': 'bpp'}]);
			}

			cX.callQueue.push(['setSiteId', '1133918090132712068']);
			cX.CCE.callQueue.push(['sendPageViewEvent']);
			(function(d,s,e,t){e=d.createElement(s);e.type='text/java'+s;e.async='async';e.src='https://cdn.cxense.com/cx.cce.js';t=d.getElementsByTagName(s)[0];t.parentNode.insertBefore(e,t);})(document,'script');

		});
		
		
		// Cxense not exclude content id
	</script>
	<!-- Cxense script end -->

	<!--BEGIN WEB STAT CODE-->
	<script type="text/javascript">
	var g_truehits_options = {
			strictMode: false,
			key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"],
			q: {
				name: "queryKey",
				parser: /(?:^|&)([^&=]*)=?([^&]*)/g
			},
			parser: {
				strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
				loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
			}
	}

	var g_truehits = {
			var_default_name : "homepage",
			fn_parseUri : function (str){
				var o = g_truehits_options;
				m = o.parser[o.strictMode ? "strict" : "loose"].exec(str);
				uri = {};
				i = 14;

				while (i--) uri[o.key[i]] = m[i] || "";

				uri[o.q.name] = {};
				uri[o.key[12]].replace(o.q.parser, function($0, $1, $2) {
					if ($1) uri[o.q.name][$1] = $2;
				});

				return uri;
			},

			fn_decode: function(encoded){
				return decodeURIComponent(encoded.replace(/\+/g, " "));
			},
			fn_getTruehitsName : function (){
				var this_url = this.fn_parseUri(window.location.href + '');
				var page = '';

				var paths = this.fn_decode(this_url['directory']).split('/');
				var paths_length = paths.length - 2;
				if (paths_length > 0) {
					if (paths_length >= 1) {
						page = paths[1];
						if (paths[2] != ''){
							if(isNaN(paths[2])) {
								//page = page + '_' + paths[2];
								if(!isNaN(paths[3])) {
									page = page + "_article";
								}
							}else{
								if(page == "photo"){
									page = page + "_view";
								}else{
									page = page + "_article";
								}
							}
						}
					}else {
						page = paths[1];
					}
				}else {
					page = paths[1] || this_url['file'];
				}

				if (page == '') page = this.var_default_name || "homepage";
				page = page.toUpperCase();
				page = "NEWDESIGN_"+page;
				return page;
			}
	}

	// Refresh ????? resize ????????????????? ad ?????????????
	var g_current_ad_type = g_ad_type;
	/*
	$( window ).resize(function() {
		g_window_width = $( window ).width();
		var _ad_type = g_ad.get_ad_type();
		if (_ad_type != g_current_ad_type) {
			location.reload();
		}
	});
	googletag.pubads().refresh();
	*/
	/* nexus */
	function sendAdserverRequest() {
				if(pbjs.adserverRequestSent) return;
				pbjs.adserverRequestSent = true;
				googletag.cmd.push(function() {
					pbjs.que.push(function() {
						pbjs.setTargetingForGPTAsync();
						// console.log("Refresh ad all slot!");
						//googletag.pubads().refresh();
					});
				});
			}
		/* end nexus */
	</script>

	<!-- openx step 1 -->
	<script type='text/javascript'>

		//g_page_type = 'homepage'; // ratt debug
		//g_section = 'homepage'; // ratt debug

		var OA_zones = {};
		if(g_page_type == "homepage"){
			OA_zones = {
				"2960": 2960, "2961": 2961, "2962": 2962, "2978": 2978,"3229":3229,"3232":3232,"4243":4243  //,"3031": 3031,"3034":3034
			}
		}
		if(g_page_type == "section"){
			switch (g_section) {
				case 'thailand':
					OA_zones = {
						"2912": 2912
					}
				  break;
				case 'world':
					OA_zones = {
						"2913": 2913
					}
				  break;
				case 'business':
					OA_zones = {
						"2768": 2768
					}
				  break;
				case 'auto':
					OA_zones = {
						"2771": 2771
					}
				  break;
				case 'life':
					OA_zones = {
						"2769": 2769
					}
				  break;
				case 'sports':
					OA_zones = {
						"2915": 2915
					}
				  break;
				case 'tech':
					OA_zones = {
						"2914": 2914
					}
				  break;
				case 'property':
					OA_zones = {
						"2869": 2869
					}
				  break;
				case 'travel':
					OA_zones = {
						"2770": 2770
					}
				  break;
			}
		}
		// campaign inter edu topics
		if(g_page_type == "sub_section" && g_section == "topics" && g_topic_id != ''){
			if(g_topic_id =='1752179'){
				OA_zones = {
					 "3010": 3010, "3016": 3016, "3019": 3019, "3022": 3022, "3025": 3025
				}
			}
			if(g_topic_id =='1802499'){ // campaign holiday time 2019 topics
				OA_zones = {
					// "2960": 2960, "2961": 2961 // debug
					 "2820": 2820, "2827": 2827 // code ad production
				}
			}

		}
		// campaign covid19
		if(g_section == "specials"){
			if(g_url_path[2] == "covid19"){
				OA_zones = {
				  
					"3241":3241,"3244":3244,"3235":3235
				}
			}
			if( g_url_path[2] == "delivery"){
				OA_zones = {
					 "3331": 3331, "3334": 3334 , "3337": 3337 , "3340": 3340 ,"3343": 3343, // store
					 "3346": 3346, "3349": 3349 , "3352": 3352 , "3355": 3355 ,"3358": 3358, // food 
					 "3388": 3388, "3391": 3391 , "3394": 3394 , "3397": 3397 ,"3400": 3400 // food
				}
			}
		}
		// Cover page
		var coverpage_ad_type = g_ad.get_ad_type();

		switch (coverpage_ad_type) {
			case 'desktop' :
				if (g_section == 'homepage') {
					Object.assign(OA_zones, {'120': 120});
				} else if (g_section != 'business') {
					Object.assign(OA_zones, {'2980': 2980});
				}
			break;
			case 'tablet' :
				// L
				if (g_section == 'homepage') {
					Object.assign(OA_zones, {'2152': 2152});
				} else if (g_section != 'business') {
					Object.assign(OA_zones, {'2983': 2983});
				}
			break;
			case 'mobile' :
				// M
				if (g_section == 'homepage') {
					Object.assign(OA_zones, {'2151': 2151});
				} else if (g_section != 'business') {
					Object.assign(OA_zones, {'2982': 2982});
				}
			break;
			default :
				// S
				if (g_section == 'homepage') {
					Object.assign(OA_zones, {'1802': 1802});
				} else if (g_section != 'business') {
					Object.assign(OA_zones, {'2981': 2981});
				}

			break;
		}


	</script>

	<script type='text/javascript' src='/common/js/openx/bkp-spcjs.php.js?v=5.83'></script>
	<script type='text/javascript'>

		var adz = [];

		// Initail openx
		for (var v in OA_zones) {
			OA_show(v);
		}

		// Render openx
		$(function(){

		if(g_page_type == "homepage"){
			oa_show_openx(2960, 'homepage', 'highlight'); // move to cxense
			oa_show_openx(2961, 'homepage', 'most-recent');
			// oa_show_openx(3229, 'homepage', 'news-covid19'); // move to owl covid19
			oa_show_openx(3232, 'homepage', 'logo-covid19'); // real 3232 demo  2960
			//oa_show_openx(2978, 'homepage', 'video'); // move to cxense
			oa_show_openx(4243, 'homepage', 'new-normal'); 

		}
		if(g_page_type == "section"){
			switch (g_section) {
				case 'thailand':
					oa_show_openx(2912, 'thailand', 'highlight');
				  break;
				case 'world':
					oa_show_openx(2913, 'world', 'highlight');
				  break;
				case 'business':
					oa_show_openx(2768, 'business', 'highlight');
				  break;
				case 'auto':
					oa_show_openx(2771, 'auto', 'highlight');
				  break;
				case 'life':
					oa_show_openx(2769, 'life', 'highlight');
				  break;
				case 'sports':
					oa_show_openx(2915, 'sports', 'highlight');
				  break;
				case 'tech':
					oa_show_openx(2914, 'tech', 'highlight');
				  break;
				case 'property':
					oa_show_openx(2869, 'property', 'highlight');
				  break;
				case 'travel':
					oa_show_openx(2770, 'travel', 'highlight');
				  break;
			}
		}
		if(g_page_type == "sub_section" && g_section == "topics" && g_topic_id != '' ){
			if(g_topic_id =='1752179'){
				oa_show_openx(3010, 'topics', 'latest1');
				oa_show_openx(3016, 'topics', 'latest2');
				oa_show_openx(3019, 'topics', 'latest3');
				oa_show_openx(3022, 'topics', 'latest4');
				oa_show_openx(3025, 'topics', 'latest5');
			}

			if(g_topic_id =='1802499'){
				oa_show_openx(2820, 'topics', 'latest3_holiday'); // campaign_holiday_2019
				oa_show_openx(2827, 'topics', 'latest6_holiday'); // campaign_holiday_2019
				//oa_show_openx(2960, 'topics', 'latest2'); // debug
				//oa_show_openx(2961, 'topics', 'latest5'); // debug

			}
		}
		if(g_section == "specials"){
			if(g_url_path[2] == "covid19"){
				oa_show_openx(3235, 'covid19page', 'logo-covid19'); // mainpage covid19 real 3235 dev 2960 
				oa_show_openx(3241, 'covid19page', 'general-covid19'); // mainpage covid19 real 3241
				oa_show_openx(3244, 'covid19page', 'life-covid19'); // mainpage covid19  real 3244 
			}
			
			if( g_url_path[2] == "delivery") {

  				//oa_show_openx(2960, 'deliverypage', 'foodA'); 
 				oa_show_openx(3346, 'deliverypage', 'foodA'); 
				oa_show_openx(3349, 'deliverypage', 'foodB'); 
				oa_show_openx(3352, 'deliverypage', 'foodC'); 
				oa_show_openx(3355, 'deliverypage', 'foodD'); 
				oa_show_openx(3358, 'deliverypage', 'foodE'); 
				oa_show_openx(3388, 'deliverypage', 'foodF'); 
				oa_show_openx(3391, 'deliverypage', 'foodG'); 
				oa_show_openx(3394, 'deliverypage', 'foodH'); 
				oa_show_openx(3397, 'deliverypage', 'foodI'); 
				oa_show_openx(3400, 'deliverypage', 'foodJ'); 
				
				oa_show_openx(3331, 'deliverypage', 'storeA'); 
				oa_show_openx(3334, 'deliverypage', 'storeB'); 
				oa_show_openx(3337, 'deliverypage', 'storeC'); 
				oa_show_openx(3340, 'deliverypage', 'storeD'); 
				oa_show_openx(3343, 'deliverypage', 'storeE');   

			}
			
		} 
		
		});

		function oa_show_openx(id, page, position) {

			// OA_show(id);
			//console.log('adz: '+adz[id]);
			//console.log('id: '+ id);
			var remove_element = null;
			if(page == "deliverypage"){
				if (typeof adz[id] === 'undefined'){
					switch(position){
						case "foodA": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq0").remove(); break;
						case "foodB": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq1").remove(); break;
						case "foodC": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq2").remove(); break;
						case "foodD": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq3").remove(); break;
						case "foodE": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq4").remove(); break;
						
						case "foodF": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq5").remove(); break;
						case "foodG": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq6").remove(); break;
						case "foodH": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq7").remove(); break;
						case "foodI": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq8").remove(); break;
						case "foodJ": $("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq9").remove(); break;
						case "storeA": $("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq0").remove(); break;
						case "storeB": $("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq1").remove(); break;
						case "storeC": $("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq2").remove(); break;
						case "storeD": $("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq3").remove(); break;
						case "storeE": $("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq4").remove(); break;
					}
				}
			}else{
				if (typeof adz[id] === 'undefined') return;
			}
			// Found ad
			if (adz[id]) {

				var headline = adz[id]['headline'];
				var intro = adz[id]['intro'];
				var src = adz[id]['src'].replace("http:", "https:");
				var click_url = adz[id]['click_url'];
				var view_url = adz[id]['view_url'].replace("http:", "https:");

				switch (page) {
					case 'homepage':

						switch (position) {
							case 'highlight':
								$('.highlights-side .list-h').eq(1).before('<div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a class="cx-exclude-id" data-cx-exclude-id="1681704" href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><img src="'+view_url+'" width="0" height="0"/></div>');
								$('.highlights-side .list-h').last().remove();
									//console.log();
									//console.log('highlight id: '+ id);
								break;
							case 'most-recent':
									// ?????????????
									$('.visible-md .box-recent li').eq(4).before('<li><div class="time"><span>SPONSORED</span></div><a href="'+click_url+'">'+headline+'</a><img src="'+view_url+'" width="0" height="0"/></li>');
									$('.visible-md .box-recent li').last().remove();

									// ?????????????
									$('.visible-xs .box-recent li').eq(4).before('<li><div class="time"><span>SPONSORED</span></div><a href="'+click_url+'">'+headline+'</a></li>');
									$('.visible-xs .box-recent li').last().remove();
								break;
							case 'recommended' :

								$('.home-recommend .owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								break;
							case 'video' :

								$('.box-bg.bg-darken div.row div.col-md-5').eq(2).before('<div class="col-md-5"><div class="list-v list-vdo"><a href="'+click_url+'"><figure><div class="icn-play"><img src="https://static.bangkokpost.com/newdesign/assets/images/hover-video.svg" alt=""></div><img src="'+src+'" alt=""></figure><div class="list-detail-mt"><h3>'+headline+' <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></a></div><img src="'+view_url+'" width="0" height="0"/></div>');
								$('.box-bg.bg-darken div.row div.col-md-5').last().remove();

							  break;
							case 'news-covid19' :
								$('.box-covid--list div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail list-detail--covid"><h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div> <a href="'+click_url+'">'+headline+'</a></h3></div></div><img src="'+view_url+'" width="0" height="0"/></div>');

							  break;
							case 'logo-covid19' :
								$('div.campaign--sponsored').html('SPONSORED BY <a href="'+click_url+'"><img src="'+src+'"></a><img src="'+view_url+'" width="0" height="0"/>');

							  break;
							  case 'new-normal':
								$('div .item.ads-list').html('<div class="list_campaign-hover"><div class="overlay"></div><figure><img class="caption-image" src="'+src+'"></figure><figcaption><h4><a href="/specials/new-normal/#quote-14">'+headline+'</a></h4><div class="view-all"><a href="'+click_url+'">'+intro+'</a></div></figcaption></div><img src="'+view_url+'" width="0" height="0"/></div>');
								//$('.highlights-side .list-h').last().remove();
									//console.log();
									//console.log('highlight id: '+ id);
								break;
							  /*
							case 'campaign1' :

								$('.campaign-highlight .owl-item').eq(3).html('<div class="item"><div class="list-v"><figure><a href="'+click_url+'"> </a><figure><a href="'+click_url+'"></a><a href="'+click_url+'"><img src="'+src+'" alt=""  ></a></figure></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								break;
							case 'campaign2' :
								$('.bg-highlight-campaign .owl-item').eq(4).html('<div class="item"><div class="list-v"><figure><a href="'+click_url+'"> </a><figure><a href="'+click_url+'"></a><a href="'+click_url+'"><img src="'+src+'" alt="" ></a></figure></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');
								break;
								*/
							}

						break;
					case 'thailand' :
							switch (position) {
								case 'highlight':
									$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
					case 'world' :
							switch (position) {
								case 'highlight':
									$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
					case 'business' :
							switch (position) {
								case 'highlight':
									$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-carousel.owl-theme.owl-recommended.owl-loaded div.owl-stage-outer div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
						case 'auto' :
								switch (position) {
									case 'highlight':
										$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
										$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

									  break;
									case 'recommended' :
										$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

									  break;
								}
						break;
						case 'sports' :
								switch (position) {
									case 'highlight':
										$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
										$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

									  break;
									case 'recommended' :
										$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

									  break;
								}
						break;
					case 'tech' :
							switch (position) {
								case 'highlight':
									$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
					case 'property' :
							switch (position) {
								case 'highlight':
									$('div.col-15.col-md.col-lg-15.col-highlights-side').eq(1).before('<div class="col-15 col-md col-lg-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md.col-lg-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
					case 'life' :
							switch (position) {
								case 'highlight':

									$('div.col-15.col-md-15.col-highlights-side').eq(1).before('<div class="col-15 col-md-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
					case 'travel' :
							switch (position) {
								case 'highlight':

									$('div.col-15.col-md-15.col-highlights-side').eq(1).before('<div class="col-15 col-md-15 col-highlights-side"><article><div class="hilight_sec"><div class="list-h"><div class="list-detail"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure></div></div></article><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.col-15.col-md-15.col-highlights-side').last().remove();

								  break;
								case 'recommended' :
									$('div.owl-stage div.owl-item').eq(2).html('<div class="item"><div class="list-v"><figure class="item-photo"><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail-mt"><h3><a href="'+click_url+'">'+headline+'</a> <div class="h-ic"><span><i class="ic-sponsored2"></i></span></div></h3></div></div></div><img src="'+view_url+'" width="0" height="0"/>');

								  break;
							}
						break;
						case 'topics':
							switch (position) {
								case 'latest1':
									//console.log('==>id: '+ id +' page: ' + page + ' position: latest1');
								$('.listnews-h .listnews-row').eq(1).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div></div>');

								  break;
								case 'latest2' :
									//console.log('==>id: '+ id +' page: ' + page + ' position: latest2 ');
									$('.listnews-h .listnews-row').eq(2).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');

								  break;
								  case 'latest3' :
								 // console.log('==>id: '+ id +' page: ' + page + ' position: latest3 ');
									$('.listnews-h .listnews-row').eq(4).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');

								  break;
								case 'latest4' :
									// console.log('==>id: '+ id +' page: ' + page + ' position: latest4 ');
									$('.listnews-h .listnews-row').eq(5).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');

								  break;
								  case 'latest5' :
								   //console.log('==>id: '+ id +' page: ' + page + ' position: latest5 ');
									$('.listnews-h .listnews-row').eq(7).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');

								  break;
								  case 'latest6' :
								  //console.log('==>id: '+ id +' page: ' + page + ' position: latest6 ');
									$('.listnews-h .listnews-row').eq(8).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');

								  break;

								//===inter_edu end
								case 'latest3_holiday' :
									//console.log('==>id: '+ id +' page: ' + page + ' position: latest3 ');
									$('.listnews-h .listnews-row').eq(2).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');

								  break;
								  case 'latest6_holiday' :
									//  console.log('==>id: '+ id +' page: ' + page + ' position: latest6 ');
									$('.listnews-h .listnews-row').eq(5).before('<div class="listnews-row"><div class="listnews-col-left"><div class="listnews-datetime"> </div></div><div class="listnews-col-right"><div class="listnews-text"><div class="h-line">sponsored</div><h3><a href="'+click_url+'">'+headline+'</a></h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div><p>'+intro+'</p></div><div class="listnews-img"><a href="'+click_url+'"><img src="'+src+'" class="img-fluid" alt=""></a></div><img src="'+view_url+'" width="0" height="0"/></div><div>');
								  break;

							}

						  break;
						case 'covid19page':
							switch (position) {
								case 'logo-covid19' :
									$('div.campaign--sponsored').html('SPONSORED BY <a href="'+click_url+'"><img src="'+src+'"></a><img src="'+view_url+'" width="0" height="0"/>');
								  break;
								case 'general-covid19' :
									$('div.covid19-news div.box-covid--listnews div.news-covid').eq(2).before('<div class="col-15 col-md-50 col-lg-5 news-covid"><div class="list-v"> <figure> <a href="'+click_url+'"><img src="'+src+'" alt=""></a> </figure> <div class="list-detail list-detail--covid"> <h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div> <a href="'+click_url+'">'+headline+'</a></h3></div> </div><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.covid19-news div.box-covid--listnews div.news-covid').last().remove();


								  break;
								case 'life-covid19' :
									$('div.covid19-life div.box-covid--listnews div.news-covid').eq(2).before('<div class="col-15 col-md-50 col-lg-5 news-covid"><div class="list-v"><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail"><h3><div class="h-ic"><span><i class="ic-sponsored2"></i></span></div> <a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div></div><img src="'+view_url+'" width="0" height="0"/></div>');
									$('div.covid19-life div.box-covid--listnews div.news-covid').last().remove();

								  break;
							}
						break;
						case 'deliverypage':
								var _template_delivery = '<div class="list-v"><figure><a href="'+click_url+'"><img src="'+src+'" alt=""></a></figure><div class="list-detail"><div class="h-line">Promotion</div><h3><a href="'+click_url+'">'+headline+'</a></h3><p>'+intro+'</p></div> <img src="'+view_url+'" width="0" height="0"/></div>';
							switch (position) {

								case 'foodA' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq0").html(_template_delivery);
								  break;
								case 'foodB' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq1").html(_template_delivery);
								  break;
								case 'foodC' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq2").html(_template_delivery);
								  break;
								case 'foodD' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq3").html(_template_delivery);
								  break;
								case 'foodE' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq4").html(_template_delivery);
								  break;
								case 'foodF' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq5").html(_template_delivery);
								  break;
								case 'foodG' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq6").html(_template_delivery);
								  break;
								case 'foodH' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq7").html(_template_delivery);
								  break;
								case 'foodI' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq8").html(_template_delivery);
								  break;
								case 'foodJ' :
										$("div.row.food div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq9").html(_template_delivery);
								  break;
								case 'storeA' :
										$("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq0").html(_template_delivery);
								  break;
								case 'storeB' :
										$("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq1").html(_template_delivery);
								  break;
								case 'storeC' :
										$("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq2").html(_template_delivery);
								  break;
								case 'storeD' :
										$("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq3").html(_template_delivery);
								  break;
								case 'storeE' :
										$("div.row.shop div.col-15.col-md-5.col-lg-5.col-xl-3.news-deliver.eq4").html(_template_delivery);
								  break;
							}
				}

			}
		}
	</script>
	<!-- openx step 1 -->


			<!-- Cxense Widget Begin -->
			<script type="text/javascript">
			/*ratt remove Cxense widget old by CR 2020-02-13 */
			var g_cxense_homepage_v2 = {
				_get_under_hl_item_template : function(item) {
					var _t = this;

					var title = g_obj_bp.escape_html(item.title);
					var headline = item["bpp-headline"];
					if (typeof item["bpp-headline"] === 'undefined') headline = title;
					var intro = item["bpp-intro"];
					if (typeof item["bpp-intro"] === 'undefined') intro = item.description;

					// var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					var thumbnail = '';
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }
					var comment = '';
					//item['bpp-comment-count'] = 3; // debug
					if (typeof item['bpp-comment-count'] !== 'undefined') {
						comment = '<span class="ic-comment"> <a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'?view_comment=1"><i class="icon-comment"></i> ' + item['bpp-comment-count'] + '</a></span>';
					}

					var intro_icon = '';
					var headline_icon = '';
					var icon = _t._get_icon(item);

					headline_icon = icon['headline'];
					intro_icon = icon['intro'];

					var h_icon = '';
					if(headline_icon !=''){
						h_icon = ' <div class="h-ic">'+ headline_icon +'</div>';
					}

					var _url_path = item.url.split('/');
					for (a = 0; a <= 5; a++) {
						if(typeof _url_path[a] === 'undefined') _url_path[a] = '';

					}
					_section = _url_path[3];
					var _class_no_image = '';
					var _html_image = '';
					if (thumbnail != '') {
						_html_image = '<figure><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '"><img src="' + thumbnail + '" title="'+headline+'" ></a></figure>';
					} else {
						_class_no_image = 'highlights-list-noimage';
					}

					 _html = '<div class="col-15 col-md-5 box-highlights-list ' + _class_no_image + '"><div class="list-v"><div class="list-detail"><div class="h-line"><a href="/'+_section+'">'+_section+'</a></div><h3><a class="cx-exclude-id" id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '" >'+headline+'</a> '+ h_icon +'</h3><p>'+intro+'</p><div class="f-icon"><span>' + publishtime +'</span>'+ comment + intro_icon +'</div></div>'+ _html_image +' </div></div>';
				return _html ;

				},
				_get_thailand_item_template : function(item) {
					var _t = this;
					var title = g_obj_bp.escape_html(item.title);
					//if (typeof item['bpp-headline'] !== 'undefined') headline = item['bpp-headline'];
					var headline = item["bpp-headline"];
					if (typeof item["bpp-headline"] === 'undefined') headline = title;
					var intro = item["bpp-intro"];
					if (typeof item["bpp-intro"] === 'undefined') intro = item.description;

					// var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					var thumbnail = '';
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }
					var comment = '';
					//item['bpp-comment-count'] = 3; // debug
					if (typeof item['bpp-comment-count'] !== 'undefined') {
						comment = '<span class="ic-comment"> <a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'?view_comment=1"><i class="icon-comment"></i> ' + item['bpp-comment-count'] + '</a></span>';
					}
					var intro_icon = '';
					var headline_icon = '';
					// item['bpp-icon'] = "video,photo,update,analysis,review,exclusive"; // debug
					var icon = _t._get_icon(item);
					headline_icon = icon['headline'];
					intro_icon = icon['intro'];

					var h_icon = '';
					if(headline_icon !=''){
						h_icon = ' <div class="h-ic">'+ headline_icon +'</div>';
					}

					var _url_path = item.url.split('/');
					for (a = 0; a <= 5; a++) {
						if(typeof _url_path[a] === 'undefined') _url_path[a] = '';

					}
					_section = _url_path[3];

					var _html = '<div class="col-md"><article><div class="list-v"><figure><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '" ><img src="'+item.dominantimage+'" title="'+title+'" ></a></figure><div class="list-detail-mt"><div class="h-line"><a href="/'+_section+'">'+_section+'</a></div><h3><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '" >'+headline+'</a>'+h_icon+'</h3><p>'+intro+'</p><div class="f-icon"><span>' + publishtime + '</span>'+comment+intro_icon+'</div></div></div></article></div>';

				return _html ;

				},
				_get_editorpick_item_template : function(item) {
					_t = this;
					var title = g_obj_bp.escape_html(item.title);
					//if (typeof item['bpp-headline'] !== 'undefined') headline = item['bpp-headline'];
					var headline = item["bpp-headline"];
					if (typeof item["bpp-headline"] === 'undefined') headline = title;
					var intro = item["bpp-intro"];
					if (typeof item["bpp-intro"] === 'undefined') intro = item.description;

					// var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					var thumbnail = '';
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }
					var comment = '';
					//item['bpp-comment-count'] = 3; // debug
					if (typeof item['bpp-comment-count'] !== 'undefined') {
						comment = '<span class="ic-comment"> <a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'?view_comment=1"><i class="icon-comment"></i> ' + item['bpp-comment-count'] + '</a></span>';
					}
					var intro_icon = '';
					var headline_icon = '';
					// item['bpp-icon'] = "video,photo,update,analysis,review,exclusive"; // debug
					var icon = _t._get_icon(item);
					headline_icon = icon['headline'];
					intro_icon = icon['intro'];

					var h_icon = '';
					if(headline_icon !=''){
						h_icon = ' <div class="h-ic">'+ headline_icon +'</div>';
					}

					var _url_path = item.url.split('/');
					for (a = 0; a <= 5; a++) {
						if(typeof _url_path[a] === 'undefined') _url_path[a] = '';

					}
					_section = _url_path[3];

					var _html = '<figure><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '" ><img src="'+item.dominantimage+'" title="'+title+'" ></a></figure><div class="list-detail-mt"><div class="h-line"><a href="/'+_section+'">'+_section+'</a></div><h3><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '">'+headline+'</a></h3>' + h_icon + '<p>'+intro+'</p><div class="f-icon"><span>' + publishtime +'</span>'+ comment + intro_icon +'</div></div>';

				return _html ;

				},
				_get_vdo_item_template : function(item) {
					_t = this;
					var title = g_obj_bp.escape_html(item.title);
					var headline = title;
					if (typeof item["bpp-headline"] !== 'undefined') { headline = item["bpp-headline"]; }
					var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY');
					}

					var _html ='<div class="col-md-5"><div class="list-v list-vdo"><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '"><figure><div class="icn-play"><img src="https://static.bangkokpost.com/newdesign/assets/images/hover-video.svg" alt=""></div><img src="'+thumbnail+'"></figure> <div class="list-detail-mt"><h3>'+headline+'</h3><div class="f-icon"> <span>'+publishtime+'</span></div></div><div class="play-time"><i class="icon-vdo"></i> </div></a></div></div>';

				return _html ;

				},
				_get_icon : function (item){
					var headline_icon = '';
					var intro_icon = '';

					if (typeof item['bpp-icon'] !== 'undefined') {
						var _icon = item['bpp-icon'].split(',');
						for (c = 0; c <_icon.length; c++) {

							if(typeof _icon[c] === 'undefined') _icon[c] = '';

								if(_icon[c] == 'update'){
									headline_icon += ' <span><i class="ic-update2"></i></span> ';
								}
								if(_icon[c] == 'analysis'){
									headline_icon += ' <span><i class="ic-analysis2"></i></span> ';
								}
								if(_icon[c] == 'review'){
									headline_icon += ' <span><i class="ic-review2"></i></span> ';
								}
								if(_icon[c] == 'exclusive'){
									headline_icon += ' <span><i class="ic-exclusive2"></i></span> ';
								}

							if(_icon[c] == 'video'){
								intro_icon += ' <span><i class="icon-vdo"></i></span> ';
							}
							if(_icon[c] == 'photo'){
								intro_icon += ' <span><i class="icon-photo"></i></span> ';
							}
						} // end for c++
					}

					icon = { headline: headline_icon, intro: intro_icon };
					return icon;
				},
				get_widgets_combined : function() {
					var _t = this;
					var _underhl_html = '';
					var _thailand_html = '';
					var _editorpick_html = '';
					var _vdo_html = '';
					cX.callQueue.push(['insertWidget', {
						widgetId: 'e6f5275f7cff9cad61fa3d0326b4176ed16fb5b5',
						renderFunction: function(data, context) {
							if (data.response.items) {
								var item = '';
								var count_cx_data = data.response.items.length;
								//console.log('count_cx_data combined =>'+count_cx_data);
								var underhl_count = 0;
								var thailand_count = 0;
								var editorpick_count = 0;
								var vdo_count = 0;
								for (i = 0; i < count_cx_data; i++) {
									var item = data.response.items[i];
									// item['bpp-icon'] = "video,photo,update,analysis,review,exclusive"; // debug
									//console.log(i+ '=placement=>' + item.placement );
									if (item.placement == 'underbox'){
										item.click_url += '?cx_placement=underbox';
										underhl_count++;
										//console.log( i+ '=underbox_count=>' + underhl_count );
										if (underhl_count <= 3) {
											// TODO: add render template to _underhl_html
											_underhl_html += _t._get_under_hl_item_template(item);
										}
									}

									else if (item.placement == 'thailand') {
										item.click_url += '?cx_placement=thailand';
										thailand_count++;
										 if (thailand_count <= 2) {
											// TODO: add render template to _thailand_html
											_thailand_html += _t._get_thailand_item_template(item);
										 }
									}
									else if (item.placement == 'editorpick') {
										item.click_url += '?cx_placement=editorpick';
										editorpick_count++;
										if (editorpick_count <= 1) {
											// TODO: add render template to _editorpick_html
											_editorpick_html += _t._get_editorpick_item_template(item);
										}
									}

									else if (item.placement == 'vdo') {
										item.click_url += '?cx_placement=vdo';
										vdo_count++;
										if (vdo_count <= 3) {
											// TODO: add render template to _vdo_html
											_vdo_html += _t._get_vdo_item_template(item);
										}
									}

								} // end for i++
								//console.log('==_vdo_html==>' + _vdo_html);

								$('.row .highlights-list').html(_underhl_html);
								$('div.home-aroundthailand div.row.aro').html(_thailand_html);
								$('div .box-border div.list-v').html(_editorpick_html);
								$('div.box-bg.bg-darken div.row').html(_vdo_html);
								oa_show_openx(2978, 'homepage', 'video');
							}
						}
					}]);
				} // get_widgets_combined
			} // g_cxense_homepage_v2 = {

			</script>
		<!-- Cxense Widget End -->

<script type="text/javascript"  >
  var isAdBlockActive=true;
</script>
<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/custom/js/ads.js?v=1.1"></script>


<script type="text/javascript" >

setTimeout(function() {
	if (isAdBlockActive) {
	 // console.log("The visitor is blocking ads");
	}else{
	 // console.log("The visitor is allow ads");
	}
}, 1000);

</script>
		<script type="text/javascript">
		var truehits_name = g_truehits.fn_getTruehitsName();
		//console.log("truehits th_page: "+ truehits_name);

		var __th_page = truehits_name;

		(function() {
			var ga1 = document.createElement('script');
			ga1.type = 'text/javascript';
			ga1.async = true;
			ga1.src = "//lvs.truehits.in.th/dataa/s0028944.js";
			var s = document.getElementsByTagName('script')[0];
			s.parentNode.insertBefore(ga1, s);
		})();

		$(function(){
			  var el = $("#truehits_div").detach();
			  el.appendTo($("#truehits_area"));
			  el.show();
			//   $("#truehits_div").show();
		});

		</script>
	<!--END WEB STAT CODE-->	

</head>
<body>

	<!-- Google Tag Manager (noscript) -->
	<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MLF6WTD"
	height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
	<!-- End Google Tag Manager (noscript) -->

	<script async src="//get.optad360.io/sf/525f6193-8c54-43c9-91be-49a33994236a/plugin.min.js"></script>
		<div class="turehits" style="padding-top:0;display:none;" id="truehits_div"></div>
	<!-- nav -->
	<header id="header-nav" class="header-nav">
		<div class="container">
			<div class="header-panel">

				<div class="bp-logo">
					<!--<h1><a href="/"><img src="https://static.bangkokpost.com/newdesign/assets/images/BangkokPost-beta.svg" class="img-fluid" alt="BangkokPost.com"></a></h1>-->
					 <h1><a href="/"><img src="https://static.bangkokpost.com/newdesign/assets/images/BangkokPost.svg" class="img-fluid" alt="BangkokPost.com"></a></h1>
				</div>


				<div class="header-menu">
					<div class="signin-panel">
						<!--
							<div class="beta-btn2"><a class="track_newdesign" href="https://www.bangkokpost.com?olddesign=1">RETURN TO THE <span>CURRENT DESIGN</span> <img src="https://static.bangkokpost.com/newdesign/assets/images/beta/arrow2.svg" alt=""></a></div>
						-->
						<ul>
							<li><a id="cta-subscription" href="/subscription" title="SUBSCRIBE NOW">SUBSCRIBE</a></li>
							<li id="signin-container"></li>
						</ul>
					</div>
					<div class="menu-panel">
						<nav class="menu-list">
							<ul>
								<li><a href="/thailand" title="THAILAND">THAILAND</a></li>
								<li><a href="/world" title="WORLD">WORLD</a></li>
								<li><a href="/business" title="BUSINESS">BUSINESS</a></li>
								<li><a href="/opinion" title="OPINION">OPINION</a></li>
								<li><a href="/auto" title="AUTO">AUTO</a></li>
								<li><a href="/life" title="LIFE">LIFE</a></li>
								<li><a href="/learning" title="LEARNING">LEARNING</a></li>
								<li><a href="/vdo" title="VIDEO">VIDEO</a></li>
								<li class="menu-list-more"><a href="javascript:;">MORE+</a>
									<div class="menu-more">
										<div class="menu-more--row">
											<div class="menu-more--left">
												<div class="menu-more--col">
													<div class="menu-more--hd"><span>Other Services</span></div>
													<ul>
														<li><a href="//property.bangkokpost.com" title="PROPERTY SEARCH">PROPERTY SEARCH</a></li>
														<li><a href="//job.bangkokpost.com" title="JOBS">JOBS</a></li>
														<li><a href="/thailandguide" title="THAILAND GUIDE">THAILAND GUIDE</a></li>
														<li><a href="/subscribe" title="HOME DELIVERY">HOME DELIVERY</a></li>
													</ul>
												</div>
												<div class="menu-more--col">
													<div class="menu-more--hd"><span>Digital products</span></div>
													<ul>
														<li><a href="/epaper" title="EPAPER">EPAPER</a></li>
														<li><a href="/sms" title="SMS">SMS</a></li>
														<li><a href="/archive" title="DIGITAL ARCHIVE">DIGITAL ARCHIVE</a></li>
													</ul>
												</div>
											</div>
											<div class="menu-more--right">
												<ul>
													<li><a href="/sports" title="SPORTS">SPORTS</a></li>
													<li><a href="/travel" title="TRAVEL">TRAVEL</a></li>
													<li><a href="/tech" title="TECH">TECH</a></li>
													<li><a href="/property" title="PROPERTY">PROPERTY</a></li>
													<li><a href="/photo" title="PHOTOS">PHOTOS</a></li>
												</ul>
											</div>
										</div>
									</div>
								</li>
							</ul>
						</nav>
						<div class="menu-search"><a href="javascript:;" id="openSearch"><i class="icon-search"></i></a></div>
					</div>
				</div>
				<div id="ham-menu">
					<span></span>
					<span></span>
					<span></span>
				</div>
			</div>
		</div>
	</header>

	<div class="divNav">
		<div class="close-menu">
			<span></span>
			<span></span>
			<span></span>
		</div>
		<div class="container">
			<div class="divNav-search">
				<div class="bp--logo"><img src="https://static.bangkokpost.com/newdesign/assets/images/BangkokPost-blue.svg" alt="BangkokPost.com"></div>
				<form method="post" onsubmit="return go_search_menu()">
					<div class="divNav--search">
						<input type="text" class="form-input-text" placeholder="SEARCH" name="q_menu" id="q_menu"><button class="btn-search" onclick="return go_search_menu()"><i class="icon-search"></i></button>
					</div>
				</form>
			</div>
			<div class="divNav-menu row">
				<div class="divNav--menu col-15 col-md-auto">
					<div class="header"><span>Section</span></div>
					<div class="divNav-row">
						<div class="divNav--row">
							<ul>
								<li><a href="/thailand" title="Thailand">Thailand</a>
									<ul>
										<li><a href="/thailand/general" title="General">General</a></li>
										<li><a href="/thailand/politics" title="Politics">Politics</a></li>
										<li><a href="/thailand/special-reports" title="Special Report">Special Report</a></li>
										<li><a href="/thailand/pr" title="PR News & Special publication">PR News</a></li>
									</ul>
								</li>
								<li><a href="/world" title="World">World</a></li>
								<li><a href="/business" title="Business">Business</a></li>
								<li><a href="/opinion" title="Opinion">Opinion</a>
									<ul>
										<li><a href="/opinion/columnist" title="Columnists">Columnists</a></li>
										<li><a href="/opinion/postbag" title="Postbag">Postbag</a></li>
									</ul>
								</li>
								<li class="show-navlist-mobi"><a href="/sports" title="Sports">Sports</a></li> <!-- show mobile -->
								<li class="show-navlist-mobi"><a href="/auto" title="Auto">Auto</a>
									<ul>
										<li><a href="/auto/news" title="News">News</a></li>
										<li><a href="/auto/review" title="Review">Review</a></li>
									</ul>
								</li> <!-- show mobile -->
							</ul>
						</div>
					</div>
					<div class="divNav-row">
						<div class="divNav--row">
							<ul>
								<li class="show-navlist-pc"><a href="/sports" title="Sports">Sports</a></li> <!-- show desktop -->
								<li class="show-navlist-pc"><a href="/auto" title="Auto">Auto</a>
									<ul>
										<li><a href="/auto/news" title="News">News</a></li>
										<li><a href="/auto/review" title="Review">Review</a></li>
									</ul>
								</li> <!-- show desktop -->
								<li><a href="/life" title="Life">Life</a>
									<ul>
										<li><a href="/life/arts-and-entertainment" title="Arts and Entertainment">Arts & Entertainment</a></li>
										<li><a href="/life/social-and-lifestyle" title="Social and Lifestyle">Social & Lifestyle</a></li>
									</ul>
								</li>
								<li><a href="/learning" title="Learning">Learning</a></li>
							</ul>
						</div>
						<div class="divNav--row">
							<ul>
								<li><a href="/vdo" title="Video">Video</a>
									<ul>
										<li><a href="/vdo/thailand" title="Thailand">Thailand</a></li>
										<li><a href="/vdo/world" title="World">World</a></li>
										<li><a href="/vdo/travel-and-lifestyle" title="Travel and Lifestyle">Travel & Lifestyle</a></li>
										<li><a href="/vdo/business" title="Business">Business</a></li>
									</ul>
								</li>
								<li><a href="/travel" title="Travel">Travel</a></li>
								<li><a href="/tech" title="Tech">Tech</a></li>
								<li><a href="/property" title="Property">Property</a></li>
								<li><a href="/photo" title="Photos">Photos</a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class="divNav--menu col-15 col-md-auto">
					<div class="divNav---col">
					<div class="header"><span>Other Services</span></div>
					<div class="divNav--row divNav--row-service">
						<ul class="menu--service">
							<li><a href="//property.bangkokpost.com" title="PROPERTY SEARCH">PROPERTY SEARCH</a></li>
							<li><a href="//job.bangkokpost.com" title="JOBS">JOBS</a></li>
							<li><a href="/thailandguide" title="THAILAND GUIDE">THAILAND GUIDE</a></li>
							<li><a href="/subscribe" title="HOME DELIVERY">HOME DELIVERY</a></li>
						</ul>
					</div>
					</div>
					<div class="divNav---col">
					<div class="header"><span>About Us</span></div>
					<div class="divNav--row divNav--row-service">
						<ul class="menu--service">
							<li><a href="https://www.bangkokpost.co.th/post_contact">CONTACT US</a></li>
							<li><a href="/mediainfo/solution">ONLINE ADVERTISING</a></li>
							<li><a href="/send-suggestions">TELL US WHAT YOU THINK</a></li>
						</ul>
					</div>
				</div>
				</div>
<!-- edit -->
			<div class="divNav--menu col-15 col-md-auto">
				<div id="signin-container2"></div>
				<script type="text/javascript">
					g_member.get_login_template();
				</script>
				<div class="box-btnsubscribe"><a href="/subscription" class="btn-subscribe" title="SUBSCRIBE">SUBSCRIBE</a></div>
				<div class="header"><span>Digital Products</span></div>
				<div class="box-todayPaper">
					<div class="divNav--img"><img src="/ads/newspaper_direct/enewspaper.jpg?20200905" class="img-fluid" alt="Today's Bangkok Post newspaper"></div>
					<div class="divNav--title">TODAY’S PAPER</div>
					<ul class="menu--product">
						<li><a href="/epaper" title="EPAPER">EPAPER</a></li>
						<li><a href="/sms" title="SMS">SMS</a></li>
						<li><a href="/archive" title="DIGITAL ARCHIVE">DIGITAL ARCHIVE</a></li>
					</ul>
				</div>
				<ul class="divNav--social">
					<li><a href="https://www.facebook.com/bangkokpost" target="_blank" rel="nofollow" title="Facebook"><i class="icon-facebook"></i></a></li>
					<li><a href="https://instagram.com/bangkokpost_official" target="_blank" rel="nofollow" title="Instagram"><i class="icon-instagram"></i></a></li>
					<li><a href="https://twitter.com/bangkokpostnews" target="_blank" rel="nofollow" title="Twitter"><i class="icon-twitter"></i></a></li>
					<li><a href="https://line.me/R/ti/p/%40axq6041s" target="_blank" rel="nofollow" title="Line"><i class="icon-line"></i></a></li>
				</ul>
			</div>
			<!-- /edit -->
			</div>
		</div>
	</div>
	<div class="divSearch">
		<div class="close-menu">
			<span></span>
			<span></span>
			<span></span>
		</div>
		<div class="container">
			<div class="bp-logo-search"><img src="https://static.bangkokpost.com/newdesign/assets/images/BangkokPost-blue.svg" alt="BangkokPost.com"></div>
			<form method="post" onsubmit="return go_search()">
				<div class="divSearch-form">
					<input type="text" class="form-input-text" placeholder="SEARCH" name="q" id="q"><button class="btn-search" onclick="return go_search()"><i class="icon-search"></i></button>
				</div>
			</form>
		</div>
	</div>
	<!-- nav -->
	<div class="content-pd"></div>
			

	<!-- /2776261/bangkokpost_homepage/leaderboard -->
		<div class="ads ads-leaderboard" id='div-gpt-ad-leaderboard-0'>
		<script>
			googletag.cmd.push(function() { googletag.display('div-gpt-ad-leaderboard-0'); });
		</script>
	</div>
	<link rel="stylesheet" type="text/css" href="https://static.bangkokpost.com/newdesign/assets/css/gallery.css">

			<!-- Cxense Widget Begin -->
			<script type="text/javascript">
			/*ratt remove Cxense widget old by CR 2020-05-13 */
			var g_cxense_article_v2 = {
				
				_get_related_item_template : function(item) {
					var _t = this;

					var title = g_obj_bp.escape_html(item.title);
					var headline = item["bpp-headline"];
					if (typeof item["bpp-headline"] === 'undefined') headline = title; 
					var intro = item["bpp-intro"];
					if (typeof item["bpp-intro"] === 'undefined') intro = item.description;

					var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }
					var comment = '';
					//item['bpp-comment-count'] = 3; // debug
					if (typeof item['bpp-comment-count'] !== 'undefined') {
						comment = '<span class="ic-comment"> <a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'?view_comment=1"><i class="icon-comment"></i> ' + item['bpp-comment-count'] + '</a></span>';
					}

					var intro_icon = '';
					var headline_icon = '';
					var icon = _t._get_icon(item);

					headline_icon = icon['headline'];
					intro_icon = icon['intro'];

					var h_icon = '';
					if(headline_icon !=''){
						h_icon = ' <div class="h-ic">'+ headline_icon +'</div>';
					}

					var _url_path = item.url.split('/');
					for (a = 0; a <= 5; a++) {
						if(typeof _url_path[a] === 'undefined') _url_path[a] = '';

					}
					_section = _url_path[3];
					if(headline != 'undefined'){
					var _html = '\
								<div class="col-15 col-md-50">\
									<div class="list-v">\
										<figure class="item-photo">\
											<a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '"><img src="' + thumbnail + '" alt=""></a>\
										</figure>\
										<div class="list-detail">\
											<h3><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '">' + headline + '</a></h3>\
										</div>\
									</div>\
								</div>\
							';
					}
				return _html ;

				},
				_get_in_section_item_template : function(item) {
					var _t = this;
					var title = g_obj_bp.escape_html(item.title);
					//if (typeof item['bpp-headline'] !== 'undefined') headline = item['bpp-headline'];
					var headline = item["bpp-headline"];
					if (typeof item["bpp-headline"] === 'undefined') headline = title;
					var intro = item["bpp-intro"];
					if (typeof item["bpp-intro"] === 'undefined') intro = item.description;

					var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					//var thumbnail = '';
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }
					var comment = '';
					//item['bpp-comment-count'] = 3; // debug
					if (typeof item['bpp-comment-count'] !== 'undefined') {
						comment = '<span class="ic-comment"> <a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'?view_comment=1"><i class="icon-comment"></i> ' + item['bpp-comment-count'] + '</a></span>';
					}
					var intro_icon = '';
					var headline_icon = '';
					// item['bpp-icon'] = "video,photo,update,analysis,review,exclusive"; // debug
					var icon = _t._get_icon(item);
					headline_icon = icon['headline'];
					intro_icon = icon['intro'];

					var h_icon = '';
					if(headline_icon !=''){
						h_icon = ' <div class="h-ic">'+ headline_icon +'</div>';
					}

					var _url_path = item.url.split('/');
					for (a = 0; a <= 5; a++) {
						if(typeof _url_path[a] === 'undefined') _url_path[a] = '';

					}
					_section = _url_path[3];

					//var _html = '<div class="col-md"><article><div class="list-v"><figure><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '" ><img src="'+item.dominantimage+'" title="'+title+'" ></a></figure><div class="list-detail-mt"><div class="h-line"><a href="/'+_section+'">'+_section+'</a></div><h3><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '" >'+headline+'</a>'+h_icon+'</h3><p>'+intro+'</p><div class="f-icon"><span>' + publishtime + '</span>'+comment+intro_icon+'</div></div></div></article></div>';
					//console.log('headline :  ' + headline);
					if(headline != 'undefined'){
					 var _html = '\
								<div class="item">\
									<div class="list-v">\
									<figure class="item-photo">\
										<a href="' + item.click_url + '"><img src="' + thumbnail + '" alt="' + intro + '"></a>\
									</figure>\
									<div class="list-detail-mt">\
										<h3><a href="' + item.click_url + '">' + headline + '</a></h3>\
									</div>\
									</div>\
								</div>\
							';
					}

				return _html ;

				},
				_get_recent_item_template : function(item) {
					_t = this;
					var title = g_obj_bp.escape_html(item.title);
					//if (typeof item['bpp-headline'] !== 'undefined') headline = item['bpp-headline'];
					var headline = item["bpp-headline"];
					if (typeof item["bpp-headline"] === 'undefined') headline = title;
					var intro = item["bpp-intro"];
					if (typeof item["bpp-intro"] === 'undefined') intro = item.description;

					var thumbnail = '';
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }
					var comment = '';
					//item['bpp-comment-count'] = 3; // debug
					if (typeof item['bpp-comment-count'] !== 'undefined') {
						comment = '<span class="ic-comment"> <a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'?view_comment=1"><i class="icon-comment"></i> ' + item['bpp-comment-count'] + '</a></span>';
					}
					var intro_icon = '';
					var headline_icon = '';
					// item['bpp-icon'] = "video,photo,update,analysis,review,exclusive"; // debug
					var icon = _t._get_icon(item);
					headline_icon = icon['headline'];
					intro_icon = icon['intro'];

					var h_icon = '';
					if(headline_icon !=''){
						h_icon = ' <div class="h-ic">'+ headline_icon +'</div>';
					}

					var _url_path = item.url.split('/');
					for (a = 0; a <= 5; a++) {
						if(typeof _url_path[a] === 'undefined') _url_path[a] = '';
					}
					_section = _url_path[3];

					var _class_no_image = '';
						var _html_image = '';
						if(thumbnail == ''){
							_class_no_image = 'noimage';
						}else {
							_html_image = '<figure><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '"><img src="' + thumbnail + '" title="'+headline+'"></a></figure>';
						}
						var _html = '';
						if(headline !== 'undefined' && headline !=''){ // undefined 

						 _html = '<div class="list-h '+_class_no_image+'"><div class="list-detail"><div class="h-line"><a href="/'+_section+'">'+_section+'</a></div><h3><a id="'+ cX.CCE.clickTracker(item)+'" href="' + item.url + '">'+headline+'</a>'+ h_icon +'</h3><p>'+item.description+'</p><div class="f-icon"><span>' + publishtime +'</span>'+ comment + intro_icon +'</div></div>'+ _html_image +'</div>';
						}
						//console.log('get_recent headline : ' + headline);
				return _html ;

				},
				_get_in_article_item_template : function(item) {
					var title = g_obj_bp.escape_html(item.title);
					var headline = title;
					if (typeof item["bpp-headline"] !== 'undefined') { headline = item["bpp-headline"]; }
					var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY'); }

					var _html = '<li><a id="'+cX.CCE.clickTracker(item)+'" href="'+item.url+'" target="_blank" >'+headline+'</a></li>';
					return _html ;
				},
				_get_recommend_item_template : function(item) {
					_t = this;
					var title = g_obj_bp.escape_html(item.title);
					var headline = title;
					if (typeof item["bpp-headline"] !== 'undefined') { headline = item["bpp-headline"]; }
					var thumbnail = "https://static.bangkokpost.com/newdesign/assets/images/bg/default-pic-w600.jpg";
					if (typeof item.dominantthumbnail !== 'undefined'){ thumbnail = item.dominantthumbnail; }
					var publishtime = '';
					if (typeof item['recs-publishtime'] !== 'undefined'){ publishtime = moment(item['recs-publishtime']).format('D MMM YYYY');
					}

					var _html = '<li><a id="'+cX.CCE.clickTracker(item)+'" href="' + item.url + '">' + headline + '</a></li>';

				return _html ;

				},
				_get_icon : function (item){
					var headline_icon = '';
					var intro_icon = '';

					if (typeof item['bpp-icon'] !== 'undefined') {
						var _icon = item['bpp-icon'].split(',');
						for (c = 0; c <_icon.length; c++) {

							if(typeof _icon[c] === 'undefined') _icon[c] = '';

								if(_icon[c] == 'update'){
									headline_icon += ' <span><i class="ic-update2"></i></span> ';
								}
								if(_icon[c] == 'analysis'){
									headline_icon += ' <span><i class="ic-analysis2"></i></span> ';
								}
								if(_icon[c] == 'review'){
									headline_icon += ' <span><i class="ic-review2"></i></span> ';
								}
								if(_icon[c] == 'exclusive'){
									headline_icon += ' <span><i class="ic-exclusive2"></i></span> ';
								}

							if(_icon[c] == 'video'){
								intro_icon += ' <span><i class="icon-vdo"></i></span> ';
							}
							if(_icon[c] == 'photo'){
								intro_icon += ' <span><i class="icon-photo"></i></span> ';
							}
						} // end for c++
					}

					icon = { headline: headline_icon, intro: intro_icon };
					return icon;
				},
				get_widgets_combined : function() {
					var _t = this;
					var in_article_html = '<div class="ads-cxense" ><ul>';
					var in_section_html = '';
					var recent_html = '';
					var recommend_html = '';
					var related_html = '';
					cX.callQueue.push(['insertWidget', {
						widgetId: 'e3b90c351522a7b8f284d563d1c79f30e6fef487',
						renderFunction: function(data, context) {
							if (data.response.items) {
								var item = '';
								var count_cx_data = data.response.items.length;
								//console.log('count_cx_data combined =>'+count_cx_data);
								var article_count = 0;
								var section_count = 0;
								var recent_count = 0;
								var recommend_count = 0;
								var related_count = 0;
								
								for (i = 0; i < count_cx_data; i++) {
									var item = data.response.items[i];
									// item['bpp-icon'] = "video,photo,update,analysis,review,exclusive"; // debug
									// console.log(i+ '=placement=>' + item.placement );
									
																			 if (item.placement == 'article'){
											item.click_url += '?cx_placement=article';
											article_count++;
											// console.log( i+ '=article_count=>' + article_count );
											if (article_count <= 3) { 
												in_article_html += _t._get_in_article_item_template(item);
											}
										}
										else
										
										if (item.placement == 'section') {
											item.click_url += '?cx_placement=section';
											section_count++;
											 if (section_count <= 5) {
												 in_section_html += _t._get_in_section_item_template(item);
											 }
										}
										
										else if (item.placement == 'recent') {
											item.click_url += '?cx_placement=recent';
											recent_count++;
											if (recent_count <= 3) {
												if(_t._get_recent_item_template(item) !=='undefined'){
												recent_html += _t._get_recent_item_template(item);
												}
											}
										}

										else if (item.placement == 'recommend') {
											item.click_url += '?cx_placement=recommend';
											recommend_count++;
											if (recommend_count <= 6) {
												recommend_html += _t._get_recommend_item_template(item);
											}
										} 
 										
										else if (item.placement == 'related') {
											item.click_url += '?cx_placement=related';
											related_count++;
											// console.log( i+ '=related_count=>' + related_count );
											if (related_count <= 4) {
												related_html += _t._get_related_item_template(item);
											}
										}  
										
									} // end for i++
									
									in_article_html += '</ul></div>';
									if($('.articl-content p').eq(4).length > 0){
										 $('.articl-content p').eq(4).after(in_article_html);
									}
									 
									  if ($('.home-recommend').length) {
										$('.home-recommend').html('<div class="container">\
												<article>\
												<div class="box-border-top">\
												<div class="chanel">MORE IN SECTION</div>\
												<div class="owl-carousel owl-theme owl-recommended">\
												' + in_section_html + '\
												</div>\
											</div>\
											</article>\
										</div>'); 
									
								// Render owl
								if ($('.owl-recommended').length) {
									$('.owl-recommended').owlCarousel({
										margin: 30,
										loop: false,
										responsiveClass: true,
										nav: false,
										dots: false,
										mouseDrag: false,
										items: 5,
										slideBy: 1,
										responsive: {
											0: {
												items: 1,
												stagePadding: 30,
												loop: false,
												mouseDrag: true,
												//dots:true,
												nav: false,
											},
											768: {
												items: 3,
												mouseDrag: true,
												//dots:true,
												nav: true,
											},
											992: {
												items: 5,
											}
										}
									});

									$(".owl-recommended").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
										if (!e.namespace) return;
										var carousel = e.relatedTarget,
											current = carousel.current();
										if (current === carousel.maximum()) {
										 $(".owl-recommended.owl-carousel .owl-stage").addClass("pos-right");
										}else if (current === carousel.minimum()){
											$(".owl-recommended.owl-carousel .owl-stage").removeClass("pos-right");
										}
										if ($('.owl-recommended .item').length <= 1) {
										   $(".owl-recommended.owl-carousel .owl-stage").addClass("item1");
										}
									});

								} //  if ($('.owl-recommended').length) { 
							} // if ($('.home-recommend 
							
							$('div.article-col-highlights-side div.hilight_sec').html(recent_html);
							
							$('#recommended-stories').html(
								'<article>\
									<div class="box-bordertop-list list-group-article">\
										<div class="chanel">RECOMMENDED</div>\
										<ul class="list-group">\
											' + recommend_html + '\
										</ul>\
									</div>\
								</article>'
							);
							
							if(coverpage_ad_type == "mobile"){
								$('#cx-output-related-mobile').html(
								'<article  class="visible-xs">\
									<div class="box-bordertop-list article-list-related">\
										<div class="chanel">RELATED</div>\
										<div class="row">\
											' + related_html + '\
										</div>\
									</div>\
								</article>'
								);
							} else {
								$('#cx-output-related').html(
								'<article class="visible-sm visible-md visible-lg">\
									<div class="box-bordertop-list article-list-related">\
										<div class="chanel">RELATED</div>\
										<div class="row">\
											' + related_html + '\
										</div>\
									</div>\
								</article>'
								);
							} 
								
							} // if (data.response.items) {

						}
					},
					 { context: {"parameters":[{"key":"articleid", "value":"1980311"},{"key":"section", "value":"world"}]} 
					 }
					 ]);
				} // get_widgets_combined
			} // g_cxense_homepage_v2 = {

			</script>
		<!-- Cxense Widget End -->
<section>
<section>
	<div class="section-article">
		<div class="container">

			<div class="article-headline-fixed">
				<span>California braces for record-setting heatwave, more fires</span>
				<div class="box-share box-share--h">
					<ul>
						<li><a href="javascript:void(0)" onclick="share_social('facebook', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires');"><i class="icon-facebook"></i></a></li>
						<li><a href="javascript:void(0)" onclick="share_social('twitter', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires', 'California braces for record-setting heatwave, more fires');"><i class="icon-twitter"></i></a></li>
						<li><a href="javascript:void(0)" onclick="share_social('line', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires', 'California braces for record-setting heatwave, more fires');"><i class="icon-line"></i></a></li>
												<li class="comment-icon-fixed">
							<a href="javascript:void(0)" class="open-comment" onclick="g_comment.show_comment();"><i class="icon-comment"></i></a>
							<label>0</label>
						</li>
											</ul>
				</div>
			</div>

			<div class="row">
				<div class="col-15 col-md-15 col-lg-10">
					<div class="row">
						<div class="col-15 col-md-15 col-lg-15">
							<!-- article-news detail -->
							<div class="article-news">
								<article>
									<div class="breadcrumb">
																					<div class="breadcrumb-item"><a href="/world">
													World</a></div>
																													</div>
									<div class="article-headline">
										<h2>
											California braces for record-setting heatwave, more fires										</h2>
																			</div>
																		<div class="article-info" id="position-set">
										<div class="row">
											<div class="col-15 col-md">
												<p>published :
													5 Sep 2020 at 09:45												</p>
																							</div>
											<div class="col-15 col-md text-right">
																																				<p>writer: <a href="http://search.bangkokpost.com/search/result_advanced?category=news&columnistName=AFP"><span>
															AFP </span></a></p>
																																				
											</div>
										</div>
									</div>
									
									<!-- show ipad and mobile only -->
									<div class="box-share box-share--h">
										<ul>
											<li>
												<label>0</label>
												<a href="javascript:void(0)" onclick="share_social('facebook', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires');"><i class="icon-facebook"></i></a>
											</li>
											<li><a href="javascript:void(0)" onclick="share_social('twitter', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires', 'California braces for record-setting heatwave, more fires');"><i class="icon-twitter"></i></a></li>
											<li><a href="javascript:void(0)" onclick="share_social('line', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires', 'California braces for record-setting heatwave, more fires');"><i class="icon-line"></i></a></li>
																						<li class="comment-icon">
												<label>0</label>
												<a href="javascript:void(0)" class="open-comment" onclick="g_comment.show_comment();"><i class="icon-comment"></i></a>
											</li>
																					</ul>
									</div>
									<!-- /show ipad and mobile only -->

									<div class="articl-content">
																					<div class="box-img">
												<figure>
													<img data-img-highlight="1" src="https://static.bangkokpost.com/media/content/20200905/c1_3740639.jpg" alt="An arrow points toward Extreme Fire Danger on September 4, 2020 as a vehicle passes along the Angeles Crest Highway in the San Gabriel Mountains northeast of Los Angeles in La Canada Flintridge" title="An arrow points toward Extreme Fire Danger on September 4, 2020 as a vehicle passes along the Angeles Crest Highway in the San Gabriel Mountains northeast of Los Angeles in La Canada Flintridge" />
												</figure>
																								<figcaption>
													An arrow points toward Extreme Fire Danger on September 4, 2020 as a vehicle passes along the Angeles Crest Highway in the San Gabriel Mountains northeast of Los Angeles in La Canada Flintridge												</figcaption>
												
											</div>
																				<p>LOS ANGELES - California is bracing for  record-breaking temperatures and dangerous fire weather conditions this Labor Day weekend, with the National Weather Service urging people to limit outdoor activity and to stay hydrated.</p><p>"Saturday and Sunday will be about 20 to 30 degrees above normal across the entire area," Frank Fisher, a NWS meteorologist for the southern part of the state, told AFP.</p><p>"By Monday, we should be 10 to 20 degrees above normal ... but still very warm and dangerous outside," he added.</p><p>Fisher said temperatures are expected to peak to 108 degrees Fahrenheit (42.2 Celsius) in the Los Angeles area on Sunday and to 118 Fahrenheit (47.8 Celsius) further inland in Woodland Hills.</p><p>Excessive heat warnings through the holiday weekend and possibly beyond have also been issued in other western states including Arizona and Nevada.</p><p>The warm temperatures in California come as the state is recovering from another heat wave in mid-August and devastating wildfires that have burned some 1.5 million acres in the last three weeks.</p><p>That heat wave also set records, with Death Valley -- located near the border with Nevada -- recording a high of 130 degrees, one of the hottest temperatures ever measured on Earth with modern instruments.</p><p>Weather forecasters said red flag warnings indicating the potential for dangerous fire conditions had been issued in many parts of California for the weekend, notably in the Santa Barbara mountains, north of Los Angeles.</p><p>"We have the heat, winds and low humidity," a perfect cocktail for fires, Fisher said.</p><p>"Our big issue with this excessive heat," he added, "is the fact that it's a holiday weekend and a lot of people are going out."</p><p>He said the National Weather Service was recommending people refrain from outdoor activities such as hiking and remain indoors during the day.</p><p>Once the sun sets, however, evening temperatures are not expected to bring much relief.</p><p>- 'Warmest nighttimes' -</p><p>"This is going to be the warmest nighttimes we are going to have in a while," Fisher said. "We are looking for temperatures to be in the upper 70s and even upper 80s, the warmest being Saturday night."  </p><p>And if you're expecting to go to a restaurant in the Los Angeles area or other regions, where only outdoor dining is allowed because of the Covid-19 pandemic, you may want to think twice.</p><p>"Outdoor dining is not going to work this weekend," Fisher said.</p><p>The situation is not expected to be any better further north -- in the Bay Area and beyond -- where dangerous hot conditions are also predicted.</p><p>"It's certainly gonna be hot all over," said Jonathan Garner, a NWS meteorologist for that region.</p><p>"In areas like Ukiah, the record of 108 degrees could be exceeded by one or two degrees," he told AFP, referring to a city about 115 miles (185 kilometers) north of San Francisco.</p>									</div>

									

									<div class="box-share box-share--h box-share--mobile">
										<ul>
											<li>
												<label>0</label>
												<a href="javascript:void(0)" onclick="share_social('facebook', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires');"><i class="icon-facebook"></i></a>
											</li>
											<li><a href="javascript:void(0)" onclick="share_social('twitter', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires', 'California braces for record-setting heatwave, more fires');"><i class="icon-twitter"></i></a></li>
											<li><a href="javascript:void(0)" onclick="share_social('line', 'https://www.bangkokpost.com/world/1980311/california-braces-for-record-setting-heatwave-more-fires', 'California braces for record-setting heatwave, more fires');"><i class="icon-line"></i></a></li>
																						<li>
												<label>0</label>
												<a href="javascript:void(0)" class="open-comment" onclick="g_comment.show_comment();"><i class="icon-comment"></i></a>
											</li>
																					</ul>
									</div>

																			<div class="box-like_unlike">
											Do you like the content of this article?
											<div class="f-comment" id="like-dislike-article">
												<script type="text/javascript">
												g_like_article.fn_show_block(1980311);
												</script>
											</div>
										</div>
																		<div class="article-btn-comment">
										<a href="javascript:void(0)" class="open-comment" onclick="g_comment.show_comment();"><i class="icon-comment"></i> COMMENT 
																				</a>
									</div>
																	</article>



							</div>
							<!-- /article-news detail -->
						</div>
						<div class="col-15 col-md-15">
							<div class="row">
								<div class="col-15 col-md-9" id="cx-output-related">
																		<!-- popin mobile -->
										<article class="visible-xs"></article>
										<!-- /popin mobile -->
																	</div>
								<div class="col-15 col-md-6" id="recommended-stories"></div>
									
							</div>
						</div>
					</div>
				</div>
				<div class="col-15 col-md-15 col-lg-5">
										<div class="ads ads-double-rectangle" id="div-gpt-ad-hybrid-0">
						<script>
							googletag.cmd.push(function() { googletag.display('div-gpt-ad-hybrid-0'); });
						</script>
					</div>
										<article>
	<div class="box-border-top">
		<div class="chanel">
			<a href="/most-recent" title="Thailand">MOST RECENT <i class="icon-arrow"></i></a>
		</div>
	</div>
	<div class="article-col-highlights-side">
		<div class="hilight_sec">
							<div class="list-h ">
					<div class="list-detail">
						<div class="h-line"><a href="/business">Business</a></div>
						<h3><a href="/business/1980167/caat-lifts-food-and-drinks-ban-on-domestic-flights">CAAT lifts food and drinks ban on domestic flights</a></h3>
						<p>The Civil Aviation Authority of Thailand (CAAT) has lifted its ban on food and drinks served on domestic flights, according to the authority's director-general Chula Sukmanop.</p>
						<div class="f-icon">
							<span>07:05</span>
																				</div>
					</div>
					<figure>
						<a href="/business/1980167/caat-lifts-food-and-drinks-ban-on-domestic-flights"><img src="https://static.bangkokpost.com/media/content/20200905/c1_1980167_200905095340.jpg" alt=""  srcset="https://static.bangkokpost.com/media/content/20200905/c1_1980167_200905095340_134.jpg 350w,https://static.bangkokpost.com/media/content/20200905/c1_1980167_200905095340_134.jpg 500w,https://static.bangkokpost.com/media/content/20200905/c1_1980167_200905095340_134.jpg 700w"  ></a>
					</figure>
				</div>
							<div class="list-h noimage">
					<div class="list-detail">
						<div class="h-line"><a href="/thailand">Thailand</a></div>
						<h3><a href="/thailand/politics/1980103/protesters-target-sanam-luang-occupation-at-rally">Protesters target Sanam Luang occupation at rally</a></h3>
						<p>Parit 'Penguin' Chivarak, a core member of the Free Youth group, on Friday vowed to lead protesters to forcibly occupy the adjacent Sanam Luang when they gather again for a major rally at Thammasat University's Tha Phrachan campus on Sept 19.</p>
						<div class="f-icon">
							<span>07:00</span>
																				</div>
					</div>
					<figure>
						<a href="/thailand/politics/1980103/protesters-target-sanam-luang-occupation-at-rally"><img src="" alt=""  ></a>
					</figure>
				</div>
							<div class="list-h ">
					<div class="list-detail">
						<div class="h-line"><a href="/thailand">Thailand</a></div>
						<h3><a href="/thailand/general/1980151/navy-targets-yuttapong-files-over-defamation">Navy targets Yuttapong, files over  'defamation'</a></h3>
						<p>The navy on Friday lodged a complaint with police against Pheu Thai Party MP Yuttapong Charasathien for defamation over his claims that the submarine procurement scheme project was not a genuine government-to-government deal.</p>
						<div class="f-icon">
							<span>07:00</span>
																				</div>
					</div>
					<figure>
						<a href="/thailand/general/1980151/navy-targets-yuttapong-files-over-defamation"><img src="https://static.bangkokpost.com/media/content/20200905/c1_1980151_200905095417.jpg" alt=""  srcset="https://static.bangkokpost.com/media/content/20200905/c1_1980151_200905095417_134.jpg 350w,https://static.bangkokpost.com/media/content/20200905/c1_1980151_200905095417_134.jpg 500w,https://static.bangkokpost.com/media/content/20200905/c1_1980151_200905095417_134.jpg 700w"  ></a>
					</figure>
				</div>
					</div>
	</div>
</article>										<div class="ads ads-double-rectangle ads-sticky" id="div-gpt-ad-sticky-0-0">
						<script>
							googletag.cmd.push(function() { googletag.display('div-gpt-ad-sticky-0-0'); });
						</script>
					</div>
									</div>
			</div>
		</div>


	</div>
</section>
<section>
	<div class="home-recommend">
		<!--
		<div class="container">
			<article>
						</article>
		</div>
		-->
	</div>

	<div class="home-aroundweb">
		<div class="container" id="cx-output-related-mobile">
			<article>
				
					<script type="text/javascript">
						 (function() {
							//setTimeout(() => {
							var pa = document.createElement('script'); pa.type = 'text/javascript'; pa.charset = "utf-8"; pa.async = true;
							pa.src = window.location.protocol + "//api.popin.cc/searchbox/bangkokpost.js";
							var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pa, s);
							//}, 5000);
						})(); 
					</script>
								</article>
		</div>
	</div>

</section>

<script type="text/javascript">
	$(document).ready(function() {
		if(coverpage_ad_type !=="mobile"){
			//console.log('coverpage_ad_type not mobile'); 
			$('div.home-aroundweb div.container article').html('<div id="_popIn_recommend"></div>');
		}else{
			//console.log('coverpage_ad_type  mobile'); 
			$('#cx-output-related article').html('<div id="_popIn_recommend"></div>');
		}

		/*
		$('.owl-recommended').owlCarousel({
			margin: 20,
			loop: false,
			responsiveClass: true,
			nav: false,
			dots: false,
			mouseDrag: false,
			items: 5,
			slideBy: 1,
			responsive: {
				0: {
					items: 1,
					stagePadding: 30,
					loop: true,
					mouseDrag: true,
					//dots:true,
					nav: false,
				},
				768: {
					items: 3,
					mouseDrag: true,
					//dots:true,
					nav: true,
				},
				992: {
					items: 5,
				}
			}
		});
		*/


		//$(window).resize(function(){ $owl.trigger('refresh.owl.carousel'); });


		if ($(window).width() > 991) {

			var position = $('#position-set').offset();

			$(window).scroll(function() {
				var y = $(this).scrollTop();
				if (y >= position.top) {
					$('.article-headline-fixed').addClass('sticky');
				} else {
					$('.article-headline-fixed').removeClass('sticky');
				}
			});

		}



	});
</script>
<script type="text/javascript">
//if ($(window).width() > 576) { // remove by cr allow mobile
	g_gallery.initial_gallery();
//}

// resize all iframe
if ($('.embed-responsive-content iframe').width() > 620) {
	$('.embed-responsive-content iframe').attr('width', '500px');
	$('.embed-responsive-content iframe').attr('height', '281px');
}

</script>
<script type="text/javascript">
	// Cxense homepage & main section recommended
	setTimeout(function(){
		// g_cxense.get_recommended();
		g_cxense_article_v2.get_widgets_combined();
	}, 1000);
</script>

<!-- footer -->
<footer>
	<section>
		<div class="container">
			<div class="footer-top footer-showmobi">
				<div class="footer-logo-postgroup"><a href="//www.bangkokpost.co.th"><img src="https://static.bangkokpost.com/newdesign/assets/images/postgroup-logo_white.svg" alt="angkok Post Public Company Limited"></a></div>
			</div>
			<div class="footer-middle">
				<div class="footer-row row">
					<div class="footer-col col-15 col-md-auto col-lg-auto">
						<div class="footer--col">
							<div class="footer-list">
								<ul>
									<li><a href="/thailand" title="THAILAND">THAILAND</a>
										<ul>
											<li><a href="/thailand/general" title="General">General</a></li>
											<li><a href="/thailand/politics" title="Politics">Politics</a></li>
											<li><a href="/thailand/special-reports" title="Special Report">Special Report</a></li>
											<li><a href="/thailand/pr" title="PR News & Special publication">PR News</a></li>
										</ul> 
									</li>
									<li><a href="/world" title="World">WORLD</a></li>
									<li><a href="/business" title="Business">BUSINESS</a>
										<ul>
											<li><a href="http://search.bangkokpost.com/search/result_advanced?q=&category=news&refinementFilter=&sort=newest&xDateSearchRadio=&searchedField=all&xChannel=&xNewsSection=Asia+focus&xColumn=&columnistName=" title="Asia Focus">Asia Focus</a></li>
										</ul>
									</li>
									<li><a href="/opinion" title="Opinion">OPINION</a>
										<ul>
											<li><a href="/opinion/columnist" title="Columnists">Columnists</a></li>
											<li><a href="/opinion/postbag" title="Postbag">Postbag</a></li>
										</ul>
									</li>
								</ul>
							</div>
							<div class="footer-list">
								<ul>
									<li><a href="/sports" title="Sports">SPORTS</a></li>
									<li><a href="/auto" title="Auto">AUTO</a>
										<ul>
											<li><a href="/auto/news" title="News">News</a></li>
											<li><a href="/auto/review" title="Review">Review</a></li>
										</ul>
									</li>
									<div class="footer-showpc">
										<li><a href="/life" title="Life">LIFE</a>
											<ul>
												<li><a href="/life/arts-and-entertainment" title="Arts and Entertainment">Arts &
														Entertainment</a></li>
												<li><a href="/life/social-and-lifestyle" title="Social and Lifestyle">Social & Lifestyle</a>
												</li>
												<li><a href="http://search.bangkokpost.com/search/result_advanced?q=&category=news&refinementFilter=&sort=newest&xDateSearchRadio=&searchedField=all&xChannel=&xNewsSection=Guru&xColumn=&columnistName=" title="Guru">Guru</a>
												</li>
												<li><a href="http://search.bangkokpost.com/search/result_advanced?q=&category=news&refinementFilter=&sort=newest&xDateSearchRadio=&searchedField=all&xChannel=&xNewsSection=B+Magazine&xColumn=&columnistName=" title="B Magazine">B Magazine</a>
												</li>
											</ul>
										</li>
										<li><a href="/learning" title="Learning">LEARNING</a></li>

									</div>
								</ul>
							</div>
						</div>
						<div class="footer--col">
							<div class="footer-list">
								<ul>
									<div class="footer-showmobi">
										<li><a href="/life" title="Life">LIFE</a>
											<ul>
												<li><a href="/life/arts-and-entertainment" title="Arts and Entertainment">Arts &
														Entertainment</a></li>
												<li><a href="/life/social-and-lifestyle" title="Social and Lifestyle">Social & Lifestyle</a>
												</li>
												<li><a href="http://search.bangkokpost.com/search/result_advanced?q=&category=news&refinementFilter=&sort=newest&xDateSearchRadio=&searchedField=all&xChannel=&xNewsSection=Guru&xColumn=&columnistName=" title="Guru">Guru</a>
												</li>
												<li><a href="http://search.bangkokpost.com/search/result_advanced?q=&category=news&refinementFilter=&sort=newest&xDateSearchRadio=&searchedField=all&xChannel=&xNewsSection=B+Magazine&xColumn=&columnistName=" title="B Magazine">B Magazine</a>
												</li>
											</ul>
										</li>
										<li><a href="/learning" title="Learning">LEARNING</a></li>

									
									</div>
										<li><a href="/vdo" title="Video">VIDEO</a>
											<ul>
												<li><a href="/vdo/thailand" title="Thailand">Thailand</a></li>
												<li><a href="/vdo/world" title="World">World</a></li>
												<li><a href="/vdo/travel-and-lifestyle" title="Travel and Lifestyle">Travel & Lifestyle</a>
												</li>
											</ul>
										</li>
									<li><a href="/travel" title="Travel">TRAVEL</a></li>
									<li><a href="/tech" title="Tech">TECH</a></li>
									<li><a href="/property" title="Property">PROPERTY</a></li>
									<li><a href="/photo" title="Photos">PHOTOS</a></li>
								</ul>
							</div>
						</div>
					</div>
					<hr class="footer-line">
					<div class="footer-col col-15 col-md-auto col-lg-auto">
						<div class="footer--col">
							<div class="footer-list">
								<ul>
									<li><span>DIGITAL PRODUCTS & SERVICES</span>
										<ul>
											<li><a href="/epaper" title="EPAPER">EPaper</a></li>
											<li><a href="/sms" title="SMS">SMS</a></li>
											<li><a href="/archive" title="DIGITAL ARCHIVE">Digital Archive</a></li>
											<li><a href="//property.bangkokpost.com" title="PROPERTY SEARCH">Property Search</a></li>
											<li><a href="//job.bangkokpost.com" title="JOBS">Jobs</a></li>
											<li><a href="/thailandguide" title="THAILAND GUIDE">Thailand Guide</a></li>
											<li><a href="/subscribe" title="HOME DELIVERY">Home Delivery </a></li>
										</ul>
									</li>
								</ul>
							</div>
							<div class="footer-list">
								<ul class="footer-network">
									<li><span>OUR NETWORK</span>
										<ul>
											<li><a href="//www.posttoday.com" title="Post Today" target="_blank" >Post Today</a></li>
											<li><a href="//www.postbooksonline.com/" title="Post Books" target="_blank">Post Books</a></li>
										</ul>
									</li>
								</ul>
							</div>
						</div>
						<div class="footer--col">
							<div class="footer-subscribe">
								<div class="footer-subscribe--title">STAY INFORMED.<span>GET DAILY UPDATES FROM THE BANGKOK POST.</span></div>
								<div class="footer-form">
								<!--
									<form class="needs-validation" novalidate>
									-->
				<form action="https://www.bangkokpost.com/newsletter/bottom/process" class="needs-validation enews-form" id="xFormEnews2" novalidate="" method="post" accept-charset="utf-8">
										<div class="footer-form--input">
										<!--
											<input type="text" class="form-control form-control-subscribe" placeholder="E-mail" required>
											-->
							<input type="email" name="xEmailContactBottom" value="" placeholder="E-mail" id="xEmailContactBottom" class="form-control form-control-subscribe" required="required"  />
											 <div class="invalid-feedback bottom-form">Please put in a valid-email.</div> 
										</div>
										<div class="enewsletter--footer">
											<span class="txt-success bottom-form">Thank you for subscribing our enewsletter. You will get the updates within 24 hours.</span>
										</div>
									 	<button type="submit" class="btn-signup-subscribe">SUBSCRIBE</button>
									</form>
								</div>
								<div class="footer-subscribe--ps">By subscribing, you accept the terms and conditions in our <a href="/policy/">privacy policy</a>.</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="footer-mid--social">
				<div class="footer-logo-postgroup footer-showpc"><a href="//www.bangkokpost.co.th"><img src="https://static.bangkokpost.com/newdesign/assets/images/postgroup-logo_white.svg" alt="Bangkok Post Public Company Limited"></a></div>
				<div class="footer-social">
					<ul>
						<li><a href="https://www.facebook.com/bangkokpost" title="Facebook" target="_blank" rel="nofollow"><i class="icon-facebook"></i></a></li>
						<li><a href="https://www.instagram.com/bangkokpost_official" title="Instagram" target="_blank" rel="nofollow"><i class="icon-instagram"></i></a></li>
						<li><a href="https://twitter.com/bangkokpostnews" title="Twitter" target="_blank" rel="nofollow" ><i class="icon-twitter"></i></a></li>
						<li><a href="https://line.me/R/ti/p/%40axq6041s" title="Line" target="_blank" rel="nofollow"><i class="icon-line"></i></a></li>
					</ul>
				</div>
			</div>
		</div>
	</section>
	<section class="footer-bottom">
		<div class="container">
			?2020 Bangkok Post Public Company Limited
			<ul>
				<li><a href="/policy" title="Terms of use">Terms of use</a></li>
				<li><a href="/republishingpolicy" title="Republishing permission">Republishing permission</a></li>
				<li><a href="/mediainfo/solution" title="Online advertising">Online advertising</a></li>
				<li><a href="https://www.bangkokpost.co.th/post_contact" title="Contact us" >Contact us</a></li>
				<li><a href="/send-suggestions" title="Tell us what you think">Tell us what you think</a></li>
				<li><a href="/partner" title="Partnership">Partnership</a></li>
				<li id="truehits_area"></li>
			</ul>
		</div>
		
	</section>
</footer>
<div id="script_html_container"></div>
<!-- /footer -->
<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/custom/js/gdpr.js?v=0.033"></script>
<script type="text/javascript" src="https://static.bangkokpost.com/newdesign/assets/custom/js/scripts.js?v=0.033"></script>
<script type="text/javascript">
	$(document).ready(function() {


		if ($('.owl-recommended').length) {
			/* for section life */
			// Render owl
			$('.owl-recommended').owlCarousel({
				margin: 30,
				loop: false,
				responsiveClass: true,
				nav: false,
				dots: false,
				mouseDrag: false,
				items: 5,
				slideBy: 1,
				responsive: {
					0: {
						items: 1,
						stagePadding: 30,
						loop: false,
						mouseDrag: true,
						//dots:true,
						nav: false,
					},
					768: {
						items: 3,
						mouseDrag: true,
						//dots:true,
						nav: true,
					},
					992: {
						items: 5,
					}
				}
			});
			
		}

		if ($('.owl-top-columnist').length) {
			$('.owl-top-columnist').owlCarousel({
				margin: 30,
				loop: false,
				responsiveClass: true,
				nav: true,
				dots: false,
				mouseDrag: false,
				items: 8,
				slideBy: 1,
				stagePadding: 80,
				responsive: {
					0: {
						items: 1,
						loop: false,
						mouseDrag: true,
						stagePadding: 70,
						nav: false,
					},
					341: {
						items: 1,
						loop: false,
						mouseDrag: true,
						stagePadding: 90,
						nav: false,
					},
					414: {
						items: 1,
						loop: false,
						mouseDrag: true,
						stagePadding: 100,
						nav: false,
					},
					426: {
						items: 2,
						loop: false,
						mouseDrag: true,
						nav: false,
					},
					768: {
						items: 3,
						mouseDrag: true,
					},
					992: {
						items: 5,
					},
					1200: {
						items: 7,
					}
				}
			});
		}


		// tab most view
		$('.tabs-stage div').hide();
		$('.tabs-stage div:first-child').show();
		$('.tabs-nav li:first-child').addClass('tab-active');

		// Change tab class and display content
		if ($('.tabs-nav a').length) {
			$('.tabs-nav a').on('click', function(event) { // most comment
				event.preventDefault();
				$('.tabs-nav li').removeClass('tab-active');
				$(this).parent().addClass('tab-active');
				$('.tabs-stage div').hide();
				$($(this).attr('href')).show();
			});
		}

		if ($('.owl-topics2').length) {
			$('.owl-topics2').owlCarousel({
				margin: 30,
				loop: false,
				responsiveClass: true,
				nav: true,
				dots: false,
				mouseDrag: false,
				items: 3,
				slideBy: 1,
				responsive: {
					0: {
						items: 1,
						stagePadding: 30,
						loop: false,
						mouseDrag: true,
						dots: false,
						nav: false,
					},
					365: {
						items: 1,
						stagePadding: 50,
						loop: false,
						mouseDrag: true,
						dots: false,
						nav: false,
					},
					768: {
						items: 2,
						mouseDrag: true,
					},
					992: {
						items: 3,
					}
				}
			});
		}

		if ($('.owl-topics').length) {
			$('.owl-topics').owlCarousel({
				margin: 30,
				loop: false,
				responsiveClass: true,
				nav: true,
				dots: false,
				mouseDrag: false,
				items: 5,
				slideBy: 1,
				responsive: {
					0: {
						items: 1,
						stagePadding: 50,
						loop: false,
						mouseDrag: true,
						dots: false,
						nav: false,
					},
					768: {
						items: 3,
						mouseDrag: true,
					},
					992: {
						items: 5,
					}
				}
			});
		}

		if ($('.owl-diary').length) {
			$('.owl-diary').owlCarousel({
				margin: 30,
				loop: false,
				responsiveClass: true,
				nav: false,
				dots: false,
				mouseDrag: true,
				items: 1,
				slideBy: 1,
				responsive: {
					0: {
						items: 1,
						stagePadding: 30,
						loop: false,
						mouseDrag: true,
						dots: false,
						nav: false,
					},
					768: {
						items: 1,
						mouseDrag: true,
						stagePadding: 0,
						nav: true,
					}
				}
			});
		}
    if ($('.owl-boxtab').length) {
		$('.owl-boxtab').owlCarousel({
			margin: 20,
			loop: false,
			responsiveClass:true,
			nav:false,
			dots:false,
			mouseDrag: true,
			items: 1,
			slideBy: 1,
			responsive: {
			  0: {
				items: 1,
				stagePadding: 30,
				loop: false,
				mouseDrag: true,
				//dots:true,
				nav:false,
			  },
			  768: {
				items: 1,
				mouseDrag: true,
					stagePadding: 0,
					nav:true,
			  }
			}
		});
	}

		if ($('.bxslider').length) {
			$('.bxslider').bxSlider({
				mode: 'fade',
				speed: 800,
				auto: true,
				autoControls: false,
				pager: false,
				controls: false
			}); 
			
		}


		$(".tab-slider--body").hide();
		$(".tab-slider--body:first").show();
		
		
		/* for thailand megatrends*/
		if ($('.owl-magatrends').length) {
			$('.owl-magatrends').owlCarousel({
				margin: 20,
				loop: false,
				responsiveClass:true,
				nav:false,
				dots:false,
				mouseDrag: false,
				items: 5,
				slideBy: 1,
				responsive: {
				  0: {
					items: 1,
					stagePadding: 20,
					loop: false,
					mouseDrag: true,
					//dots:true,
					nav:false,
				  },
				  768: {
					items: 3,
					mouseDrag: true,
					//dots:true,
					nav:true,
				  },
				  992: {
					items: 5,
				  }
				}
			});
			
			$(".owl-magatrends").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
				if (!e.namespace) return;
				var carousel = e.relatedTarget,
					current = carousel.current();
				if (current === carousel.maximum()) {
				 $(".owl-magatrends.owl-carousel .owl-stage").addClass("pos-right");
				}else if (current === carousel.minimum()){
					$(".owl-magatrends.owl-carousel .owl-stage").removeClass("pos-right");
				}
				if ($('.owl-magatrends .item').length <= 1) {
				   $(".owl-magatrends.owl-carousel .owl-stage").addClass("item1");
				}
			});
			
			// oa_show_openx(3031, 'homepage', 'campaign1');
			// oa_show_openx(3034, 'homepage', 'campaign2');

		}

		$('.bxslider2').bxSlider({
			//mode: 'fade',
			speed: 800,
		  auto: true,
		  autoControls: false,
		  pager: false,
		  controls: false,
		});
		
		// Homepage only
	if ( window.location.pathname == '/' ){
		g_homepagelanding.set_homepagelanding(); 
	}
	
	});

	$(".tab-slider--nav li").click(function() {
		$(".tab-slider--body").hide();
		var activeTab = $(this).attr("rel");
		$("#" + activeTab).fadeIn();

		if ($(this).attr("rel") == activeTab) {
			$('.tab-slider--tabs').addClass('slide');
		} else {
			$('.tab-slider--tabs').removeClass('slide');
		}
		$(".tab-slider--nav li").removeClass("active");
		$(this).addClass("active");
		// $(this).addClass("active").fadeIn("slow", 4000);
	});
	
/* ??????? */
var g_homepagelanding = {

	/* Config */
	date_begin: '2020/08/10 00:00:00 GMT+0700',
	date_end: '2020/08/13 23:59:59 GMT+0700',
	cookie_name: 'landingpage',
	domain: 'bangkokpost.com',
	// age: 86400, /* 1 Day */
	age: 10800, /* 3 Hours */
	get_cookie_homepagelanding: function() {
		var v = document.cookie.match('(^|;) ?' + this.cookie_name + '=([^;]*)(;|$)');
		return v ? v[2] : null;
	},
	close_homepagelanding: function() {
		var d = new Date();
		d.setTime(d.getTime() + (this.age * 1000));
		document.cookie = this.cookie_name + "=1;domain=" + this.domain + ";path=/;expires=" + d.toGMTString();
	},
	show_homepagelanding: function() {
		this.close_homepagelanding();
		location = 'https://www.bangkokpost.com/page/queensirikit/';
	},
	check_show_homepagelanding: function() {
		var multi_timezone_offset = 60000;
		var t = new Date();
		var utc_now = t.getTime() + (t.getTimezoneOffset() * multi_timezone_offset);
		var check_date_begin = new Date(this.date_begin);
		var utc_begin = check_date_begin.getTime() + (check_date_begin.getTimezoneOffset() * multi_timezone_offset);
		var check_date_end = new Date(this.date_end);
		var utc_end = check_date_end.getTime() + (check_date_end.getTimezoneOffset() * multi_timezone_offset);

		if (utc_now > utc_begin && utc_now < utc_end) {
			var is_noti = this.get_cookie_homepagelanding();
			if (!is_noti) {
				return true;
			}
		} else {
			return false;
		}
	},
	set_homepagelanding: function() {
		if (this.check_show_homepagelanding()) {
			this.show_homepagelanding();
		}
	}
}
</script>

<script type="text/javascript">
	if ($(".box-diary-info").length) {
		var elm_today_info_tab;
		var count_tab_today_info;
		var today_info_delay = 10000;
		var today_info_interval;

		(function($, window, document) {
			/* Jquery ready here */
			elm_today_info_tab = $(".box-diary-info .tab-slider--trigger");
			count_tab_today_info = elm_today_info_tab.length;
			today_info_interval = setInterval(slide_today_info, today_info_delay);
		}(window.jQuery, window, document));

		function slide_today_info() {
			for (i = 0; i < count_tab_today_info; i++) {
				if (elm_today_info_tab.eq(i).hasClass('active')) {
					break;
				}
			}
			if (i >= (count_tab_today_info - 1)) {
				i = 0;
			} else {
				i++;
			}
			elm_today_info_tab.eq(i).trigger("click");
		}

		$(".box-diary-info")
			.mouseenter(function() {
				clearInterval(today_info_interval);
			})
			.mouseleave(function() {
				today_info_interval = setInterval(slide_today_info, today_info_delay);
			});
	}

	$(function() {
		// @TODO: Fix outbrain gap
		setTimeout(function() {
			if ($('#ctcg_frame_65349_0').length) {
				$('#ctcg_frame_65349_0').hide();
			}
		}, 3000);

	
	});
</script>


	<script type="text/javascript">
		// Cxense article page recommended & related
		setTimeout(function() {
			// g_cxense.get_article();
		}, 500);
	
					// Hits
			$.get( "/hits/1980311", { t: Math.floor((Math.random() * 100000)) } );
		
	</script>



<script type='text/javascript'>
var is_bkp_newdesign_switched = null;

function get_cookie_bkp_newdesign(name) {
	var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
	return v ? v[2] : null;
}

function accept_bkp_newdesign_switched() {
	var d = new Date;
	d.setTime(d.getTime() + 31536000000); // 1 year
	document.cookie = "is_bkp_newdesign_switched=1;domain=bangkokpost.com;path=/;expires=" + d.toGMTString();	
}

function check_bkp_newdesign_switched() {
	var is_bkp_newdesign_switched = get_cookie_bkp_newdesign('is_bkp_newdesign_switched');
	if (!is_bkp_newdesign_switched) show_bkp_newdesign_bar();
}

function go_bkp_old_newdesign() {
	accept_bkp_newdesign_switched();
	location="https://www.bangkokpost.com?olddesign=1";
}

function close_bkp_newdesign_bar() {
	accept_bkp_newdesign_switched();
	document.getElementById("beta-banner").remove();
	// $('#beta-banner').fadeOut();
}

function show_bkp_newdesign_bar() {

	$('body').append('\
		<div class="beta-footer" id="beta-banner" style="display:none">\
			<div class="container">\
				<div class="beta-footer-content">\
					<div class="beta-close"><a onclick="close_bkp_newdesign_bar();" href="javascript:;" id="beta-close"><img src="https://static.bangkokpost.com/newdesign/assets/images/beta/close.svg" alt=""></a></div>\
					<div class="beta-header">YOU’RE LOOKING AT THE NEW DESIGN.</div>\
					<div class="beta-btn">\
						<a target="_blank" href="https://docs.google.com/forms/d/e/1FAIpQLSf7I92Q7BGfYI652QyxSQ2ofoop7HEPDQqYn9WNLzZqypx6Kg/viewform?hl=en">TELL US WHAT YOU THINK <img src="https://static.bangkokpost.com/newdesign/assets/images/beta/arrow.svg" alt=""></a>\
						<!--<a class="track_newdesign" href="javascript:;" onclick="go_bkp_old_newdesign();">RETURN TO THE CURRENT DESIGN <img src="https://static.bangkokpost.com/newdesign/assets/images/beta/arrow.svg" alt=""></a>--\>\
					</div>\
				</div>\
			</div>\
		</div>\
	');
	// https://docs.google.com/forms/d/e/1FAIpQLSf7I92Q7BGfYI652QyxSQ2ofoop7HEPDQqYn9WNLzZqypx6Kg/viewform?usp=sf_link

	$(window).scroll(function() {
		if ($(window).scrollTop() > 200) {
			$('#beta-banner').fadeIn();
		} else {
			$('#beta-banner').fadeOut();
		}
	});
	$('#beta-close').click(function() {
		$('#beta-banner').fadeOut();
	});

} 

// -- remove by ratt 2019-07-23-- check_bkp_newdesign_switched();

//======live-blog
	// console.log('test maintenance: ok');
	var g_campaign_promote_event = {
    /* Config */
    date_begin: '2020/01/20 17:00:00 GMT+0700',
    date_end: '2020/02/05 22:30:00 GMT+0700',
    cookie_name: 'is_show_promote',
    domain: 'bangkokpost.com',
    age: 86400, // 1 day  
    get_cookie_promote_event: function() {
        var v = document.cookie.match('(^|;) ?' + this.cookie_name + '=([^;]*)(;|$)');
        return v ? v[2] : null;
    },
    close_promote_event: function() {
        var d = new Date;
        d.setTime(d.getTime() + (this.age * 1000));
        document.cookie = this.cookie_name + "=1;domain=" + this.domain + ";path=/;expires=" + d.toGMTString();
		$('#bar-promote-live').fadeOut();
       //$("#bar-promote-live").remove();
    },
    show_promote_event: function() {


$('body').append('<div class="bar-promote-live" id="bar-promote-live"><div class="container"><div class="bar-promote-bg"><div class="bar-close"><a href="javascript:;" onclick="g_campaign_promote_event.close_promote_event();" id="bar-close"><img src="https://static.bangkokpost.com/newdesign/assets/images/close.svg" alt=""></a></div><div class="bar-promote--box promo1"><img src="https://static.bangkokpost.com/newdesign/assets/images/forum/2020/economic_forum/logo_forum.svg" class="img-fluid" alt=""></div><div class="bar-promote--box promo3"><span class="animate-live"></span><img src="https://static.bangkokpost.com/newdesign/assets/images/forum/2020/economic_forum/icn-live.svg" alt=""></div><div class="bar-promote--box promo31"><div class="box1">Special <span>LIVE</span></div><div class="box2">Streaming</div></div><div class="bar-promote--box promo4">	<strong>Celebrating the 17th anniversary of Post Today</strong><span>Thursday 6 February, 2020 13:10 hrs. onward</span></div><div class="bar-promote--box promo5"><a href="https://www.posttoday.com/events/economicforum2020/live"><img src="https://static.bangkokpost.com/newdesign/assets/images/forum/2020/economic_forum/icn-play.svg" class="img-fluid" alt=""></a></div><div class="bar-promote--box promo6"><img src="https://static.bangkokpost.com/newdesign/assets/images/forum/2020/economic_forum/text_forum.svg" class="img-fluid" alt=""></div></div></div></div>');

    },
    check_show_promote_event: function() {
        var multi_timezone_offset = 60000;
        var t = new Date();
        var utc_now = t.getTime() + (t.getTimezoneOffset() * multi_timezone_offset);
        var check_date_begin = new Date(this.date_begin);
        var utc_begin = check_date_begin.getTime() + (check_date_begin.getTimezoneOffset() * multi_timezone_offset);
        var check_date_end = new Date(this.date_end);
        var utc_end = check_date_end.getTime() + (check_date_end.getTimezoneOffset() * multi_timezone_offset);
        if (utc_now > utc_begin && utc_now < utc_end) {
            var is_noti = this.get_cookie_promote_event();
            if (!is_noti) {                     
                return true;
            }
        } else {
            return false;
        }
    },
    set_promote_event: function() {
        if (this.check_show_promote_event()) {
            this.show_promote_event();
        }
    }
}

$(function() {
     g_campaign_promote_event.set_promote_event();        
});

$(window).scroll(function() {
	 if (g_campaign_promote_event.check_show_promote_event()) {
		if ($(window).scrollTop() > 200) {
			$('#bar-promote-live').fadeIn();
		} else {
			$('#bar-promote-live').fadeOut();
		}
	 }
});

//======end live-blog

// tracking 
$(function(){ 
	$(".track_newdesign").on('mouseup', function (e) {		
		ga('send', 'event', 'Bangkok post newdesign', 'click', 'click_back_to_olddesign');		
	});
});

</script>
<script>
$(".owl-topics").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
    if (!e.namespace) return;
    var carousel = e.relatedTarget,
        current = carousel.current();
    if (current === carousel.maximum()) {
     $(".owl-topics.owl-carousel .owl-stage").addClass("pos-right");
    }else if (current === carousel.minimum()){
    	$(".owl-topics.owl-carousel .owl-stage").removeClass("pos-right");
    }
    if ($('.owl-topics .item').length <= 1) {
       $(".owl-topics.owl-carousel .owl-stage").addClass("item1");
    }
});
/* for section life */
$(".owl-recommended").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
    if (!e.namespace) return;
    var carousel = e.relatedTarget,
        current = carousel.current();
    if (current === carousel.maximum()) {
     $(".owl-recommended.owl-carousel .owl-stage").addClass("pos-right");
    }else if (current === carousel.minimum()){
    	$(".owl-recommended.owl-carousel .owl-stage").removeClass("pos-right");
    }
    if ($('.owl-recommended .item').length <= 1) {
       $(".owl-recommended.owl-carousel .owl-stage").addClass("item1");
    }
 }); 

$(".owl-diary").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
    if (!e.namespace) return;
    var carousel = e.relatedTarget,
        current = carousel.current();
    if (current === carousel.maximum()) {
     $(".owl-diary.owl-carousel .owl-stage").addClass("pos-right");
    }else if (current === carousel.minimum()){
    	$(".owl-diary.owl-carousel .owl-stage").removeClass("pos-right");
    }
    if ($('.owl-diary .item').length <= 1) {
       $(".owl-diary.owl-carousel .owl-stage").addClass("item1");
    }
});

$(".owl-boxtab").on('initialized.owl.carousel changed.owl.carousel refreshed.owl.carousel', function (e) {
    if (!e.namespace) return;
    var carousel = e.relatedTarget,
        current = carousel.current();
    if (current === carousel.maximum()) {
     $(".owl-boxtab.owl-carousel .owl-stage").addClass("pos-right");
    }else if (current === carousel.minimum()){
    	$(".owl-boxtab.owl-carousel .owl-stage").removeClass("pos-right");
    }
    if ($('.owl-boxtab .item').length <= 1) {
       $(".owl-boxtab.owl-carousel .owl-stage").addClass("item1");
    }
});

</script>
<script type="text/javascript">
	// console.log('test maintenance: ok');
	
	
	var g_maintenance = {
    /* Config */
    date_begin: '2020/02/10 17:00:00 GMT+0700',
	// date_begin: '2019/12/23 13:00:00 GMT+0700',
    date_end: '2020/02/10 22:00:00 GMT+0700',
    cookie_name: 'is_show_maintenance',
    domain: 'bangkokpost.com',            
    age: 86400, // 1 day  
    get_cookie_maintenance: function() {
        var v = document.cookie.match('(^|;) ?' + this.cookie_name + '=([^;]*)(;|$)');
        return v ? v[2] : null;
    },
    close_maintenance: function() {
        var d = new Date;
        d.setTime(d.getTime() + (this.age * 1000));
        document.cookie = this.cookie_name + "=1;domain=" + this.domain + ";path=/;expires=" + d.toGMTString();
        $("#box-mainten").remove();
    },
    show_maintenance: function() {

		$( "body" ).addClass( "body-maintenance" );
		$('#header-nav').before('\<div id="box-mainten" style="background-color: #333; width: 100%; padding: 10px;">\
		<div style="max-width: 730px; width: 100%; margin: 0 auto; position: relative;">\
			<img src="https://static.bangkokpost.com/newdesign/assets/images/icon/alert.svg" style="width: 35px; height: 35px; position: absolute; left: 0; top: 5px;" alt="">\
			<div class="visible-lg visible-md visible-sm" style="padding:2px 50px 0; font-size: 13px; line-height: 20px; color: #fff;">On February 10th at 22.00 - 22.30 hrs (UTC+7), Bangkokpost.com will be performing some maintenance. You will not be able to access the website. We apologize for this inconvenience.</div>\
			<div class="visible-xs" style="padding:2px 50px 0; font-size: 13px; line-height: 20px; color: #fff;">On February 10th at 22.00 - 22.30 hrs (UTC+7), Bangkokpost.com will be performing some maintenance. You will not be able to access the website. We apologize for this inconvenience.</div>\
			<a href="javascript:void(0);" onclick="g_maintenance.close_maintenance();" id="btn-close2"><img src="https://static.bangkokpost.com/newdesign/assets/images/icon/icon-close.svg" style="width: 38px; height: 38px; position: absolute; right: 0; top: 3px;" alt=""></a>\
		</div>\
	</div>');
		

    },
    check_show_maintenance: function() {
        var multi_timezone_offset = 60000;
        var t = new Date();
        var utc_now = t.getTime() + (t.getTimezoneOffset() * multi_timezone_offset);
        var check_date_begin = new Date(this.date_begin);
        var utc_begin = check_date_begin.getTime() + (check_date_begin.getTimezoneOffset() * multi_timezone_offset);
        var check_date_end = new Date(this.date_end);
        var utc_end = check_date_end.getTime() + (check_date_end.getTimezoneOffset() * multi_timezone_offset);
        if (utc_now > utc_begin && utc_now < utc_end) {
            var is_noti = this.get_cookie_maintenance();
            if (!is_noti) {                     
                return true;
            }
        } else {
            return false;
        }
    },
    set_maintenance: function() {
        if (this.check_show_maintenance()) {
            this.show_maintenance();
        }
    }
}
$(function() {
     g_maintenance.set_maintenance();        
});
</script>

<div id='div-gpt-ad-skin-0' style='height:1px; width:1px;'>
	<script>
		// googletag.cmd.push(function() {
		// 	googletag.display('div-gpt-ad-skin-0');
		// });
	</script>
</div>
<script>
  //window.googletag = window.googletag || {cmd: []};
  /* remove by tong 2020-07-31
   if(g_section != 'business' && g_section != 'homepage' ){ 
   //console.log('test skin ad show');
   
		googletag.cmd.push(function() {
		googletag.defineOutOfPageSlot('/2776261/bp_ros_skin', 'div-gpt-ad-theme').addService(googletag.pubads()); 
		googletag.pubads().collapseEmptyDivs();
		googletag.enableServices();
	  });
   }
   */
  // setTimeout(initGPT, 100);
</script>
<!-- /2776261/BKP_homepage_test/skin -->
<div id='div-gpt-ad-theme'>
  <script>
  if(g_section != 'business' && g_section != 'homepage' ){
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-theme'); });
  }
  </script>
</div>
	<input type="text"  id="temp_section" name="temp_section" style="display:none" >
  <script src="https://static.bangkokpost.com/newdesign/assets/custom/validate/validator_newsletter.js?v=0.033"></script>
  </body>
</html>
送彩金38元不限id