﻿window.onload = function() {
    //var el = $('sliderPrix')
    //var pmi = parseInt($('ctl00_ContentPlaceHolder2_resume1_pmin').getValue(), 10)
    //var pma = parseInt($('ctl00_ContentPlaceHolder2_resume1_pmax').getValue(), 10)

    //$('minValue').update(pmi)
    //$('maxValue').update(pma)
    //    new Control.Slider(el.select('.handle'), el, {
    //        range: $R(0, 300),
    //        sliderValue: [pmi, pma],
    //        onSlide: function(values) {
    //            $('minValue').update(parseInt(values[0], 10))
    //            $('maxValue').update(parseInt(values[1], 10))
    //        },
    //        onChange: function(values) {
    //            $('minValue').update(parseInt(values[0], 10))
    //            $('maxValue').update(parseInt(values[1], 10))
    //            $('ctl00_ContentPlaceHolder2_resume1_pmin').setValue(parseInt(values[0], 10))
    //            $('ctl00_ContentPlaceHolder2_resume1_pmax').setValue(parseInt(values[1], 10))
    //        }
    //    });
    initMap();
    if (_gmapOk == '1') {
        showGoogleMap(_x, _y);
    } else {
        $('map_canvas').hide()
        $('map_canvas_t').hide()
    
    }
    
}


function showGoogleMap(x,y) {

    map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(y, x), 14);
    geocoder = new GClientGeocoder();
    marker = null
    createMarker(new GLatLng(y, x))
   // createMarker(GLatLng.fromUrlValue(y + ',' + x))
  /*  GEvent.addListener(map, "click", function(overlay, latlng) {
        map.closeInfoWindow();
        if (latlng) {
            if (marker) {
                //  marker.setLatLng(latlng)
            } else {
                
            }
        }
    });*/
    map.addControl(new GSmallMapControl());

   // getLatLng()

}

var marker;
var map
var geocoder

function initMap() {
    var marker = null;
    var map = null
    var geocoder = null
    $('map_canvas').update('')
}

function createMarker(point) {
    marker = new GMarker(point)
  /*  GEvent.addListener(marker, "dragstart", function() {
        map.closeInfoWindow();
    });
    GEvent.addListener(marker, "dragend", function(latlng) {
        if (latlng) {
            saveLatLng()
            //   alert(latlng.x);
            //   alert(latlng.y);
        }
    });*/
    map.addOverlay(marker)
}

