

    
function mapload() {
    var myOptions = { 
      mapTypeId: google.maps.MapTypeId.ROADMAP 
    }; 
    
    var map = new google.maps.Map(document.getElementById("map"),  myOptions); 
    window.map = map;
    var bounds = new google.maps.LatLngBounds(new google.maps.LatLng(document.getElementById("minLat").innerHTML,document.getElementById("minLong").innerHTML),new google.maps.LatLng(document.getElementById("maxLat").innerHTML,document.getElementById("maxLong").innerHTML));
    window.bounds = bounds;
     map.fitBounds(bounds);
	google.maps.event.addListener(map, 'tilesloaded', function() {      $('.loading-container').css('display','none');   }); 

     function createMarker(point, text, title, letter) {
          if (letter=='undefined' || letter=='') {
          	var icon = new google.maps.MarkerImage("/img/markers/marker_small.png",
          	new google.maps.Size(11, 27),
          	new google.maps.Point(0,0),
          	new google.maps.Point(5, 27)
          	);
          	         	
          } else {
          	var icon = new google.maps.MarkerImage("/img/markers/marker_" + letter + ".png",
          	new google.maps.Size(21, 29),
          	new google.maps.Point(0,0),
          	new google.maps.Point(11, 29)
          	);
          }
          
         var marker = new google.maps.Marker({
        	position: point,
        	map: map,
        	icon: icon,
        	title: title
    });
    	var infowindow = new google.maps.InfoWindow({ 
    	content: text 
	}); 
	google.maps.event.addListener(marker, 'click', function() { 
  	infowindow.open(map,marker); 
	});
          return marker;
        }
        
        geo=$('.geo');
        titles=$('.adtitle');
	ids=$('.id');
	hashes=$('.hash');
	maxDesks=$('.maxDesks');
	addresses=$('.address');

        for ( var i=0;i<geo.length;i=i+1)
{
        var html = '<div style="width:200px"><a href="/detail/' + ids[i].innerHTML + '" style="float:right;display:block;margin-right:5px;" ><img src="/images/thumbnail/'+hashes[i].innerHTML+'.jpg"  alt="" title="" border="0"  /></a> <h3 style="line-height:1.3em">'+addresses[i].innerHTML+'</h3><ul style="float:left;clear:left;"><li>'+maxDesks[i].innerHTML+' desk';
        if (maxDesks[i].innerHTML!='1') html = html + "s";
        html = html + '</li></ul> <a href="/detail/' + ids[i].innerHTML + '" title="" style="clear:left;float:left;margin-bottom:10px;font-weight:bold" >Details&nbsp;&amp;&nbsp;photos&raquo;</a><br style="clear:both" /></div></div>';
        
        var marker = createMarker(
        new google.maps.LatLng($('.latitude',geo[i])[0].innerHTML,$('.longitude',geo[i])[0].innerHTML),
        
        html
        ,
        titles[i].innerHTML,
        $('.letter',geo[i])[0].innerHTML);
  }
 
 
    }
    
    

