﻿function determineLandingPage() {
    if (google.loader.ClientLocation) {
        $.ajax({
            type: "POST",
            url: "/PageLocationService.asmx/FindRedirectPage",
            data: "{'stateName': '" + google.loader.ClientLocation.address.region + "', 'cityName': '" + google.loader.ClientLocation.address.city + "', 'latitude': '" + google.loader.ClientLocation.latitude + "', 'longitude': '" + google.loader.ClientLocation.longitude + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (json) {
                window.location.href = json.d;
            },
            error: function (jqXHR, textStatus, errorThrown) {
                $("#errorStatus").html(jqXHR.responseText);
            }
        });
    }
    else {
        $.ajax({
            type: "POST",
            url: "/PageLocationService.asmx/FindDefaultPage",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (json) {
                window.location.href = json.d;
            },
            error: function (jqXHR, textStatus, errorThrown) {
                $("#errorStatus").html(jqXHR.responseText);
            }
        });
    }
}
