﻿/// <reference path="VEJS/VeJavaScriptIntellisenseHelper.js" />


function pageLoad() {
    var theLat = document.getElementById("ctl00_ContentPlaceHolderMap_GeoIPLat");
    var theLong = document.getElementById("ctl00_ContentPlaceHolderMap_GeoIpLong");

    if (theLat != null && theLong != null) {
        RB_reset = false;
        RB_initMapLatLon("myMap", theLat.value, theLong.value, 6);
        RB_reset = true;
        
        RB_GetDataJsonSimple("http://ipinfodb.com/ip_query.php?output=json&callback=handleLocation&timezone=false");
    }
}



function handleLocation(data) {
    if (!data || !data.Latitude || !data.Longitude || !RB_map)
        return;

    var point = new VELatLong(data.Latitude, data.Longitude, 11, VEAltitudeMode.RelativeToGround);
    RB_map.SetCenterAndZoom(point, 10);
}


function RB_GetDataJsonSimple(url) {
    var json = document.createElement('script');
    json.src = url;
    json.type = 'text/javascript';
    document.getElementsByTagName('head').item(0).appendChild(json);
    return;
}



function eventWizard(lat, lon) {
    up = document.getElementById("ctl00_ContentPlaceHolderMap_upEventWizard");
    dv = document.getElementById("ctl00$ContentPlaceHolderMap$hfEventWizard");
    dv.value = lat + ":" + lon;

    __doPostBack("ctl00_ContentPlaceHolderMap_upEventWizard", "");

}

 