/**
 * Map display shortcode
 *
 * @param string $meta_key
 * @param int $post_id
 * @param array $args
 */
function wpuf_shortcode_map($location, $post_id = null, $args = array(), $meta_key = '')
{
    global $post;
    // compatibility
    if ($post_id) {
        wpuf_shortcode_map_post($location, $post_id, $args);
        return;
    }
    $default = array('width' => 450, 'height' => 250, 'zoom' => 12);
    $args = wp_parse_args($args, $default);
    list($def_lat, $def_long) = explode(',', $location);
    $def_lat = $def_lat ? $def_lat : 0;
    $def_long = $def_long ? $def_long : 0;
    ?>

    <div class="google-map" style="margin: 10px 0; height: <?php 
    echo $args['height'];
    ?>
px; width: <?php 
    echo $args['width'];
    ?>
px;" id="wpuf-map-<?php 
    echo $meta_key . $post->ID;
    ?>
"></div>

    <script type="text/javascript">
        jQuery(function($){
            var curpoint = new google.maps.LatLng(<?php 
    echo $def_lat;
    ?>
, <?php 
    echo $def_long;
    ?>
);

            var gmap = new google.maps.Map( $('#wpuf-map-<?php 
    echo $meta_key . $post->ID;
    ?>
')[0], {
                center: curpoint,
                zoom: <?php 
    echo $args['zoom'];
    ?>
,
                mapTypeId: window.google.maps.MapTypeId.ROADMAP
            });

            var marker = new window.google.maps.Marker({
                position: curpoint,
                map: gmap,
                draggable: true
            });

        });
    </script>
    <?php 
}
/**
 * Map display shortcode
 *
 * @param string $meta_key
 * @param int $post_id
 * @param array $args
 */
function wpuf_shortcode_map($location, $post_id = null, $args = array(), $meta_key = '')
{
    global $post;
    // compatibility
    if ($post_id) {
        wpuf_shortcode_map_post($location, $post_id, $args);
        return;
    }
    $default = array('width' => 450, 'height' => 250, 'zoom' => 12);
    $args = wp_parse_args($args, $default);
    list($def_lat, $def_long) = explode(',', $location);
    $def_lat = $def_lat ? $def_lat : 0;
    $def_long = $def_long ? $def_long : 0;
    ?>

    <div class="google-map" style="margin: 10px 0; height: <?php 
    echo $args['height'];
    ?>
px; width: <?php 
    echo $args['width'];
    ?>
px;" id="wpuf-map-<?php 
    echo $meta_key . $post->ID;
    ?>
"></div>

    <?php 
}