var markers = [{lat:51.519638,lng:-0.135747},{lat:51.902437,lng:-2.07985}]
var mapMarkers = [];
var map = null;
var projL = null;
var projC = null;
var helper = null;
var londonLt = null;
var cheltLt = null;

var initialize_map = function() {
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 15,
      center: latlng,
      draggable:false,
      streetViewControl:false,
      scrollwheel: false,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    
    map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
    placeMapMarkers();
    
    google.maps.event.addListener(map, 'click', function(event) {
        
        if(!this.draggable){
            this.draggable = true;    
        }else{
            this.draggable = false;
        }
        
        
    });
    
}

var placeMapMarkers = function(){
    var bounds = new google.maps.LatLngBounds();
    
    for(i in markers){
        var myLatLng = new google.maps.LatLng(markers[i].lat,markers[i].lng);
        var marker = new google.maps.Marker({
                        map: map,
                        position: myLatLng,
                        icon: "site/images/mark.png",
                        type: "location"
                    });
    }
    
    map.panTo(myLatLng)
    
    londonLt = new google.maps.LatLng(markers[0].lat,markers[0].lng);
    cheltLt = new google.maps.LatLng(markers[1].lat,markers[1].lng);
    /*
    helper = new google.maps.OverlayView();
    helper.setMap(map);
    helper.draw = function () { 
        if (!this.ready) { 
            this.ready = true; 
            google.maps.event.trigger(this, 'ready');
            projC = helper.getProjection().fromLatLngToDivPixel(myLatLng);
            projL = helper.getProjection().fromLatLngToDivPixel(londonLt);
        } 
    };
    */
} 

