ultimix
google_maps.js
Go to the documentation of this file.
1 
6 if( !ultimix )
7 {
8  ultimix = {};
9 }
10 
16 if( !ultimix.google_maps )
17 {
18  ultimix.google_maps = {};
19 }
20 
26 ultimix.google_maps.AutoInitialize = function()
27 {
28  jQuery( ".google_map" ).each(
29  function( index , Element )
30  {
31  ultimix.google_maps.InitializeMap( Element );
32  }
33  );
34 }
35 
45 ultimix.google_maps.GetAddress = function( Address , PointAcceptor )
46 {
47  var Geocoder = new GClientGeocoder();
48 
49  Geocoder.getLatLng(
50  Address ,
51  function( LatLng )
52  {
53  if( !LatLng )
54  {
55  /* setting default values */
56  LatLng = new GLatLng( 55.7519 , 37.6229 );
57  }
58 
59  if( PointAcceptor )
60  {
61  PointAcceptor( LatLng );
62  }
63  }
64  );
65 }
66 
74 ultimix.google_maps.InitializeMap = function( Element )
75 {
76  if( GBrowserIsCompatible() )
77  {
78  var Map = new GMap2( Element );
79  if( jQuery( Element ).attr( 'lat' ) )
80  {
81  var Point = new GLatLng( jQuery( Element ).attr( 'lat' ) , jQuery( Element ).attr( 'lng' ) );
82  }
83  else
84  {
85  var Point = new GLatLng( 55.7519 , 37.6229 );
86  }
87 
88  Map.setCenter( Point , 12 );
89  Map.addOverlay( new GMarker( Point ) );
90  Map.setUIToDefault();
91  }
92 }
93 
94 jQuery(
95  function()
96  {
97  ultimix.google_maps.AutoInitialize();
98  }
99 );