Currently 36683 machines for sale
Used Water Well Drilling Rigs & Trucks For Sale
").insertBefore($("#sign-in-box .signInTitle")); }
$("#sign-in-box #sign-in-button").attr("action", "wantadagent");
toggleModal('[data-modal=\'signinbox\']');
}
Sort by:
");
if ($("#locationSearch").val().trim().length > 0) {
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
}
}
if ($('#q').length) $('#q').val($("#freeTxtSearch").val());
else
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
$('#aspnetForm').submit();
}
function disableEnterToSubmit() {
var input = document.getElementById('locationSearch');
google.maps.event.addDomListener(input, 'keydown', function (e) {
setLocationSearchType("null");
$(".search .button").addClass("disabled");
var suggestion_selected = $(".pac-item-selected").length > 0;
if (e.keyCode === 13 && !e.triggered) {
if (!suggestion_selected)
google.maps.event.trigger(this, 'keydown', { keyCode: 40 })
google.maps.event.trigger(this, 'keydown', { keyCode: 13, triggered: true })
if ($(".search_form_fields input.button").length > 0)
setTimeout(function () {
if(_locationSearchType != "" && _locationSearchType != null)
$(".search_button input.button").click();
}, 300);
}
});
google.maps.event.addDomListener(input, 'keyup', function (e) {
if ($("#locationSearch").val() == "")
$(".search .button").removeClass("disabled");
});
}
function appendLongLatToForm(geoLat, geoLong) {
if ($("#locationSearch") && $("#locationSearch").val().trim().length > 0) {
var geoDist = $("#locationRange").val();
var geoName = $("#locationSearch").val();
if($("#submitGeoSrc").length > 0)
$("#submitGeoSrc").remove();
$('#aspnetForm').append("
");
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
$('#submitGeoSrc').append("
");
var $form = $(document.forms[0]);
var action = $form.attr("action");
if (action.indexOf("geolong") != -1) {
action = removeParam("geolong", action);
action = removeParam("geolat", action);
action = removeParam("distrange", action);
action = removeParam("locationName", action);
}
action += "&geolong=" + geoLong + "&geolat=" + geoLat + "&distrange=" + geoDist + "&locationName=" + encodeURI(geoName);
$form.attr("action", action);
}
}
function appendCodeToForm(codeType, codeValue) {
removeCodeFromForm();
if (codeType == "countrycode") {
$('#aspnetForm').append("
");
}
else if (codeType == "region") {
$('#aspnetForm').append("
");
$('#aspnetForm').append("
");
}
}
function removeCodeFromForm() {
if ($("#srcCountryCode").length > 0)
$("#srcCountryCode").remove();
if($("#srcRegionCode").length > 0)
$("#srcRegionCode").remove();
}
function removeLongLatFromForm() {
$("#submitGeoSrc").remove();
var $form = $(document.forms[0]);
var action = $form.attr("action");
if (action.indexOf("geolong") != -1) {
action = removeParam("geolong", action);
action = removeParam("geolat", action);
action = removeParam("distrange", action);
action = removeParam("locationName", action);
}
$form.attr("action", action);
}
function removeParam(key, sourceURL) {
var rtn = sourceURL.split("?")[0],
param,
params_arr = [],
queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
if (queryString !== "") {
params_arr = queryString.split("&");
for (var i = params_arr.length - 1; i >= 0; i -= 1) {
param = params_arr[i].split("=")[0];
if (param === key) {
params_arr.splice(i, 1);
}
}
rtn = rtn + "?" + params_arr.join("&");
}
return rtn;
}
function overrideFacetFunctions() {
countrySearchSubmit = function () {
var baseUrl = "";
var queryUrl = "/search.aspx";
if (_locationSearchType == "country") {
var q = $("input[name='q']").val();
var countrycode = "";
if (sessionStorage.locationCountryCode != undefined)
countrycode = sessionStorage.locationCountryCode
else countrycode = $("#srcCountryCode").val();
queryUrl += "?q=" + encodeURI(q);
if (countrycode.length > 0)
queryUrl += "&sf_countrycode=" + encodeURI(countrycode);
}
queryUrl = baseUrl + queryUrl;
window.location = queryUrl;
}
regionSearchInput = function () {
var baseUrl = "";
var queryUrl = "/search.aspx";
if (_locationSearchType == "region") {
var q = $("input[name='q']").val();
var regioncode = "";
var countrycode = "";
if (sessionStorage.locationRegionCode != undefined)
regioncode = sessionStorage.locationRegionCode;
else regioncode = $("#srcRegionCode").val();
if (sessionStorage.locationCountryCode != undefined)
countrycode = sessionStorage.locationCountryCode;
else countrycode = $("#srcCountryCode").val();
queryUrl += "?q=" + encodeURI(q);
if (regioncode.length > 0)
queryUrl += "&sf_region=" + encodeURI(regioncode) + "&sf_country=" + encodeURI(countrycode);
}
queryUrl = baseUrl + queryUrl;
window.location = queryUrl;
}
geoSearchSubmit = function () {
$("#locationRange").val(2147483647);
var baseUrl = "";
var pathName = window.location.pathname;
var urlPath = pathName.replace('/rbclassified', '');
urlPath = urlPath.indexOf('&') > 0 ? urlPath.substring(0, urlPath.indexOf('&')) : urlPath.indexOf('?') > 0 ? urlPath.substring(0, urlPath.indexOf('?')) : urlPath;
urlPath = urlPath == '/' ? '' : urlPath;
var queryUrl = urlPath + (urlPath.length > 0 ? "?" : "/") + (urlPath.indexOf('.html') > 0 ? '' : urlPath.indexOf('search.aspx') > 0 ? '' : urlPath.length > 0 ? '': 'search.aspx');
if (pathName.indexOf('dealer.aspx') >= 0)
queryUrl = urlPath + (urlPath.length > 0 ? "?" : "/") + (urlPath.indexOf('.html') > 0 ? '' : urlPath.indexOf('dealer.aspx') > 0 ? '' : urlPath.length > 0 ? '': 'dealer.aspx');
if (_locationSearchType == "location") {
var queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
var q = $("input[name='q']").val();
if (q == undefined || q == '') {
q = $("input[name='qholder']").val();
if (q == undefined || q == '') {
q = urlParams.get("q");
if (q == undefined || q == null)
q = '';
}
}
q = q.trim();
var locationQuery = makeLocationQuery("q");
if (queryUrl.endsWith('?') || queryUrl.endsWith('&'))
queryUrl = queryUrl.substring(0, queryUrl.length - 1);
if (q != '') {
if (queryUrl.endsWith("/search.aspx") || queryUrl.endsWith(".html"))
queryUrl = "/" + encodeURI(q) + '/+/+/1,21,relevance,search.html';
else
queryUrl += (queryUrl.indexOf('?') > 0 ? "&q=" : "?q=") + encodeURI(q);
}
//queryUrl += (q == '' ? '' : (queryUrl.indexOf('?') > 0 ? "&q=" : "?q=") + encodeURI(q));
urlParams.delete('q');
if (locationQuery.indexOf('geolat') >= 0) {
urlParams.delete('geolat');
urlParams.delete('sf_geolat');
}
if (locationQuery.indexOf('geolong') >= 0) {
urlParams.delete('geolong');
urlParams.delete('sf_geolong');
}
if (locationQuery.indexOf('distrange') >= 0) {
urlParams.delete('distrange');
urlParams.delete('sf_distrange');
}
if (locationQuery.indexOf('locationName') >= 0) {
urlParams.delete('locationName');
urlParams.delete('locationname');
}
var urlToAppend = urlParams.toString();
if (queryUrl.indexOf("dealer.html") > 0) {
queryUrl += (queryUrl.indexOf('?') >= 0 ? '&' : '?') + "orgid=" + urlParams.get('orgid');
}
queryUrl += (queryUrl.indexOf('?') >= 0 ? '&' : '?') + (locationQuery.startsWith('&') ? locationQuery.substring(1, locationQuery.length) : locationQuery) + (urlToAppend.length > 0 && urlToAppend != '&' ? '&' + urlToAppend : '');
if (queryUrl.endsWith('?') || queryUrl.endsWith('&'))
queryUrl = queryUrl.substring(0, queryUrl.length - 1);
}
queryUrl = baseUrl + queryUrl;
window.location = queryUrl;
}
noLocationSearchSubmit = function () {
var baseUrl = "";
var queryUrl = "/search.aspx";
var q = '';
$("input[name='q']").each(function() {
if ($(this).val() && $(this).val() != '' && $(this).val() != ',') {
q = $(this).val().trim();
return;
}
});
if (q == '' || !q) {
$("input[name='qholder']").each(function() {
if ($(this).val() && $(this).val() != '' && $(this).val() != ',') {
q = $(this).val().trim();
return;
}
});
}
if (q == '' || !q)
queryUrl += "?q=" + encodeURI(q);
else
queryUrl = '/' + encodeURI(q) + '/+/+/1,21,relevance,search.html';
queryUrl = baseUrl + queryUrl;
window.location = queryUrl;
}
locationSearchSubmit = function () {
if (sessionStorage.locationSearchType != undefined)
_locationSearchType = sessionStorage.locationSearchType;
if (_locationSearchType == "country")
countrySearchSubmit();
else if (_locationSearchType == "region")
regionSearchInput();
else if (_locationSearchType == "location")
geoSearchSubmit();
else
noLocationSearchSubmit();
}
addFilter = function (paramType, name, value, displayText) {
if (displayText && displayText != value)
value += _valueDataSeparator + displayText;
var url = getFilterQuery('a' + paramType, name + '=' + encodeURIComponent(value));
url += makeLocationQuery();
if (window.location.href.indexOf("view=1") > -1) {
window.location = url + "&view=1";
} else {
window.location = url;
}
}
addMultipleFilter = function (paramType, name, value, displayText) {
if (displayText && displayText != value)
value += _valueDataSeparator + displayText;
var url = getFilterQuery('a' + paramType, name + '=' + value);
url += makeLocationQuery();
var sfField = "sf_" + name;
if (url.indexOf(sfField) > -1) {
var sfValue = getParameterByName(sfField, url);
url = url.replace("&" + sfField + "=" + sfValue,"");
}
if (window.location.href.indexOf("view=1") > -1) {
//window.location = url + "&view=1";
redirectUrlSearchFilter(url + "&view=1");
} else {
//window.location = url;
redirectUrlSearchFilter(url);
}
}
updateFilter = function (paramType, name, value, displayText) {
if (displayText && displayText != value)
value += _valueDataSeparator + displayText;
var url = getFilterQuery('u' + paramType, name + '=' + encodeURIComponent(value));
url += makeLocationQuery();
if (window.location.href.indexOf("view=1") > -1) {
window.location = url + "&view=1";
} else {
window.location = url;
}
}
removeFilter = function (paramType, name, value) {
var url = '';
if (name == 'q') {
url = removeParam('q', window.location.href);
if (url.indexOf("?") == url.length - 1)
url = url .replace("?", "");
} else {
if (!value)
value = '*'
url = getFilterQuery('r' + paramType, name + '=' + encodeURIComponent(value));
}
if (name != "locationName")
url += makeLocationQuery();
window.location = url;
}
updateFilters = function (btnParamType, btnName, btnValue) {
var searchParams = '';
var refineParams = '';
if (btnParamType && btnName && btnValue) {
if ($.isArray(btnValue) && btnName.indexOf(_rangeSuffix) == -1)
btnName += _rangeSuffix;
if (getCachedFilterIndex(btnName) == -1) {
if ($.isArray(btnValue))
cacheFilterChange(btnParamType, btnName, btnValue[0] + _rangeSeparator + btnValue[1], null);
else
cacheFilterChange(btnParamType, btnName, btnValue, null);
}
}
for (var i = 0; i -1)
// href = href.replace(/Page=\d+/, "Page=1");
//if (href.indexOf("PageSize") > -1)
// href = href.replace(/PageSize=\w+/, "PageSize=" + size);
//else if (href.indexOf("?") > -1)
// href = href + "&PageSize=" + size;
//else
// href = href + "?PageSize=" + size;
//window.location = href;
}
changeSort = function (sortBy) {
var url = _sortChangeUrl.replace(/\{0\}/, sortBy) + makeLocationQuery();
//alert(url);
if (GetQueryString("PageSize") != null)
//window.location = url + "&PageSize=" + GetQueryString("PageSize");
redirectUrlSearchFilter(url + "&PageSize=" + GetQueryString("PageSize"));
else
//window.location = url;
redirectUrlSearchFilter(url);
//var href = window.location.href;
//if (href.indexOf("SortBy") > -1)
// window.location = href.replace(/SortBy=\w+/, "SortBy=" + sortBy);
//else if (href.indexOf("?") > -1)
// window.location = href + "&SortBy=" + sortBy;
//else
// window.location = href + "?SortBy=" + sortBy;
}
changeSortFavorites = function (sortBy) {
var url = _sortChangeUrl.replace(/\{0\}/, sortBy) + makeLocationQuery();
if (GetQueryString("PageSize") != null)
window.location = url + "&PageSize=" + GetQueryString("PageSize");
else
window.location = url;
}
}