  function gmap_attachUrl(marker, url) {
    google.maps.event.addListener(marker, 'click', function() {
      window.location = url;
    });
  }

  function gmap_initialize(urlPrefix, citiesLatLng, citiesNames, citiesUrl) {
    var latlng = new google.maps.LatLng(15, 0);
    var myOptions = {
      zoom: 2,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    for(i = 0; i < citiesLatLng.length; i++)
  	{
      var marker = new google.maps.Marker({
        position: citiesLatLng[i],
        map: map,
        title: citiesNames[i]
      });
      gmap_attachUrl(marker, urlPrefix + citiesUrl[i]);
    }
  }


    /* colors :
     * red : ff0000
     * red orange : ff4600
     * orange : ff7f00
     * yellow orange : feb300
     * yellow : ffff00
     * yellow green : 00ff00
     * green : 007900
     * blue green : 00aeae
     * blue : 0000ff
     *
     *
     * example link for red : http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=+|FF0000|000000
     *
     * */
  function gmap_initialize_colorful(urlPrefix, citiesLatLng, citiesNames, citiesUrl, citiesColor, link) {
    var colorIcons = new Array(9);
    var commonPrefix = 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=+|';
    var commonSuffix = '|000000';
    colorIcons[0] = commonPrefix + '0000FF' + commonSuffix;
    colorIcons[1] = commonPrefix + '00AEAE' + commonSuffix;
    colorIcons[2] = commonPrefix + '007900' + commonSuffix;
    colorIcons[3] = commonPrefix + '00FF00' + commonSuffix;
    colorIcons[4] = commonPrefix + 'FFFF00' + commonSuffix;
    colorIcons[5] = commonPrefix + 'FEB300' + commonSuffix;
    colorIcons[6] = commonPrefix + 'FF7F00' + commonSuffix;
    colorIcons[7] = commonPrefix + 'FF4600' + commonSuffix;
    colorIcons[8] = commonPrefix + 'FF0000' + commonSuffix;

    var latlng = new google.maps.LatLng(35, 0);
    var myOptions = {
      zoom: 3,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    for(i = 0; i < citiesLatLng.length; i++)
  	{
      var marker = new google.maps.Marker({
        position: citiesLatLng[i],
        map: map,
        title: citiesNames[i],
        icon:  colorIcons[citiesColor[i]]
      });
      if (link == true) {
        gmap_attachUrl(marker, urlPrefix + citiesUrl[i]);
      }
    }
  }