<?php
/**
 * @subpackage  tcshortcodes plugin
 */
//no direct accees
defined ('_JEXEC') or die('resticted aceess');
	
//[Map]
if(!function_exists('map_sc')) {
	function map_sc( $atts, $content="" ){
		
			extract(shtcode_atts(array(
				  'lat' => '41.3850409',
				  'lng' => '2.1747294',
				  'maptype'=>'ROADMAP',
				  'height' => '200',
				  'zoom' => 16
			 ), $atts));
			
			ob_start();
			?>
				
			<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=true"></script>
		
			<script type="text/javascript">
			  var myLatlng  = new google.maps.LatLng(<?php echo $lat ?>,<?php echo $lng ?>);
			  function initialize() {
				var mapOptions = {
				  zoom: <?php echo $zoom; ?>,
				  center: myLatlng,
					mapTypeId: google.maps.MapTypeId.<?php echo $maptype; ?>
				};
				var map = new google.maps.Map(document.getElementById('tc_simple_map_canvas'), mapOptions);
				var marker = new google.maps.Marker({position:myLatlng, map:map});	
			  }
			  google.maps.event.addDomListener(window, 'load', initialize);
			</script>
			
			<div style="height:<?php echo $height ?>px" id="tc_simple_map_canvas"></div>
				
			<?php
			
			$data = ob_get_clean();
			return $data;
	}
	add_shtcode( 'tcmap', 'map_sc' );
}