require(['config'], function() {
	require([
		'jquery', 
		'jquery.rwdImageMaps', 
		'jquery.maphilight'
	], function($) {
		$('.fnImageMap').maphilight();
	});
});

var itp_fn_LOCATION_INFO_info = function(param) {
	fn_ajax_call('/api/location/info-location', param, function(result) {
		
		let lctnDtlCd = itp_fn_get_param_value(param, 'lctnDtlCd'); // 위치상세코드
		// console.log('[BIZPOP_LOCATION_VIEW] lctnDtlCd = ' + lctnDtlCd);
				
		let lctnTxt = '<img id="ITP_BTN_LOCATION_VIEW_IMAGE" class="fnImageMap" src="' + result.lctnFileUrl + '" usemap="#ITP_BTN_LOCATION_VIEW_IMAGE_MAP">';
		lctnTxt += '<map id="ITP_BTN_LOCATION_VIEW_IMAGE_DATA" name="ITP_BTN_LOCATION_VIEW_IMAGE_MAP"></map>';
		
		$('#ITP_FORM_BIZPOP_LOCATION_VIEW .fnLctnView').empty(); 
		$('#ITP_FORM_BIZPOP_LOCATION_VIEW .fnLctnView').html(lctnTxt).promise().done(function(){			
			$('#ITP_FORM_BIZPOP_LOCATION_VIEW #ITP_BTN_LOCATION_VIEW_IMAGE_DATA').html(result.lctnFileMap).promise().done(function(){				
				setTimeout(function(){
					$('#ITP_FORM_BIZPOP_LOCATION_VIEW #ITP_BTN_LOCATION_VIEW_IMAGE_DATA').find('area[alt='+lctnDtlCd+']').mouseover();	
				}, 300);
			});
		});
		
		// $('#ITP_BTN_LOCATION_VIEW_IMAGE').maphilight();
		// $('#ITP_FORM_BIZPOP_LOCATION_VIEW #ITP_BTN_LOCATION_VIEW_IMAGE_DATA').find('area').mouseout(); 
			
	}, 'GET');
};

function itp_fn_BIZPOP_LOCATION_VIEW(parentPopFn, args, returnType) {
	
	$('#ITP_BIZPOP_LOCATION_VIEW .modal-dialog').css('width', 'fit-content');
	
	itp_fn_LOCATION_INFO_info(args);
	
	$('#ITP_BIZPOP_LOCATION_VIEW').one('shown.bs.modal', function(e) {		
		itp_fn_fire_window_resize();
	}).one('hidden.bs.modal', function(e) {
		$('#ITP_BIZPOP_LOCATION_VIEW').remove();
	}).modal('show');
	
};

