<?php

function mp_enqueue_scripts_and_styles() {

	// https://developers.google.com/maps/documentation/javascript/marker-clustering
	$marker_clusterer = "https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js";

	wp_enqueue_style('mp__style',				plugins_url('styles/mp__style.css'			, __FILE__),	'',						'',	false);

	// enqueue header
	wp_enqueue_script('mp_info_window',			plugins_url('scripts/mp_info_window.js'		, __FILE__),	'',						'',	false);
	wp_enqueue_script('mp_errors_map',			plugins_url('scripts/mp_errors_map.js'		, __FILE__),	'',						'',	false);
	wp_enqueue_script('mp_create_filters',		plugins_url('scripts/mp_create_filters.js'	, __FILE__),	'',						'',	false);
	wp_enqueue_script('mp_create_markers',		plugins_url('scripts/mp_create_markers.js'	, __FILE__),	'',						'',	false);
	wp_enqueue_script('mp_create_map',			plugins_url('scripts/mp_create_map.js'		, __FILE__),	'',						'',	false);
	wp_enqueue_script('mp_draw_clusters',		plugins_url('scripts/mp_draw_clusters.js'	, __FILE__),	'',						'',	false);
	wp_enqueue_script('mp_filter_events',		plugins_url('scripts/mp_filter_events.js'	, __FILE__),	'',						'',	false);

	// enqueue footer
	wp_enqueue_script('mp_marker_clusterer',	$marker_clusterer,											'',						'', true);
	wp_enqueue_script('mp_init_map',			plugins_url('scripts/mp_init_map.js'		, __FILE__),	['mp_marker_clusterer'],'',	true);
	wp_enqueue_script('mp_google_api',			mp_url_api(),												['mp_init_map'],		'',	true);

}

?>
