<?php
//echo __FILE__;
$optres['js'][] = $path . "amodules/wb_search_results/js/markerclusterer.js";
//$optres['js'][] = $path . "amodules/wb_search_results/js/infobubble.js";
$optres['css'][] = $path . "assets/plugins/snazzy/snazzy-info-window.css";
$optres['css'][] = $path . "assets/plugins/snazzy/snazzy-custom.css";
$optres['css'][] = $path . "assets/css/bootstrap-dialog.min.css";
$optres['js'][] = $path . "assets/js/bootstrap-dialog.min.js";

if(isset($wb_uid) && trim($wb_uid) != "") {
	$template_css = dirname(__FILE__) . "/templates_css/$wb_uid.css";
	if(file_exists($template_css)) {
		$optres ['css'][] = $path . "amodules/full_adverts_list/templates_css/$wb_uid.css";
	}
}

//print_r($optres['css']);

$wb_sm_size = 'large';
$have_wb_search_map_image = false;
if(isset($module_map_search_image) && $module_map_search_image != "") {
	$wb_logo_image_path = $_SERVER['DOCUMENT_ROOT'] . "/images/wb_res/$wb_uid" . $module_map_search_image;
	if(file_exists($wb_logo_image_path)) {
		$have_wb_search_map_image = true;
		$wb_sm_size = 'small';
		$wb_logo_image_url = $path . "images/wb_res/$wb_uid" . $module_map_search_image;
	}
	
}

?>

<div id="wb_search_map" class="wb_search_map_<?php echo $wb_sm_size;?>">
	<div id="wb_search_map_image">
		<?php
		if($have_wb_search_map_image) {
			echo '<img id="wb_search_map_img" src="', $wb_logo_image_url, '" width="670" height="240" alt="', $webpage_title_en,'">';
		}
		?>
	</div>
	<?php
	if($have_wb_search_map_image) {
		?>
		<div id="wb_search_map_container" class="wb_search_map_container_small" style="display: none;">
			<div id="cyprus_map" class="wb_search_map_gmap_small"></div>
			<div id="map_menu_small" class="wb_search_map_menu">
				<span class="map_menu_link" id="map_enlarge"><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-newwin"></span>Larger Map</span>
			</div>
			<div id="map_menu_large" class="wb_search_map_menu" style="display: none;">
				<span class="map_menu_link" id="map_close"><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-closethick"></span>Smaller Map</span>
			</div>
		</div>
		<?php
	}
	else {
		?>
		<div id="wb_search_map_container" class="wb_search_map_container_large" style="display: none;">
			<div id="cyprus_map" class="wb_search_map_gmap_large" style="width:100%; height: 400px;"></div>
            <div id="map_menu_center" class="wb_search_map_menu">
                <span class="map_menu_link" id="map_center">
                    <i class="fa fa-dot-circle-o fa-lg"></i>
                </span>
            </div>

		</div>
		<?php
	}
	?>
	<div style="clear: both;"></div>
	
</div>


<script type="text/javascript">
	<?php
	if(count($json_locations) > 0) {
		?>
		
		var json_locations = <?php echo json_encode($json_locations); ?>;
	
		<?php
		
	}
	else {
		echo 'var json_locations = {};';
	}
	
	if($have_wb_search_map_image) {
		$optres['js'][] = $path . 'amodules/full_adverts_list/js/wb_search_map_image.js';
	}
	else {
		?>
		var have_wb_search_map_image = false;
		<?php
	}
	?>
    window.wb_search_map_init = '<?=$path;?>amodules/full_adverts_list/js/full_adverts_list.js';
    //console.log(window.wb_search_map_init);
</script>