﻿/// <reference path="jquery-1.4.1-vsdoc.js" />

(function ($) {
    $.fn.googleMap = function (opts) {
        var container = $(this);
        if (container == null || opts.positions == null || opts.positions.length == 0)
            return;

        var map = new google.maps.Map(document.getElementById(container.attr('id')), {
            center: new google.maps.LatLng(0, 0),
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            zoom: 2
        });

        $.each(opts.positions, function (i, v) {
            var p = new google.maps.LatLng(v.LatLng[0], v.LatLng[1]);
            var m = new google.maps.Marker({ position: p, map: map, title: v.Title });
            map.setCenter(p);
        });

    }
})(jQuery)
