
$(document).ready(function () {
    $.getJSON("http://www.geoplugin.net/json.gp?jsoncallback=?", function (data) {
        var lat = data.geoplugin_latitude;
        var lon = data.geoplugin_longitude;
        var city = data.geoplugin_city;
        var state = data.geoplugin_region;
        $.ajax({
            type: "POST",
            url: "jobsLocal.ashx",
            data: { latitude: lat, longitude: lon, City: city, State: state, caller: "LROjobSlider" },
            dataType: "json",
            success: function (json) {
                displayJobs(json);
            },
            error: function (json) {
            },
            complete: function () {
            }
        });
    });
});

function displayJobs(json) {
    if(json.MsgJobsBase.indexOf("null, null?") != -1)
      json.MsgJobsBase = 'We could not find your base<br /><br /><a href="/jobs.aspx">Click here to search for jobs around you</a> or enter your zipcode below!<br /><br /><a target="_blank" href="https://apply.prodrivers.com" class="btn-applynow"></a>';
    $(".home-header .left .baseJobs").html(json.MsgJobsBase);
    $(".sliderLeftContent").html("<div class=\"panel-shim\"><div class=\"InnerContentleft\">" + json.MsgJobsLocal + "</div></div>");
    $(".sliderCenterContent").html("<div class=\"panel-shim\"><div class=\"InnerContentcenter\">" + json.MsgJobsRegional + "</div></div>");
    $(".sliderRightContent").html("<div class=\"panel-shim\"><div class=\"InnerContentright\">" + json.MsgJobsOtr + "</div></div>");
}

$(function () {

  $(".sliderLeft").mouseenter(function () {
        $(this).stop().animate({ width: ['478', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderLeft").mouseenter(function () {
        $(".sliderCenter").stop().animate({ width: ['180', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderLeft").mouseenter(function () {
        $(".sliderRight").stop().animate({ width: ['220', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderLeft").mouseenter(function () {
        $(".sliderLeftContent").css({ display: 'block' })
            .stop().animate({ width: ['290', 'easeOutCubic'] }, 600, function () { });
    });


    $(".sliderCenter").mouseenter(function () {
        $(this).stop().animate({ width: ['478', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderCenter").mouseenter(function () {
        $(".sliderLeft").stop().animate({ width: ['180', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderCenter").mouseenter(function () {
        $(".sliderRight").stop().animate({ width: ['220', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderCenter").mouseenter(function () {
        $(".sliderCenterContent").css({ display: 'block' })
            .stop().animate({ width: ['290', 'easeOutCubic'] }, 600, function () { });
    });


    $(".sliderRight").mouseenter(function () {
        $(this).stop().animate({ width: ['520', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderRight").mouseenter(function () {
        $(".sliderLeft").stop().animate({ width: ['178', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderRight").mouseenter(function () {
        $(".sliderCenter").stop().animate({ width: ['178', 'easeOutCubic'] }, 600, function () { });
    });
    $(".sliderRight").mouseenter(function () {
        $(".sliderRightContent").css({ display: 'block' })
            .stop().animate({ width: ['290', 'easeOutCubic'] }, 600, function () { });
    });


    $(".sliderDiv").mouseleave(function () {
        $(".sliderDiv").each(function () {
            $(this).stop().animate({ width: ['293', 'easeOutCubic'] }, 600, function () {});
        });
        $(".sliderContent").each(function () {
            $(this).stop().animate({ width: ['0', 'easeOutCubic'] }, 600, function () {
                $(this).css({ display: 'none' });
            });
        });
    });
});

