function tool_setup() {
var n = $(document),
t = $("body"),
i = $(".validation", t);
n.foundation("reveal", { closeOnBackgroundClick: !1 });
n.foundation();
$.validator.setDefaults({ onfocusout: !1, onkeyup: !1 });
$.ajaxSetup({ cache: !1 });
$.valHooks.text = {};
$.valHooks.text.set = function (n, t) {
if ($(n).is(".formatted_field")) {
var i = $(this).data("entered_value");
return (
$(n).data("entered_value", t),
(n.value = format_field($(n).data("field_format"), t)),
t !== i && $(n).trigger("change_complete"),
n.value
);
}
return undefined;
};
$.valHooks.text.get = function (n) {
if ($(n).is(".formatted_field")) {
var t = $(n).data("entered_value");
return typeof t == "undefined" ? n.value : t;
}
return undefined;
};
n.on("focusout", ".formatted_field", function () {
$(this).val(this.value);
(typeof populating_form != "undefined" && populating_form) ||
$(this).valid();
});
n.on("focusin", "input.formatted_field", function () {
this.value = $(this).val();
});
n.on("change", "input:not(.formatted_field)", function () {
$(this).trigger("change_complete");
});
n.on("focusout", "input:not(.formatted_field)", function () {
(typeof populating_form != "undefined" && populating_form) ||
$(this).valid();
});
n.on("keyup", ".numeric", function () {
var n = this.value.replace(/[^0-9\.\-]/g, "");
this.value !== n && (this.value = n);
});
n.on("change", 'input[type="range"]', function () {
if ($(this).attr("name")) {
var n = $(this).attr("name").replace("_range", "");
$('input[name="' + n + '"]').val($(this).val());
(typeof populating_form != "undefined" && populating_form) ||
$('input[name="' + n + '"]').valid();
}
});
n.on("change", 'input[type="text"]', function () {
var n = $(this).attr("name");
$('input[name="' + n + '_range"]').val(this.value);
});
$("select").each(function () {
$(this).next(".custom.dropdown").attr("title", this.title);
});
n.on("click", ".top_of_page_link", function (n) {
return n.preventDefault(), $(document).scrollTo($("body")), !1;
});
$(".upload_file_size_limit_message").text(
"Please note: maximum file size for uploads is 1.94MB"
);
i.on("click", "a.validate-link", function (n) {
var i = $(this),
r = $(':input[name="' + i.attr("for") + '"]', t),
f = i.attr("href"),
u = r;
$(window).scrollTo(u, 500, { offset: -30, axis: "y" });
setTimeout(function () {
r.focus().select();
}, 400);
n.preventDefault();
});
}
function get_modules_id() {
var n = modules_id === null ? getCookie("MemberID") : this.modules_id;
try {
Raven.setUser({ id: n });
} catch (t) {}
return n;
}
function get_auth_token() {
var n, t;
if (auth_token === null) {
if (((n = getCookie("APIMemberJSON")), !n)) return "";
try {
return (t = $.parseJSON(decodeURIComponent(n))), t.AuthToken;
} catch (i) {
return "";
}
} else return auth_token;
}
function get_profile_country_code() {
var n, t;
if (portfolioCountry === null) {
if (((n = getCookie("APIMemberJSON")), !n)) return "";
try {
return (t = $.parseJSON(decodeURIComponent(n))), t.PortfolioCountry;
} catch (i) {
return "";
}
} else return portfolioCountry;
}
function get_user_country_code() {
var n, t;
if (userCountry === null) {
if (((n = getCookie("APIMemberJSON")), !n)) return "";
try {
return (t = $.parseJSON(decodeURIComponent(n))), t.Country;
} catch (i) {
return "";
}
} else return userCountry;
}
function get_member_name() {
var n, t;
if (memberName === null) {
if (((n = getCookie("APIMemberJSON")), !n)) return "";
try {
return (
(t = $.parseJSON(decodeURIComponent(n))), t.FirstName + " " + t.LastName
);
} catch (i) {
return "";
}
} else return memberName;
}
function get_user_roles() {
var n, t;
if (userRoles === null) {
if (((n = getCookie("APIMemberJSON")), !n)) return "";
try {
return (t = $.parseJSON(decodeURIComponent(n))), t.Roles;
} catch (i) {
return "";
}
} else return userRoles;
}
function check_user_roles(n) {
if (typeof n == "undefined" || n.length === 0) return !1;
typeof n == "string" && (n = [n]);
for (
var u = get_user_roles(), e = u.length, f = !1, o = n.length, r, i, t = 0;
t < o;
t++
) {
for (r = !1, i = 0; i < e; i++)
if (n[t] === u[i].Module) {
r = !0;
break;
}
if (!r) {
f = !0;
break;
}
}
return !f;
}
function api_url(n, t, i, r, u, f) {
var e, o;
switch ($("#rei_account_details").data("rei_api")) {
case "dev_env":
e = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/securitydev",
service_name: "AuthService",
};
o = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/analyserdev",
service_name: "AnalyserService",
};
tracker_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/tracker",
service_name: "PortfolioService",
};
search_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/searchdev",
service_name: "PropertySearchService",
};
parameter_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/searchdev",
service_name: "ParameterService",
};
xeroauth_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/Xero",
service_name: "XeroAuthService",
};
xerodata_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/Xero",
service_name: "XeroDataService",
};
fileupload_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/upload",
service_name: "FileUploadService",
};
break;
case "future_live":
e = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/security",
};
o = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/v2/analyser",
service_name: "AnalyserService",
};
tracker_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/v2/tracker",
service_name: "PortfolioService",
};
search_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/v2/search",
service_name: "PropertySearchService",
};
parameter_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/v2/search",
service_name: "ParameterService",
};
xeroauth_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/v2/xero",
service_name: "XeroAuthService",
};
xerodata_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/v2/xero",
service_name: "XeroDataService",
};
fileupload_api = {
protocol: "http://",
host: "121.50.209.112",
port: 80,
path: "",
service_name: "FileUploadService",
};
break;
case "dev_env_3":
e = {
protocol: "http://",
host: "121.50.209.113",
port: 4165,
path: "",
service_name: "AuthService",
};
o = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/dev3/analyser",
service_name: "AnalyserService",
};
tracker_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/dev3/tracker",
service_name: "PortfolioService",
};
search_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/dev3/Search",
service_name: "PropertySearchService",
};
parameter_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/dev3/Search",
service_name: "ParameterService",
};
xeroauth_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/dev3/Xero",
service_name: "XeroAuthService",
};
xerodata_api = {
protocol: "http://",
host: "api.realestateinvestar.com",
port: 80,
path: "/dev3/Xero",
service_name: "XeroDataService",
};
fileupload_api = {
protocol: "http://",
host: "121.50.209.112",
port: 80,
path: "",
service_name: "FileUploadService",
};
break;
case "live":
case "dev_env_2":
case "default":
e = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/security",
service_name: "AuthService",
};
o = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/analyser",
service_name: "AnalyserService",
};
tracker_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/tracker",
service_name: "PortfolioService",
};
search_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/search",
service_name: "PropertySearchService",
};
parameter_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/search",
service_name: "ParameterService",
};
xeroauth_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/Xero",
service_name: "XeroAuthService",
};
xerodata_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/Xero",
service_name: "XeroDataService",
};
fileupload_api = {
protocol: "https://",
host: "sec.realestateinvestar.com",
port: 443,
path: "/v1_0/upload",
service_name: "FileUploadService",
};
}
typeof t == "undefined" &&
($("#tracker_tool").length
? (t = "PortfolioService")
: $("#analyser_tool").length
? (t = "AnalyserService")
: $("#search_tool").length && (t = "PropertySearchService"));
switch (t) {
case "AuthService":
api_details = e;
break;
case "PortfolioService":
api_details = tracker_api;
break;
case "PropertySearchService":
api_details = search_api;
break;
case "ParameterService":
api_details = parameter_api;
break;
case "XeroAuthService":
api_details = xeroauth_api;
break;
case "XeroDataService":
api_details = xerodata_api;
break;
case "FileUploadService":
api_details = fileupload_api;
break;
default:
case "AnalyserService":
api_details = o;
}
return (
(u = typeof u == "undefined" ? api_details.protocol : u),
(i = typeof i == "undefined" ? api_details.host : i),
(r = typeof r == "undefined" ? api_details.port : r),
(f = typeof f == "undefined" ? api_details.path : f),
(t = typeof t == "undefined" ? api_details.service_name : t),
u + i + ":" + parseInt(r) + f + "/" + t + ".svc/API/" + n
);
}
function authenticate_user(n, t) {
var r = { UserName: n, Password: t, SessionType: 0 },
i = new $.Deferred();
return (
$.ajax({
url: api_url("Security/AuthMember/", "AuthService"),
data: JSON.stringify(r),
type: "POST",
contentType: "application/json",
headers: { APIUserName: api_username, APIPassword: api_password },
dataType: "json",
})
.fail(function () {
i.reject();
})
.done(function (n) {
$.ajax({
url: api_url("Security/Member/" + n.MemberID, "AuthService"),
type: "GET",
contentType: "application/json",
headers: {
APIUserName: api_username,
APIPassword: api_password,
UserToken: n.AuthToken,
},
dataType: "json",
})
.fail(function () {
i.reject();
})
.done(function (t) {
n.ValidLogin && n.MemberID !== ""
? ((modules_id = n.MemberID),
(auth_token = n.AuthToken),
(userCountry = t.Country),
(memberName = t.FirstName + " " + t.LastName),
(userRoles = t.Roles),
(portfolioCountry = t.PortfolioCountry))
: i.reject();
i.resolve();
});
}),
i
);
}
function open_valuer_window(n) {
if (n.toUpperCase() === "NZ") {
window.open("http://www.rpnz.co.nz/", "_blank");
return;
}
window.open(
"http://www.realestateinvestar.com.au/ME2/MyModules/SOAP/apm/connect_myvaluer.asp",
"_blank"
);
}
function integer_with_commas(n) {
var t = Math.round(n);
return Math.floor(Math.abs(t)) < 1e3
? t.toString()
: t.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
}
function rounded_decimal(n, t) {
var i = Math.round(n * Math.pow(10, t)) / Math.pow(10, t),
r = Math.floor(Math.abs(i));
return r < 1e4
? i.toString()
: i.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
}
function zero_pad_decimal(n, t) {
n = String(n);
var i = n.indexOf(".");
return (
i === -1 && ((n = n + "."), (i = n.length - 1)),
(n + "00000000000000000000000000000000000000000000000000").substr(
0,
i + t + 1
)
);
}
function format_field(n, t) {
if ((t === "-" && (t = ""), t === "")) return "";
var i;
switch (n) {
case "integer":
i = integer_with_commas(t);
break;
case "number_1dp":
i = rounded_decimal(t, 1);
break;
case "number_2dp":
i = rounded_decimal(t, 2);
break;
case "number_2fdp":
i = zero_pad_decimal(rounded_decimal(t, 2), 2);
break;
default:
i = t;
}
return i;
}
function simple_integer(n, t) {
var i = integer_with_commas(n);
return (
n < 0 &&
t !== !1 &&
(i =
'' +
String(i).replace("-", "") +
" "),
i
);
}
function dollar_value(n, t) {
var i = "$" + integer_with_commas(n);
return (
n < 0 &&
t !== !1 &&
(i =
'' +
String(i).replace("-", "") +
" "),
i
);
}
function percentage_value(n, t, i, r) {
var f = rounded_decimal(n, typeof t == "undefined" ? 1 : t),
u;
return (
typeof r != "undefined" && (f = zero_pad_decimal(f, r)),
(u = f + "%"),
n < 0 &&
i !== !1 &&
(u =
'' +
String(u).replace("-", "") +
" "),
u
);
}
function percentage_int(n, t) {
return percentage_value(n, 0, t);
}
function percentage_1dp(n, t) {
return percentage_value(n, 1, t);
}
function percentage_2dp(n, t) {
return percentage_value(n, 2, t);
}
function percentage_2fdp(n, t) {
return percentage_value(n, 2, t, 2);
}
function float_value(n, t, i, r) {
t = typeof t == "undefined" ? 1 : t;
r = typeof r != "undefined" && r;
var u = rounded_decimal(n, t);
return (
(u = r ? parseFloat(u).toFixed(t) : u),
n < 0 &&
i !== !1 &&
(u =
'' +
String(u).replace("-", "") +
" "),
u
);
}
function float_1dp(n) {
return float_value(n, 1);
}
function float_2dp(n) {
return float_value(n, 2);
}
function float_2dp_fixed(n) {
return float_value(n, 2, !0, !0);
}
function plain_text(n) {
return n;
}
function display_years(n) {
return float_1dp(n) + " yrs";
}
function shortened_date(n) {
return String(n) === "" || n === null
? ""
: String(n).substr(0, n.length - 4) + n.substr(-2);
}
function shortened_mortgage_type(n) {
var t;
switch (n) {
case "P & I":
t = "P&I";
break;
case "Interest Only":
t = "I.O.";
break;
default:
t = n;
}
return t;
}
function date_string(n) {
return String(
n.getDate() + "/" + String(n.getMonth() + 1) + "/" + String(n.getFullYear())
);
}
function date_from_string(n) {
var t = n.split("/");
return new Date(
parseInt(t[2]) || 0,
(parseInt(t[1]) || 1) - 1,
parseInt(t[0]) || 0
);
}
function nth(n) {
if (n > 3 && n < 21) return "th";
switch (n % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
function filter_value_from_id(n, t, i, r) {
typeof r == "undefined" && (r = "Label");
for (var u = 0; u < n.length; u++)
if (String(n[u][i]) === String(t)) return n[u][r];
return null;
}
function body_corporate_applies(n) {
return (
n.toLowerCase() === "unit/apartment" || n.toLowerCase() === "townhouse"
);
}
function global_country_list() {
return g_filters.hasOwnProperty("AU")
? g_filters.AU.Countries
: g_filters.Country.values;
}
function country_code_from_id(n) {
var i = global_country_list(),
r = parseInt(n),
t;
if (isNaN(r)) return !1;
for (t = 0; t < i.length; t++)
if (i[t].CountryID === r || i[t].FilterCountryId === r)
return i[t].CountryCode;
return !1;
}
function country_name_from_id(n) {
var i = global_country_list(),
r = parseInt(n),
t;
if (isNaN(r)) return !1;
for (t = 0; t < i.length; t++)
if (i[t].CountryID === r || i[t].FilterCountryId === r) return i[t].Label;
return !1;
}
function country_id_from_code(n) {
for (var i = global_country_list(), t = 0; t < i.length; t++)
if (i[t].CountryCode.toLowerCase() === String(n).toLowerCase())
return i[t].CountryID || i[t].FilterCountryId;
return !1;
}
function country_name_from_code(n) {
for (var i = global_country_list(), t = 0; t < i.length; t++)
if (i[t].CountryCode.toLowerCase() === String(n).toLowerCase())
return i[t].Label;
return !1;
}
function current_financial_year_bounds(n) {
var u, r, l, t, f, e, o, i, s, h, c;
if (!($("#tracker_tool").length < 1)) {
try {
for (
u = g_filters[n.toUpperCase()].CurrentFiscalYear, r = 0, l = u.length;
r < l;
r++
)
u[r].CountryCode.toUpperCase() === n.toUpperCase() &&
((t = u[r].StartDate.split("/")),
isNaN(parseInt(t[0])) || (f = parseInt(t[0])),
isNaN(parseInt(t[1])) || (e = parseInt(t[1])),
isNaN(parseInt(t[2])) || (o = parseInt(t[2])),
(i = u[r].EndDate.split("/")),
isNaN(parseInt(i[0])) || (s = parseInt(i[0])),
isNaN(parseInt(i[1])) || (h = parseInt(i[1])),
isNaN(parseInt(i[2])) || (c = parseInt(i[2])));
} catch (a) {
console.log("ERROR: Could not establish current financial year.", n, a);
return;
}
return (
(financial_year_start = new Date(o, e - 1, f)),
(financial_year_end = new Date(c, h - 1, s)),
[financial_year_start, financial_year_end]
);
}
}
function in_current_financial_year(n, t) {
var r = current_financial_year_bounds(t),
i;
return (
typeof n != "object" &&
((i = n.split("/")), (n = new Date(i[2], i[1] - 1, i[0]))),
n >= r[0] && n <= r[1]
);
}
function current_financial_year(n) {
return new Date(current_financial_year_bounds(n)[1]).getFullYear();
}
function round_to_places(n, t) {
return Math.round(n * Math.pow(10, t)) / Math.pow(10, t);
}
function toTitleCase(n) {
return n.replace(/\w\S*/g, function (n) {
return n.charAt(0).toUpperCase() + n.substr(1).toLowerCase();
});
}
function set_area_display_status(n, t) {
$area_element = typeof n == "string" ? $(n) : n;
$area_element.children(".preparing_indicator").toggle(t === "preparing");
$area_element.children(".loading_indicator").toggle(t === "loading");
$area_element.children(".loading_failure_alert").toggle(t === "failed");
$area_element.children(".updating_indicator").toggle(t === "updating");
$area_element
.children(".updating_failure_indicator")
.toggle(t === "updating_failed");
$area_element.children(".area_content").toggle(t === "loaded");
}
function set_area_display_status_v2(n, t, i) {
$(n + " > .area_indicator").hide();
t !== "" && $(n + " > .area_indicator." + t).show();
typeof i == "undefined" && (i = !1);
$(n + " > .area_content").toggle(i);
}
function set_editing_state(n, t) {
(typeof t == "undefined" || t !== "edit") && (t = "display");
$(".edit_state_display", n).toggle(t === "display");
$(".edit_state_input", n).toggle(t === "edit");
$(".edit_state_cancel_button", n).toggle(t === "edit");
$(".edit_state_save_button", n).toggle(t === "edit");
n.data("editing_state", t);
}
function fetch_document_list(n, t) {
var i = new $.Deferred();
return (
$.ajax({
url: api_url("Documents/AllFiles/" + t, "FileUploadService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: api_username,
APIPassword: api_password,
UserToken: get_auth_token(),
},
dataType: "json",
timeout: 2e4,
})
.done(function (t, r, u) {
var f;
switch (n) {
case "attachment":
f = t.Attachements;
break;
case "image":
f = t.PropertyImages;
break;
default:
case "all":
f = t;
}
i.resolve(f, r, u);
})
.fail(function (n, t, r) {
if (check_session_expiry(n, t, r)) {
handle_session_expiry(n);
return;
}
i.reject(n, t, r);
}),
i
);
}
function uploadFile(n, t, i, r, u) {
var f = api_url("Documents/Uploads/HtmlClient/", "FileUploadService");
$.ajax({
url: f,
type: "POST",
data: n,
headers: {
APIUserName: api_username,
APIPassword: api_password,
UserToken: get_auth_token(),
},
processData: !1,
beforeSend: function (i) {
i.setRequestHeader("FileName", n.name);
i.setRequestHeader("FileSize", n.size);
i.setRequestHeader("MemberPropertyID", u);
i.setRequestHeader("UserToken", get_auth_token());
i.setRequestHeader("IsAttachement", t === "attachment" ? "1" : "0");
},
})
.done(i)
.fail(r);
}
function deleteFile(n, t) {
function u(n, t, i) {
if (check_session_expiry(n, t, i)) {
handle_session_expiry(n);
return;
}
alert("Sorry, an error occurred while deleting your file.");
}
var i = api_url("Documents/DeleteFiles/", "FileUploadService"),
r = { MemberPropertyId: n, FileNames: [t] };
return $.ajax({
url: i,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(r),
headers: {
APIUserName: api_username,
APIPassword: api_password,
UserToken: get_auth_token(),
},
timeout: 1e4,
}).fail(u);
}
function getCookie(n) {
for (
var t, r = n + "=", u = document.cookie.split(";"), i = 0, f = u.length;
i < f;
i++
)
if (((t = u[i].trim()), t.indexOf(r) === 0))
return t.substring(r.length, t.length);
return null;
}
function UserProfile(n, t) {
var i = this,
r = null;
this.entities = [];
this.environment = {};
this.construct = function (n, t) {
i.user_id = n;
i.environment = t;
i.initialise_interactions();
};
this.initialise_interactions = function () {
var n = $("#form_profile");
n.validate({ onfocusout: !1, onkeyup: !1 });
$("#profile_defaults_overlay").on("closed", function () {
$("#profile_defaults_overlay").data("action_on_close").apply();
$("#profile_defaults_overlay").data("action_on_close", function () {});
});
$("#profile_defaults_discard_changes").on("click", function () {
i.discard_changes();
});
$("#profile_defaults_save").on("click", function (n) {
return (
n.preventDefault(),
$("#form_profile").valid() && i.save_defaults(!1),
!1
);
});
$("input.control_group_switcher", n).on("change_complete", function () {
$(this).prop("checked") &&
i.switch_controls($(this).data("control_group"), $(this).val());
});
$("#profile_entities_select").on("change", function () {
var t = $(this).find(":selected");
$(".selected_ent", n).text(t.text());
$(".selected_entity_link", n).attr(
"href",
$("#rei_tool_wrapper .rei_tool").attr(
"data-rei_tracker_url_" + get_user_country_code().toLowerCase()
) +
"&my_entities=" +
t.val()
);
});
};
this.open_editor = function (n) {
function t(n) {
i.get_entities().done(function () {
i.populate_editor(n);
var t = !0;
typeof n.UserDetailDefault != "undefined" &&
typeof n.UserDetailDefault.HasDefault != "undefined" &&
(t = n.UserDetailDefault.HasDefault === "1");
$("#profile_defaults_overlay .default_profile_heading").text(
t ? "Edit Default Profile" : "Create Default Profile"
);
i.set_editor_state("loaded");
});
}
function r(n, t, r) {
if (i.environment.check_session_expiry(n, t, r)) {
$("#profile_defaults_overlay").foundation("reveal", "close");
i.environment.handle_session_expiry(n);
return;
}
i.set_editor_state("error");
}
typeof n == "function"
? $("#profile_defaults_overlay").data("action_on_close", n)
: $("#profile_defaults_overlay").data("action_on_close", function () {});
i.set_editor_state("loading");
$("#profile_defaults_overlay").foundation("reveal", "open");
i.populate_defaults_loan_length_menu(i.environment.user_country_code);
$.ajax({
url: api_url(
"Analyser/UserDefault?ModulesID=" +
i.environment.modules_id +
"&Country=" +
i.environment.user_country_code +
"&memberName=" +
i.environment.member_name,
"AnalyserService"
),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: i.environment.api_username,
APIPassword: i.environment.api_password,
UserToken: i.environment.auth_token,
},
dataType: "json",
timeout: 1e4,
})
.done(t)
.fail(r);
};
this.get_entities = function () {
return this.environment
.load_user_entities()
.done(function (n) {
i.entities = n;
i.populate_entities_list();
})
.fail(function (n, t, r) {
if (i.environment.check_session_expiry(n, t, r)) {
$("#profile_defaults_overlay").foundation("reveal", "close");
i.environment.handle_session_expiry(n);
return;
}
i.set_editor_state("error");
});
};
this.set_editor_state = function (n) {
var t = $("#profile_defaults_overlay");
switch (n) {
case "loading":
r && r.stop();
$(".saving_indicator", t).hide();
$(".loading_indicator .close-reveal-modal", t).hide();
$(".loading_indicator .alert-box", t).hide();
$(".content", t).hide();
$(".loading_message", t).show();
$(".loading_indicator", t).show();
break;
case "error":
$(".loading_message", t).hide();
$(".loading_indicator .alert-box", t).show();
$(".loading_indicator .close-reveal-modal", t).show();
$(".content", t).hide();
$(".loading_indicator", t).show();
break;
case "loaded":
$(".loading_indicator", t).hide();
$(".content", t).show();
r = Ladda.create($("#profile_defaults_save").get(0));
break;
case "saving":
r.start();
$(".saving_indicator .close-reveal-modal", t).hide();
$(".saving_indicator .alert-box", t).hide();
$(".saving_indicator", t).show();
break;
case "saving_error":
r.stop();
$(".saving_indicator .alert-box", t).show();
$(".saving_indicator .close-reveal-modal", t).show();
}
};
this.populate_entities_list = function () {
var n = $("#form_profile"),
t;
for (
i.entities.length === 1 && n.find(".profile_entities_selection").hide(),
n.find(".profile_entities").show(),
n.find('select[name="entity"]').empty(),
t = 0;
t < i.entities.length;
t++
)
n.find('select[name="entity"]').append(
$(
'' +
i.entities[t].EntityName +
" "
)
);
n.find(".entities_page_link").attr(
"href",
$("#rei_tool_wrapper .rei_tool").attr(
"data-rei_tracker_url_" + get_user_country_code().toLowerCase()
) + "&my_entities=0"
);
};
this.populate_defaults_loan_length_menu = function () {
var t = $(
'#profile_defaults_overlay select[name="mortgage_type_loan_length"]'
),
n,
r,
u;
for (t.empty(), n = 0; n < i.environment.loan_length_values.length; n++)
(r = i.environment.loan_length_values[n]),
(u = $("").val(r[i.environment.loan_id_name]).text(r.Label)),
t.append(u);
t.trigger("change", !0);
};
this.populate_editor = function (n) {
var t = $("#form_profile");
$('input[name="mortgage_type_interest"]')
.prop("checked", !1)
.next("span.radio")
.removeClass("checked");
n.MortgageType.PrincipalNInterest === "1" &&
$('input[name="mortgage_type_interest"][value="principal"]', t)
.data("starting_value", "checked")
.prop("checked", !0)
.next("span.radio")
.addClass("checked");
n.MortgageType.InterestOnly === "1" &&
$('input[name="mortgage_type_interest"][value="interest"]', t)
.data("starting_value", "checked")
.prop("checked", !0)
.next("span.radio")
.addClass("checked");
$('select[name="mortgage_type_loan_length"]', t)
.data("starting_value", n.MortgageType.LengthOfLoan)
.val(n.MortgageType.LengthOfLoan);
$('input[name="mortgage_type_interest_rate_range"]', t)
.data("starting_value", n.MortgageType.InterestRate)
.val(n.MortgageType.InterestRate);
$('input[name="mortgage_type_interest_rate"]', t)
.data("starting_value", n.MortgageType.InterestRate)
.val(n.MortgageType.InterestRate);
$("#loan_deposit_format_dollar, #loan_deposit_format_percent")
.prop("checked", !1)
.next("span.radio")
.removeClass("checked");
n.LoanDeposit.EnterValue === "1" &&
($("#loan_deposit_format_dollar")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#loan_deposit_format_percent").data("starting_value", ""),
$('input[name="loan_deposit_cash_dollars_range"]', t)
.data("starting_value", n.LoanDeposit.CashDeposit)
.val(n.LoanDeposit.CashDeposit),
$('input[name="loan_deposit_cash_dollars"]', t)
.data("starting_value", n.LoanDeposit.CashDeposit)
.val(n.LoanDeposit.CashDeposit),
$('input[name="loan_deposit_equity_dollars_range"]', t)
.data("starting_value", n.LoanDeposit.EquityDeposit)
.val(n.LoanDeposit.EquityDeposit),
$('input[name="loan_deposit_equity_dollars"]', t)
.data("starting_value", n.LoanDeposit.EquityDeposit)
.val(n.LoanDeposit.EquityDeposit));
n.LoanDeposit.EnterPercentage === "1" &&
($("#loan_deposit_format_percent")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#loan_deposit_format_dollar").data("starting_value", ""),
$('input[name="loan_deposit_cash_percent_range"]', t)
.data("starting_value", n.LoanDeposit.CashDepositPercentage)
.val(n.LoanDeposit.CashDepositPercentage),
$('input[name="loan_deposit_cash_percent"]', t)
.data("starting_value", n.LoanDeposit.CashDepositPercentage)
.val(n.LoanDeposit.CashDepositPercentage),
$('input[name="loan_deposit_equity_percent_range"]', t)
.data("starting_value", n.LoanDeposit.EquityDepositPercentage)
.val(n.LoanDeposit.EquityDepositPercentage),
$('input[name="loan_deposit_equity_percent"]', t)
.data("starting_value", n.LoanDeposit.EquityDepositPercentage)
.val(n.LoanDeposit.EquityDepositPercentage));
$('input[name="loan_cost_est_fee_range"]', t)
.data("starting_value", n.LoanCost.EstPrice)
.val(n.LoanCost.EstPrice);
$('input[name="loan_cost_est_fee"]', t)
.data("starting_value", n.LoanCost.EstPrice)
.val(n.LoanCost.EstPrice);
$('input[name="loan_cost_valuation_fee_range"]', t)
.data("starting_value", n.LoanCost.ValuationFee)
.val(n.LoanCost.ValuationFee);
$('input[name="loan_cost_valuation_fee"]', t)
.data("starting_value", n.LoanCost.ValuationFee)
.val(n.LoanCost.ValuationFee);
$('input[name="loan_cost_solicitor_fee_range"]', t)
.data("starting_value", n.LoanCost.SolicitorFee)
.val(n.LoanCost.SolicitorFee);
$('input[name="loan_cost_solicitor_fee"]', t)
.data("starting_value", n.LoanCost.SolicitorFee)
.val(n.LoanCost.SolicitorFee);
$('input[name="loan_cost_improvements_range"]', t)
.data("starting_value", n.LoanCost.ImprovementFee)
.val(n.LoanCost.ImprovementFee);
$('input[name="loan_cost_improvements"]', t)
.data("starting_value", n.LoanCost.ImprovementFee)
.val(n.LoanCost.ImprovementFee);
$('input[name="loan_cost_other_costs_range"]', t)
.data("starting_value", n.LoanCost.OtherLoanCost)
.val(n.LoanCost.OtherLoanCost);
$('input[name="loan_cost_other_costs"]', t)
.data("starting_value", n.LoanCost.OtherLoanCost)
.val(n.LoanCost.OtherLoanCost);
$('input[name="tax_market_price_index_range"]', t)
.data("starting_value", n.TaxRateMarketFactors.ConsumerPrice)
.val(n.TaxRateMarketFactors.ConsumerPrice);
$('input[name="tax_market_price_index"]', t)
.data("starting_value", n.TaxRateMarketFactors.ConsumerPrice)
.val(n.TaxRateMarketFactors.ConsumerPrice);
$('input[name="tax_market_growth_range"]', t)
.data("starting_value", n.TaxRateMarketFactors.CapitalGrowth)
.val(n.TaxRateMarketFactors.CapitalGrowth);
$('input[name="tax_market_growth"]', t)
.data("starting_value", n.TaxRateMarketFactors.CapitalGrowth)
.val(n.TaxRateMarketFactors.CapitalGrowth);
$('select[name="entity"]', t)
.data("starting_value", i.entities[0].MemberEntityId)
.val(i.entities[0].MemberEntityId)
.trigger("change");
n.PropertyExpenseStandard.isRatePercentage === "1"
? ($("#expense_rates_format_percent")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_rates_format_dollar").data("starting_value", ""),
$('input[name="expense_rates_percent_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.RatesPercentage)
.val(n.PropertyExpenseStandard.RatesPercentage),
$('input[name="expense_rates_percent"]', t)
.data("starting_value", n.PropertyExpenseStandard.RatesPercentage)
.val(n.PropertyExpenseStandard.RatesPercentage))
: ($("#expense_rates_format_dollar")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_rates_format_percent").data("starting_value", ""),
$('input[name="expense_rates_dollars_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.Rates)
.val(n.PropertyExpenseStandard.Rates),
$('input[name="expense_rates_dollars"]', t)
.data("starting_value", n.PropertyExpenseStandard.Rates)
.val(n.PropertyExpenseStandard.Rates));
n.PropertyExpenseStandard.isInsurancePercentage === "1"
? ($("#expense_insurance_format_percent")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_insurance_format_dollar").data("starting_value", ""),
$('input[name="expense_insurance_percent_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.InsurancePercentage)
.val(n.PropertyExpenseStandard.InsurancePercentage),
$('input[name="expense_insurance_percent"]', t)
.data("starting_value", n.PropertyExpenseStandard.InsurancePercentage)
.val(n.PropertyExpenseStandard.InsurancePercentage))
: ($("#expense_insurance_format_dollar")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_insurance_format_percent").data("starting_value", ""),
$('input[name="expense_insurance_dollars_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.Insurance)
.val(n.PropertyExpenseStandard.Insurance),
$('input[name="expense_insurance_dollars"]', t)
.data("starting_value", n.PropertyExpenseStandard.Insurance)
.val(n.PropertyExpenseStandard.Insurance));
n.PropertyExpenseStandard.isRepairPercentage === "1"
? ($("#expense_repair_format_percent")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_repair_format_dollar").data("starting_value", ""),
$('input[name="expense_repair_percent_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.RepairPercentage)
.val(n.PropertyExpenseStandard.RepairPercentage),
$('input[name="expense_repair_percent"]', t)
.data("starting_value", n.PropertyExpenseStandard.RepairPercentage)
.val(n.PropertyExpenseStandard.RepairPercentage))
: ($("#expense_repair_format_dollar")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_repair_format_percent").data("starting_value", ""),
$('input[name="expense_repair_dollars_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.Repair)
.val(n.PropertyExpenseStandard.Repair),
$('input[name="expense_repair_dollars"]', t)
.data("starting_value", n.PropertyExpenseStandard.Repair)
.val(n.PropertyExpenseStandard.Repair));
n.PropertyExpenseSpecific.isBodyCorporatePercentage === "1"
? ($("#expense_body_corporate_format_percent")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_body_corporate_format_dollar").data("starting_value", ""),
$('input[name="expense_body_corporate_percent_range"]', t)
.data(
"starting_value",
n.PropertyExpenseSpecific.BodyCorpatePercentage
)
.val(n.PropertyExpenseSpecific.BodyCorpatePercentage),
$('input[name="expense_body_corporate_percent"]', t)
.data(
"starting_value",
n.PropertyExpenseSpecific.BodyCorpatePercentage
)
.val(n.PropertyExpenseSpecific.BodyCorpatePercentage))
: ($("#expense_body_corporate_format_dollar")
.prop("checked", !0)
.data("starting_value", "checked")
.trigger("change", !0)
.next("span.radio")
.addClass("checked"),
$("#expense_body_corporate_format_percent").data("starting_value", ""),
$('input[name="expense_body_corporate_dollars_range"]', t)
.data("starting_value", n.PropertyExpenseSpecific.BodyCorporate)
.val(n.PropertyExpenseSpecific.BodyCorporate),
$('input[name="expense_body_corporate_dollars"]', t)
.data("starting_value", n.PropertyExpenseSpecific.BodyCorporate)
.val(n.PropertyExpenseSpecific.BodyCorporate));
$('input[name="property_expense_cleaning_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.Cleaning)
.val(n.PropertyExpenseStandard.Cleaning);
$('input[name="property_expense_cleaning"]', t)
.data("starting_value", n.PropertyExpenseStandard.Cleaning)
.val(n.PropertyExpenseStandard.Cleaning);
$('input[name="property_expense_letting_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.LettingFee)
.val(n.PropertyExpenseStandard.LettingFee);
$('input[name="property_expense_letting"]', t)
.data("starting_value", n.PropertyExpenseStandard.LettingFee)
.val(n.PropertyExpenseStandard.LettingFee);
$('input[name="property_expense_agent_range"]', t)
.data("starting_value", n.PropertyExpenseStandard.AgentComm)
.val(n.PropertyExpenseStandard.AgentComm);
$('input[name="property_expense_agent"]', t)
.data("starting_value", n.PropertyExpenseStandard.AgentComm)
.val(n.PropertyExpenseStandard.AgentComm);
$('input[name="property_expense_gardening_range"]', t)
.data("starting_value", n.PropertyExpenseSpecific.Gardening)
.val(n.PropertyExpenseSpecific.Gardening);
$('input[name="property_expense_gardening"]', t)
.data("starting_value", n.PropertyExpenseSpecific.Gardening)
.val(n.PropertyExpenseSpecific.Gardening);
$('input[name="property_expense_land_lease_range"]', t)
.data("starting_value", n.PropertyExpenseSpecific.LandLease)
.val(n.PropertyExpenseSpecific.LandLease);
$('input[name="property_expense_land_lease"]', t)
.data("starting_value", n.PropertyExpenseSpecific.LandLease)
.val(n.PropertyExpenseSpecific.LandLease);
t.data("user_details", n.UserDetailDefault);
$('input[name="save_method"]')
.prop("checked", !1)
.next("span.radio")
.removeClass("checked");
n.UserDetailDefault.isCurrent === "1" &&
$('input[name="save_method"][value="future"]', t)
.data("starting_value", "checked")
.prop("checked", !0)
.next("span.radio")
.addClass("checked");
n.UserDetailDefault.isAll === "1" &&
$('input[name="save_method"][value="existing"]', t)
.data("starting_value", "checked")
.prop("checked", !0)
.next("span.radio")
.addClass("checked");
t.find('input[type="radio"], select').trigger("change", !0);
};
this.switch_controls = function (n, t) {
$("." + n).hide();
$("." + n + "." + t + "_controls").show();
};
this.discard_changes = function () {
var n = $("#form_profile");
n.find("input, select").each(function () {
$(this).is(":radio")
? $(this).data("starting_value") === "checked"
? $(this).prop("checked", !0).next("span.radio").addClass("checked")
: $(this)
.prop("checked", !1)
.next("span.radio")
.removeClass("checked")
: $(this).val($(this).data("starting_value"));
});
n.find("input, select").not('[name$="_range"]').trigger("change", !0);
};
this.save_defaults = function () {
function u(n) {
saving_succeeded = n === 1;
saving_succeeded
? ($('#analyser_dashboard_screen input[name="use_default_profile"]')
.prop("checked", !0)
.next("span.custom.checkbox")
.addClass("checked"),
$("#analyser_add_property_screen").is(":visible") &&
($('#analyser_add_property_screen input[name="use_defaults"]')
.prop("checked", !0)
.next("span.custom.checkbox")
.addClass("checked"),
add_property_form_apply_defaults(!0)),
$("#tracker_add_property_screen").is(":visible") &&
($('#tracker_add_property_screen input[name="use_defaults"]')
.prop("checked", !0)
.next("span.custom.checkbox")
.addClass("checked"),
add_property_form_apply_defaults(!0)),
$("#profile_defaults_overlay").foundation("reveal", "close"),
$("#profile_defaults_overlay").data("action_on_close").apply(),
$("#profile_defaults_overlay").data(
"action_on_close",
function () {}
))
: i.set_editor_state("saving_error");
}
function f(n, t, r) {
if (i.environment.check_session_expiry(n, t, r)) {
$("#profile_defaults_overlay").foundation("reveal", "close");
i.environment.handle_session_expiry(n);
return;
}
i.set_editor_state("saving_error");
}
var t, n, r;
if (
($("#profile_defaults_deposit_100_warning").hide(),
$("#loan_deposit_format_percent:checked").length > 0 &&
(parseInt(
$(
'#profile_defaults_overlay input[name="loan_deposit_cash_percent"]'
).val()
) || 0) +
(parseInt(
$(
'#profile_defaults_overlay input[name="loan_deposit_equity_percent"]'
).val()
) || 0) >
100)
) {
$("#profile_defaults_deposit_100_warning").show();
$(document).scrollTo(
$("#loan_deposit_format_percent").closest("fieldset")
);
return;
}
i.set_editor_state("saving");
t = $("#form_profile");
n = { group: {} };
n.group.MortgageCategory = [
{
PrincipalNInterest: $(
'input[name="mortgage_type_interest"][value="principal"]',
t
).prop("checked")
? "1"
: "0",
InterestOnly: $(
'input[name="mortgage_type_interest"][value="interest"]',
t
).prop("checked")
? "1"
: "0",
LengthOfLoan: parseInt(
$('select[name="mortgage_type_loan_length"] option:checked').val()
),
InterestRate: parseFloat(
$('input[name="mortgage_type_interest_rate"]').val()
),
},
];
n.group.LoanDeposit = [
{
EnterValue: "0",
EnterPercentage: "0",
EquityDeposit: 0,
CashDeposit: 0,
EquityDepositPercentage: 0,
CashDepositPercentage: 0,
},
];
$('input[name="loan_deposit_format"][value="dollar"]', t).prop("checked")
? ((n.group.LoanDeposit[0].EnterValue = "1"),
(n.group.LoanDeposit[0].CashDeposit = parseInt(
$('input[name="loan_deposit_cash_dollars"]', t).val()
)),
(n.group.LoanDeposit[0].EquityDeposit = parseInt(
$('input[name="loan_deposit_equity_dollars"]', t).val()
)))
: ((n.group.LoanDeposit[0].EnterPercentage = "1"),
(n.group.LoanDeposit[0].CashDepositPercentage = parseFloat(
$('input[name="loan_deposit_cash_percent"]', t).val()
)),
(n.group.LoanDeposit[0].EquityDepositPercentage = parseFloat(
$('input[name="loan_deposit_equity_percent"]', t).val()
)));
n.group.LoanCost = [
{
EstPrice: parseInt($('input[name="loan_cost_est_fee"]', t).val()),
ValuationFee: parseInt(
$('input[name="loan_cost_valuation_fee"]', t).val()
),
OtherLoanCost: parseInt(
$('input[name="loan_cost_other_costs"]', t).val()
),
SolicitorFee: parseInt(
$('input[name="loan_cost_solicitor_fee_range"]', t).val()
),
ImprovementFee: parseInt(
$('input[name="loan_cost_improvements"]', t).val()
),
},
];
n.group.TaxRateMarketFactors = [
{
ConsumerPrice: parseFloat(
$('input[name="tax_market_price_index"]', t).val()
),
CapitalGrowth: parseFloat(
$('input[name="tax_market_growth"]', t).val()
),
},
];
n.group.PropertyExpenseSpecific = [
{
BodyCorpatePercentage: 0,
BodyCorporate: 0,
Gardening: 0,
LandLease: 0,
isBodyCorporatePercentage: "0",
},
];
$('input[name="expense_body_corporate_format"][value="dollar"]', t).prop(
"checked"
)
? ((n.group.PropertyExpenseSpecific[0].isBodyCorporatePercentage = "0"),
(n.group.PropertyExpenseSpecific[0].BodyCorporate = parseInt(
$('input[name="expense_body_corporate_dollars"]', t).val()
)))
: ((n.group.PropertyExpenseSpecific[0].isBodyCorporatePercentage = "1"),
(n.group.PropertyExpenseSpecific[0].BodyCorpatePercentage = parseFloat(
$('input[name="expense_body_corporate_percent"]', t).val()
)));
n.group.PropertyExpenseSpecific[0].Gardening = parseInt(
$('input[name="property_expense_gardening"]', t).val()
);
n.group.PropertyExpenseSpecific[0].LandLease = parseInt(
$('input[name="property_expense_land_lease"]', t).val()
);
n.group.PropertyExpenseStandard = [
{
AgentComm: 0,
Cleaning: 0,
Insurance: 0,
InsurancePercentage: 0,
LettingFee: 0,
Others: 0,
Rates: 0,
RatesPercentage: 0,
Repair: 0,
RepairPercentage: 0,
ServiceCont: 0,
isInsurancePercentage: "0",
isRatePercentage: "0",
isRepairPercentage: "0",
},
];
n.group.PropertyExpenseStandard[0].AgentComm = parseFloat(
$('input[name="property_expense_agent"]', t).val()
);
n.group.PropertyExpenseStandard[0].Cleaning = parseInt(
$('input[name="property_expense_cleaning"]', t).val()
);
$('input[name="expense_insurance_format"][value="dollar"]', t).prop(
"checked"
)
? ((n.group.PropertyExpenseStandard[0].isInsurancePercentage = "0"),
(n.group.PropertyExpenseStandard[0].Insurance = parseInt(
$('input[name="expense_insurance_dollars"]', t).val()
)))
: ((n.group.PropertyExpenseStandard[0].isInsurancePercentage = "1"),
(n.group.PropertyExpenseStandard[0].InsurancePercentage = parseFloat(
$('input[name="expense_insurance_percent"]', t).val()
)));
n.group.PropertyExpenseStandard[0].LettingFee = parseInt(
$('input[name="property_expense_letting"]', t).val()
);
$('input[name="expense_rates_format"][value="dollar"]', t).prop("checked")
? ((n.group.PropertyExpenseStandard[0].isRatePercentage = "0"),
(n.group.PropertyExpenseStandard[0].Rates = parseInt(
$('input[name="expense_rates_dollars"]', t).val()
)))
: ((n.group.PropertyExpenseStandard[0].isRatePercentage = "1"),
(n.group.PropertyExpenseStandard[0].RatesPercentage = parseFloat(
$('input[name="expense_rates_percent"]', t).val()
)));
$('input[name="expense_repair_format"][value="dollar"]', t).prop("checked")
? ((n.group.PropertyExpenseStandard[0].isRepairPercentage = "0"),
(n.group.PropertyExpenseStandard[0].Repair = parseInt(
$('input[name="expense_repair_dollars"]', t).val()
)))
: ((n.group.PropertyExpenseStandard[0].isRepairPercentage = "1"),
(n.group.PropertyExpenseStandard[0].RepairPercentage = parseFloat(
$('input[name="expense_repair_percent"]', t).val()
)));
n.group.UserDetailDefault = [t.data("user_details")];
n.group.UserDetailDefault[0].MemberEntityID = $(
'select[name="entity"] option:selected',
t
).val();
n.group.UserDetailDefault[0].isCurrent = $(
'input[name="save_method"][value="future"]',
t
).prop("checked")
? "1"
: "0";
n.group.UserDetailDefault[0].isAll = $(
'input[name="save_method"][value="existing"]',
t
).prop("checked")
? "1"
: "0";
n.group.UserDetailDefault[0].Country = i.environment.user_country_code;
r = n.group.UserDetailDefault[0].HasDefault === "1";
$.ajax({
url: api_url("Analyser/UserSettings/", "AnalyserService"),
type: r ? "PUT" : "POST",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: i.environment.api_username,
APIPassword: i.environment.api_password,
UserToken: i.environment.auth_token,
},
data: JSON.stringify(n),
dataType: "json",
timeout: 15e3,
})
.done(u)
.fail(f);
};
this.load_defaults = function (n) {
var r = api_url("Analyser/UserDefault", "AnalyserService"),
t;
return (
(r += n
? "?ModulesId=" +
i.user_id +
"&Country=" +
i.environment.user_country_code +
"&memberName=" +
i.environment.member_name
: "/" + i.environment.user_country_code),
(t = $.ajax({
url: r,
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: i.environment.api_username,
APIPassword: i.environment.api_password,
UserToken: i.environment.auth_token,
},
dataType: "json",
timeout: 1e4,
})),
t.done(function (t) {
n && (i.defaults = t);
}),
t
);
};
this.user_defaults = function () {
return i.defaults;
};
this.construct(n, t);
}
function InvestarSearchTool() {
var n = this;
this.api_username = "WEBUI";
this.api_password = "ghghe46754685FHJF653$%$3#^!";
this.modules_id = null;
this.auth_token = null;
this.userCountry = null;
this.memberName = null;
this.userRoles = null;
this.show_all_results_expanded = !1;
this.key_values = {};
this.email_alerts = null;
this.default_search = null;
this.current_search = null;
this.search_results = null;
this.profile_editor_values = { AU: {}, NZ: {} };
this.user_profile = null;
n.get_modules_id = function () {
return this.modules_id === null ? n.getCookie("MemberID") : this.modules_id;
};
n.get_auth_token = function () {
var t, i;
if (n.auth_token === null) {
if (((t = n.getCookie("APIMemberJSON")), !t)) return "";
try {
return (i = $.parseJSON(decodeURIComponent(t))), i.AuthToken;
} catch (r) {
return "";
}
} else return n.auth_token;
};
n.get_user_country_code = function () {
var t, i;
if (n.userCountry === null) {
if (((t = n.getCookie("APIMemberJSON")), !t)) return "";
try {
return (i = $.parseJSON(decodeURIComponent(t))), i.Country;
} catch (r) {
return "";
}
} else return n.userCountry;
};
n.get_member_name = function () {
var t, i;
if (n.memberName === null) {
if (((t = n.getCookie("APIMemberJSON")), !t)) return "";
try {
return (
(i = $.parseJSON(decodeURIComponent(t))),
i.FirstName + " " + i.LastName
);
} catch (r) {
return "";
}
} else return n.memberName;
};
n.get_user_roles = function () {
var t, i;
if (n.userRoles === null) {
if (((t = n.getCookie("APIMemberJSON")), !t)) return "";
try {
return (i = $.parseJSON(decodeURIComponent(t))), i.Roles;
} catch (r) {
return "";
}
} else return n.userRoles;
};
this.check_user_roles = function (t) {
if (typeof t == "undefined" || t.length === 0) return !1;
typeof t == "string" && (t = [t]);
for (
var f = n.get_user_roles(),
o = f.length,
e = !1,
s = t.length,
u,
r,
i = 0;
i < s;
i++
) {
for (u = !1, r = 0; r < o; r++)
if (t[i] === f[r].Module) {
u = !0;
break;
}
if (!u) {
e = !0;
break;
}
}
return !e;
};
this.setup = function () {
function f() {
typeof Raven != "undefined" &&
(Raven.config(
"https://4b0a5f1536bb4ba7a992d36ca5cd527a@app.getsentry.com/32654",
{}
).install(),
Raven.setUser({ id: n.get_modules_id() }));
n.get_search_results_view_option();
$.when(
n.load_key_values("AU"),
n.load_key_values("NZ"),
n.load_profile_editor_values("AU"),
n.load_profile_editor_values("NZ"),
n.load_email_alert_labels()
)
.done(function () {
var s = {
api_username: n.api_username,
api_password: n.api_password,
auth_token: n.get_auth_token(),
modules_id: n.get_modules_id(),
user_country_code: n.get_user_country_code(),
member_name: n.get_member_name(),
check_session_expiry: n.check_session_expiry,
handle_session_expiry: n.handle_session_expiry,
load_user_entities: n.load_user_entities,
loan_length_values:
n.profile_editor_values[n.get_user_country_code()]
.loan_length_years,
loan_id_name: "LengthOfLoanId",
},
u,
e,
o,
i,
t,
r,
f;
n.user_profile = new UserProfile(n.get_modules_id(), s);
n.watchlist = new IS_watchlist(n);
n.search_screen = new IS_search_screen(n);
n.results_screen = new IS_results_screen(n);
n.default_search = n.create_default_search();
i = window.location.search.match(
/[?&]asl_search&country_code=(.*)&state_region=(.*)&district=(.*)&postcode=(.*)&suburb=(.*)&category=(.*)/
);
i &&
((u = "asl_search"),
(e = {
CountryCode: decodeURIComponent(i[1]),
StateRegion: decodeURIComponent(i[2]),
District: decodeURIComponent(i[3]),
PostCode: decodeURIComponent(i[4]),
Suburb: decodeURIComponent(i[5]),
Category: decodeURIComponent(i[6]),
}));
t = window.location.search.match(
/[?&]htu_search&country_code=(.*)&state_region=(.*)&district=(.*)&postcode=(.*)&suburb=(.*)&category=(.*)&price_from=(.*)&price_to=(.*)/
);
t &&
((u = "htu_search"),
(o = {
CountryCode: decodeURIComponent(t[1]),
StateRegion: decodeURIComponent(t[2]),
District: decodeURIComponent(t[3]),
PostCode: decodeURIComponent(t[4]),
Suburb: decodeURIComponent(t[5]),
Category: decodeURIComponent(t[6]),
ValueFrom: decodeURIComponent(t[7]),
ValueTo: decodeURIComponent(t[8]),
}));
r = window.location.search.match(
/[?&]email_link&CountryCode=(.*)&LinkIdHash=(.*)&PropertyId=(.*)&Website=(.*)&WebsiteMode=(.*)/
);
r &&
((u = "email_link"),
(email_link_data = {
MemberId: n.get_modules_id(),
CountryCode: decodeURIComponent(r[1]),
LinkIdHash: decodeURIComponent(r[2]),
PropertyId: decodeURIComponent(r[3]),
Website: decodeURIComponent(r[4]),
WebsiteMode: decodeURIComponent(r[5]),
}));
f = window.location.search.match(
/[?&]execute_saved_search&SSID=(.*)/
);
f &&
((u = "email_ss_execute"),
(email_ss_execute_data = {
saved_search_id: decodeURIComponent(f[1]),
}));
switch (u) {
case "asl_search":
n.show_search_screen("search");
n.search_screen.perform_asl_search(e);
break;
case "htu_search":
n.show_search_screen("search");
n.search_screen.perform_htu_search(o);
break;
case "email_link":
n.show_search_screen("search");
n.search_screen.show_property_in_modal(email_link_data);
break;
case "email_ss_execute":
n.show_search_screen("search");
console.log("doit", email_ss_execute_data.saved_search_id);
n.search_screen.load_and_execute_saved_search(
email_ss_execute_data.saved_search_id
);
break;
default:
n.show_search_screen("search");
}
})
.fail(function () {
$("#search_tool .authentication_failure_alert").show();
return;
});
}
function i() {
$("#search_tool .authentication_failure_alert").show();
return;
}
var t = $(document),
e,
r,
u;
set_area_display_status_v2(
"#search_search_screen .main_display",
"loading"
);
$("#search_search_screen").show();
tool_setup();
window.addEventListener("popstate", function (t) {
if ($("#search_search_screen").data("popstate_count") === 0) {
$("#search_search_screen").data("popstate_count", 1);
history.pushState({ screen: "search" });
return;
}
t.state === null || typeof t.state.screen == "undefined"
? n.show_search_screen("search", !1)
: n.show_search_screen(t.state.screen, !1);
});
t.mousemove(function (n) {
analyser_mouse_x = n.pageX;
analyser_mouse_y = n.pageY;
});
t.on("click", ".go_to_search", function (t) {
return (
t.preventDefault(),
n.show_search_screen("search"),
n.set_search_form(n.current_search, $("#main_search")),
!1
);
});
t.on("click", ".close_validation_message_modal", function (n) {
n.preventDefault();
$("#validation_message_modal").foundation("reveal", "close");
});
if (
((e =
window.location.host.match(/realestateinvestar\.com\.au/) ||
window.location.host.match(/realestateinvestar\.co\.nz/)),
e && !n.getCookie("MemberID"))
) {
window.location = window.location.host.match(/realestateinvestar\.co\.nz/)
? "https://info.realestateinvestar.co.nz/session-expired-nz"
: "https://info.realestateinvestar.com.au/session-expired";
return;
}
var o = n.get_auth_token(),
s = n.get_modules_id(),
h = n.get_user_country_code(),
c = n.get_member_name(),
l = n.get_user_roles();
if (o && s && h && c && l) f();
else {
if (window.location.host.match(/realestateinvestar\.com\.au/)) {
i();
alert(
"AUTH ISSUE - There seems to be a problem with the auth information from Central Point. Please check the page source for further information."
);
return;
}
if (
((r = $("#rei_account_details").data("rei_username")),
(u = $("#rei_account_details").data("rei_password")),
r.length && u.length)
)
$authentication = this.authenticate_user(r, u).done(f).fail(i);
else {
i();
return;
}
}
};
this.authenticate_user = function (t, i) {
var u = { UserName: t, Password: i, SessionType: 0 },
r = new $.Deferred();
return (
$.ajax({
url: api_url("Security/AuthMember/", "AuthService"),
data: JSON.stringify(u),
type: "POST",
contentType: "application/json",
headers: { APIUserName: n.api_username, APIPassword: n.api_password },
dataType: "json",
})
.fail(function () {
r.reject();
})
.done(function (t) {
$.ajax({
url: api_url("Security/Member/" + t.MemberID, "AuthService"),
type: "GET",
contentType: "application/json",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: t.AuthToken,
},
dataType: "json",
})
.fail(function () {
r.reject();
})
.done(function (i) {
t.ValidLogin && t.MemberID !== ""
? ((n.modules_id = t.MemberID),
(n.auth_token = t.AuthToken),
(n.userCountry = i.Country),
(n.memberName = i.FirstName + " " + i.LastName),
(n.userRoles = i.Roles),
r.resolve())
: r.reject();
});
}),
r
);
};
this.get_search_results_view_option = function () {
$.ajax({
url: api_url(
"Search/MemberDefault?MemberId=" +
n.get_modules_id() +
"&CountryCode=" +
n.get_user_country_code()
),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
})
.fail()
.done(function (t) {
n.show_all_results_expanded = t === 1;
$("#search_results_screen .show_all_results_expanded_link").text(
n.show_all_results_expanded
? "Collapse all listings"
: "Expand all listings"
);
});
};
this.save_search_results_view_option = function (t) {
$.ajax({
url: api_url("Search/MemberDefault/"),
type: "PUT",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
data: JSON.stringify({
MemberId: n.get_modules_id(),
CountryCode: n.get_user_country_code(),
ExpandAllListings: t === !0 ? 1 : 0,
}),
})
.fail()
.done(function () {
n.show_all_results_expanded = t;
});
};
this.show_search_screen = function (t, i) {
$(".search_screen").hide();
$("#search_" + t + "_screen").show();
$(document).scrollTo($("body"));
(typeof i == "undefined" || i) && history.pushState({ screen: t }, "", "");
switch (t) {
case "search":
n.search_screen.open();
break;
case "results":
n.results_screen.open();
break;
case "property_detail":
open_property_detail();
}
};
this.load_key_values = function (t) {
return $.ajax({
url: api_url("KeyValues/LocalityFilters/" + t, "ParameterService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function (i) {
n.key_values[t] = i;
});
};
this.load_profile_editor_values = function (t) {
return $.ajax({
url: api_url("Filter/LengthOfLoan/" + t, "AnalyserService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function (i) {
n.profile_editor_values[t].loan_length_years = i;
});
};
this.load_email_alert_labels = function () {
return $.ajax({
url: api_url("/SavedSearch/EmailAlert/", "PropertySearchService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function (t) {
n.email_alerts = t;
});
};
this.create_default_search = function () {
var r = n.key_values,
i = r[n.get_user_country_code()].PropertySpecifics,
t = r[n.get_user_country_code()].SuburbStatistics,
u = r[n.get_user_country_code()].ListngDetails,
f = r[n.get_user_country_code()].Strategy;
return {
Country: {
MemberID: n.get_modules_id(),
Limit: "200",
Title: "",
OrderBy: "1",
CountryCode: n.get_user_country_code(),
Strategy: [
{
strategyTypeId: n
.find_id(f.Strategies, "FilterStrategyID", "All")
.toString(),
strategyType: "",
keywords: "",
KeywordsOperand: "AND",
KeywordsOperandId: "1",
exclude: "",
ExcludedKeywordsOperand: "AND",
ExcludedKeywordsOperandId: "1",
},
],
StrategyTypeKeywords: [],
PropertySpecifics: [
{
dwellingType: n
.find_id(i.DwellingTypes, "FilterDwellingTypeID", "All")
.toString(),
includeLand: "false",
priceFrom: n
.find_id(
i.PriceRange.PriceRangeMin,
"ListingPrice_From_ID",
"All"
)
.toString(),
priceTo: n
.find_id(i.PriceRange.PriceRangeMax, "ListingPrice_To_ID", "All")
.toString(),
bedRoomMin: n
.find_id(i.BedRooms.BedRoomsMin, "Bedroom_From_ID", "Min")
.toString(),
bedRoomMax: n
.find_id(i.BedRooms.BedRoomsMax, "Bedroom_To_ID", "50+")
.toString(),
bathRoomMin: n
.find_id(i.BathRooms.BathRoomsMin, "Bathroom_From_ID", "Min")
.toString(),
bathRoomMax: n
.find_id(i.BathRooms.BathRoomsMax, "Bathroom_To_ID", "5+")
.toString(),
carPortMin: n
.find_id(i.Carports.CarportsMin, "Carport_From_ID", "Min")
.toString(),
carPortMax: n
.find_id(i.Carports.CarportsMax, "Carport_To_ID", "5+")
.toString(),
landSizeMin: n
.find_id(i.LandSizes.LandSizesMin, "LandSize_From_ID", "Min")
.toString(),
landSizeMax: n
.find_id(i.LandSizes.LandSizesMax, "LandSize_To_ID", "Max")
.toString(),
},
],
LocationAdvanced: [
{
limitPostcode: "",
limitStreet: "",
suburbRadiusFrom: "",
suburbRadiusTo: "",
OflimitSuburb: "",
locationSearchType: "",
limitSuburb: "",
postcodeRadiusFrom: "",
postcodeRadiusTo: "",
ofPostcode: "",
selectedSuburbType: "",
},
],
SuburbStatistics: [
{
suburbMedianMin: n
.find_id(t.SuburbMedian.FilterRangeMin, "From_ID", "All")
.toString(),
suburbMedianMax: n
.find_id(t.SuburbMedian.FilterRangeMax, "To_ID", "All")
.toString(),
vacancyRateMin: n
.find_id(t.VacancyRate.FilterRangeMin, "From_ID", "Min")
.toString(),
vacancyRateMax: n
.find_id(t.VacancyRate.FilterRangeMax, "To_ID", "Max")
.toString(),
listingMedianMin: n
.find_id(t.ListingMedian.FilterRangeMin, "From_ID", "Min")
.toString(),
listingMedianMax: n
.find_id(t.ListingMedian.FilterRangeMax, "To_ID", "Max")
.toString(),
rentalYieldMin: n
.find_id(t.RentalYields.FilterRangeMin, "From_ID", "Min")
.toString(),
rentalYieldMax: n
.find_id(t.RentalYields.FilterRangeMax, "To_ID", "Max")
.toString(),
oneYrGrowthMin: n
.find_id(t.YearGrowth.FilterRangeMin, "From_ID", "Min")
.toString(),
oneYrGrowthMax: n
.find_id(t.YearGrowth.FilterRangeMax, "To_ID", "Max")
.toString(),
populationMin: n
.find_id(t.Population.FilterRangeMin, "From_ID", "Min")
.toString(),
populationMax: n
.find_id(t.Population.FilterRangeMax, "To_ID", "Max")
.toString(),
daysOnMarketMin: n
.find_id(t.DaysOnMarket.FilterRangeMin, "From_ID", "Min")
.toString(),
daysOnMarketMax: n
.find_id(t.DaysOnMarket.FilterRangeMax, "To_ID", "Max")
.toString(),
},
],
ListingDetail: [
{
propertyYieldMin: n
.find_id(
u.PropertyYields.PropertyYieldMin,
"PotentialYield_From_ID",
"Min"
)
.toString(),
propertyYieldMax: n
.find_id(
u.PropertyYields.PropertyYieldMax,
"PotentialYield_To_ID",
"Max"
)
.toString(),
listingAgeMin: n
.find_id(u.ListingAge.ListingAgeMin, "ListingAge_From_ID", "Min")
.toString(),
listingAgeMax: n
.find_id(u.ListingAge.ListingAgeMax, "ListingAge_To_ID", "Max")
.toString(),
showDuplicates: "false",
},
],
LocationBasics: [
{
Country: "Australia",
StateId: "",
State: "",
Region: "",
RegionId: "0",
DistrictId: "0",
District: "",
},
],
Locality: [{}],
},
};
};
this.set_form_country = function (t, i) {
$(".more_location_options").hide();
$(".show_more_location .linktext.more").show();
$(".show_more_location .linktext.fewer").hide();
$(".more_strategy_options").hide();
$(".show_more_strategy .linktext.more").show();
$(".show_more_strategy .linktext.fewer").hide();
$(".more_property_specific").hide();
$(".show_more_property_specific .linktext.more").show();
$(".show_more_property_specific .linktext.fewer").hide();
$(".more_suburb_options").hide();
i === "AU" ? $(".au_only").show() : $(".au_only").hide();
$(".show_more_suburb_options .linktext.more").show();
$(".show_more_suburb_options .linktext.fewer").hide();
t.find(".map_region").attr("class", function (n, t) {
return t.replace("selected", "");
});
i === "AU"
? (t.find(".nz_map_wrap").hide().removeClass("active"),
t.find(".au_map_wrap").show().addClass("active"),
t.find(".searching_country").attr("data-country-code", "AU"))
: (t.find(".au_map_wrap").hide().removeClass("active"),
t.find(".nz_map_wrap").show().addClass("active"),
t.find(".searching_country").attr("data-country-code", "NZ"));
t.find(".search_country_toggle a").removeClass("active");
t.find(".search_country_toggle__" + i.toLowerCase()).addClass("active");
t.find(".localities_container").empty();
t.find(".no_region_selected")
.addClass("active")
.show()
.find(".autocomplete_search_input")
.val("");
$(".locality_input_explanation", t).hide();
t.find(".localities_container .selected_locality")
.has("span[data-id]")
.remove();
t.find(".district_suburb_selections").hide();
n.reset_advanced_location_options($(".more_location_options", t));
$(".au_postcode_search_link").toggle(i === "AU");
n.populate_filters(i);
};
this.set_search_form = function (t, i) {
var u = t.Country.CountryCode,
k,
f,
d,
g,
nt,
tt,
l,
a,
s,
h,
it,
rt,
e,
o,
r,
c,
y,
p,
ot,
w,
b;
i.find(".searching_country").attr("data-country-code", u);
$(".locality_input_warning", i).hide();
$(".locality_input_explanation", i).hide();
$(".autocomplete_search_input", i).removeData("latest_matches");
n.set_form_country(i, u);
k = i.find(".search_country_toggle");
k.length > 0 &&
((f = !1),
u === "NZ" && t.Country.LocationBasics[0].RegionId !== 0
? ((d = n.get_state_or_region_name(
u,
t.Country.LocationBasics[0].RegionId
)),
(f = i.find('.map_region[data-region-state="' + d + '"]')))
: u === "AU" &&
t.Country.LocationBasics[0].StateId !== 0 &&
((g = n.get_state_or_region_name(
u,
t.Country.LocationBasics[0].StateId
)),
(f = i.find('.map_region[data-region-state="' + g + '"]'))),
f && ((nt = f.attr("class")), f.attr("class", nt + " selected")));
i.find(".localities_container").empty();
tt = n.search_type(t);
switch (tt) {
case "locality":
for (
i.find(".no_region_selected").show(),
i.find(".district_suburb_selections").hide(),
l = t.Locality,
r = 0;
r < l.length;
r++
)
i.find(".localities_container").append(
$('').html(
"" +
l[r].Locality +
' delete '
)
);
break;
case "suburb":
if (
(i.find(".no_region_selected").hide(),
i.find(".district_suburb_selections").show(),
u === "NZ"
? ((a = t.Country.LocationBasics[0].RegionId),
(s = t.Country.LocationBasics[0].DistrictId))
: ((a = t.Country.LocationBasics[0].StateId),
(s = t.Country.LocationBasics[0].RegionId)),
n.search_screen.populate_dropdown_filters(
i,
t.Country.CountryCode,
a
),
s &&
(i
.find(".select_region_or_district")
.find('option[data-id="' + s + '"]')
.prop("selected", !0)
.end()
.trigger("change", !0),
t.Country.LocationAdvanced[0].locationSearchType !== "suburbLimit"))
)
for (
h = t.Country.LocationBasicsSuburbs, r = 0, c = h.length;
r < c;
r++
)
(it = n.suburb_tag_label(t.Country.LocationBasics[0], h[r])),
(rt =
' ' +
it +
' delete '),
i.find(".localities_container").append(rt);
break;
default:
case "whole-country":
i.find(".no_region_selected").show();
i.find(".district_suburb_selections").hide();
}
if (
(n.reset_advanced_location_options($(".more_location_options", i)),
i
.find(".postcode_limit")
.val(t.Country.LocationAdvanced[0].limitPostcode || ""),
i
.find(".street_name")
.val(t.Country.LocationAdvanced[0].limitStreet || ""),
u === "NZ"
? (i
.find(
'.suburb_radius_from option[value="' +
t.Country.LocationAdvanced[0].suburbRadiusFrom +
'"]'
)
.prop("selected", !0),
i
.find(
'.suburb_radius_to option[value="' +
t.Country.LocationAdvanced[0].suburbRadiusTo +
'"]'
)
.prop("selected", !0),
t.Country.LocationAdvanced[0].locationSearchType === "suburbLimit"
? ((e = {
FilterDistrictID: t.Country.LocationBasics[0].DistrictId,
FilterRegionID: t.Country.LocationBasics[0].RegionId,
FilterSuburbID: t.Country.LocationBasicsSuburbs[0].SuburbId,
Label: t.Country.LocationBasicsSuburbs[0].Suburb,
Suburb: t.Country.LocationBasicsSuburbs[0].Suburb,
}),
i.find(".of_suburb").val(e.Suburb).data("chosen_suburb", e))
: i.find(".of_suburb").val("").removeData("chosen_suburb"))
: (i
.find(".suburb_limit")
.val(t.Country.LocationAdvanced[0].limitSuburb || ""),
i
.find(
'.postcode_radius_from option[value="' +
t.Country.LocationAdvanced[0].postcodeRadiusFrom +
'"]'
)
.prop("selected", !0),
i
.find(
'.postcode_radius_to option[value="' +
t.Country.LocationAdvanced[0].postcodeRadiusTo +
'"]'
)
.prop("selected", !0),
i
.find(".of_postcode")
.val(t.Country.LocationAdvanced[0].ofPostcode || ""),
i
.find('input[name="suburb_classification"][value="mining"]')
.prop(
"checked",
t.Country.LocationAdvanced[0].selectedSuburbType === "mining"
),
i
.find('input[name="suburb_classification"][value="coastal"]')
.prop(
"checked",
t.Country.LocationAdvanced[0].selectedSuburbType === "coastal"
),
i
.find('input[name="suburb_classification"][value="universities"]')
.prop(
"checked",
t.Country.LocationAdvanced[0].selectedSuburbType ===
"universities"
),
t.Country.LocationAdvanced[0].locationSearchType === "suburbLimit"
? ((e = {
FilterStateID: t.Country.LocationBasics[0].StateId,
FilterRegionID: t.Country.LocationBasics[0].RegionId,
FilterSuburbID: t.Country.LocationBasicsSuburbs[0].SuburbId,
Label: t.Country.LocationBasicsSuburbs[0].Suburb,
Suburb: t.Country.LocationBasicsSuburbs[0].Suburb,
}),
i.find(".of_suburb").val(e.Suburb).data("chosen_suburb", e))
: i.find(".of_suburb").val("").removeData("chosen_suburb")),
(o = t.Country.LocationAdvanced[0].locationSearchType),
typeof o != "undefined" && o !== undefined && o !== null && o !== "")
) {
$(".advanced_location_option", i).hide();
switch (o) {
case "postcodeLimit":
$('.advanced_location_search option[value="limit_postcode"]', i).prop(
"selected",
!0
);
$(".advanced_location_option_limit_postcode", i).show();
break;
case "addressLimit":
$('.advanced_location_search option[value="limit_address"]', i).prop(
"selected",
!0
);
$(".advanced_location_option_limit_address", i).show();
break;
case "suburbLimit":
u === "NZ"
? ($(
'.advanced_location_search option[value="limit_suburb_nz"]',
i
).prop("selected", !0),
$(".advanced_location_option_limit_suburb_nz", i).show())
: ($(
'.advanced_location_search option[value="limit_suburb_au"]',
i
).prop("selected", !0),
$(".advanced_location_option_limit_suburb_au", i).show());
break;
case "postcodeRadius":
$('.advanced_location_search option[value="radius"]', i).prop(
"selected",
!0
);
$(".advanced_location_option_radius", i).show();
break;
case "suburbtype":
$('.advanced_location_search option[value="classification"]', i).prop(
"selected",
!0
);
$(".advanced_location_option_classification", i).show();
}
$(".more_location_options", i)
.show()
.parent()
.find(".show_more_location")
.addClass("more")
.find(".linktext.more")
.hide()
.end()
.find(".linktext.fewer")
.show();
} else
$(".more_location_options", i)
.hide()
.parent()
.find(".show_more_location")
.removeClass("more")
.find(".linktext.more")
.show()
.end()
.find(".linktext.fewer")
.hide(),
$('.advanced_location_search option[value="limit_postcode"]', i).prop(
"selected",
!0
),
$(".advanced_location_option_limit_postcode", i).show();
i.find(
'.min_budget_select option[value="' +
t.Country.PropertySpecifics[0].priceFrom +
'"]'
).prop("selected", !0);
i.find(
'.max_budget_select option[value="' +
t.Country.PropertySpecifics[0].priceTo +
'"]'
).prop("selected", !0);
i.find(
'.strategy_select option[value="' +
t.Country.Strategy[0].strategyTypeId +
'"]'
).prop("selected", !0);
n.display_strategy_keywords(
i,
n.key_values[u].StrategiesCollection.StrategiesAndKeywords,
t.Country.Strategy[0].strategyTypeId
);
var ut = t.Country.StrategyTypeKeywords,
ft = [],
v = !0,
et = 0;
for (r = 0, c = ut.length; r < c; r++) ft.push(ut[r].keywordId);
i.find(".strategy_keywords input:not(:first)").each(function () {
$.inArray(String($(this).val()), ft) === -1
? ($(this).prop("checked", !1), (v = !1))
: ($(this).prop("checked", !0), et++);
});
i.find(".strategy_keywords .select_all").prop("checked", v);
i.find(".additional_keywords").val(t.Country.Strategy[0].keywords);
i.find(".exclude_keywords").val(t.Country.Strategy[0].exclude);
i.find(
'.keyword_include_type option[value="' +
t.Country.Strategy[0].KeywordsOperandId +
'"]'
).prop("selected", !0);
i.find(
'.keyword_exclude_type option[value="' +
t.Country.Strategy[0].ExcludedKeywordsOperandId +
'"]'
).prop("selected", !0);
y =
String(t.Country.Strategy[0].strategyTypeId) ===
String(n.key_values[u].Strategy.Strategies[0].FilterStrategyID);
p =
(y && et > 0) ||
(!y && !v) ||
t.Country.Strategy[0].keywords !== "" ||
t.Country.Strategy[0].exclude !== "";
$(".more_strategy_options, .show_more_strategy .linktext.fewer", i).toggle(
p
);
$(".show_more_strategy .linktext.more", i).toggle(!p);
i.find(
'.dwelling_type_select option[value="' +
t.Country.PropertySpecifics[0].dwellingType +
'"]'
).prop("selected", !0);
i.find(".include_land_check").prop(
"checked",
"true" === t.Country.PropertySpecifics[0].includeLand
);
ot = i
.find(".include_land_check")
.closest("section")
.find(".dwelling_type_select option:selected")
.text();
i.find(".include_land_check")
.closest(".include_land_control_container")
.toggle(ot.toLowerCase() === "all");
i.find(
'.bedrooms_select.min option[value="' +
t.Country.PropertySpecifics[0].bedRoomMin +
'"]'
).prop("selected", !0);
i.find(
'.bedrooms_select.max option[value="' +
t.Country.PropertySpecifics[0].bedRoomMax +
'"]'
).prop("selected", !0);
i.find(
'.bathrooms_select.min option[value="' +
t.Country.PropertySpecifics[0].bathRoomMin +
'"]'
).prop("selected", !0);
i.find(
'.bathrooms_select.max option[value="' +
t.Country.PropertySpecifics[0].bathRoomMax +
'"]'
).prop("selected", !0);
i.find(
'.carports_select.min option[value="' +
t.Country.PropertySpecifics[0].carPortMin +
'"]'
).prop("selected", !0);
i.find(
'.carports_select.max option[value="' +
t.Country.PropertySpecifics[0].carPortMax +
'"]'
).prop("selected", !0);
i.find(
'.landsize_min option[value="' +
t.Country.PropertySpecifics[0].landSizeMin +
'"]'
).prop("selected", !0);
i.find(
'.landsize_max option[value="' +
t.Country.PropertySpecifics[0].landSizeMax +
'"]'
).prop("selected", !0);
i.find(
'.property_yield_min option[value="' +
t.Country.ListingDetail[0].propertyYieldMin +
'"]'
).prop("selected", !0);
i.find(
'.property_yield_max option[value="' +
t.Country.ListingDetail[0].propertyYieldMax +
'"]'
).prop("selected", !0);
i.find(
'.listing_age_min option[value="' +
t.Country.ListingDetail[0].listingAgeMin +
'"]'
).prop("selected", !0);
i.find(
'.listing_age_max option[value="' +
t.Country.ListingDetail[0].listingAgeMax +
'"]'
).prop("selected", !0);
w =
$(".landsize_min option:first", i).is(":selected") &&
$(".landsize_max option:first", i).is(":selected") &&
$(".property_yield_min option:first", i).is(":selected") &&
$(".property_yield_max option:first", i).is(":selected") &&
$(".listing_age_min option:first", i).is(":selected") &&
$(".listing_age_max option:first", i).is(":selected");
$(
".more_property_specific, .show_more_property_specific .linktext.fewer",
i
).toggle(!w);
$(".show_more_property_specific .linktext.more", i).toggle(w);
i.find(
'.suburb_rental_yield_min option[value="' +
t.Country.SuburbStatistics[0].rentalYieldMin +
'"]'
).prop("selected", !0);
i.find(
'.suburb_rental_yield_max option[value="' +
t.Country.SuburbStatistics[0].rentalYieldMax +
'"]'
).prop("selected", !0);
i.find(
'.suburb_growth_min option[value="' +
t.Country.SuburbStatistics[0].oneYrGrowthMin +
'"]'
).prop("selected", !0);
i.find(
'.suburb_growth_max option[value="' +
t.Country.SuburbStatistics[0].oneYrGrowthMax +
'"]'
).prop("selected", !0);
i.find(
'.suburb_median_min option[value="' +
t.Country.SuburbStatistics[0].listingMedianMin +
'"]'
).prop("selected", !0);
i.find(
'.suburb_median_max option[value="' +
t.Country.SuburbStatistics[0].listingMedianMax +
'"]'
).prop("selected", !0);
i.find(
'.vacancy_rate_min option[value="' +
t.Country.SuburbStatistics[0].vacancyRateMin +
'"]'
).prop("selected", !0);
i.find(
'.vacancy_rate_max option[value="' +
t.Country.SuburbStatistics[0].vacancyRateMax +
'"]'
).prop("selected", !0);
i.find(
'.suburb_price_median_min option[value="' +
t.Country.SuburbStatistics[0].suburbMedianMin +
'"]'
).prop("selected", !0);
i.find(
'.suburb_price_median_max option[value="' +
t.Country.SuburbStatistics[0].suburbMedianMax +
'"]'
).prop("selected", !0);
i.find(
'.population_min option[value="' +
t.Country.SuburbStatistics[0].populationMin +
'"]'
).prop("selected", !0);
i.find(
'.population_max option[value="' +
t.Country.SuburbStatistics[0].populationMax +
'"]'
).prop("selected", !0);
i.find(
'.days_on_market_min option[value="' +
t.Country.SuburbStatistics[0].daysOnMarketMin +
'"]'
).prop("selected", !0);
i.find(
'.days_on_market_max option[value="' +
t.Country.SuburbStatistics[0].daysOnMarketMax +
'"]'
).prop("selected", !0);
i.find(".include_duplicates").prop(
"checked",
"true" === t.Country.ListingDetail[0].showDuplicates
);
b =
$(".population_min option:first", i).is(":selected") &&
$(".population_max option:first", i).is(":selected") &&
$(".days_on_market_min option:first", i).is(":selected") &&
$(".days_on_market_max option:first", i).is(":selected");
$(
".more_suburb_options, .show_more_suburb_options .linktext.fewer",
i
).toggle(!b);
$(".show_more_suburb_options .linktext.more", i).toggle(b);
};
this.populate_filters = function (t) {
var u = n.key_values[t],
r,
y = u.Strategy.Strategies,
h,
c,
l,
a,
v,
f,
i;
for (
r = $(".search_filters select.strategy_select").empty(),
i = 0,
f = y.length;
i < f;
i++
)
r.append(
' ' +
y[i].Label +
" "
);
n.display_strategy_keywords(
$("body"),
u.StrategiesCollection.StrategiesAndKeywords,
$(".search_filters .strategy_select").val()
);
var o = u.Strategy.KeywordPhrase,
s = u.Strategy.ExcKeywordPhrase,
e = "";
for (
r = $(".search_filters select.keyword_include_type").empty(), i = 0;
i < o.length;
i++
) {
switch (o[i].Label) {
case "Exact Phrase":
e =
"boat pontoonĀĀ- The two words must be next to each other in the title or description";
break;
case "All Words":
e =
"boat pontoonĀĀ- The two words must be in the title or description but do not need to be next to each other";
break;
case "Any Words":
e =
"boat pontoonĀ - Either of the two words must be in the title or description";
break;
default:
e = "";
}
$("")
.text(o[i].Label)
.attr("value", o[i].FilterKeywordSearchTypeID)
.attr("title", e)
.appendTo(r);
}
for (
r = $(".search_filters select.keyword_exclude_type").empty(), i = 0;
i < s.length;
i++
) {
switch (s[i].Label) {
case "Exact Phrase":
e =
"boat pontoonĀ - The two words must be next to each other in the title or description";
break;
case "All Words":
e =
"boat pontoonĀ The two words must be in the title or description but do not need to be next to each other";
break;
case "Any Words":
e =
"boat pontoonĀĀ - Either of the two words must be in the title or description";
break;
default:
e = "";
}
$(" ")
.text(s[i].Label)
.attr("value", s[i].FilterExcludeKeywordSearchTypeID)
.attr("title", e)
.appendTo(r);
}
for (
h = u.LocationAdvanced.PostcodeRadius.PostcodeRadiusFrom,
c = u.LocationAdvanced.PostcodeRadius.PostcodeRadiusTo,
r = $(".search_filters select.include_suburb_min").empty(),
i = 0;
i < h.length;
i++
)
$(" ")
.text(h[i].Label)
.attr("value", h[i].PostcodeRadius_From_ID)
.appendTo(r);
for (
r = $(".search_filters select.include_suburb_max").empty(), i = 0;
i < c.length;
i++
)
$(" ")
.text(c[i].Label)
.attr("value", c[i].PostcodeRadius_To_ID)
.appendTo(r);
for (
l = u.PropertySpecifics.PriceRange.PriceRangeMin,
a = u.PropertySpecifics.PriceRange.PriceRangeMax,
r = $(".search_filters select.min_budget_select").empty(),
i = 0;
i < l.length;
i++
)
$(" ")
.text(l[i].Label)
.attr("value", l[i].ListingPrice_From_ID)
.appendTo(r);
for (
r = $(".search_filters select.max_budget_select").empty(), i = 0;
i < a.length;
i++
)
$(" ")
.text(a[i].Label)
.attr("value", a[i].ListingPrice_To_ID)
.appendTo(r);
for (
v = u.PropertySpecifics.DwellingTypes,
r = $(".search_filters select.dwelling_type_select").empty(),
i = 0;
i < v.length;
i++
)
$(" ")
.text(v[i].Label)
.attr("value", v[i].FilterDwellingTypeID)
.appendTo(r);
$(".include_land_control_container")
.show()
.find(".option_description")
.hide()
.filter("." + t.toLowerCase())
.show();
var p = u.PropertySpecifics.BedRooms.BedRoomsMin,
w = u.PropertySpecifics.BedRooms.BedRoomsMax,
b = u.PropertySpecifics.BathRooms.BathRoomsMin,
k = u.PropertySpecifics.BathRooms.BathRoomsMax,
d = u.PropertySpecifics.Carports.CarportsMin;
for (
carports_max = u.PropertySpecifics.Carports.CarportsMax,
r = $(".search_filters select.bedrooms_select.min").empty(),
i = 0,
f = p.length;
i < f;
i++
)
r.append(
' ' +
p[i].Label +
" "
);
for (
r = $(".search_filters select.bedrooms_select.max").empty(),
i = 0,
f = w.length;
i < f;
i++
)
r.append(
'' + w[i].Label + " "
);
for (
r = $(".search_filters select.bathrooms_select.min").empty(),
i = 0,
f = b.length;
i < f;
i++
)
r.append(
'' +
b[i].Label +
" "
);
for (
r = $(".search_filters select.bathrooms_select.max").empty(),
i = 0,
f = k.length;
i < f;
i++
)
r.append(
'' +
k[i].Label +
" "
);
for (
r = $(".search_filters select.carports_select.min").empty(),
i = 0,
f = d.length;
i < f;
i++
)
r.append(
'' +
d[i].Label +
" "
);
for (
r = $(".search_filters select.carports_select.max").empty(),
i = 0,
f = carports_max.length;
i < f;
i++
)
r.append(
'' +
carports_max[i].Label +
" "
);
var g = u.PropertySpecifics.LandSizes.LandSizesMin,
nt = u.PropertySpecifics.LandSizes.LandSizesMax,
tt = u.ListngDetails.PropertyYields.PropertyYieldMin,
it = u.ListngDetails.PropertyYields.PropertyYieldMax,
rt = u.ListngDetails.ListingAge.ListingAgeMin,
ut = u.ListngDetails.ListingAge.ListingAgeMax;
for (
r = $(".search_filters select.landsize_min").empty(), i = 0;
i < g.length;
i++
)
$("")
.text(g[i].Label)
.attr("value", g[i].LandSize_From_ID)
.appendTo(r);
for (
r = $(".search_filters select.landsize_max").empty(), i = 0;
i < nt.length;
i++
)
$(" ")
.text(nt[i].Label)
.attr("value", nt[i].LandSize_To_ID)
.appendTo(r);
for (
r = $(".search_filters select.property_yield_min").empty(), i = 0;
i < tt.length;
i++
)
$(" ")
.text(tt[i].Label)
.attr("value", tt[i].PotentialYield_From_ID)
.appendTo(r);
for (
r = $(".search_filters select.property_yield_max").empty(), i = 0;
i < it.length;
i++
)
$(" ")
.text(it[i].Label)
.attr("value", it[i].PotentialYield_To_ID)
.appendTo(r);
for (
r = $(".search_filters select.listing_age_min").empty(), i = 0;
i < rt.length;
i++
)
$(" ")
.text(rt[i].Label)
.attr("value", rt[i].ListingAge_From_ID)
.appendTo(r);
for (
r = $(".search_filters select.listing_age_max").empty(), i = 0;
i < ut.length;
i++
)
$(" ")
.text(ut[i].Label)
.attr("value", ut[i].ListingAge_To_ID)
.appendTo(r);
var ft = u.SuburbStatistics.RentalYields.FilterRangeMin,
et = u.SuburbStatistics.RentalYields.FilterRangeMax,
ot = u.SuburbStatistics.YearGrowth.FilterRangeMin,
st = u.SuburbStatistics.YearGrowth.FilterRangeMax,
ht = u.SuburbStatistics.ListingMedian.FilterRangeMin,
ct = u.SuburbStatistics.ListingMedian.FilterRangeMax,
lt = u.SuburbStatistics.SuburbMedian.FilterRangeMin,
at = u.SuburbStatistics.SuburbMedian.FilterRangeMax,
vt = u.SuburbStatistics.VacancyRate.FilterRangeMin,
yt = u.SuburbStatistics.VacancyRate.FilterRangeMax,
r = $(".search_filters select.suburb_rental_yield_min").empty();
for (i = 0; i < ft.length; i++)
$(" ").text(ft[i].Label).attr("value", ft[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_rental_yield_max").empty(), i = 0;
i < et.length;
i++
)
$(" ").text(et[i].Label).attr("value", et[i].To_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_growth_min").empty(), i = 0;
i < ot.length;
i++
)
$(" ").text(ot[i].Label).attr("value", ot[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_growth_max").empty(), i = 0;
i < st.length;
i++
)
$(" ").text(st[i].Label).attr("value", st[i].To_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_median_min").empty(), i = 0;
i < ht.length;
i++
)
$(" ").text(ht[i].Label).attr("value", ht[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_median_max").empty(), i = 0;
i < ct.length;
i++
)
$(" ").text(ct[i].Label).attr("value", ct[i].To_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_price_median_min").empty(), i = 0;
i < lt.length;
i++
)
$(" ").text(lt[i].Label).attr("value", lt[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.suburb_price_median_max").empty(), i = 0;
i < at.length;
i++
)
$(" ").text(at[i].Label).attr("value", at[i].To_ID).appendTo(r);
for (
r = $(".search_filters select.vacancy_rate_min").empty(), i = 0;
i < vt.length;
i++
)
$(" ").text(vt[i].Label).attr("value", vt[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.vacancy_rate_max").empty(), i = 0;
i < yt.length;
i++
)
$(" ").text(yt[i].Label).attr("value", yt[i].To_ID).appendTo(r);
var pt = u.SuburbStatistics.Population.FilterRangeMin,
wt = u.SuburbStatistics.Population.FilterRangeMax,
bt = u.SuburbStatistics.DaysOnMarket.FilterRangeMin,
kt = u.SuburbStatistics.DaysOnMarket.FilterRangeMax;
for (
r = $(".search_filters select.population_min").empty(), i = 0;
i < pt.length;
i++
)
$(" ").text(pt[i].Label).attr("value", pt[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.population_max").empty(), i = 0;
i < wt.length;
i++
)
$(" ").text(wt[i].Label).attr("value", wt[i].To_ID).appendTo(r);
for (
r = $(".search_filters select.days_on_market_min").empty(), i = 0;
i < bt.length;
i++
)
$(" ").text(bt[i].Label).attr("value", bt[i].From_ID).appendTo(r);
for (
r = $(".search_filters select.days_on_market_max").empty(), i = 0;
i < kt.length;
i++
)
$(" ").text(kt[i].Label).attr("value", kt[i].To_ID).appendTo(r);
};
this.load_user_entities = function () {
return $.ajax({
url: api_url(
"MemberEntityDetails?memberID=" +
n.get_modules_id() +
"&userCountryCode=" +
n.get_user_country_code() +
"&memberName=" +
n.get_member_name(),
"PortfolioService"
),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.display_strategy_keywords = function (n, t, i) {
for (var o, f, u = [], r = 0, e = t.length; r < e; r++)
if (String(t[r].FilterStrategyID) === String(i)) {
u = t[r].Keywords;
break;
}
for (
o = n.find(".strategy_keywords").empty(),
f = String(t[0].FilterStrategyID) === String(i),
f ||
o.append(
' All '
),
checkboxes_HTML = "",
r = 0,
e = u.length;
r < e;
r++
)
u[r].Label !== "Please Select..." &&
(checkboxes_HTML +=
' ' +
u[r].Label +
" ");
o.append(checkboxes_HTML);
};
this.reset_advanced_location_options = function (t, i) {
var h = $(".searching_country", t.closest(".search_filters")).attr(
"data-country-code"
),
f,
e,
o,
s,
r,
u;
if (
((selected_option_val =
typeof i != "undefined" && i
? $(".advanced_location_search option:selected", t).val()
: null),
$(".advanced_location_search", t).empty(),
$(".advanced_location_option", t).hide(),
$(".postcode_limit", t).val(""),
$(".street_name", t).val(""),
h === "NZ")
) {
for (
f = n.key_values.NZ.LocationAdvanced.SuburbRadius.SuburbRadiusFrom,
e = n.key_values.NZ.LocationAdvanced.SuburbRadius.SuburbRadiusTo,
$current_select = $(".suburb_radius_from", t).empty(),
r = 0,
u = f.length;
r < u;
r++
)
$(" ")
.text(f[r].Label)
.attr("value", f[r].SearchRadius_From_ID)
.appendTo($current_select);
for (
$current_select = $(".suburb_radius_to", t).empty(),
r = 0,
u = e.length;
r < u;
r++
)
$(" ")
.text(e[r].Label)
.attr("value", e[r].SearchRadius_To_ID)
.appendTo($current_select);
$(".of_suburb", t).val("");
} else {
for (
$(".suburb_limit", t).val(""),
o =
n.key_values.AU.LocationAdvanced.PostcodeRadius.PostcodeRadiusFrom,
s = n.key_values.AU.LocationAdvanced.PostcodeRadius.PostcodeRadiusTo,
$current_select = $(".postcode_radius_from", t).empty(),
r = 0,
u = o.length;
r < u;
r++
)
$(" ")
.text(o[r].Label)
.attr("value", o[r].PostcodeRadius_From_ID)
.appendTo($current_select);
for (
$current_select = $(".postcode_radius_to", t).empty(),
r = 0,
u = s.length;
r < u;
r++
)
$(" ")
.text(s[r].Label)
.attr("value", s[r].PostcodeRadius_To_ID)
.appendTo($current_select);
$(".of_postcode", t).val("");
$('input[name="suburb_classification"]', t).prop("checked", !1);
}
$(".advanced_location_option_limit_postcode", t).show();
$(".advanced_location_search", t).append(
' Limit postcode '
);
$(".advanced_location_search", t).append(
'Limit street address '
);
h === "NZ"
? $(".advanced_location_search", t).append(
'Limit suburb '
)
: ($(".advanced_location_search", t).append(
'Limit suburb '
),
$(".advanced_location_search", t).append(
'Search radius '
),
$(".advanced_location_search", t).append(
'Suburb classification '
));
selected_option_val !== null &&
$(
'.advanced_location_search option[value="' + selected_option_val + '"]',
t
).prop("selected", !0);
};
this.handle_backend_validation = function (n) {
return n.status === 400 &&
typeof n.responseJSON == "string" &&
(n.responseJSON.match(/^Limit Postcode:.*invalid\.?\,?$/) ||
n.responseJSON.match(/^Postcode :.*is invalid format\.?\,?$/) ||
n.responseJSON.match(/^Address:.*invalid\.?\,?$/))
? ($("#validation_message_modal")
.find(".validation_message")
.text(n.responseJSON)
.end()
.find(".limit_address_message")
.toggleClass("hide", n.responseJSON.match(/^Address:/) === null)
.end()
.foundation("reveal", "open"),
!0)
: !1;
};
this.check_locality_input = function (t) {
var s = $(".no_region_selected.active", t).length > 0,
i,
e,
o,
u,
r,
f;
if (!s) return !0;
if ($(".localities_container", t).children().length > 0)
return (
$("#main_search .autocomplete_search_input")
.val("")
.data("latest_matches"),
!0
);
if ($(".autocomplete_search_input", t).val() === "") return !0;
if (
((i = $(".autocomplete_search_input", t).data("latest_matches") || []),
i.length > 0 &&
i.length <= 5 &&
((e = /^.*(\([^\)]*\))$/), i[0].LocalityLabel.match(e) !== null))
) {
for (
o = i[0].LocalityLabel.replace(/^.*(\([^\)]*\))$/, "$1"),
u = null,
r = Math.min(1, i.length - 1),
f = Math.min(5, i.length);
r < f;
r++
) {
if (i[r].LocalityLabel.replace(/^.*(\([^\)]*\))$/, "$1") !== o) {
u = !1;
break;
}
u = !0;
}
if (u === !0) {
for (r = 0, f = Math.min(5, i.length); r < f; r++)
n.add_selected_locality(i[r].LocalityLabel, t);
return (
$(".autocomplete_search_input", t).val("").data("latest_matches"), !0
);
}
}
return (
i.length === 0
? $(".locality_input_explanation", t).show()
: ($(".autocomplete_search_input", t).autocomplete("search"),
$(".locality_input_warning", t).show()),
$(document).scrollTo($(".locality_input_warning")),
!1
);
};
this.add_selected_locality = function (n, t) {
var i, r;
$(".locality_input_warning", t).hide();
$(".locality_input_explanation", t).hide();
$(".autocomplete_search_input", t).removeData("latest_matches");
i = !1;
$(".selected_locality", t).each(function () {
if ($(this).find("span").text() === n) {
$(this)
.fadeIn(80)
.fadeOut(80)
.fadeIn(80)
.fadeOut(80)
.fadeIn(80)
.fadeOut(80)
.fadeIn(80);
i = !0;
return;
}
});
i ||
((r = $('').html(
"" + n + ' delete '
)),
$(".localities_container", t).append(r));
$(this).val("");
};
this.search_type = function (n) {
return n.Locality && n.Locality.length > 0
? "locality"
: n.Country.LocationBasics[0].Country === "AU" &&
(n.Country.LocationBasics[0].StateId === "0" ||
n.Country.LocationBasics[0].StateId === null ||
n.Country.LocationBasics[0].StateId === "" ||
typeof n.Country.LocationBasics[0].StateId == "undefined")
? "whole-country"
: n.Country.LocationBasics[0].Country === "NZ" &&
(n.Country.LocationBasics[0].RegionId === "0" ||
n.Country.LocationBasics[0].RegionId === null ||
n.Country.LocationBasics[0].RegionId === "" ||
typeof n.Country.LocationBasics[0].RegionId == "undefined")
? "whole-country"
: n.Country.LocationBasicsSuburbs
? "suburb"
: "other";
};
this.find_id = function (n, t, i, r) {
r === undefined && (r = "Label");
for (var u = 0; u < n.length; u++) if (n[u][r] === i) return n[u][t];
return "";
};
this.find_label = function (n, t, i, r) {
typeof r == "undefined" && (r = "Label");
for (var u = 0, f = n.length; u < f; u++)
if (String(n[u][i]) === String(t)) return n[u][r];
return "";
};
this.get_state_or_region_name = function (t, i) {
var e = !1,
u,
f,
r;
if (t === "NZ") {
for (
u = n.key_values.NZ.LocationBasicsNZ.Regions, r = 0;
r < u.length;
r++
)
if (u[r].FilterRegionID == i) {
e = u[r].Label;
break;
}
} else
for (
f = n.key_values.AU.LocationBasicsAU.States, r = 0;
r < f.length;
r++
)
if (f[r].FilterStateID == i) {
e = f[r].Label;
break;
}
return e;
};
this.suburb_tag_label = function (t, i) {
if (String(i.SuburbId) === "0") {
if (t.Country === "AU")
return String(t.RegionId) === "0"
? n.get_state_or_region_name("AU", t.StateId) + ": all suburbs"
: t.Region + ": all suburbs";
if (t.Country === "NZ")
return String(t.DistrictId) === "0"
? n.get_state_or_region_name("NZ", t.RegionId) + ": all suburbs"
: t.District + ": all suburbs";
} else return i.Suburb;
};
this.count_words = function (n) {
return n.length === 0
? 0
: ((n = n.replace(/(^\s*)|(\s*$)/gi, "")),
(n = n.replace(/[ ]{2,}/gi, " ")),
(n = n.replace(/\n /, "\n")),
n.split(" ").length);
};
this.getCookie = function (n) {
for (
var t, r = n + "=", u = document.cookie.split(";"), i = 0, f = u.length;
i < f;
i++
)
if (((t = u[i].trim()), t.indexOf(r) === 0))
return t.substring(r.length, t.length);
return null;
};
this.check_session_expiry = function (n) {
return n.status === 401;
};
this.handle_session_expiry = function (n) {
if (typeof n != "undefined") {
var t = n.responseJSON || "";
$(".authentication_problem .problem_message").text(t);
}
$(".search_screen").hide();
$("#edit_search_modal").foundation("reveal", "close");
$("#search_search_screen").show();
set_area_display_status_v2(
"#search_search_screen .main_display",
"authentication_problem",
!0
);
$(document).scrollTo($("body"));
};
this.setup();
}
function IS_search_screen(n) {
var t = this,
i = {};
this.initialise = function () {
var r = $(document);
r.on(
"click",
"#search_search_screen .show_watch_list, #search_search_screen .show_saved_searches",
function (n) {
n.preventDefault();
$watchlists_row = $(this).closest(".watchlists");
watchlist = $watchlists_row.find(".investor_watchlist");
saved_searches = $watchlists_row.find(".saved_investor_searches");
$(watchlist).slideToggle(function () {
$watchlists_row
.find(".show_watch_list")
.toggleClass("open")
.find("h3 i")
.toggle();
});
$(saved_searches).slideToggle(function () {
$watchlists_row
.find(".show_saved_searches")
.toggleClass("open")
.find("h3 i")
.toggle();
});
}
);
$.ui.autocomplete.filter = function (n, t) {
var i = new RegExp("^" + $.ui.autocomplete.escapeRegex(t), "i");
return $.grep(n, function (n) {
return i.test(n.label || n.value || n);
});
};
r.on("click", "#search_search_screen .default_profile_link", function (t) {
return t.preventDefault(), n.user_profile.open_editor(), !1;
});
n.set_form_country($("#main_search"), n.get_user_country_code());
r.on("click", ".search_country_toggle a", function (t) {
t.preventDefault();
var r = $(this).hasClass("search_country_toggle__au") ? "AU" : "NZ",
i = $(this).closest(".search_filters");
n.set_form_country(i, r);
$(".locality_input_warning", i).hide();
$(".autocomplete_search_input", i).removeData("latest_matches");
});
r.on("click", ".map_region", function (n) {
n.preventDefault();
var i = $(this).closest("div"),
r = i.find(".map_region"),
t = $(this);
t.hasClass("selected")
? t.attr("class", function (n, t) {
return t.replace("selected", "");
})
: (r.attr("class", function (n, t) {
return t.replace("selected", "");
}),
t.attr("class", function (n, t) {
return t + " selected";
}));
$(this).closest(".search_filters").find(".localities_container").empty();
});
r.on("click", "#search_search_screen .delete_watch", function (i) {
i.preventDefault();
var r = $(this).attr("data-watchlist-id"),
u = $(this).closest("tr");
n.watchlist
.remove_property_from_watchlist(r)
.done(function () {
t.display_watchlist();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert("Deleting from watchlist failed, please try again later.");
});
});
r.on("click", "#search_search_screen .show_watched_property", function (i) {
i.preventDefault();
var r = {
WatchlistID: $(this).attr("data-watchlist-id"),
CountryCode: $(this).attr("data-country-code"),
PropertyId: $(this).attr("data-property-id"),
LinkIdHash: $(this).attr("data-link-id-hash"),
MemberId: n.get_modules_id(),
};
t.show_property_in_modal(r, !0);
});
$(window).on("resize", function () {
$("#watched_property_details").is(":visible") && i.resize_graphs();
});
r.on(
"click",
"#search_search_screen .show_market_stats_button",
function (n) {
n.preventDefault();
var t = $(this).closest(".search_result");
$(".area_container", t)
.find(".more_property_details")
.slideToggle({
done: function () {
$(".more_property_details", t).is(":visible")
? i.display_extended_stats(
t.data("property_details").Suburb,
t,
"WLP"
)
: i.clear_postcode_graph("WLP");
},
})
.end()
.find(".show_market_stats_button")
.toggle();
$(document).scrollTo(t);
}
);
r.on(
"click",
"#search_search_screen .show_search_delete_confirmation",
function (n) {
n.preventDefault();
$table = $(this).closest("table");
$table.find(".confirm_delete_options").hide();
$table.find("tr").not(".confirm_delete_options").show();
$(this).closest("tr").hide().next().show();
}
);
r.on(
"click",
"#search_search_screen .cancel_delete_saved_search",
function (n) {
n.preventDefault();
$(this).closest("tr").hide().prev().show();
}
);
r.on("click", "#search_search_screen .delete_saved_search", function (i) {
i.preventDefault();
var r = $(this).closest("tr");
t.delete_saved_search($(this).attr("data-saved-search-id"))
.done(function () {
r.prev().remove();
r.remove();
$(
"#search_search_screen .saved_investor_searches .some_saved_searches tbody tr"
).length < 2 &&
($(
"#search_search_screen .saved_investor_searches .some_saved_searches"
).hide(),
$(
"#search_search_screen .saved_investor_searches .no_saved_searches"
).show());
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert(
"Sorry we are unable to delete your search at this time please try again later."
);
});
});
r.on("click", "#main_search .save_this_search", function (t) {
(t.preventDefault(), n.check_locality_input($("#main_search"))) &&
($("#save_search_modal .validation").empty(),
$("#save_search_modal").foundation("reveal", "open"));
});
r.on("click", ".save_search", function (i) {
var r;
i.preventDefault();
r = $("#main_search").is(":visible")
? t.get_search_request_data($("#main_search"))
: n.current_search;
var u = $("#save_search_modal .name_of_saved_search").val(),
o =
$("#save_search_modal input[name=receive_emails]:checked").val() ===
"yes"
? !0
: !1,
f = $("#save_search_modal .email_frequency").val(),
e = $("#save_search_modal .email_frequency option:selected").text();
if (u === "") {
$("#save_search_modal .validation").html(
"Please enter a name for your search."
);
return;
}
if (u.match(/[\&\=\;\']/g)) {
$("#save_search_modal .validation").html(
"Please enter a name for your search that doesn't include any of these characters: & = ; ' "
);
return;
}
r.Country.Title = u;
t.save_property_search(r)
.done(function (n) {
var i = n.SavedSearchID;
e.toLowerCase() !== "inactive" &&
t.save_email_frequency(f, n.SavedSearchID);
$("#save_search_modal").foundation("reveal", "close");
$("#save_search_modal .name_of_saved_search").val("");
t.display_saved_searches();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
n.handle_backend_validation(t) ||
alert(
"Sorry we are unable to save your search at this time. Please try again later."
);
});
});
r.on("click", "#search_search_screen .edit_search", function (n) {
n.preventDefault();
t.display_saved_search(
$(this).attr("data-saved-search-id"),
$(this).attr("data-email-alert-frequency-id"),
$(this).attr("data-date-added")
);
});
r.on("click", "#edit_search_modal .update_saved_search", function (i) {
var r, u;
(i.preventDefault(), n.check_locality_input($("#edit_search_modal"))) &&
((r = t.get_search_request_data($("#edit_search_modal"))),
(r.Country.SavedSearchId = $(
"#edit_search_modal .saved_search_id"
).val()),
(r.Country.Title = $("#edit_search_modal .search_title").val()),
t
.update_saved_search(r)
.done(function () {
t.display_saved_searches();
$("#edit_search_modal").foundation("reveal", "close");
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
n.handle_backend_validation(t) ||
alert(
"Sorry, we are unable to update your search at this time. Please try again later"
);
}),
(u = $("#edit_search_modal")
.find('select[name="email_frequency"]')
.val()),
t.save_email_frequency(u, r.Country.SavedSearchId),
$(this).attr("data-email-alert-frequency-id", u));
});
r.on("click", "#search_search_screen .run_saved_search", function (n) {
n.preventDefault();
t.load_and_execute_saved_search($(this).attr("data-saved-search-id"));
});
r.on("click", ".search_filters path[data-country]", function (n) {
n.preventDefault();
var r = $(this),
i = $(this).closest(".search_filters"),
u = r.attr("data-country"),
f = r.attr("data-region-state"),
e = t.get_region_or_state_id(u, f);
t.populate_dropdown_filters(i, u, e);
i.find(".no_region_selected").removeClass("active").hide();
i.find(".district_suburb_selections").show();
});
r.on("change", ".search_filters .select_region_or_district", function () {
var i = $(this),
u;
i.closest(".search_filters")
.find(".search_for_properties")
.addClass("disabled");
u = i.closest(".search_filters").find("select.select_suburb").empty();
u.empty();
i.closest(".search_filters").find(".localities_container").empty();
var r = $("option:selected", this).attr("data-country-code"),
f = $("option:selected", this).attr("data-top-location-level-id"),
e = $("option:selected", this).attr("data-id"),
o = r === "AU" ? f : "",
s = r === "AU" ? e : f,
h = r === "AU" ? "" : e;
t.load_suburbs(r, o, s, h)
.done(function (n) {
for (var r = "", t = 0, f = n.length; t < f; t++)
r +=
'' +
n[t].Label +
" ";
u.html(r);
i.closest(".search_filters")
.find(".search_for_properties")
.removeClass("disabled");
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert("Unable to download suburb list, please try again later");
});
});
r.on("click", ".search_filters .add_suburb", function (t) {
var s, i, e, o;
t.preventDefault();
var r = $(this).closest(".search_filters"),
u = $(this)
.closest(".district_suburb_selections")
.find(".select_suburb option:selected"),
y = u.text(),
f = u.attr("data-id"),
c = r.find(".selected_locality"),
h = !1;
if (
(f === "0" && r.find(".localities_container").empty(),
c.each(function () {
if (
($(this).find("span").attr("data-id") === "0" &&
f !== "0" &&
$(this).remove(),
$(this).find("span").attr("data-id") == f)
) {
$(this)
.fadeIn(80)
.fadeOut(80)
.fadeIn(80)
.fadeOut(80)
.fadeIn(80)
.fadeOut(80)
.fadeIn(80);
h = !0;
return;
}
}),
!h)
) {
s = r.find(".searching_country").attr("data-country-code");
i = { Country: s };
s === "AU"
? ((e = r.find(".select_region_or_district option:selected")),
(i.StateId = e.data("top-location-level-id")),
(i.RegionId = e.data("id")),
(i.Region = e.val()))
: ((o = r.find(".select_region_or_district option:selected")),
(i.RegionId = o.data("top-location-level-id")),
(i.DistrictId = o.data("id")),
(i.District = o.val()));
var l = { SuburbId: u.data("id"), Suburb: u.val() },
a = n.suburb_tag_label(i, l),
v =
' ' +
a +
' delete ';
r.find(".localities_container").append(v);
}
});
r.on("change", ".search_filters .strategy_select", function () {
var t = $(this).closest(".search_filters"),
i = $(".searching_country", t).attr("data-country-code");
n.display_strategy_keywords(
t.closest(".area_content"),
n.key_values[i].StrategiesCollection.StrategiesAndKeywords,
$(this).val()
);
$(".more_strategy_options", t).is(":visible") ||
($(".more_strategy_options", t).slideToggle(),
$(".show_more_strategy .linktext", t).toggle());
});
r.on(
"click",
".search_filters .strategy_keywords .select_all",
function () {
var n = $(this).is(":checked"),
t = $(this).closest("div");
t.find("input").prop("checked", n);
}
);
r.on(
"click",
".search_filters .strategy_keywords input:not(.select_all)",
function () {
var n = $(this).closest("div");
n.find(".select_all").prop("checked", !1);
}
);
r.on("click", ".search_filters .show_more_strategy", function (n) {
n.preventDefault();
var t = $(this).closest("section");
t.find(".more_strategy_options").slideToggle();
$(this).find(".linktext").toggle();
});
r.on("click", ".search_filters .show_more_location", function (n) {
n.preventDefault();
var t = $(this).closest("section");
t.find(".more_location_options").slideToggle();
$(this).toggleClass("more").find(".linktext").toggle();
});
r.on(
"change",
".search_filters select.advanced_location_search",
function () {
var i = $(this).val(),
t = $(this).closest(".more_location_options");
n.reset_advanced_location_options(t, !0);
t.find(".advanced_location_option").hide();
t.find(".advanced_location_option_" + i).show();
}
);
r.on("change_complete", ".search_filters .suburb_limit", function () {
$(this).val() === "" && $(this).removeData("chosen_suburb");
});
r.on("click", ".search_filters .show_more_property_specific", function (n) {
n.preventDefault();
var t = $(this).closest("section").parent();
t.find(".more_property_specific").slideToggle();
$(this).find(".linktext").toggle();
});
r.on("change", ".search_filters .dwelling_type_select", function (n) {
n.preventDefault();
var t = $(this).closest("section").find(".include_land_check");
$("option:selected", this).text().toLowerCase() === "all"
? t.closest(".include_land_control_container").show()
: t
.prop("checked", !1)
.closest(".include_land_control_container")
.hide();
});
r.on("click", ".search_filters .show_more_suburb_options", function (n) {
n.preventDefault();
var t = $(this).closest("section").parent();
t.find(".more_suburb_options").slideToggle();
$(this).find(".linktext").toggle();
});
r.on("click", ".reset_filters", function (t) {
t.preventDefault();
$search_form = $(this).closest(".area_content").find(".search_filters");
var i = $(".searching_country", $search_form).attr("data-country-code");
n.set_form_country($search_form, i);
$(".additional_keywords", $search_form).val("");
$(".exclude_keywords", $search_form).val("");
$(".include_land_check", $search_form).prop("checked", !1);
$(".include_duplicates", $search_form).prop("checked", !1);
});
$(".search_filters .area_input").autocomplete({
source: function (t, i) {
var u = this.element[0],
r = $(this.element[0])
.closest(".search_filters")
.find(".searching_country")
.attr("data-country-code");
$.ajax({
url: api_url(
r + "/KeyValues/AutoSuggest?countryCode=" + r + "&prefix=" + t.term,
"ParameterService"
),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
success: function (n) {
$(u).data("latest_matches", n);
i(
$.map(n.AutoSuburbs, function (n) {
return { label: n.Label, value: n.Label, suburb_record: n };
})
);
},
});
},
select: function (n, t) {
$(this).data("chosen_suburb", t.item.suburb_record);
},
minLength: 2,
});
$(
"#main_search .autocomplete_search_input, #edit_search_modal .autocomplete_search_input, #refine_search .autocomplete_search_input"
).autocomplete({
source: function (n, t) {
var i = this.element[0],
r = n.term,
u = $(i)
.closest(".search_filters")
.find(".searching_country")
.attr("data-country-code");
$.ajax({
url:
"https://sec.realestateinvestar.com/v1_0/address/suburbautocomplete.svc/API/Address/" +
u +
"/" +
r,
type: "get",
success: function (n) {
$(i).data("latest_matches", n);
t(
$.map(n, function (n) {
return { label: n.LocalityLabel };
})
);
},
});
},
minLength: 2,
});
r.on("change", ".search_filters .autocomplete_search_input", function () {
if (this.value === "") {
var n = $(this).closest(".search_filters");
$(".locality_input_warning", n).hide();
$(".autocomplete_search_input", n).removeData("latest_matches");
}
});
r.on(
"autocompleteselect",
".search_filters .autocomplete_search_input",
function (t, i) {
t.preventDefault();
n.add_selected_locality(
i.item.value,
$(this).closest(".search_filters")
);
$(this).val("");
$(this).removeData("latest_matches");
}
);
r.on("click", ".selected_locality", function () {
$(this).fadeOut("fast", function () {
$(this).remove();
});
});
r.on("click", "#search_search_screen .search_for_properties", function (n) {
if ((n.preventDefault(), !$(this).hasClass("disabled")))
if ($("#main_search .localities_container").children().length > 0)
t.perform_main_property_search();
else {
var i = $("#main_search .no_region_selected.active").length > 0;
i
? t.perform_main_property_search()
: ($("#main_search .add_suburb").trigger("click"),
t.perform_main_property_search());
}
});
};
this.open = function () {
set_area_display_status_v2(
"#search_search_screen .main_display",
"loading"
);
this.display_saved_searches();
this.display_watchlist();
n.populate_filters(n.get_user_country_code());
this.populate_email_alerts();
n.reset_advanced_location_options($("#main_search .more_location_options"));
set_area_display_status_v2("#search_search_screen .main_display", "", !0);
};
this.perform_main_property_search = function () {
if (n.check_locality_input($("#main_search"))) {
var i = t.get_search_request_data($("#main_search"));
set_area_display_status_v2(
"#search_search_screen .main_display",
"searching"
);
t.property_search(i)
.done(function (t) {
var r = new Date();
n.display_timing_readouts &&
console.log(
"Main search data loaded after: ",
(r - property_search_start) / 1e3
);
n.current_search = i;
n.search_results = t;
n.show_search_screen("results", !0);
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
(set_area_display_status_v2(
"#search_search_screen .main_display",
"",
!0
),
n.handle_backend_validation(t)) ||
(set_area_display_status_v2(
"#search_search_screen .main_display",
"search_failure",
!0
),
console.log(
"search failed while running search - jqXHR, textStatus, errorThrown:",
t,
i,
r
));
});
}
};
this.perform_asl_search = function (i) {
set_area_display_status_v2(
"#search_search_screen .main_display",
"searching"
);
t.asl_property_search(i)
.done(function (t) {
n.search_results = t;
$("#search_results_screen").data("asl_search", !0);
$("#search_results_screen .asl_search_message .property_type").text(
i.Category
);
$("#search_results_screen .asl_search_message .suburb").text(i.Suburb);
t.RowsCount > 0
? ((n.current_search = n.default_search),
(n.current_search.Country.CountryCode = t.CountryCode),
(n.current_search.Country.LocationBasics[0].Country = t.Country),
$("#search_results_screen").data("results_found", !0))
: ($("#search_results_screen").data("results_found", !1),
$(
"#search_results_screen .asl_search_message .results_found"
).hide(),
$(
"#search_results_screen .asl_search_message .no_results_found"
).show());
n.show_search_screen("results");
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
(set_area_display_status_v2(
"#search_search_screen .main_display",
"",
!0
),
n.handle_backend_validation(t)) ||
set_area_display_status_v2(
"#search_search_screen .main_display",
"search_failure",
!0
);
});
};
this.perform_htu_search = function (i) {
set_area_display_status_v2(
"#search_search_screen .main_display",
"searching"
);
t.htu_property_search(i)
.done(function (t) {
n.search_results = t;
$("#search_results_screen").data("htu_search", !0);
$("#search_results_screen .htu_search_message .property_type").text(
i.Category
);
$("#search_results_screen .htu_search_message .price_range").text(
i.ValueTo === ""
? i.ValueFrom === ""
? "of any price"
: "in the price range " + dollar_value(i.ValueFrom) + " and above"
: "in the price range " +
dollar_value(i.ValueFrom) +
" to " +
dollar_value(i.ValueTo)
);
$("#search_results_screen .htu_search_message .suburb").text(i.Suburb);
t.RowsCount > 0
? ((n.current_search = n.default_search),
(n.current_search.Country.CountryCode = t.CountryCode),
(n.current_search.Country.LocationBasics[0].Country = t.Country),
$("#search_results_screen").data("results_found", !0))
: ($("#search_results_screen").data("results_found", !1),
$(
"#search_results_screen .htu_search_message .results_found"
).hide(),
$(
"#search_results_screen .htu_search_message .no_results_found"
).show());
n.show_search_screen("results");
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
(set_area_display_status_v2(
"#search_search_screen .main_display",
"",
!0
),
n.handle_backend_validation(t)) ||
set_area_display_status_v2(
"#search_search_screen .main_display",
"search_failure",
!0
);
});
};
this.load_and_execute_saved_search = function (i) {
t.load_saved_search(i)
.done(function (i) {
for (
var r = i, u = 0, f = r.Country.StrategyTypeKeywords.length;
u < f;
u++
)
r.Country.StrategyTypeKeywords[u].keyword === "Please Select..." &&
r.Country.StrategyTypeKeywords.splice(u, 1);
set_area_display_status_v2(
"#search_search_screen .main_display",
"searching"
);
t.property_search(r)
.done(function (t) {
n.current_search = r;
n.search_results = t;
n.show_search_screen("results", !0);
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
set_area_display_status_v2(
"#search_search_screen .main_display",
"search_failure",
!0
);
console.log(
"search failed while running saved search - jqXHR, textStatus, errorThrown:",
t,
i,
r
);
});
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
set_area_display_status_v2(
"#search_search_screen .main_display",
"search_failure",
!0
);
console.log(
"search failed while preparing to run saved search - jqXHR, textStatus, errorThrown:",
t,
i,
r
);
});
};
this.display_saved_searches = function () {
this.load_saved_searches()
.done(function (n) {
var i, t, r;
if (
typeof n.SavedSearch == "undefined" ||
n.SavedSearch === null ||
n.SavedSearch.length === 0
) {
$(
"#search_search_screen .saved_investor_searches .some_saved_searches"
).hide();
$(
"#search_search_screen .saved_investor_searches .no_saved_searches"
).show();
return;
}
for (
i = n.SavedSearch,
$(
"#search_search_screen .saved_investor_searches .some_saved_searches tbody"
).empty(),
$(
"#search_search_screen .saved_investor_searches .no_saved_searches"
).hide(),
$(
"#search_search_screen .saved_investor_searches .some_saved_searches"
).show(),
t = 0;
t < i.length;
t++
)
(r = $("
")),
r.append(
$('').append(
$('')
.attr("class", "run_saved_search")
.attr("data-saved-search-id", i[t].Id)
.text(i[t].Title)
)
),
r.append($(' ').text(i[t].WhenAdded)),
($edit_link = $("")
.attr("class", "edit_search")
.attr("data-saved-search-id", i[t].Id)
.attr("data-email-alert-frequency-id", i[t].SavedSearchAlertFK)
.attr("data-date-added", i[t].WhenAdded)
.attr("data-reveal-id", "edit_search_modal")
.attr("data-reveal", "")
.text("Edit")),
r.append($(' ').append($edit_link)),
r.append(
' '
),
r.appendTo(
"#search_search_screen .saved_investor_searches .some_saved_searches tbody"
),
(r = $(' ')),
r.append($("").text(i[t].Title)),
r.append(
' Confirmdelete?
'
),
r.appendTo(
"#search_search_screen .saved_investor_searches .some_saved_searches tbody"
);
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert("Sorry we are unable to load saved searches at this time.");
});
};
this.display_saved_search = function (t, i, r) {
set_area_display_status("#edit_search_modal", "loading");
this.load_saved_search(t)
.done(function (t) {
var u = t,
o = $('#edit_search_modal select[name="email_frequency"]'),
e,
f,
s;
if (!$.trim(o.html()))
for (e = n.email_alerts, f = 0, s = e.length; f < s; f++)
$("")
.attr("value", e[f].DB_Value)
.text(e[f].Label)
.appendTo(o);
$(
'#edit_search_modal select[name="email_frequency"] option[value="' +
i +
'"]'
).prop("selected", !0);
$("#edit_search_modal h2 span").text(" - " + u.Country.Title);
$("#edit_search_modal .search_date_created").text("Created " + r);
$("#edit_search_modal .saved_search_id").attr(
"value",
u.Country.SavedSearchId
);
$("#edit_search_modal .search_title").attr("value", u.Country.Title);
$("#edit_search_modal .searching_country").attr(
"data-country-code",
u.Country.CountryCode
);
n.set_search_form(u, $("#edit_search_modal form"));
set_area_display_status("#edit_search_modal", "loaded");
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
set_area_display_status("#edit_search_modal", "failed");
});
};
this.display_watchlist = function () {
n.watchlist
.update_watchlist_object()
.done(function () {
var r = n.watchlist.watchlist,
u;
if (
(r.length === 0 &&
$("#search_search_screen .investor_watchlist tbody").html(
'You currently have no properties in your watchlist. '
),
typeof r == "undefined" || r === null || r.length === 0)
) {
$(
"#search_search_screen .investor_watchlist .some_watchlist_props"
).hide();
$(
"#search_search_screen .investor_watchlist .no_watchlist_props"
).show();
return;
}
for (
$(
"#search_search_screen .investor_watchlist .some_watchlist_props tbody"
).empty(),
$(
"#search_search_screen .investor_watchlist .no_watchlist_props"
).hide(),
$(
"#search_search_screen .investor_watchlist .some_watchlist_props"
).show(),
u = 0;
u < r.length;
u++
) {
var t = r[u],
f =
t.StreetAddress +
(t.Suburb === "" ? "" : ", " + toTitleCase(t.Suburb)) +
(t.StateRegion === "" ? "" : ", " + t.StateRegion) +
(t.Postcode === "" ? "" : ", " + t.Postcode),
i = $("");
$('')
.append(
$("")
.text(f)
.attr("data-watchlist-id", t.WatchlistID)
.attr("data-country-code", t.CountryID)
.attr("data-property-id", t.PropertyID)
.attr("data-link-id-hash", t.LinkIDHash)
.attr("data-reveal", "")
.attr("class", "show_watched_property")
)
.appendTo(i);
$(' ').text(t.BedRooms).appendTo(i);
$(' ').text(t.BathRooms).appendTo(i);
$(' ').text(t.Carport).appendTo(i);
i.append(
' '
);
i.appendTo(
"#search_search_screen .investor_watchlist .some_watchlist_props tbody"
);
i = $(' ');
i.append($('').text(f));
i.append(
' Confirmdelete?
'
);
i.appendTo(
"#search_search_screen .investor_watchlist .some_watchlist_props tbody"
);
}
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert("Sorry, we're not able to load your watchlist at this time.");
});
};
this.populate_email_alerts = function () {
for (var i = "", t = 0, r = n.email_alerts.length; t < r; t++)
i +=
'' +
n.email_alerts[t].Label +
" ";
$("#save_search_modal .email_frequency").html(i);
};
this.populate_dropdown_filters = function (t, i, r) {
var l = i === "AU" ? "FilterStateID" : "FilterRegionID",
a = i === "AU" ? "State" : "Regions",
s = i === "AU" ? "Regions" : "Districts",
v = i === "AU" ? "FilterRegionID" : "FilterDistrictID",
f,
e,
o,
u,
h,
c;
for (
t.find(".searching_country").attr("data-country-code", i),
t.find(".sub_level_location_name").text(s.slice(0, -1).toLowerCase()),
e = n.key_values[i]["LocationBasic" + i + "Collection"][a],
u = 0;
u < e.length;
u++
)
if (e[u][l] === parseInt(r)) {
f = e[u][s];
break;
}
for (
o = $("select.select_region_or_district", t).empty(), u = 0, h = f.length;
u < h;
u++
)
(c = $("")
.attr("data-id", f[u][v])
.attr("data-country-code", i)
.attr("data-top-location-level-id", r)
.text(f[u].Label)),
o.append(c);
o.trigger("change", !0);
};
this.get_search_request_data = function (i) {
function ut() {
c = i.find(".selected_locality");
c.each(function () {
it.push({ Locality: $(this).find("span").text() });
});
}
var f = i.find(".searching_country").attr("data-country-code"),
h,
l,
a,
v,
g,
nt,
tt,
y = "",
p = "",
w = "",
it = [],
o = [],
rt,
e,
c,
r,
u,
b,
s,
k,
d;
t.finalise_search();
rt = { Country: f, State: y, Region: p, District: w };
e = rt;
i.find(".district_suburb_selections").is(":visible") || ut();
r = null;
$(".advanced_location_search option:selected", i).val() ===
"limit_suburb_au"
? ((r = $(".suburb_limit", i).data("chosen_suburb")),
typeof r != "undefined" &&
((e.State = n.find_label(
n.key_values.AU.LocationBasicsAU.States,
r.FilterStateID,
"FilterStateID"
)),
(e.StateId = r.FilterStateID),
(e.RegionId = r.FilterRegionID),
(o = [{ Suburb: r.Suburb, SuburbId: r.FilterSuburbID }])))
: $(".advanced_location_search option:selected", i).val() ===
"limit_suburb_nz"
? ((r = $(".of_suburb", i).data("chosen_suburb")),
typeof r != "undefined" &&
((e.Region = n.find_label(
n.key_values.NZ.LocationBasicsNZ.Regions,
r.FilterRegionID,
"FilterRegionID"
)),
(e.RegionId = r.FilterRegionID),
(e.District = ""),
(e.DistrictId = r.FilterDistrictID),
(o = [{ Suburb: r.Suburb, SuburbId: r.FilterSuburbID }])))
: i.find(".district_suburb_selections").is(":visible") &&
((h = i
.find(".select_region_or_district option:selected")
.attr("data-top-location-level-id")),
(l = i
.find(".select_region_or_district option:selected")
.attr("data-id")),
(a =
f === "AU"
? n.find_label(
n.key_values.AU.LocationBasicsAU.States,
h,
"FilterStateID"
)
: n.find_label(
n.key_values.NZ.LocationBasicsNZ.Regions,
h,
"FilterRegionID"
)),
(v = i.find(".select_region_or_district option:selected").val()),
(g = f === "AU" ? h : ""),
(nt = f === "AU" ? l : h),
(tt = f === "AU" ? "" : l),
(y = f === "AU" ? a : ""),
(p = f === "AU" ? v : a),
(w = f === "AU" ? "" : v),
(e = {
Country: f,
StateId: g,
State: y,
Region: p,
RegionId: nt,
DistrictId: tt,
District: w,
}),
(c = i.find(".selected_locality")),
c.each(function () {
o.push({
SuburbId: $(this).find("span").attr("data-id"),
Suburb: $(this).find("span").text(),
});
}),
o.length === 0 &&
(o = [
{
SuburbId: i
.find(".select_suburb option:selected")
.attr("data-id"),
Suburb: i.find(".select_suburb option:selected").text(),
},
]));
u = {
locationSearchType: "",
limitPostcode: "",
limitStreet: "",
limitSuburb: "",
postcodeRadiusFrom: "",
postcodeRadiusTo: "",
ofPostcode: "",
suburbRadiusFrom: "",
suburbRadiusTo: "",
OflimitSuburb: "",
selectedSuburbType: "",
};
switch (i.find(".advanced_location_search option:selected").val()) {
case "limit_postcode":
s = i.find(".postcode_limit").val();
s !== "" &&
((u.locationSearchType = "postcodeLimit"), (u.limitPostcode = s));
break;
case "limit_address":
b = i.find(".street_name").val();
b !== "" &&
((u.locationSearchType = "addressLimit"), (u.limitStreet = b));
break;
case "limit_suburb_nz":
r !== undefined &&
((u.locationSearchType = "suburbLimit"),
(u.suburbRadiusFrom = i.find(".suburb_radius_from").val()),
(u.suburbRadiusTo = i.find(".suburb_radius_to").val()),
($(".suburb_radius_from option:first", i).prop("selected") &&
$(".suburb_radius_to option:first", i).prop("selected")) ||
(u.OflimitSuburb = r.Suburb));
break;
case "limit_suburb_au":
r !== undefined &&
((u.locationSearchType = "suburbLimit"), (u.limitSuburb = r.Suburb));
break;
case "radius":
s = i.find(".of_postcode").val();
s !== "" &&
((u.locationSearchType = "postcodeRadius"),
(u.postcodeRadiusFrom = i.find(".postcode_radius_from").val()),
(u.postcodeRadiusTo = i.find(".postcode_radius_to").val()),
(u.ofPostcode = s));
break;
case "classification":
k = i.find('input[name="suburb_classification"]:checked').val() || "";
k !== "" &&
((u.locationSearchType = "suburbtype"), (u.selectedSuburbType = k));
}
return (
(d = []),
i.find(".strategy_keywords input:not(:first)").each(function () {
if ($(this).prop("checked")) {
var n = {
keywordId: $(this).val(),
keyword: $(this).attr("data-keyword"),
};
d.push(n);
}
}),
{
Country: {
MemberID: n.get_modules_id(),
Limit: "200",
Title: "",
OrderBy: "1",
CountryCode: f,
Strategy: [
{
strategyTypeId: i.find(".strategy_select").val(),
strategyType: i.find(".strategy_select option:selected").text(),
keywords: i.find(".additional_keywords").val(),
KeywordsOperand: i
.find(".keyword_include_type option:selected")
.text(),
KeywordsOperandId: i
.find(".keyword_include_type option:selected")
.val(),
exclude: i.find(".exclude_keywords").val(),
ExcludedKeywordsOperand: i
.find(".keyword_exclude_type option:selected")
.text(),
ExcludedKeywordsOperandId: i
.find(".keyword_exclude_type option:selected")
.val(),
},
],
StrategyTypeKeywords: d,
PropertySpecifics: [
{
dwellingType: i.find(".dwelling_type_select").val(),
includeLand: i
.find(".include_land_check")
.prop("checked")
.toString(),
priceFrom: i.find(".min_budget_select").val(),
priceTo: i.find(".max_budget_select").val(),
bedRoomMin: i.find(".bedrooms_select.min").val(),
bedRoomMax: i.find(".bedrooms_select.max").val(),
bathRoomMin: i.find(".bathrooms_select.min").val(),
bathRoomMax: i.find(".bathrooms_select.max").val(),
carPortMin: i.find(".carports_select.min").val(),
carPortMax: i.find(".carports_select.max").val(),
landSizeMin: i.find(".landsize_min").val(),
landSizeMax: i.find(".landsize_max").val(),
},
],
LocationAdvanced: [u],
LocationBasicsSuburbs: o,
SuburbStatistics: [
{
suburbMedianMin: i.find(".suburb_price_median_min").val(),
suburbMedianMax: i.find(".suburb_price_median_max").val(),
vacancyRateMin: i.find(".vacancy_rate_min").val(),
vacancyRateMax: i.find(".vacancy_rate_max").val(),
listingMedianMin: i.find(".suburb_median_min").val(),
listingMedianMax: i.find(".suburb_median_max").val(),
rentalYieldMin: i.find(".suburb_rental_yield_min").val(),
rentalYieldMax: i.find(".suburb_rental_yield_max").val(),
oneYrGrowthMin: i.find(".suburb_growth_min").val(),
oneYrGrowthMax: i.find(".suburb_growth_max").val(),
populationMin: i.find(".population_min").val(),
populationMax: i.find(".population_max").val(),
daysOnMarketMin: i.find(".days_on_market_min").val(),
daysOnMarketMax: i.find(".days_on_market_max").val(),
},
],
ListingDetail: [
{
propertyYieldMin: i.find(".property_yield_min").val(),
propertyYieldMax: i.find(".property_yield_max").val(),
listingAgeMin: i.find(".listing_age_min").val(),
listingAgeMax: i.find(".listing_age_max").val(),
showDuplicates:
i.find(".include_duplicates").prop("checked") !== undefined
? i.find(".include_duplicates").prop("checked").toString()
: "false",
},
],
LocationBasics: [e],
},
Locality: it,
}
);
};
this.load_suburbs = function (t, i, r, u) {
return $.ajax({
url: api_url(
"KeyValues/Suburbs?countryCode=" +
t +
"&stateId=" +
i +
"®ionId=" +
r +
"&districtId=" +
u,
"ParameterService"
),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.show_property_in_modal = function (r, u) {
var f, e, p, c, h, y;
typeof u == "undefined" && (u = !1);
$("#property_detail_modal .loading_failure_alert").hide();
$("#property_detail_modal .not_found_message").hide();
$("#watched_property_details").empty();
$("#property_detail_modal .loading_watched_property").show();
$("#property_detail_modal").foundation("reveal", "open");
f = $("#search_results_screen .search_result_template").clone();
f.removeClass("search_result_template");
f.removeClass("hide");
u &&
($(".comments_feature", f).show(),
$(".attachments_feature", f).show(),
(t.watchlist_comments = new WatchlistComments($(".comments_view", f), n)),
(t.watchlist_attachments = new WatchlistAttachments(
$(".attachments_view", f),
n
)));
var o = [],
l = new $.Deferred(),
a = new $.Deferred(),
s = new $.Deferred(),
v = new $.Deferred();
o.push(l);
o.push(a);
o.push(s);
o.push(v);
y = !0;
n.results_screen
.get_property_details(r)
.done(function (t) {
var u, r, i;
if (t.Result.length === 0) {
y = !1;
return;
}
if (
((e = t),
l.resolve(),
n.results_screen
.get_archistar_stats(
n.get_modules_id(),
e.Result[0].PropertyDetails.Country,
"",
"",
"",
""
)
.done(function (n) {
c = n;
v.resolve();
})
.fail(function () {
v.reject();
}),
(u = {
MemberId: n.get_modules_id(),
PropertyCountryCode: t.Result[0].PropertyDetails.Country,
PropertyLinkId: t.Result[0].PropertyDetails.LinkIDHash,
UserCountryCode: n.get_user_country_code(),
Website: t.Result[0].PropertyDetails.Website,
WebsiteMode: t.Result[0].PropertyDetails.WebsiteMode,
MemberName: n.get_member_name(),
}),
n.results_screen
.get_snapshot_analysis(u)
.done(function (n) {
p = n;
a.resolve();
})
.fail(function () {
a.reject();
}),
(r = !1),
e.Result[0].PropertyDetails.StreetAddress.length > 0 &&
e.Result[0].PropertyDetails.Country.toLowerCase() == "au")
)
for (
i = 0;
i < e.Result[0].PropertyDetails.StreetAddress.length;
i++
) {
if (
!isNaN(
parseInt(
e.Result[0].PropertyDetails.StreetAddress.substring(i, i + 1)
)
)
) {
r = !0;
break;
}
h = c;
s.resolve();
}
else (h = c), s.resolve();
r &&
n.results_screen
.get_archistar_stats(
n.get_modules_id(),
e.Result[0].PropertyDetails.Country,
e.Result[0].PropertyDetails.StreetAddress,
e.Result[0].PropertyDetails.Suburb,
e.Result[0].PropertyDetails.StateRegion,
e.Result[0].PropertyDetails.Postcode
)
.done(function (n) {
h = n;
s.resolve();
})
.fail(function () {
h = c;
s.resolve();
});
})
.fail(function () {
l.reject();
});
$.when
.apply($, o)
.done(function () {
if (!y) {
$("#property_detail_modal .loading_watched_property").hide();
$("#property_detail_modal .not_found_message").show();
return;
}
var o = e.Result[0],
s = p,
c = h;
f.data("property_details", e.Result[0].PropertyDetails);
f.data("watchlist_id", r.WatchlistID);
f = n.results_screen.populate_listing_template(f, "WLP", o, s, c);
i = new SS_set(o);
u &&
($.ajax({
url: api_url("Comments/" + r.WatchlistID),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function (n) {
t.watchlist_comments.set_data(r.WatchlistID, n.Comments);
t.watchlist_comments.populate_comments();
}),
$.ajax({
url: api_url("Watchlist/" + r.WatchlistID),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function () {
t.watchlist_attachments.set_watchlist_id(r.WatchlistID);
t.watchlist_attachments.show_attachment_list();
}));
$("#property_detail_modal .loading_watched_property").hide();
f.appendTo("#watched_property_details");
o.PropertyDetails.Country === "AU"
? $("#watched_property_details .au_only").show()
: $("#watched_property_details .au_only").hide();
i.plot_mp_graph(o.CountryCode, f, "WLP");
})
.fail(function (t, i, r) {
if (
($("#property_detail_modal .loading_watched_property").hide(),
typeof t != "undefined" && n.check_session_expiry(t, i, r))
) {
n.handle_session_expiry(t);
return;
}
$("#property_detail_modal .loading_failure_alert").show();
});
};
this.property_search = function (t) {
var i, r;
return (
(property_search_start = new Date()),
n.display_timing_readouts &&
console.log("Performing property search at: ", property_search_start),
(i = t.Country.CountryCode),
(r = n.find_id(
n.key_values[i].PropertySpecifics.DwellingTypes,
"FilterDwellingTypeID",
"Land",
"Label"
)),
r !== "" &&
String(t.Country.PropertySpecifics[0].dwellingType) === String(r) &&
(t.Country.PropertySpecifics[0].includeLand = "true"),
$.ajax({
url: api_url(i + "/Search/Summary/", "PropertySearchService"),
type: "POST",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 12e4,
})
);
};
this.asl_property_search = function (t) {
return $.ajax({
url: api_url(
t.CountryCode + "/Search/AllSales/",
"PropertySearchService"
),
type: "POST",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 12e4,
});
};
this.htu_property_search = function (t) {
return $.ajax({
url: api_url(
t.CountryCode + "/Search/CategoryTypeSaleListings/",
"PropertySearchService"
),
type: "POST",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 12e4,
});
};
this.save_property_search = function (t) {
return $.ajax({
url: api_url("/SavedSearch/", "PropertySearchService"),
type: "POST",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.save_email_frequency = function (t, i) {
var r = {
MemberId: n.get_modules_id(),
FilterEmailAlertSchedule: [{ FilterEmailAlertScheduleId: t }],
SavedSearch: [{ Id: i }],
};
return $.ajax({
url: api_url("/SavedSearch/EmailAlert/", "PropertySearchService"),
type: "POST",
data: JSON.stringify(r),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.load_saved_searches = function () {
return $.ajax({
url: api_url(
"/SavedSearch/" + n.get_modules_id(),
"PropertySearchService"
),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.load_saved_search = function (t) {
return $.ajax({
url: api_url("/SavedSearch?SavedSearchId=" + t, "PropertySearchService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function (n) {
n.Country.LocationAdvanced[0].locationSearchType === "suburbLimit" &&
(n.Country.LocationAdvanced[0].limitSuburb === "" ||
n.Country.LocationAdvanced[0].limitSuburb === null) &&
(n.Country.LocationAdvanced[0].locationSearchType = "");
(n.Country.LocationAdvanced[0].locationSearchType === null ||
n.Country.LocationAdvanced[0].locationSearchType === "") &&
n.Country.LocationAdvanced[0].OflimitSuburb !== "" &&
n.Country.LocationAdvanced[0].OflimitSuburb !== null &&
(n.Country.LocationAdvanced[0].locationSearchType = "suburbLimit");
});
};
this.update_saved_search = function (t) {
return $.ajax({
url: api_url("/SavedSearch/", "PropertySearchService"),
type: "PUT",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.delete_saved_search = function (t) {
return $.ajax({
url: api_url(
"/SavedSearch?MemberId=" + n.get_modules_id() + "&SavedSearchId=" + t,
"PropertySearchService"
),
type: "DELETE",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.get_region_or_state_id = function (t, i) {
var u,
f = n.key_values.AU.LocationBasicsAU.States,
e = n.key_values.NZ.LocationBasicsNZ.Regions,
r;
if (t === "AU") {
for (r = 0; r < f.length; r++)
if (f[r].Label === i) {
u = f[r].FilterStateID;
break;
}
} else
for (r = 0; r < e.length; r++)
if (e[r].Label === i) {
u = e[r].FilterRegionID;
break;
}
return u;
};
this.finalise_search = function (n) {
var u = $(".searching_country", n).attr("data-country-code"),
t,
r = $(".advanced_location_search option:selected", n).val(),
i;
switch (r) {
case "limit_suburb_au":
t = $(".suburb_limit", n);
break;
case "limit_suburb_nz":
t = $(".of_suburb", n);
break;
default:
t = null;
}
t !== null &&
t.val() !== "" &&
((t.data("chosen_suburb") !== undefined &&
t.val() === t.data("chosen_suburb").Label) ||
(t.removeData("chosen_suburb"),
t.data("latest_matches") !== undefined
? t.data("latest_matches").AutoSuburbs.length === 1
? ((i = t.data("latest_matches").AutoSuburbs[0]),
i.Label.substr(0, t.val().length).toLowerCase() ===
t.val().toLowerCase()
? t
.data(
"chosen_suburb",
t.data("latest_matches").AutoSuburbs[0]
)
.val(t.data("latest_matches").AutoSuburbs[0].Label)
: t.removeData("chosen_suburb"))
: t.removeData("chosen_suburb")
: t.removeData("chosen_suburb")));
t !== null &&
t.val() !== "" &&
t.data("chosen_suburb") === undefined &&
(t.val("").removeData("chosen_suburb"),
$(".advanced_location_search option:first", n).prop("selected", !0));
};
this.initialise();
}
function IS_results_screen(n) {
var t = this,
i,
r = {};
this.initialise = function () {
var r = $(document);
r.on("click", "#search_results_screen .default_profile_link", function (i) {
return (
i.preventDefault(),
n.user_profile.open_editor(function () {
t.re_run_search(n.current_search);
}),
!1
);
});
r.on("click", "#search_results_screen .remove_criteria", function (n) {
n.preventDefault();
t.reset_screen();
t.update_search($(this).data("reset_data"));
});
r.on(
"click",
"#search_results_screen .show_market_stats_button",
function (n) {
n.preventDefault();
var i = $(this).closest(".search_result");
t.toggle_listing_detail(i);
$(document).scrollTo(i);
}
);
r.on(
"click",
"#search_results_screen .show_all_results_expanded_link",
function (i) {
i.preventDefault();
var r = !n.show_all_results_expanded,
u = $(this)
.closest(".area_content")
.find(".search_results .search_result");
u.each(function () {
t.toggle_listing_detail($(this), r);
});
$(this).text(r ? "Collapse all listings" : "Expand all listings");
n.save_search_results_view_option(r);
}
);
r.on(
"click",
"#search_results_screen .result_pagination_controls a.paging",
function (n) {
n.preventDefault();
var t = $(this).attr("data-page");
i.display_results_page(t);
}
);
r.on("change", "#search_results_screen .sort_order", function () {
t.reset_screen();
set_area_display_status(
"#search_results_screen .main_display",
"loading"
);
n.current_search.Country.OrderBy = $(this).val();
n.search_screen
.property_search(n.current_search)
.done(function (i) {
n.search_results = i;
t.open();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert(
"Unable to reorder search at this time, please try again later."
);
});
});
r.on("click", ".pagination_count", function (n) {
n.preventDefault();
i.set_pagination_count(parseInt($(this).data("pcount")));
i.display_results_page(0);
});
r.on("click", ".add_to_watchlist", function (t) {
t.preventDefault();
$this_link = $(this);
var i = $(this).closest(".search_result").attr("data-country"),
r = $(this).closest(".search_result").attr("data-linkidhash"),
u = $(this).closest(".search_result").attr("data-website"),
f = $(this).closest(".search_result").attr("data-websitemode");
n.watchlist
.add_property_to_watchlist(i, r, u, f)
.done(function () {
$this_link
.removeClass("add_to_watchlist")
.addClass("remove_from_watchlist");
n.search_screen.display_watchlist();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert(
"Sorry unable to save to watchlist at this time, please try again later"
);
});
});
r.on("click", ".remove_from_watchlist", function (t) {
t.preventDefault();
$this_link = $(this);
var i = $(this).closest(".search_result").attr("data-linkidhash"),
r = n.watchlist.find_watchlist_id(i);
n.watchlist
.remove_property_from_watchlist(r)
.done(function () {
$this_link
.removeClass("remove_from_watchlist")
.addClass("add_to_watchlist");
n.search_screen.display_watchlist();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert(
"Sorry unable to save to watchlist at this time, please try again later"
);
});
});
r.on("click", ".property_picture", function (n) {
n.preventDefault();
window.open($(this).data("href"), "_blank");
});
r.on("click", ".google_street_view_link", function (n) {
n.preventDefault();
window.open($(this).data("href"), "_blank");
});
r.on("click", ".snapshot_tooltip", function () {
var h = $(this).offset(),
c = $(this).closest(".search_result"),
t = $(this)
.closest(".search_screen")
.find(".snapshot_explanation_modal"),
n,
r;
if (t.is(":visible")) t.hide();
else {
if (
((n = c.data("property_snapshot_data")),
n.LongTermGrowthPropertyType !== null)
)
switch (n.LongTermGrowthPropertyType.toLowerCase()) {
case "house":
r = "houses";
break;
case "unit":
r = "units";
break;
default:
r = n.LongTermGrowthPropertyType.toLowerCase() + " properties";
}
var u = "",
i = "",
f = !0,
e = parseFloat(n.LongTermGrowthSuburbRate),
o = parseFloat(n.LongTermGrowthPostcodeRate),
s = parseFloat(n.LongTermGrowthRegionRate);
!isNaN(e) && e < 10
? ((i = e), (u = n.LongTermGrowthSuburb))
: !isNaN(o) && o < 10
? ((i = o), (u = n.LongTermGrowthPostcode))
: !isNaN(s) && s < 10
? ((i = s), (u = n.LongTermGrowthRegion))
: n.CountryCode == "NZ"
? ((f = !1), (i = n.UserCapitalGrowth || 6))
: ((f = !1), (i = n.LongTermGrowthSuburbRate));
n.OverTen === ""
? t
.find(".property_type")
.text(r)
.end()
.find(".suburb")
.text(u)
.end()
.find(".long_term_trend")
.html(percentage_2dp(i, !1))
: t.find(".long_term_growth_message").html(n.OverTen);
t.css({ top: h.top, left: h.left }).show();
$(".analysis", t).toggle(f);
$(".default", t).toggle(!f);
}
});
r.on("mouseenter", ".snapshot_tooltip", function () {
$(this)
.closest(".search_screen")
.find(".snapshot_explanation_modal")
.addClass("shown_on_mouseenter");
$(this).trigger("click");
});
r.on("mouseleave", ".snapshot_tooltip", function () {
$(this)
.closest(".search_screen")
.find(".snapshot_explanation_modal")
.hasClass("shown_on_mouseenter") &&
$(this)
.closest(".search_screen")
.find(".snapshot_explanation_modal")
.removeClass("shown_on_mouseenter")
.hide();
});
r.on("click", ".snapshot_explanation_modal", function () {
$(this).hide();
});
r.on("click", ".mpc_graph_tooltip", function () {
var t = $(this).offset(),
i = $(this).closest(".search_result"),
n = $(this)
.closest(".search_screen")
.find(".mpc_graph_explanation_modal");
n.is(":visible") ? n.hide() : n.css({ top: t.top, left: t.left }).show();
});
r.on("mouseenter", ".mpc_graph_tooltip", function () {
$(this)
.closest(".search_screen")
.find(".mpc_graph_explanation_modal")
.addClass("shown_on_mouseenter");
$(this).trigger("click");
});
r.on("mouseleave", ".mpc_graph_tooltip", function () {
$(this)
.closest(".search_screen")
.find(".mpc_graph_explanation_modal")
.hasClass("shown_on_mouseenter") &&
$(this)
.closest(".search_screen")
.find(".mpc_graph_explanation_modal")
.removeClass("shown_on_mouseenter")
.hide();
});
r.on("click", ".mpc_graph_explanation_modal", function () {
$(this).hide();
});
r.on("click", ".analyse_in_full_button", function (t) {
t.preventDefault();
var i = $(this).closest(".search_result"),
r = i.attr("data-linkidhash"),
f = i.attr("data-country"),
e = i.attr("data-website"),
o = i.attr("data-websitemode"),
u = n.watchlist.find_watchlist_id(r),
s = {
country_code: f,
link_id_hash: r,
website: e,
website_mode: o,
watchlist_id: u ? u : "",
},
h =
$("#search_tool").data(
"rei_analyser_url_" + n.get_user_country_code().toLowerCase()
) +
"&analyse&data=" +
encodeURIComponent(btoa(JSON.stringify(s)));
window.open(h, "_blank");
});
r.on(
"click",
"#search_results_screen .refine_search_bar, #search_results_screen .refine_search_thumb, #search_results_screen .refine_search_close_button",
function () {
var n = $("#search_results_screen .refine_search");
if (n.hasClass("hide")) {
var t = $(".search_results").offset().top,
i = $(document).scrollTop(),
r = 0;
i > t && (r = i - t + 20);
n.css({ top: r });
n.removeClass("hide").show();
} else n.addClass("hide").hide();
}
);
r.on(
"click",
"#search_results_screen .search_for_properties",
function (i) {
if (
(i.preventDefault(),
n.check_locality_input($("#search_results_screen")))
) {
var r = n.search_screen.get_search_request_data($("#refine_search"));
set_area_display_status(
"#search_results_screen .main_display",
"loading"
);
$("#search_results_screen .refine_search")
.slideToggle()
.addClass("hide");
t.re_run_search(r);
}
}
);
r.on("click", ".asl_listing_search_link", function (t) {
t.preventDefault();
var i = $(this).closest(".search_result").data("property_details"),
r =
"&country_code=" +
(i.Country.toUpperCase() || "") +
"&state_region=" +
(i.StateRegion || "") +
"&district=" +
(i.District || "") +
"&postcode=" +
(i.Postcode || "") +
"&suburb=" +
(i.Suburb || "") +
"&category=" +
($(this).data("dwelling_type") || ""),
u =
$("#search_tool").data(
"rei_search_url_" + n.get_user_country_code().toLowerCase()
) +
"asl_search" +
r;
window.open(u, "_blank");
});
r.on("click", ".htu_listing_search_link", function (t) {
t.preventDefault();
var i = $(this).closest(".search_result").data("property_details"),
r =
"&country_code=" +
(i.Country.toUpperCase() || "") +
"&state_region=" +
(i.StateRegion || "") +
"&district=" +
(i.District || "") +
"&postcode=" +
(i.Postcode || "") +
"&suburb=" +
(i.Suburb || "") +
"&category=" +
(i.DwellingType || "") +
"&price_from=" +
($(this).data("price_from") || "") +
"&price_to=" +
($(this).data("price_to") || ""),
u =
$("#search_tool").data(
"rei_search_url_" + n.get_user_country_code().toLowerCase()
) +
"htu_search" +
r;
window.open(u, "_blank");
});
r.on("error", ".search_result img.property_picture", function () {
t.image_error(this);
});
};
this.open = function () {
var t, r;
i = new IS_result_pages(n);
$("#search_results_screen").data("asl_search")
? ((t = $("#search_results_screen").data("results_found")),
$("#search_results_screen .save_this_search").hide(),
$("#search_results_screen .refine_search_bar").hide(),
$("#search_results_screen .refine_search_thumb").hide(),
$("#search_results_screen .keep_refining_message").hide(),
$("#search_results_screen .asl_search_message.results_found").toggle(t),
$("#search_results_screen .asl_search_message.no_results_found").toggle(
!t
),
this.display_search_results("asl_search"))
: $("#search_results_screen").data("htu_search")
? ((r = $("#search_results_screen").data("results_found")),
$("#search_results_screen .save_this_search").hide(),
$("#search_results_screen .refine_search_bar").hide(),
$("#search_results_screen .refine_search_thumb").hide(),
$("#search_results_screen .keep_refining_message").hide(),
$("#search_results_screen .htu_search_message.results_found").toggle(r),
$("#search_results_screen .htu_search_message.no_results_found").toggle(
!r
),
this.display_search_results("htu_search"))
: ($("#search_results_screen .refine_search").addClass("hide").hide(),
this.display_active_filters(),
i.get_number_of_results() !== 0 && this.display_sorting_options(),
n.set_search_form(n.current_search, $("#refine_search")),
this.display_search_results("standard_search"));
$("#search_results_screen .show_all_results_expanded_link").text(
n.show_all_results_expanded
? "Collapse all listings"
: "Expand all listings"
);
};
this.re_run_search = function (i) {
n.search_screen
.property_search(i)
.done(function (r) {
t.reset_screen();
n.current_search = i;
n.search_results = r;
t.open();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
(set_area_display_status(
"#search_results_screen .main_display",
"loaded"
),
$("#search_results_screen .refine_search")
.slideToggle()
.removeClass("hide"),
n.handle_backend_validation(t)) ||
set_area_display_status(
"#search_results_screen .main_display",
"failed"
);
});
};
this.display_active_filters = function () {
var c, s, o, v, e, h, l, a, r, i;
$("#search_results_screen .currently_active_filters").empty();
var t = n.current_search,
f = n.default_search,
u = n.key_values,
y = n.search_type(t);
switch (y) {
case "locality":
for (c = t.Locality, o = 0; o < c.length; o++)
(r = c[o].Locality),
(i = [{ type: "locality", name: r }]),
this.create_criteria_button(r, i);
break;
case "suburb":
if (t.Country.LocationAdvanced[0].locationSearchType !== "suburbLimit")
for (
s = t.Country.LocationBasicsSuburbs, o = 0, v = s.length;
o < v;
o++
)
(r = n.suburb_tag_label(t.Country.LocationBasics[0], s[o])),
(i = [{ type: "location_suburb", id: s[o].SuburbId }]),
this.create_criteria_button(r, i);
}
e = t.Country.LocationAdvanced[0];
i = [{ type: e.locationSearchType }];
switch (e.locationSearchType) {
case "postcodeLimit":
i.name = "Limit postcode: " + e.limitPostcode;
this.create_criteria_button(i.name, i);
break;
case "addressLimit":
i.name = "Limit street address: " + e.limitStreet;
this.create_criteria_button(i.name, i);
break;
case "suburbLimit":
i.name =
t.Country.CountryCode === "NZ"
? e.OflimitSuburb === ""
? "Limit suburb: " + t.Country.LocationBasicsSuburbs[0].Suburb
: "Limit suburb: " +
n.find_label(
n.key_values[t.Country.CountryCode].LocationAdvanced
.SuburbRadius.SuburbRadiusFrom,
e.suburbRadiusFrom,
"SearchRadius_From_ID"
) +
" to " +
n.find_label(
n.key_values[t.Country.CountryCode].LocationAdvanced
.SuburbRadius.SuburbRadiusTo,
e.suburbRadiusTo,
"SearchRadius_To_ID"
) +
" from " +
e.OflimitSuburb
: "Limit suburb: " + t.Country.LocationBasicsSuburbs[0].Suburb;
this.create_criteria_button(i.name, i);
break;
case "postcodeRadius":
i.name =
"Search radius: " +
n.find_label(
n.key_values[t.Country.CountryCode].LocationAdvanced.PostcodeRadius
.PostcodeRadiusFrom,
e.postcodeRadiusFrom,
"PostcodeRadius_From_ID"
) +
" to " +
n.find_label(
n.key_values[t.Country.CountryCode].LocationAdvanced.PostcodeRadius
.PostcodeRadiusTo,
e.postcodeRadiusTo,
"PostcodeRadius_To_ID"
) +
" from postcode " +
e.ofPostcode;
this.create_criteria_button(i.name, i);
break;
case "suburbtype":
switch (e.selectedSuburbType) {
case "mining":
h = "Mining";
break;
case "coastal":
h = "Waterfront";
break;
case "universities":
h = "University";
}
i.name = "Suburb classification: " + h;
this.create_criteria_button(i.name, i);
}
l =
t.Country.StrategyTypeKeywords.length +
n.count_words(t.Country.Strategy[0].keywords) +
n.count_words(t.Country.Strategy[0].exclude);
l !== 0 &&
((r =
"Strategy: " +
this.find_label(
u[t.Country.CountryCode].Strategy.Strategies,
"FilterStrategyID",
t.Country.Strategy[0].strategyTypeId
) +
" - " +
l +
" keywords"),
(i = [{ type: "strategy" }]),
this.create_criteria_button(r, i));
a =
String(t.Country.PropertySpecifics[0].dwellingType) ===
String(
n.key_values[t.Country.CountryCode].PropertySpecifics.DwellingTypes[0]
.FilterDwellingTypeID
);
a ||
((r = this.find_label(
u[t.Country.CountryCode].PropertySpecifics.DwellingTypes,
"FilterDwellingTypeID",
t.Country.PropertySpecifics[0].dwellingType
)),
(i = [{ type: "property_type" }]),
this.create_criteria_button(r, i));
a &&
t.Country.PropertySpecifics[0].includeLand !== null &&
t.Country.PropertySpecifics[0].includeLand !== "false" &&
((i = [
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "includeLand",
},
]),
this.create_criteria_button(
t.Country.CountryCode === "AU" ? "Land included" : "Sections included",
i
));
(t.Country.PropertySpecifics[0].priceFrom !==
f.Country.PropertySpecifics[0].priceFrom ||
t.Country.PropertySpecifics[0].priceTo !==
f.Country.PropertySpecifics[0].priceTo) &&
((r =
"$" +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.PriceRange.PriceRangeMin,
"ListingPrice_From_ID",
t.Country.PropertySpecifics[0].priceFrom
) +
" - $" +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.PriceRange.PriceRangeMax,
"ListingPrice_To_ID",
t.Country.PropertySpecifics[0].priceTo
)),
(i = [
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "priceFrom",
},
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "priceTo",
},
]),
this.create_criteria_button(r, i));
(t.Country.PropertySpecifics[0].bedRoomMin !==
f.Country.PropertySpecifics[0].bedRoomMin ||
t.Country.PropertySpecifics[0].bedRoomMax !==
f.Country.PropertySpecifics[0].bedRoomMax) &&
((r =
"Bedrooms: " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.BedRooms.BedRoomsMin,
"Bedroom_From_ID",
t.Country.PropertySpecifics[0].bedRoomMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.BedRooms.BedRoomsMax,
"Bedroom_To_ID",
t.Country.PropertySpecifics[0].bedRoomMax
)),
(i = [
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "bedRoomMin",
},
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "bedRoomMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.PropertySpecifics[0].bathRoomMin !==
f.Country.PropertySpecifics[0].bathRoomMin ||
t.Country.PropertySpecifics[0].bathRoomMax !==
f.Country.PropertySpecifics[0].bathRoomMax) &&
((r =
"Bathrooms: " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.BathRooms.BathRoomsMin,
"Bathroom_From_ID",
t.Country.PropertySpecifics[0].bathRoomMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.BathRooms.BathRoomsMax,
"Bathroom_To_ID",
t.Country.PropertySpecifics[0].bathRoomMax
)),
(i = [
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "bathRoomMin",
},
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "bathRoomMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.PropertySpecifics[0].carPortMin !==
f.Country.PropertySpecifics[0].carPortMin ||
t.Country.PropertySpecifics[0].carPortMax !==
f.Country.PropertySpecifics[0].carPortMax) &&
((r =
"Carports: " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.Carports.CarportsMin,
"Carport_From_ID",
t.Country.PropertySpecifics[0].carPortMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.Carports.CarportsMax,
"Carport_To_ID",
t.Country.PropertySpecifics[0].carPortMax
)),
(i = [
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "carPortMin",
},
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "carPortMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.PropertySpecifics[0].landSizeMin !==
f.Country.PropertySpecifics[0].landSizeMin ||
t.Country.PropertySpecifics[0].landSizeMax !==
f.Country.PropertySpecifics[0].landSizeMax) &&
((r =
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.LandSizes.LandSizesMin,
"LandSize_From_ID",
t.Country.PropertySpecifics[0].landSizeMin
) +
"m² to " +
this.find_label(
u[t.Country.CountryCode].PropertySpecifics.LandSizes.LandSizesMax,
"LandSize_To_ID",
t.Country.PropertySpecifics[0].landSizeMax
) +
"m²"),
(i = [
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "landSizeMin",
},
{
type: "change",
top_level_property: "PropertySpecifics",
index: 0,
second_level_property: "landSizeMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].suburbMedianMin !==
f.Country.SuburbStatistics[0].suburbMedianMin ||
t.Country.SuburbStatistics[0].suburbMedianMax !==
f.Country.SuburbStatistics[0].suburbMedianMax) &&
((r =
"Suburb Median $: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.SuburbMedian.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].suburbMedianMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.SuburbMedian.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].suburbMedianMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "suburbMedianMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "suburbMedianMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].vacancyRateMin !==
f.Country.SuburbStatistics[0].vacancyRateMin ||
t.Country.SuburbStatistics[0].vacancyRateMax !==
f.Country.SuburbStatistics[0].vacancyRateMax) &&
((r =
"Vacancy Rate %: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.VacancyRate.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].vacancyRateMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.VacancyRate.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].vacancyRateMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "vacancyRateMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "vacancyRateMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].listingMedianMin !==
f.Country.SuburbStatistics[0].listingMedianMin ||
t.Country.SuburbStatistics[0].listingMedianMax !==
f.Country.SuburbStatistics[0].listingMedianMax) &&
((r =
"% of suburb median: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.ListingMedian
.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].listingMedianMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.ListingMedian
.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].listingMedianMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "listingMedianMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "listingMedianMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].rentalYieldMin !==
f.Country.SuburbStatistics[0].rentalYieldMin ||
t.Country.SuburbStatistics[0].rentalYieldMax !==
f.Country.SuburbStatistics[0].rentalYieldMax) &&
((r =
"Suburb rental yield: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.RentalYields.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].rentalYieldMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.RentalYields.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].rentalYieldMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "rentalYieldMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "rentalYieldMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].oneYrGrowthMin !==
f.Country.SuburbStatistics[0].oneYrGrowthMin ||
t.Country.SuburbStatistics[0].oneYrGrowthMax !==
f.Country.SuburbStatistics[0].oneYrGrowthMax) &&
((r =
"Suburb 1yr growth: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.YearGrowth.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].oneYrGrowthMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.YearGrowth.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].oneYrGrowthMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "oneYrGrowthMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "oneYrGrowthMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].populationMin !==
f.Country.SuburbStatistics[0].populationMin ||
t.Country.SuburbStatistics[0].populationMax !==
f.Country.SuburbStatistics[0].populationMax) &&
((r =
"Suburb population: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.Population.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].populationMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.Population.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].populationMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "populationMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "populationMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.SuburbStatistics[0].daysOnMarketMin !==
f.Country.SuburbStatistics[0].daysOnMarketMin ||
t.Country.SuburbStatistics[0].daysOnMarketMax !==
f.Country.SuburbStatistics[0].daysOnMarketMax) &&
((r =
"Suburb average days on market: " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.DaysOnMarket.FilterRangeMin,
"From_ID_Int",
t.Country.SuburbStatistics[0].daysOnMarketMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].SuburbStatistics.DaysOnMarket.FilterRangeMax,
"To_ID_Int",
t.Country.SuburbStatistics[0].daysOnMarketMax
)),
(i = [
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "daysOnMarketMin",
},
{
type: "change",
top_level_property: "SuburbStatistics",
index: 0,
second_level_property: "daysOnMarketMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.ListingDetail[0].propertyYieldMin !==
f.Country.ListingDetail[0].propertyYieldMin ||
t.Country.ListingDetail[0].propertyYieldMax !==
f.Country.ListingDetail[0].propertyYieldMax) &&
((r =
"Property yield: " +
this.find_label(
u[t.Country.CountryCode].ListngDetails.PropertyYields
.PropertyYieldMin,
"PotentialYield_From_ID",
t.Country.ListingDetail[0].propertyYieldMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].ListngDetails.PropertyYields
.PropertyYieldMax,
"PotentialYield_To_ID",
t.Country.ListingDetail[0].propertyYieldMax
)),
(i = [
{
type: "change",
top_level_property: "ListingDetail",
index: 0,
second_level_property: "propertyYieldMin",
},
{
type: "change",
top_level_property: "ListingDetail",
index: 0,
second_level_property: "propertyYieldMax",
},
]),
this.create_criteria_button(r, i));
(t.Country.ListingDetail[0].listingAgeMin !==
f.Country.ListingDetail[0].listingAgeMin ||
t.Country.ListingDetail[0].listingAgeMax !==
f.Country.ListingDetail[0].listingAgeMax) &&
((r =
"Listing age: " +
this.find_label(
u[t.Country.CountryCode].ListngDetails.ListingAge.ListingAgeMin,
"ListingAge_From_ID",
t.Country.ListingDetail[0].listingAgeMin
) +
" to " +
this.find_label(
u[t.Country.CountryCode].ListngDetails.ListingAge.ListingAgeMax,
"ListingAge_To_ID",
t.Country.ListingDetail[0].listingAgeMax
)),
(i = [
{
type: "change",
top_level_property: "ListingDetail",
index: 0,
second_level_property: "listingAgeMin",
},
{
type: "change",
top_level_property: "ListingDetail",
index: 0,
second_level_property: "listingAgeMax",
},
]),
this.create_criteria_button(r, i));
t.Country.ListingDetail[0].showDuplicates !== null &&
t.Country.ListingDetail[0].showDuplicates !== "false" &&
((i = [
{
type: "change",
top_level_property: "ListingDetail",
index: 0,
second_level_property: "showDuplicates",
},
]),
this.create_criteria_button("Showing duplicate listings", i));
};
this.populate_archistar = function (i) {
var u = i.data("suburb_stats_set_identifier"),
f = n.search_results.Root[u].Archistar,
r;
f.Loaded
? t.update_archistar_labels(f, i)
: ((r = i.data("property_details")),
n.results_screen
.get_archistar_stats(
n.get_modules_id(),
r.Country,
r.StreetAddress,
r.Suburb,
r.StateRegion,
r.Postcode
)
.done(function (r) {
r.Loaded = !0;
n.search_results.Root[u].Archistar = r;
t.update_archistar_labels(r, i);
})
.fail(function () {
$listing_clone
.find(".archistar_stats tbody td.archistar_error")
.text("Address Not Valid");
}));
};
this.update_archistar_labels = function (n, t) {
var u, i, f, r;
for (
t.find(".archistar_stats tbody td.archistar_zoning").text(n.Zoning),
u = 0,
i = "";
u < n.LandUses.length;
u++
)
(i = i + n.LandUses[u]), u < n.LandUses.length - 1 && (i = i + " ");
for (
t.find(".archistar_stats tbody td.archistar_landuse").html(i),
f = 0,
r = "";
f < n.Overlays.length;
f++
)
(r = r + n.Overlays[f]), f < n.Overlays.length - 1 && (r = r + " ");
t.find(".archistar_stats tbody td.archistar_overlay").html(r);
n.Archistar_Activated
? t.find(".ArchifindLogin").show()
: t.find(".ArchifindSignup").show();
};
this.toggle_listing_detail = function (n, r) {
var f = $(".area_container", n),
e = n.data("expanded") === !0,
u = null;
u = typeof r == "undefined" ? !e : r === !0;
e !== u &&
(f.find(".more_property_details").slideToggle({
done: function () {
u
? (t.populate_archistar(n),
i.display_extended_stats(
n,
n.data("suburb_stats_set_identifier")
))
: i.clear_postcode_graph(n.data("suburb_stats_set_identifier"));
},
}),
f.find(".show_market_stats_button").toggle(),
n.data("expanded", u));
};
this.find_label = function (n, t, i) {
for (var r = 0; r < n.length; r++)
if (n[r][t] === parseInt(i, 10)) return n[r].Label;
return !1;
};
this.create_criteria_button = function (n, t) {
$("#search_results_screen .currently_active_filters").append(
$(
'' +
n +
'delete '
).data("reset_data", t)
);
};
this.display_search_results = function (t) {
i.get_number_of_results() === 0
? ($(
"#search_results_screen .refine_search_bar, #search_results_screen .refine_search_thumb"
).hide(),
$("#search_results_screen .number_of_results_found").hide(),
t === "asl_search" || t === "htu_search"
? $("#search_results_screen .no_results_message").hide()
: $("#search_results_screen .no_results_message").show(),
$("#search_results_screen .search_results").empty(),
$("#search_results_screen .show_all_results_expanded_link").hide(),
$("#search_results_screen .sort_order_label").hide(),
$("#search_results_screen .sort_order_menu").hide(),
$("#search_results_screen .result_pagination_controls").hide(),
set_area_display_status(".search_results_subscreen", "loaded"))
: ($(
"#search_results_screen .refine_search_bar, #search_results_screen .refine_search_thumb"
).show(),
$("#search_results_screen .no_results_message").hide(),
$("#search_results_screen .number_of_results_found").show(),
t === "standard_search" &&
($(".sort_order_label").show(), $(".sort_order_menu").show()),
$("#search_results_screen .show_all_results_expanded_link").show(),
$(".result_pagination_controls").show(),
i.display_results_page(0));
var r = i.get_total_number_of_results();
$("#search_results_screen .number_of_results_found").html(
integer_with_commas(n.search_results.SearchedProperties) +
" listings searched: showing 1 -" +
(r > 200 ? 200 : r) +
" of " +
integer_with_commas(r) +
" matching properties"
);
t === "standard_search" &&
r > 200 &&
$("#search_results_screen .keep_refining_message").show();
};
this.display_sorting_options = function () {
var u, f, i;
if (Object.getOwnPropertyNames(r).length === 0) {
$.when(t.load_sort_order_options("AU"), t.load_sort_order_options("NZ"))
.done(function () {
t.display_sorting_options();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
alert("Unable to load sort options at this time");
});
return;
}
for (
u = r[n.search_results.CountryCode],
f = $("#search_results_screen .sort_order"),
f.empty(),
i = 0;
i < u.length;
i++
)
$(" ")
.attr("value", u[i].FilterSearchSortClauseId)
.text(u[i].Label)
.appendTo(f);
$("#search_results_screen .sort_order")
.find('option[value="' + n.current_search.Country.OrderBy + '"]')
.prop("selected", !0);
};
this.populate_listing_template = function (i, r, u, f, e, o) {
var s = u.PropertyDetails,
l = u.PropertyStatistics,
y = u.SuburbStatistics,
a = e,
b,
ft,
c,
h,
rt,
nt,
k,
ut,
tt,
it,
d,
p,
v,
w,
g;
if (
(i
.attr("data-LinkIDHash", s.LinkIDHash)
.attr("data-Country", s.Country)
.attr("data-Website", s.Website)
.attr("data-WebsiteMode", s.WebsiteMode)
.data("dwelling_type", s.DwellingType)
.data("property_snapshot_data", f)
.data("suburb_stats_set_identifier", r),
n.watchlist.in_watchlist(s.LinkIDHash) &&
i
.find(".add_to_watchlist")
.removeClass("add_to_watchlist")
.addClass("remove_from_watchlist"),
i.find(".suburb").text(s.SuburbMatch === "" ? s.Suburb : s.SuburbMatch),
i
.find(".listing_date")
.text(s.DateDownloadedFirst.replace(/Date listed: /, "")),
i
.find(".price_and_median")
.text(s.PriceFormatted + " " + s.LocalityMedian),
(b = i.find(".property_picture")),
s.ThumbnailURL === ""
? t.image_error(b.get(0))
: b.attr("src", s.ThumbnailURL),
window.setTimeout(function () {
b.get(0).naturalWidth === 0 && t.image_error(b.get(0));
}, 5e3),
i.find(".property_picture").data("href", s.Link),
i
.find(".search_result_area_link")
.text("View listing.")
.attr({ href: s.Link, target: "_blank" }),
u.PropertyLinks &&
u.PropertyLinks[1] &&
u.PropertyLinks[1].Links.UrlDescription ===
"View on Google Maps & Street View" &&
$(".google_street_view_link", i)
.data("href", u.PropertyLinks[1].Links.Url)
.show(),
i.find(".category").text(s.Category),
i.find(".num_bedrooms").text(s.BedRooms),
i.find(".num_bathrooms").text(s.BathRooms),
i.find(".num_carports").text(s.Carport),
(ft = s.LandArea && s.LandArea !== "N/A" ? s.LandArea + " m²" : "N/A"),
i.find(".land_area").text(ft),
(c = s.StreetAddress),
s.Suburb !== "" && (c = c === "" ? s.Suburb : c + ", " + s.Suburb),
s.Country === "NZ" &&
s.District !== "" &&
(c = c === "" ? s.District : c + ", " + s.District),
s.State !== "" && (c = c === "" ? s.State : c + ", " + s.State),
s.Postcode !== "" && (c = c === "" ? s.Postcode : c + " " + s.Postcode),
i.find(".street_address h2").text(c),
(h = $(".snapshot_table", i)),
(rt = $(".snapshot_message", i)),
f.DisplayGraph
? ($("tr.cashflow_pre_tax td.yr1", h).html(
f.CashflowPreTaxYr1 === null
? ""
: dollar_value(parseInt(f.CashflowPreTaxYr1.replace(",", "")))
),
$("tr.cashflow_pre_tax td.yr3", h).html(
f.CashflowPreTaxYr3 === null
? ""
: dollar_value(parseInt(f.CashflowPreTaxYr3.replace(",", "")))
),
$("tr.cashflow_pre_tax td.yr5", h).html(
f.CashflowPreTaxYr5 === null
? ""
: dollar_value(parseInt(f.CashflowPreTaxYr5.replace(",", "")))
),
$("tr.cashflow_pre_tax td.yr10", h).html(
f.CashflowPreTaxYr10 === null
? ""
: dollar_value(parseInt(f.CashflowPreTaxYr10.replace(",", "")))
),
$("tr.gross_yield td.yr1", h).html(
f.GrossYieldYr1 === null
? ""
: percentage_1dp(parseFloat(f.GrossYieldYr1.replace("%", "")))
),
$("tr.gross_yield td.yr3", h).html(
f.GrossYieldYr3 === null
? ""
: percentage_1dp(parseFloat(f.GrossYieldYr3.replace("%", "")))
),
$("tr.gross_yield td.yr5", h).html(
f.GrossYieldYr5 === null
? ""
: percentage_1dp(parseFloat(f.GrossYieldYr5.replace("%", "")))
),
$("tr.gross_yield td.yr10", h).html(
f.GrossYieldYr10 === null
? ""
: percentage_1dp(parseFloat(f.GrossYieldYr10.replace("%", "")))
),
$("tr.net_yield td.yr1", h).html(
f.NetYieldY1 === null
? ""
: percentage_1dp(parseFloat(f.NetYieldY1.replace("%", "")))
),
$("tr.net_yield td.yr3", h).html(
f.NetYieldY3 === null
? ""
: percentage_1dp(parseFloat(f.NetYieldY3.replace("%", "")))
),
$("tr.net_yield td.yr5", h).html(
f.NetYieldY5 === null
? ""
: percentage_1dp(parseFloat(f.NetYieldY5.replace("%", "")))
),
$("tr.net_yield td.yr10", h).html(
f.NetYieldY10 === null
? ""
: percentage_1dp(parseFloat(f.NetYieldY10.replace("%", "")))
),
$("tr.total_returns td.yr1", h).html(
f.TotalReturnYr1 === null
? ""
: dollar_value(parseInt(f.TotalReturnYr1))
),
$("tr.total_returns td.yr3", h).html(
f.TotalReturnYr3 === null
? ""
: dollar_value(parseInt(f.TotalReturnYr3))
),
$("tr.total_returns td.yr5", h).html(
f.TotalReturnYr5 === null
? ""
: dollar_value(parseInt(f.TotalReturnYr5))
),
$("tr.total_returns td.yr10", h).html(
f.TotalReturnYr10 === null
? ""
: dollar_value(parseInt(f.TotalReturnYr10))
),
rt.hide(),
h.show())
: (h.hide(), rt.show()),
l.PotentialRent !== "N/A" &&
l.PotentialYield !== "N/A" &&
l.PotentialRent !== "" &&
l.PotentialYield !== "" &&
($(".current_potential_rent_stats .cp_rent_value", i).text(
l.PotentialRent
),
$(".current_potential_rent_stats", i).show()),
(nt = s.Description),
(k = s.Title),
typeof o != "undefined")
)
for (tt = 0, v = o.length; tt < v; tt++)
(ut = new RegExp("(" + RegExp.escape(o[tt]) + ")", "igm")),
(k = k.replace(ut, '$1 ')),
(nt = nt.replace(ut, '$1 '));
if (
(i.find(".listing_title h2").html(k),
i.find(".property_title").html(k),
i.find(".long_description").html(nt),
s.Country.toUpperCase() === "AU" &&
i.find(".finance_link").attr("href", s.FinanceLink).parent().show(),
(it = parseInt(s.BedRooms)),
isNaN(it) && (it = 0),
i
.find(".suburb_house_stats thead")
.append(
'' +
toTitleCase(s.StatisticsSuburb) +
" " +
it +
" b/r " +
(s.DwellingType === null ? "" : s.DwellingType.toLowerCase()) +
" stats "
),
i
.find(".suburb_house_stats tbody")
.append(
'Median listing price ' +
l.MedianSalePrice +
' 1 yr listing price growth ' +
l.YearGrowthPercent +
' Median weekly rent ' +
l.MedianRent +
" "
),
s.Country !== "NZ" &&
i
.find(".suburb_house_stats tbody")
.append(
'1 yr weekly rent growth ' +
l.RentGrowth_1yr +
" "
),
i
.find(".suburb_house_stats tbody")
.append(
'Median gross yield ' +
l.MedianRentalYield +
" "
),
s.Country === "NZ" &&
i
.find(".suburb_house_stats tbody")
.append(
' '
),
i
.find(".suburb_stats thead")
.append(
'' +
toTitleCase(s.StatisticsSuburb) +
" suburb stats "
),
s.Country !== "NZ" &&
i
.find(".suburb_stats tbody")
.append(
'Vacancy rate ' +
y.VacancyPercent +
' 1 yr vacancy rate change ' +
y.VacancyChange_1yr +
" "
),
i
.find(".suburb_stats tbody")
.append(
'Average days on market ' +
y.AvgDaysOnMarket +
' Current listings ' +
y.NumberOfSales +
' Listings cleared in the last 30 days ' +
y.ListingsClearedLast30days +
' Clearance rate ' +
y.ClearanceRate +
" "
),
$(".mpc_graph_container", i).attr("id", "mpc_graph_" + r),
$(".pcs_graph_container", i).attr("id", "pcs_graph_" + r),
$(".pcs_graph_legend", i).attr("id", "pcs_legend_" + r),
u.MedianPriceChangeAU !== null && u.MedianPriceChangeAU.length > 0)
) {
i.find(".mpc_heading").attr(
"class",
"mpc_heading conf" + u.MedianPriceChangeAU[0].PriceChange.StatLevel
);
i.find(".mpc_heading").text("Median Listing Price ");
i.find(".mpc_heading").append(
'help '
);
i.find(".mpc_heading").append(" ");
switch (u.MedianPriceChangeAU[0].PriceChange.StatLevel) {
case "4":
i.find(".mpc_heading").append(
u.PropertyDetails.BedRooms +
" b/r " +
u.PropertyDetails.Category.toLowerCase()
);
break;
case "3":
i.find(".mpc_heading").append(
u.PropertyDetails.Category.toLowerCase()
);
break;
case "2":
i.find(".mpc_heading").append(
toTitleCase(u.PropertyDetails.StatisticsSuburb)
);
}
}
for (
i
.find(".listing_tables_header .suburb")
.text(toTitleCase(s.StatisticsSuburb)),
i
.find(".all_sales_listings p")
.text(u.AllSalesListings[0].Count + " total"),
i.find(".postcode_stats p").text(s.Postcode),
d = 0;
d < u.PropertyLinks.length;
d++
)
i.find(".references").append(
'' +
u.PropertyLinks[d].Links.UrlDescription +
" "
);
if (s.Country == "AU")
if (!a)
i.find(".archistar_stats tbody").append(
'Address Not Valid '
);
else {
for (
i
.find(".archistar_stats thead")
.append(
'Planning Essentials - Powered by Archistar© '
),
i
.find(".archistar_stats tbody")
.append(
'Zone ' +
a.Zoning +
" "
),
p = "",
v = 0;
v < a.LandUses.length;
v++
)
(p = p + a.LandUses[v]),
v < a.LandUses.length - 1 && (p = p + " ");
for (
i
.find(".archistar_stats tbody")
.append(
'Land Use ' +
p +
" "
),
w = "",
g = 0;
g < a.Overlays.length;
g++
)
(w = w + a.Overlays[g]),
g < a.Overlays.length - 1 && (w = w + " ");
i.find(".archistar_stats tbody").append(
'Overlays ' +
w +
" "
);
a.Archistar_Activated
? i.find(".ArchifindLogin").show()
: i.find(".ArchifindSignup").show();
}
return i;
};
this.image_error = function (n) {
n.src = base_url + "assets/images/placeholders/no_gallery_images.gif";
};
this.get_property_details = function (t) {
return $.ajax({
url: api_url(
t.CountryCode + "/Search/PropertyDetails/",
"PropertySearchService"
),
type: "POST",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 3e4,
});
};
this.get_snapshot_analysis = function (t) {
return $.ajax({
url: api_url("Analyser/QuickAnalyseList2/", "AnalyserService"),
type: "POST",
data: JSON.stringify(t),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 45e3,
});
};
this.get_archistar_stats = function (t, i, r, u, f, e) {
var o =
"MemberID=" +
encodeURIComponent(t) +
"&PropertyCountryCode=" +
encodeURIComponent(i) +
"&StreetAddress=" +
encodeURIComponent(r) +
"&Suburb=" +
encodeURIComponent(u) +
"&State=" +
encodeURIComponent(f) +
"&Postcode=" +
encodeURIComponent(e);
return $.ajax({
url: api_url("AU/search/ArchistarStats", "PropertySearchService"),
type: "GET",
data: o,
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 6e4,
});
};
this.load_sort_order_options = function (t) {
return $.ajax({
url: api_url("KeyValues/OrderBy/" + t, "ParameterService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
}).done(function (n) {
r[t] = n;
});
};
this.reset_screen = function () {
$("#search_results_screen .loading_search_results").show();
$("#search_results_screen .search_results").empty();
$("#search_results_screen .result_pagination_controls .back").empty();
$(
"#search_results_screen .result_pagination_controls .showing_message"
).empty();
$("#search_results_screen .result_pagination_controls .next").empty();
};
this.update_search = function (i) {
for (var r, u, e, f = 0, o = i.length; f < o; f++) {
r = i[f];
switch (r.type) {
case "change":
n.current_search.Country[r.top_level_property][r.index][
r.second_level_property
] =
n.default_search.Country[r.top_level_property][r.index][
r.second_level_property
];
break;
case "location_suburb":
for (
u = 0, e = n.current_search.Country.LocationBasicsSuburbs.length;
u < e;
u++
)
if (
n.current_search.Country.LocationBasicsSuburbs[u].SuburbId == r.id
)
break;
n.current_search.Country.LocationBasicsSuburbs.splice(u, 1);
n.current_search.Country.LocationBasicsSuburbs.length === 0 &&
(n.current_search.Country.LocationBasics[0].Country === "AU"
? ((n.current_search.Country.LocationBasics[0].State = ""),
(n.current_search.Country.LocationBasics[0].StateId = "0"),
(n.current_search.Country.LocationBasics[0].Region = ""),
(n.current_search.Country.LocationBasics[0].RegionId = "0"))
: n.current_search.Country.LocationBasics[0].Country === "NZ" &&
((n.current_search.Country.LocationBasics[0].Region = ""),
(n.current_search.Country.LocationBasics[0].RegionId = "0"),
(n.current_search.Country.LocationBasics[0].District = ""),
(n.current_search.Country.LocationBasics[0].DistrictId = "0")));
break;
case "locality":
for (u = 0, e = n.current_search.Locality.length; u < e; u++)
if (n.current_search.Locality[u].Locality == r.name) break;
n.current_search.Locality.splice(u, 1);
break;
case "postcodeLimit":
n.current_search.Country.LocationAdvanced[0].locationSearchType = "";
n.current_search.Country.LocationAdvanced[0].limitPostcode = "";
break;
case "addressLimit":
n.current_search.Country.LocationAdvanced[0].locationSearchType = "";
n.current_search.Country.LocationAdvanced[0].limitStreet = "";
break;
case "suburbLimit":
n.current_search.Country.LocationAdvanced[0].locationSearchType = "";
n.current_search.Country.LocationAdvanced[0].suburbRadiusFrom = "";
n.current_search.Country.LocationAdvanced[0].suburbRadiusTo = "";
n.current_search.Country.LocationAdvanced[0].OflimitSuburb = "";
n.current_search.Country.LocationAdvanced[0].limitSuburb = "";
n.current_search.Country.LocationBasics[0].State = "";
n.current_search.Country.LocationBasics[0].StateId = "0";
n.current_search.Country.LocationBasics[0].Region = "";
n.current_search.Country.LocationBasics[0].RegionId = "0";
n.current_search.Country.LocationBasics[0].District = "";
n.current_search.Country.LocationBasics[0].DistrictId = "0";
n.current_search.Country.LocationBasicsSuburbs = [];
break;
case "postcodeRadius":
n.current_search.Country.LocationAdvanced[0].locationSearchType = "";
n.current_search.Country.LocationAdvanced[0].postcodeRadiusFrom = "";
n.current_search.Country.LocationAdvanced[0].postcodeRadiusTo = "";
n.current_search.Country.LocationAdvanced[0].ofPostcode = "";
break;
case "suburbtype":
n.current_search.Country.LocationAdvanced[0].locationSearchType = "";
n.current_search.Country.LocationAdvanced[0].selectedSuburbType = "";
break;
case "strategy":
n.current_search.Country.Strategy[0] = {
strategyTypeId:
n.key_values[n.current_search.Country.LocationBasics[0].Country]
.Strategy.Strategies[0].FilterStrategyID,
strategyType:
n.key_values[n.current_search.Country.LocationBasics[0].Country]
.Strategy.Strategies[0].Label,
keywords: "",
exclude: "",
KeywordsOperandId:
n.key_values[n.current_search.Country.LocationBasics[0].Country]
.Strategy.KeywordPhrase[0].FilterKeywordSearchTypeID,
KeywordsOperand:
n.key_values[n.current_search.Country.LocationBasics[0].Country]
.Strategy.KeywordPhrase[0].Label,
ExcludedKeywordsOperandId:
n.key_values[n.current_search.Country.LocationBasics[0].Country]
.Strategy.ExcKeywordPhrase[0].FilterKeywordSearchTypeID,
ExcludedKeywordsOperand:
n.key_values[n.current_search.Country.LocationBasics[0].Country]
.Strategy.ExcKeywordPhrase[0].Label,
};
n.current_search.Country.StrategyTypeKeywords = [];
break;
case "property_type":
n.current_search.Country.PropertySpecifics[0].dwellingType =
n.key_values[
n.current_search.Country.CountryCode
].PropertySpecifics.DwellingTypes[0].FilterDwellingTypeID;
n.current_search.Country.PropertySpecifics[0].includeLand = "false";
}
}
set_area_display_status("#search_results_screen .main_display", "loading");
n.search_screen
.property_search(n.current_search)
.done(function (i) {
n.search_results = i;
t.open();
})
.fail(function (t, i, r) {
if (n.check_session_expiry(t, i, r)) {
n.handle_session_expiry(t);
return;
}
set_area_display_status(
"#search_results_screen .main_display",
"error"
);
alert("Unable run search at this time");
});
};
this.initialise();
}
function IS_result_pages(n) {
for (
var i = this,
e = n.search_results.RowsCount,
o = n.search_results.Root.length,
t = n.search_results.Root,
r = 10,
u = 0;
u < t.length;
u++
)
(t[u].Details = null),
(t[u].Snapshot = null),
(t[u].Archistar = null),
(t[u].Suburb_stats_set = null);
var f = !1;
this.get_total_number_of_results = function () {
return e;
};
this.get_number_of_results = function () {
return o;
};
this.get_search_results = function () {
return t;
};
this.set_pagination_count = function (n) {
r = parseInt(n);
};
this.display_results_page = function (u) {
var e;
set_area_display_status(".search_results_subscreen", "loading");
u = parseInt(u, 10);
$("#search_results_screen .search_results").empty();
i.start_result = u * r;
i.end_result = u * r + r;
i.end_result = i.end_result > t.length ? t.length : i.end_result;
var o = [],
s = new Date(),
h = new $.Deferred();
for (
o.push(h),
n.results_screen
.get_archistar_stats(n.get_modules_id(), "AU", "", "", "", "")
.done(function (n) {
ArchistarMemberStatus = n;
h.resolve();
})
.fail(function () {
h.reject();
}),
e = i.start_result;
e < i.end_result;
e++
)
t[e].Details === null &&
(function (i) {
var u = new $.Deferred(),
r,
f;
o.push(u);
r = new $.Deferred();
o.push(r);
f = {
CountryCode: n.current_search.Country.CountryCode,
PropertyId: t[i].Summary.PropertyId,
LinkIdHash: t[i].Summary.LinkIDHash,
MemberId: n.get_modules_id(),
};
n.results_screen
.get_property_details(f)
.done(function (f) {
var s, o, e;
if (
((t[i].Details = f.Result[0]),
(t[i].Suburb_stats_set = new SS_set(t[i].Details)),
(s = {
MemberId: n.get_modules_id(),
PropertyCountryCode: t[i].Details.PropertyDetails.Country,
PropertyLinkId: t[i].Details.PropertyDetails.LinkIDHash,
UserCountryCode: n.get_user_country_code(),
Website: t[i].Details.PropertyDetails.Website,
WebsiteMode: t[i].Details.PropertyDetails.WebsiteMode,
MemberName: n.get_member_name(),
}),
n.results_screen
.get_snapshot_analysis(s)
.done(function (n) {
t[i].Snapshot = n[0];
u.resolve();
})
.fail(function () {
u.reject();
}),
(o = !1),
t[i].Details.PropertyDetails.StreetAddress.length > 0 &&
n.current_search.Country.CountryCode.toLowerCase() == "au")
)
for (
e = 0;
e < t[i].Details.PropertyDetails.StreetAddress.length;
e++
)
if (
!isNaN(
parseInt(
t[i].Details.PropertyDetails.StreetAddress.substring(
e,
e + 1
)
)
)
) {
o = !0;
break;
}
o
? n.show_all_results_expanded
? n.results_screen
.get_archistar_stats(
n.get_modules_id(),
t[i].Details.PropertyDetails.Country,
t[i].Details.PropertyDetails.StreetAddress,
t[i].Details.PropertyDetails.Suburb,
t[i].Details.PropertyDetails.StateRegion,
t[i].Details.PropertyDetails.Postcode
)
.done(function (n) {
t[i].Archistar = n;
r.resolve();
})
.fail(function () {
r.reject();
})
: r.resolve()
: r.resolve();
})
.fail(function () {
u.reject();
});
})(e);
$.when
.apply($, o)
.done(function () {
var y, h, l, c, v, a, r, o, e;
for (
$(document).scrollTo($("body")),
e = new Date(),
f &&
console.log(
"Data for individual listings (PropertyDetail and QuickAnalysis) finished loading ",
(e - s) / 1e3,
" after starting to load individual results."
),
y = new Date(),
h = [],
r = 0,
c = n.current_search.Country.StrategyTypeKeywords.length;
r < c;
r++
)
h.push(n.current_search.Country.StrategyTypeKeywords[r].keyword);
for (
l = n.current_search.Country.Strategy[0].keywords.split(" "),
r = 0,
c = l.length;
r < c;
r++
)
l[r] !== "" && h.push(l[r]);
for (
set_area_display_status(".search_results_subscreen", "loaded"),
v = [],
graphing_time = 0,
a = null,
r = i.start_result;
r < i.end_result;
r++
)
(o = $("#search_results_screen .search_result_template")
.clone(!0)
.data("suburb_stats_set_identifier", r)
.data("property_details", t[r].Details.PropertyDetails)
.removeClass("hide search_result_template")),
t[r].Archistar ||
((ArchistarMemberStatus.Loaded = !1),
(t[r].Archistar = ArchistarMemberStatus)),
(o = n.results_screen.populate_listing_template(
o,
r,
t[r].Details,
t[r].Snapshot,
t[r].Archistar,
h
)),
$("#search_results_screen .search_results").append(o),
(v[r] = o),
(function () {
var n = o,
t = r;
window.setTimeout(function () {
a = new Date();
i.plot_mp_graph(n, t);
graphing_time += (new Date() - a) / 1e3;
}, 0);
})();
e = new Date();
f &&
console.log(
"Time to populate results screen: ",
(e - s) / 1e3,
" from starting to load individual results."
);
n.show_all_results_expanded &&
$("#search_results_screen .search_results .search_result").each(
function () {
n.results_screen.toggle_listing_detail($(this), !0);
}
);
e = new Date();
f &&
console.log(
"Displaying pagination controls ",
(e - s) / 1e3,
" after starting to load individual results."
);
i.display_pagination_controls(u, i.start_result, i.end_result);
e = new Date();
f &&
(console.log(
"All results loaded and displayed, including result expansion, ",
(e - s) / 1e3,
" after starting to load individual results."
),
console.log(
"NB This is ",
(e - property_search_start) / 1e3,
" since starting the original search (this reading is only relevant for the first page of results)."
));
})
.fail(function () {
set_area_display_status(".search_results_subscreen", "failed");
});
};
this.plot_mp_graph = function (n, i) {
t[i].Suburb_stats_set.plot_mp_graph(t[i].Details.CountryCode, n, i);
};
this.display_extended_stats = function (n, i) {
t[i].Suburb_stats_set.display_extended_stats(
t[i].Details.PropertyDetails.Suburb,
n,
i
);
};
this.clear_postcode_graph = function (n) {
t[n].Suburb_stats_set.clear_postcode_graph();
};
this.display_pagination_controls = function (n, i, u) {
n === 0
? $("#search_results_screen .result_pagination_controls .back")
.empty()
.html(" ")
: $("#search_results_screen .result_pagination_controls .back").html(
'navigateleft Show ' +
(i - r + 1) +
"-" +
i +
" "
);
$(
"#search_results_screen .result_pagination_controls .showing_message"
).text("Showing " + (i + 1) + "-" + u + " (of " + t.length + ")");
u >= t.length
? $("#search_results_screen .result_pagination_controls .next")
.empty()
.html(" ")
: $("#search_results_screen .result_pagination_controls .next").html(
'Show ' +
(u + 1) +
"-" +
(u + r > t.length ? t.length : u + r) +
' navigateright '
);
};
}
function IS_watchlist(n) {
var t = this;
this.update_watchlist_object = function () {
return this.load_watchlist()
.done(function (n) {
t.watchlist = n.WatchList || [];
})
.fail(function () {
t.watchlist = [];
});
};
this.add_property_to_watchlist = function (t, i, r, u) {
var f = {
Country: t,
LinkIDHash: i,
MemberId: n.get_modules_id(),
Website: r,
WebsiteMode: u,
};
return $.ajax({
url: api_url("/Watchlist/", "PropertySearchService"),
type: "POST",
data: JSON.stringify(f),
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.remove_property_from_watchlist = function (t) {
return $.ajax({
url: api_url("Watchlist/" + t, "PropertySearchService"),
type: "DELETE",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.load_watchlist = function () {
return $.ajax({
url: api_url("/Watchlist/" + n.get_modules_id(), "PropertySearchService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: n.api_username,
APIPassword: n.api_password,
UserToken: n.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
});
};
this.in_watchlist = function (n) {
for (var i = 0, r = t.watchlist.length; i < r; i++)
if (this.watchlist[i].LinkIDHash === n) return !0;
return !1;
};
this.find_watchlist_id = function (n) {
for (var i = 0, r = t.watchlist.length; i < r; i++)
if (this.watchlist[i].LinkIDHash === n)
return this.watchlist[i].WatchlistID;
return !1;
};
}
function WatchlistComments(n, t) {
var i = this;
this.property_id = null;
this.comments = [];
this.dom_object = n;
this.comments_index = {};
this.construct = function () {
$('.comment_editor textarea[name="comment_text"]', i.dom_object).val("");
$(".comment_editor", i.dom_object).data("comment_id", null).hide();
i.dom_object
.off("click", ".show_more_link, .show_less_link")
.on("click", ".show_more_link, .show_less_link", function (n) {
n.preventDefault();
$(".comments_list", i.dom_object).toggleClass("show_more show_less");
$(".show_more_link", i.dom_object).toggle();
$(".show_less_link", i.dom_object).toggle();
});
i.dom_object
.off("click", ".comment_delete_link")
.on("click", ".comment_delete_link", function (n) {
n.preventDefault();
i.delete_comment($(this).closest("li").data("comment_id"));
});
i.dom_object
.off("click", ".comment_edit_link")
.on("click", ".comment_edit_link", function (n) {
n.preventDefault();
i.edit_comment($(this).closest("li").data("comment_id"));
});
i.dom_object
.off("click", ".add_comment_link")
.on("click", ".add_comment_link", function (n) {
n.preventDefault();
i.new_comment();
});
i.dom_object
.off("click", ".save_comment_button")
.on("click", ".save_comment_button", function (n) {
n.preventDefault();
var t = $(this).closest("li").data("comment_id");
i.save_comment(
t,
$("#watched_property_details .search_result").data("watchlist_id")
);
});
};
this.rebuild_index = function () {
i.comments_index = [];
for (var n = 0, t = i.comments.length; n < t; n++)
i.comments_index[i.comments[n].WatchListCommentID] = n;
};
this.set_data = function (n, t) {
i.property_id = n;
i.comments = t;
i.rebuild_index();
};
this.populate_comments = function () {
for (
var r,
u = $(".comment_editor", i.dom_object).data("comment_id", null).hide(),
t = "",
n = 0,
f = i.comments.length;
n < f;
n++
)
(r = $("
")
.text(i.comments[n].CommentText)
.html()
.replace(/\n/g, "")),
(t +=
' ");
t += " ";
$(".comments_list", i.dom_object).html(t);
$(".comments_list", i.dom_object).append(u);
$(".comments_list", i.dom_object).get(0).scrollTop = 999999;
};
this.remove_alerts = function () {
$(
".delete_comment_failure_alert, .save_comment_failure_alert",
i.dom_object
).hide();
};
this.new_comment = function () {
i.remove_alerts();
var n = $(".comment_editor", i.dom_object).data("comment_id");
n !== null &&
$('li[data-comment_id="' + n + '"] .comment_text', i.dom_object).show();
$('.comment_editor textarea[name="comment_text"]', i.dom_object).val("");
$(".comment_editor", i.dom_object)
.appendTo($(".comments_list ul", i.dom_object))
.data("comment_id", null)
.show()
.find(".new_note_message")
.show();
$(".comments_list", i.dom_object).scrollTo(
$(".comment_editor", i.dom_object)
);
};
this.delete_comment = function (n) {
function r() {
i.comments.splice(i.comments_index[n], 1);
i.rebuild_index();
i.populate_comments();
}
function u() {
$(".delete_comment_failure_alert", i.dom_object).show();
}
i.remove_alerts();
$('.comment_editor textarea[name="comment_text"]', i.dom_object).val("");
$(".comment_editor", i.dom_object).data("comment_id", null).hide();
$.ajax({
url: api_url("Comments/" + n),
type: "DELETE",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: t.api_username,
APIPassword: t.api_password,
UserToken: t.get_auth_token(),
},
dataType: "json",
timeout: 1e4,
})
.done(r)
.fail(u);
};
this.edit_comment = function (n) {
var r, u, t, f;
i.remove_alerts();
r = $('li[data-comment_id="' + n + '"]', i.dom_object);
u = $(".comment_editor", i.dom_object).data("comment_id");
u !== null &&
$('li[data-comment_id="' + u + '"] .comment_text', i.dom_object).show();
$('.comment_editor textarea[name="comment_text"]', i.dom_object).val(
i.comments[i.comments_index[n]].CommentText
);
$(".comment_text", r).hide();
$(".comment_editor", i.dom_object)
.insertAfter(r)
.data("comment_id", n)
.show()
.find(".new_note_message")
.hide();
$(".comments_list", i.dom_object).scrollTo(
$(".comment_editor", i.dom_object).prev("li")
);
t = $('.comment_editor textarea[name="comment_text"]', i.dom_object).get(0);
t.createTextRange
? ((f = t.createTextRange()), f.move("character", 0), f.select())
: t.setSelectionRange && t.setSelectionRange(0, 0);
$(t).focus();
};
this.save_comment = function () {
function f(t) {
n === null
? (n = t)
: (i.comments.splice(i.comments_index[n], 1), i.rebuild_index());
var r = new Date();
i.comments.push({
CommentText: u,
WatchListCommentID: n,
CommentDate:
("0" + r.getDate()).substr(-2) +
"/" +
("0" + (r.getMonth() + 1)).substr(-2) +
"/" +
r.getFullYear(),
});
i.rebuild_index();
i.populate_comments();
}
function e() {
$(".save_comment_failure_alert", i.dom_object).show();
}
i.remove_alerts();
var n = $(".comment_editor", i.dom_object).data("comment_id"),
u = $(
'.comment_editor textarea[name="comment_text"]',
i.dom_object
).val(),
r = null;
r =
n === null
? {
Comment: u,
WatchlistID: $("#watched_property_details .search_result").data(
"watchlist_id"
),
}
: {
CommentDate: "String content",
CommentText: u,
WatchListCommentID: n,
WatchListNewId: $("#watched_property_details .search_result").data(
"watchlist_id"
),
};
n === null
? (r.MemberPropertyId = i.property_id)
: (r.WatchListCommentID = n);
$.ajax({
url: api_url("Comments/"),
type: n === null ? "POST" : "PUT",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: t.api_username,
APIPassword: t.api_password,
UserToken: t.get_auth_token(),
},
data: JSON.stringify(r),
dataType: "json",
timeout: 1e4,
})
.done(f)
.fail(e);
};
this.construct();
}
function WatchlistAttachments(n, t) {
var i = this;
this.watchlist_id = null;
this.attachments = [];
this.dom_object = n;
this.attachments_index = {};
this.construct = function () {
i.dom_object
.off("click", ".show_more_link, .show_less_link")
.on("click", ".show_more_link, .show_less_link", function (n) {
n.preventDefault();
$(".attachments_list", i.dom_object).toggleClass("show_more show_less");
$(".show_more_link", i.dom_object).toggle();
$(".show_less_link", i.dom_object).toggle();
});
i.dom_object
.off("click", ".add_attachment_link")
.on("click", ".add_attachment_link", function (n) {
n.preventDefault();
$(".upload_controls", i.dom_object).toggle();
});
i.dom_object
.off("click", ".upload_controls .upload_button")
.on("click", ".upload_controls .upload_button", function () {
i.uploadAttachment();
});
i.dom_object
.off("click", ".upload_controls .cancel_button")
.on("click", ".upload_controls .cancel_button", function () {
$(".attachment_for_upload", i.dom_object).val("");
$(".upload_controls").hide();
});
i.dom_object
.off("click", ".attachment_delete_link")
.on("click", ".attachment_delete_link", function () {
i.deleteAttachment($(this).data("file_name"));
});
};
this.set_watchlist_id = function (n) {
i.watchlist_id = n;
};
this.show_attachment_list = function () {
set_area_display_status(i.dom_object, "loading");
i.fetch_document_list("attachment", i.watchlist_id)
.done(function (n) {
var u = $(".attachments_list", i.dom_object),
t = "";
for (var r in n.Files)
t =
'file ' +
n.Files[r].FileName +
" " +
t;
u.empty().append("");
set_area_display_status(i.dom_object, "loaded");
$("div.property_documents .upload_controls").hide();
})
.fail(function (n, t, i) {
if (check_session_expiry(n, t, i)) {
handle_session_expiry(n);
return;
}
set_area_display_status("div.property_documents", "failed");
});
};
this.uploadAttachment = function () {
var t = function () {
$(".uploading_indicator", i.dom_object).hide();
$(".add_attachment_link", i.dom_object).show();
i.show_attachment_list(i.watchlist_id);
},
r = function (n, t, r) {
if (check_session_expiry(n, t, r)) {
handle_session_expiry(n);
return;
}
$(".uploading_indicator", i.dom_object).hide();
$(".add_attachment_link", i.dom_object).show();
switch (n.status) {
case 0:
break;
case 413:
alert("Sorry, that file is too large to be uploaded");
break;
case 415:
alert("Sorry, that file type is not supported");
break;
default:
alert(
"Sorry, an error occurred while trying to upload your attachment (" +
n.status +
")."
);
}
},
n = $(".attachment_for_upload", i.dom_object)[0].files[0];
typeof n != "undefined" &&
($(".attachment_for_upload", i.dom_object).val(""),
$(".add_attachment_link", i.dom_object).hide(),
$(".upload_controls", i.dom_object).hide(),
$(".uploading_indicator", i.dom_object).show(),
i.uploadFile(n, "attachment", t, r, i.watchlist_id));
};
this.deleteAttachment = function (n) {
i.deleteFile(i.watchlist_id, n).done(function () {
i.show_attachment_list();
});
};
this.fetch_document_list = function (n, i) {
var r = new $.Deferred();
return (
$.ajax({
url: api_url("Documents/AllFiles/" + i, "FileUploadService"),
type: "GET",
contentType: "application/json; charset=utf-8",
headers: {
APIUserName: t.api_username,
APIPassword: t.api_password,
UserToken: t.get_auth_token(),
},
dataType: "json",
timeout: 2e4,
})
.done(function (t, i, u) {
var f;
switch (n) {
case "attachment":
f = t.Attachements;
break;
case "image":
f = t.PropertyImages;
break;
default:
case "all":
f = t;
}
r.resolve(f, i, u);
})
.fail(function (n, t, i) {
if (check_session_expiry(n, t, i)) {
handle_session_expiry(n);
return;
}
r.reject(n, t, i);
}),
r
);
};
this.uploadFile = function (n, i, r, u, f) {
var e = api_url("Documents/Uploads/HtmlClient/", "FileUploadService");
$.ajax({
url: e,
type: "POST",
data: n,
headers: {
APIUserName: t.api_username,
APIPassword: t.api_password,
UserToken: t.get_auth_token(),
},
processData: !1,
beforeSend: function (r) {
r.setRequestHeader("FileName", n.name);
r.setRequestHeader("FileSize", n.size);
r.setRequestHeader("MemberPropertyID", f);
r.setRequestHeader("UserToken", t.get_auth_token());
r.setRequestHeader("IsAttachement", i === "attachment" ? "1" : "0");
},
})
.done(r)
.fail(u);
};
this.deleteFile = function (n, i) {
function f(n, t, i) {
if (check_session_expiry(n, t, i)) {
handle_session_expiry(n);
return;
}
alert("Sorry, an error occurred while deleting your file.");
}
var r = api_url("Documents/DeleteFiles/", "FileUploadService"),
u = { MemberPropertyId: n, FileNames: [i] };
return $.ajax({
url: r,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(u),
headers: {
APIUserName: t.api_username,
APIPassword: t.api_password,
UserToken: t.get_auth_token(),
},
timeout: 1e4,
}).fail(f);
};
this.construct();
}
function SS_set(n, t) {
var i = this;
this.ss_data = null;
this.graph_papers = {};
this.graph_containers = {};
this.setup = function (n, t) {
var r, u;
if (t === "analyser") {
n.PropertyDetails = n.ISPropertyDetails;
var f = n.PropertyDetails.PropertyType,
e =
n.AllSalesListing.NumberOfHouses +
n.AllSalesListing.NumberOfUnits +
n.AllSalesListing.NumberOfTownhouses +
n.AllSalesListing.NumberOfBlocks +
n.AllSalesListing.NumberOfLands +
n.AllSalesListing.NumberOfOther,
o = [
{ Count: e, DwellingType: "", Label: "Total" },
{
Count: n.AllSalesListing.NumberOfHouses,
DwellingType: "House",
Label: "House",
},
{
Count: n.AllSalesListing.NumberOfUnits,
DwellingType: "Unit",
Label: "Unit",
},
{
Count: n.AllSalesListing.NumberOfTownhouses,
DwellingType: "Townhouse",
Label: "Townhouse",
},
{
Count: n.AllSalesListing.NumberOfBlocks,
DwellingType: "Block",
Label: "Multi Dwelling",
},
{
Count: n.AllSalesListing.NumberOfLands,
DwellingType: "Land",
Label: "Land",
},
{
Count: n.AllSalesListing.NumberOfOther,
DwellingType: "",
Label: "Other",
},
];
n.AllSalesListings = o;
delete n.AllSalesListing;
switch (f) {
case "townhouse":
n.SalesPriceRange = n.TownhouseSalesListings.TownhouseSales;
n.RentalPriceRange = n.TownhouseRentalListing.TownhouseRental;
break;
case "unit/apartment":
n.SalesPriceRange = n.UnitSalesListing.Unitsales;
n.RentalPriceRange = n.UnitRentalListing.Unitrental;
break;
default:
case "house":
n.SalesPriceRange = n.HouseSalesListing.HouseSales;
n.RentalPriceRange = n.HouseRentalListing.HouseRental;
}
for (r = 0, u = n.SalesPriceRange.length; r < u; r++)
n.SalesPriceRange[r].Count = n.SalesPriceRange[r].Value;
for (r = 0, u = n.RentalPriceRange.length; r < u; r++)
n.RentalPriceRange[r].Count = n.RentalPriceRange[r].Value;
}
i.prepare_ss_data(n);
};
this.prepare_ss_data = function (n) {
var f, y, p, b, k, r, u;
if (
((i.ss_data = {}),
(f = n["MedianPriceChange" + n.CountryCode]),
typeof f == "undefined" || f === null || f.length === 0)
)
i.ss_data.mpc_ss_data = null;
else {
var h = [],
d = [],
g = [],
nt = [],
a = 0,
c = 0;
for (r = 0; r < f.length; r++)
(mpc_data_element = t === "analyser" ? f[r] : f[r].PriceChange),
(h[r] = mpc_data_element.Price),
(d[r] = mpc_data_element.Label.replace(/^- /, "")),
(nt[r] =
mpc_data_element.Label.match(/ Mth Ago/) !== null
? "#ccc"
: mpc_data_element.Price > c
? "#0e0"
: "#e00"),
(g[r] =
dollar_value(mpc_data_element.Price) +
(r === 0
? ""
: mpc_data_element.Label.match(/ Mth Ago/) === null
? "\n" +
String(
Math.round(((mpc_data_element.Price - c) / c) * 1e3) / 10
) +
"%"
: "\n" +
String(
Math.round(((mpc_data_element.Price - a) / a) * 1e3) / 10
) +
"%")),
mpc_data_element.Label.match(/ Mth Ago/) === null &&
(c = mpc_data_element.Price),
(a = mpc_data_element.Price);
for (
var tt = Math.max.apply(Math, h),
it = Math.min.apply(Math, h),
l = tt - it,
o =
l >= 4e5
? 2e5
: l >= 2e5
? 1e5
: l >= 1e5
? 5e4
: l >= 3e4
? 2e4
: 1e4,
rt = (Math.floor(tt / o) + 1) * o,
ut = (Math.floor(it / o) - 1) * o,
ft = [],
v = ut;
v <= rt;
)
ft.push(dollar_value(v)), (v += o);
i.ss_data.mpc_ss_data = {
chart_data: h,
colours: nt,
labels: d,
hover_labels: g,
y_axis_interval: o,
y_upper_limit: rt,
y_lower_limit: ut,
y_axis_labels: ft,
};
}
for (
i.ss_data.asl_table_data = { asl_data: n.AllSalesListings },
i.ss_data.property_type =
t === "analyser"
? n.PropertyDetails.PropertyType
: n.PropertyDetails.DwellingType,
y = 0,
r = 0,
u = n.SalesPriceRange.length;
r < u;
r++
)
y += parseInt(n.SalesPriceRange[r].Count);
for (p = 0, r = 0, u = n.RentalPriceRange.length; r < u; r++)
p += parseInt(n.RentalPriceRange[r].Count);
i.ss_data.htusales_table_data = {
htusales_hilo: n.SalesPriceHighLow,
htusales_data: n.SalesPriceRange,
htusales_total: y,
};
i.ss_data.hturentals_table_data = {
hturentals_hilo: n.RentalPriceHighLow,
hturentals_data: n.RentalPriceRange,
hturentals_total: p,
};
var s = t === "analyser" ? n.PostCodeStatistics : n.PostcodeStatistics,
e =
t === "analyser"
? ["Mortgaged", "Owned", "Renting"]
: ["Purchasing", "FullyOwned", "Rented"],
w = 0;
for (r = 0, u = e.length; r < u; r++) w += parseFloat(s[e[r]]) || 0;
for (b = [], k = [], r = 0, u = e.length; r < u; r++)
s[e[r]] > 0 &&
(b.push(
String(Math.round(((parseFloat(s[e[r]]) || 0) / w) * 100)) +
"% " +
e[r]
),
k.push(parseFloat(s[e[r]]) || 0));
i.ss_data.pcs_ss_data = {
postcode: s.Postcode,
population: s.Population,
pcs_labels: b,
pcs_values: k,
pcs_total: w,
};
};
this.plot_mp_graph = function (n, t, i) {
n.toLowerCase() === "au"
? this.plot_mp_graph_au(t, i)
: n.toLowerCase() === "nz" && this.plot_mp_graph_nz(t, i);
};
this.mpc_hover_handler_in = function () {
var n = $(this.node).closest(".mpc_graph_container");
this.flag = this.paper
.popup(
this.attrs.x + 6,
analyser_mouse_y - n.offset().top,
this.data("hover_label"),
"down"
)
.insertBefore(this)
.toFront();
};
this.mpc_hover_handler_out = function () {
this.flag.remove();
};
this.plot_mp_graph_au = function (n, t) {
var v, o, r, u, d;
if (i.ss_data === null || i.ss_data.mpc_ss_data === null) {
$(".mpc_heading", n).hide();
$(".mpc_graph_container", n).hide();
$(".mpc_graph_message", n).show();
$(".not_provided_message", n).addClass("au");
$(".mpc_graph", n).show();
return;
}
$(".mpc_heading", n).show();
$(".mpc_graph_container", n).show();
$(".mpc_graph_message", n).hide();
$(".mpc_graph", n).hide();
v = { "font-size": "10px", "font-weight": "500", fill: "#4d4d4d" };
typeof i.graph_papers.mpc_graph_paper != "undefined" &&
i.graph_papers.mpc_graph_paper.remove();
o = $(".mpc_graph", n);
r = i.ss_data.mpc_ss_data;
o.show();
var g = o.width(),
y = 20,
f = 74,
c = y + f,
nt = y + f + 60,
s = 68,
p = g,
w = 6,
tt = p - s - 22,
b = 12,
e = ScaleRaphael("mpc_graph_" + t, p, nt),
l,
a,
k,
h;
for (u = 0; u < r.chart_data.length; u++)
(l =
((r.chart_data[u] - r.y_lower_limit) /
(r.y_upper_limit - r.y_lower_limit)) *
f),
(a = s + u * (b + 3)),
(k = c - l),
e
.rect(a, k, b, l)
.attr("fill", r.colours[u])
.attr("stroke-width", 0)
.data("hover_label", r.hover_labels[u])
.hover(i.mpc_hover_handler_in, i.mpc_hover_handler_out),
(h = e.text(a, f + 30, r.labels[u]).attr("text-anchor", "start")),
(x_label_box = h.getBBox()),
h.translate(-x_label_box.width / 2 + 6, x_label_box.width / 2 - 6),
h.rotate(270);
d = "M" + String(s - w) + "," + String(c) + "h" + tt;
e.path(d).attr({ "stroke-width": "1" });
Raphael.g
.axis(
s - w,
c,
f,
null,
null,
r.y_axis_labels.length - 1,
1,
r.y_axis_labels,
"_",
0,
e
)
.text.attr(v);
i.graph_papers.mpc_graph_paper = e;
i.graph_containers.mpc_graph_container = o;
};
this.plot_mp_graph_nz = function (n, t) {
var v, f, r, u, d;
if (i.ss_data === null || i.ss_data.mpc_ss_data === null) {
$(".mpc_heading", n).hide();
$(".mpc_graph_container", n).hide();
$(".mpc_graph_message", n).show();
$(".not_provided_message", n).addClass("nz");
$(".mpc_graph", n).show();
return;
}
$(".mpc_heading", n).show();
$(".mpc_graph_container", n).show();
$(".mpc_graph_message", n).hide();
$(".mpc_graph", n).hide();
v = { "font-size": "10px", "font-weight": "500", fill: "#4d4d4d" };
typeof i.graph_papers.mpc_graph_paper != "undefined" &&
i.graph_papers.mpc_graph_paper.remove();
f = $(".mpc_graph", n);
r = i.ss_data.mpc_ss_data;
f.show();
var g = f.width(),
c = 20,
o = 74,
y = c + o,
p = c + o + 50,
s = 68,
l = g,
w = 6,
a = l - s - 22,
b = [];
for (u = 0; u < r.chart_data.length; u++) b.push(u);
var e = ScaleRaphael("mpc_graph_" + t, l, p),
e = ScaleRaphael("mpc_graph_" + t, l, p),
tt = e
.linechart(s, c, a, o, b, r.chart_data, {
width: "8",
colors: ["#4e9fba"],
axis: "0 0 0 0",
symbol: "",
})
.hover(
function () {
var n = r.labels[this.axis] + ":\n" + dollar_value(this.value);
this.flag = e
.popup(this.x, analyser_mouse_y - f.offset().top, n, "down")
.insertBefore(this)
.toFront();
},
function () {
this.flag.remove();
}
),
k,
h,
nt = a / r.chart_data.length;
for (u = 0; u < r.chart_data.length; u++)
(k = s + u * nt),
(h = e.text(k, o + 30, r.labels[u]).attr("text-anchor", "start")),
(x_label_box = h.getBBox()),
h.translate(-x_label_box.width / 2 + 6, x_label_box.width / 2 - 6),
h.rotate(270);
$(".graph_content", f).show();
d = "M" + String(s - w) + "," + String(y) + "h" + a;
e.path(d).attr({ "stroke-width": "1" });
Raphael.g
.axis(
s - w,
y,
o,
null,
null,
r.y_axis_labels.length - 1,
1,
r.y_axis_labels,
"_",
0,
e
)
.text.attr(v);
i.graph_papers.mpc_graph_paper = e;
i.graph_containers.mpc_graph_container = f;
};
this.display_extended_stats = function (n, t, r) {
var g, v, o, k, ut, s, a, b, e, u, f;
if (i.ss_data !== null && $(".pcs_graph", t).width() !== 0) {
if (
((g = { "font-size": "10px", "font-weight": "500", fill: "#4d4d4d" }),
typeof i.graph_papers.pcs_graph_paper != "undefined" &&
i.graph_papers.pcs_graph_paper.remove(),
typeof i.graph_papers.pcs_graph_legend_paper != "undefined" &&
i.graph_papers.pcs_graph_legend_paper.remove(),
(v = i.ss_data.pcs_ss_data),
$(".postcode_stats .postcode", t).text(v.postcode),
$(".postcode_stats .population", t).text(v.population),
(o = $(".pcs_graph_container", t)),
i.ss_data.pcs_ss_data.pcs_total === 0)
)
o.hide(),
$(".postcode_stats .with_graph", t).hide(),
$(".postcode_stats .without_graph", t).show();
else {
o.show();
var h = v.pcs_labels,
c = v.pcs_values.slice(0),
d = o.width(),
nt = d,
y = 20,
p = d - 2 * y,
tt = p + y,
it = y + p / 2,
rt = y + p / 2,
w = ["#2f69bf", "#bf5a2f", "#a2bf2f"],
l = [];
for (u = 0, f = c.length; u < f; u++)
l.push({ label: h[u], value: c[u], color: w[u] });
for (
l.sort(function (n, t) {
return t.value - n.value;
}),
c = [],
h = [],
w = [],
u = 0,
f = l.length;
u < f;
u++
)
(c[u] = l[u].value), (h[u] = l[u].label), (w[u] = l[u].color);
for (
pcs_graph_paper = ScaleRaphael("pcs_graph_" + r, nt, tt),
pcs_graph_chart = pcs_graph_paper
.piechart(it, rt, p / 2, c, {
minPercent: 0.001,
legend: h,
legendpos: "south",
colors: w,
})
.hover(
function () {
var t = this.label[1].attrs.text,
n = this;
setTimeout(function () {
n.flag = pcs_graph_paper
.popup(
analyser_mouse_x - o.offset().left,
analyser_mouse_y - o.offset().top - 2 * y - 10,
t
)
.insertBefore(n.cover)
.toFront();
}, 50);
},
function () {
var n = this;
setTimeout(function () {
n.flag.remove();
}, 50);
}
),
k = [],
u = 0,
f = h.length;
u < f;
u++
)
k.push({
colour: pcs_graph_chart.series[u].attr("fill"),
label: h[c[u].order],
});
ut = $(".legend", o);
pcs_graph_legend_paper = i.multi_column_legend("pcs_legend_" + r, k, {
column_count: 2,
padding_bottom: 1,
});
i.graph_papers.pcs_graph_paper = pcs_graph_paper;
i.graph_papers.pcs_graph_legend_paper = pcs_graph_legend_paper;
i.graph_containers.pcs_graph_container = o;
}
for (
$(".all_sales_table", t).hide().empty(),
s = i.ss_data.asl_table_data.asl_data,
e = "",
u = 0,
f = s.length;
u < f;
u++
)
e +=
"" +
s[u].Label +
" " +
(s[u].Label === "Other"
? s[u].Count
: '' +
s[u].Count +
" ") +
" ";
for (
$(".all_sales_table", t).append(e).show(),
$(".sales_property_type", t).text(i.ss_data.property_type),
$(".sales_listings_count", t).text(
i.ss_data.htusales_table_data.htusales_total
),
$(".sales_listings_table", t).hide().empty(),
a = i.ss_data.htusales_table_data.htusales_data,
e = "",
u = 0,
f = a.length;
u < f;
u++
)
e +=
"" +
a[u].Label +
' ' +
a[u].Count +
" ";
for (
$(".sales_listings_table", t).append(e).show(),
$(".rentals_property_type", t).text(i.ss_data.property_type),
$(".rentals_listings_count", t).text(
i.ss_data.hturentals_table_data.hturentals_total
),
$(".rentals_listings_table", t).hide().empty(),
b = i.ss_data.hturentals_table_data.hturentals_data,
e = "",
u = 0,
f = b.length;
u < f;
u++
)
e += "" + b[u].Label + " " + b[u].Count + " ";
$(".rentals_listings_table", t).append(e).show();
}
};
this.clear_postcode_graph = function () {
i.graph_papers.pcs_graph_paper && i.graph_papers.pcs_graph_paper.clear();
};
this.multi_column_legend = function (n, t, i) {
var r, e, o, u, l;
i = i || {};
var f = i.column_count || 2,
a = i.legend_member_height || 12,
s = i.legend_symbol_size || 10,
k = i.legend_label_offset || 5,
v = i.legend_font_size || 10,
y = i.padding_top || 10,
d = i.padding_bottom || 10,
p = i.padding_left || 10,
g = i.padding_right || 10,
w = i.paper_width || $("#" + n).width(),
nt = i.legend_width || w - p - g,
h = Math.ceil(t.length / f),
tt = i.paper_height || y + h * a + d,
it = i.column_widths || [],
b = [];
for (r = 0; r < f; r++) b[r] = it[r] || nt / f;
for (e = ScaleRaphael(n, w, tt), o = p, c = 0; c < f; c++)
for (c > 0 && (o += parseFloat(b[c - 1])), r = 0; r < h; r++)
(u = c * h + r),
u < t.length &&
((l = y + r * a),
e
.rect(o, l, s, s)
.attr({ fill: t[u].colour || t[u].color, "stroke-width": 0 }),
e
.text(o + s + k, l + v / 2, t[u].label)
.attr({ "text-anchor": "start", "font-size": v }));
return e;
};
this.setup(n, t);
}
var libFuncName, ss_set, ss_icons, ss_keywords, i, spinner;
if (
((window.Modernizr = (function (n, t, i) {
function k(n) {
g.cssText = n;
}
function o(n, t) {
return typeof n === t;
}
var r = {},
c = !0,
e = t.documentElement,
u = "modernizr",
d = t.createElement(u),
g = d.style,
nt,
tt = {}.toString,
l = " -webkit- -moz- -o- -ms- ".split(" "),
a = { svg: "http://www.w3.org/2000/svg" },
f = {},
v = [],
y = v.slice,
s,
p = function (n, i, r, f) {
var l,
a,
c,
v,
o = t.createElement("div"),
h = t.body,
s = h || t.createElement("body");
if (parseInt(r, 10))
while (r--)
(c = t.createElement("div")),
(c.id = f ? f[r] : u + (r + 1)),
o.appendChild(c);
return (
(l = ["", '"].join("")),
(o.id = u),
((h ? o : s).innerHTML += l),
s.appendChild(o),
h ||
((s.style.background = ""),
(s.style.overflow = "hidden"),
(v = e.style.overflow),
(e.style.overflow = "hidden"),
e.appendChild(s)),
(a = i(o, n)),
h
? o.parentNode.removeChild(o)
: (s.parentNode.removeChild(s), (e.style.overflow = v)),
!!a
);
},
it = function (t) {
var i = n.matchMedia || n.msMatchMedia,
r;
return i
? i(t).matches
: (p(
"@media " + t + " { #" + u + " { position: absolute; } }",
function (t) {
r =
(n.getComputedStyle
? getComputedStyle(t, null)
: t.currentStyle
).position == "absolute";
}
),
r);
},
w = {}.hasOwnProperty,
b,
h;
b =
!o(w, "undefined") && !o(w.call, "undefined")
? function (n, t) {
return w.call(n, t);
}
: function (n, t) {
return t in n && o(n.constructor.prototype[t], "undefined");
};
Function.prototype.bind ||
(Function.prototype.bind = function (n) {
var t = this,
i,
r;
if (typeof t != "function") throw new TypeError();
return (
(i = y.call(arguments, 1)),
(r = function () {
var f, e, u;
return this instanceof r
? ((f = function () {}),
(f.prototype = t.prototype),
(e = new f()),
(u = t.apply(e, i.concat(y.call(arguments)))),
Object(u) === u ? u : e)
: t.apply(n, i.concat(y.call(arguments)));
}),
r
);
});
f.touch = function () {
var i;
return (
"ontouchstart" in n || (n.DocumentTouch && t instanceof DocumentTouch)
? (i = !0)
: p(
[
"@media (",
l.join("touch-enabled),("),
u,
")",
"{#modernizr{top:9px;position:absolute}}",
].join(""),
function (n) {
i = n.offsetTop === 9;
}
),
i
);
};
f.localstorage = function () {
try {
return localStorage.setItem(u, u), localStorage.removeItem(u), !0;
} catch (n) {
return !1;
}
};
f.svg = function () {
return (
!!t.createElementNS && !!t.createElementNS(a.svg, "svg").createSVGRect
);
};
f.inlinesvg = function () {
var n = t.createElement("div");
return (
(n.innerHTML = " "),
(n.firstChild && n.firstChild.namespaceURI) == a.svg
);
};
f.svgclippaths = function () {
return (
!!t.createElementNS &&
/SVGClipPath/.test(tt.call(t.createElementNS(a.svg, "clipPath")))
);
};
for (h in f)
b(f, h) &&
((s = h.toLowerCase()),
(r[s] = f[h]()),
v.push((r[s] ? "" : "no-") + s));
return (
(r.addTest = function (n, t) {
if (typeof n == "object")
for (var u in n) b(n, u) && r.addTest(u, n[u]);
else {
if (((n = n.toLowerCase()), r[n] !== i)) return r;
t = typeof t == "function" ? t() : t;
typeof c != "undefined" &&
c &&
(e.className += " " + (t ? "" : "no-") + n);
r[n] = t;
}
return r;
}),
k(""),
(d = nt = null),
(function (n, t) {
function v(n, t) {
var i = n.createElement("p"),
r = n.getElementsByTagName("head")[0] || n.documentElement;
return (
(i.innerHTML = "x"),
r.insertBefore(i.lastChild, r.firstChild)
);
}
function s() {
var n = r.elements;
return typeof n == "string" ? n.split(" ") : n;
}
function u(n) {
var t = a[n[l]];
return t || ((t = {}), o++, (n[l] = o), (a[o] = t)), t;
}
function h(n, r, f) {
if ((r || (r = t), i)) return r.createElement(n);
f || (f = u(r));
var e;
return (
(e = f.cache[n]
? f.cache[n].cloneNode()
: b.test(n)
? (f.cache[n] = f.createElem(n)).cloneNode()
: f.createElem(n)),
e.canHaveChildren && !w.test(n) ? f.frag.appendChild(e) : e
);
}
function y(n, r) {
if ((n || (n = t), i)) return n.createDocumentFragment();
r = r || u(n);
for (
var e = r.frag.cloneNode(), f = 0, o = s(), h = o.length;
f < h;
f++
)
e.createElement(o[f]);
return e;
}
function p(n, t) {
t.cache ||
((t.cache = {}),
(t.createElem = n.createElement),
(t.createFrag = n.createDocumentFragment),
(t.frag = t.createFrag()));
n.createElement = function (i) {
return r.shivMethods ? h(i, n, t) : t.createElem(i);
};
n.createDocumentFragment = Function(
"h,f",
"return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" +
s()
.join()
.replace(/\w+/g, function (n) {
return (
t.createElem(n), t.frag.createElement(n), 'c("' + n + '")'
);
}) +
");return n}"
)(r, t.frag);
}
function c(n) {
n || (n = t);
var f = u(n);
return (
r.shivCSS &&
!e &&
!f.hasCSS &&
(f.hasCSS = !!v(
n,
"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}"
)),
i || p(n, f),
n
);
}
var f = n.html5 || {},
w =
/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,
b =
/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,
e,
l = "_html5shiv",
o = 0,
a = {},
i,
r;
(function () {
try {
var n = t.createElement("a");
n.innerHTML = " ";
e = "hidden" in n;
i =
n.childNodes.length == 1 ||
(function () {
t.createElement("a");
var n = t.createDocumentFragment();
return (
typeof n.cloneNode == "undefined" ||
typeof n.createDocumentFragment == "undefined" ||
typeof n.createElement == "undefined"
);
})();
} catch (r) {
e = !0;
i = !0;
}
})();
r = {
elements:
f.elements ||
"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",
shivCSS: f.shivCSS !== !1,
supportsUnknownElements: i,
shivMethods: f.shivMethods !== !1,
type: "default",
shivDocument: c,
createElement: h,
createDocumentFragment: y,
};
n.html5 = r;
c(t);
})(this, t),
(r._version = "2.6.2"),
(r._prefixes = l),
(r.mq = it),
(r.testStyles = p),
(e.className =
e.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") +
(c ? " js " + v.join(" ") : "")),
r
);
})(this, this.document)),
(function (n, t, i) {
function h(n) {
return "[object Function]" == y.call(n);
}
function c(n) {
return "string" == typeof n;
}
function l() {}
function w(n) {
return !n || "loaded" == n || "complete" == n || "uninitialized" == n;
}
function f() {
var n = a.shift();
v = 1;
n
? n.t
? s(function () {
("c" == n.t ? u.injectCss : u.injectJs)(n.s, 0, n.a, n.x, n.e, 1);
}, 0)
: (n(), f())
: (v = 0);
}
function ut(n, i, o, h, c, l, y) {
function k(t) {
if (
!nt &&
w(p.readyState) &&
((tt.r = nt = 1),
!v && f(),
(p.onload = p.onreadystatechange = null),
t)
) {
"img" != n &&
s(function () {
g.removeChild(p);
}, 50);
for (var u in r[i]) r[i].hasOwnProperty(u) && r[i][u].onload();
}
}
var y = y || u.errorTimeout,
p = t.createElement(n),
nt = 0,
b = 0,
tt = { t: o, s: i, e: c, a: l, x: y };
1 === r[i] && ((b = 1), (r[i] = []));
"object" == n ? (p.data = i) : ((p.src = i), (p.type = n));
p.width = p.height = "0";
p.onerror =
p.onload =
p.onreadystatechange =
function () {
k.call(this, b);
};
a.splice(h, 0, tt);
"img" != n &&
(b || 2 === r[i]
? (g.insertBefore(p, d ? null : e), s(k, y))
: r[i].push(p));
}
function ft(n, t, i, r, u) {
return (
(v = 0),
(t = t || "j"),
c(n)
? ut("c" == t ? et : nt, n, t, this.i++, i, r, u)
: (a.splice(this.i++, 0, n), 1 == a.length && f()),
this
);
}
function b() {
var n = u;
return (n.loader = { load: ft, i: 0 }), n;
}
var o = t.documentElement,
s = n.setTimeout,
e = t.getElementsByTagName("script")[0],
y = {}.toString,
a = [],
v = 0,
k = "MozAppearance" in o.style,
d = k && !!t.createRange().compareNode,
g = d ? o : e.parentNode,
o = n.opera && "[object Opera]" == y.call(n.opera),
o = !!t.attachEvent && !o,
nt = k ? "object" : o ? "script" : "img",
et = o ? "script" : nt,
tt =
Array.isArray ||
function (n) {
return "[object Array]" == y.call(n);
},
p = [],
r = {},
it = {
timeout: function (n, t) {
return t.length && (n.timeout = t[0]), n;
},
},
rt,
u;
u = function (n) {
function a(n) {
for (
var n = n.split("!"),
f = p.length,
i = n.pop(),
e = n.length,
i = { url: i, origUrl: i, prefixes: n },
u,
r,
t = 0;
t < e;
t++
)
(r = n[t].split("=")), (u = it[r.shift()]) && (i = u(i, r));
for (t = 0; t < f; t++) i = p[t](i);
return i;
}
function f(n, t, u, f, e) {
var o = a(n),
s = o.autoCallback;
o.url.split(".").pop().split("?").shift();
o.bypass ||
(t &&
(t = h(t)
? t
: t[n] || t[f] || t[n.split("/").pop().split("?")[0]]),
o.instead
? o.instead(n, t, u, f, e)
: (r[o.url] ? (o.noexec = !0) : (r[o.url] = 1),
u.load(
o.url,
o.forceCSS ||
(!o.forceJS &&
"css" == o.url.split(".").pop().split("?").shift())
? "c"
: i,
o.noexec,
o.attrs,
o.timeout
),
(h(t) || h(s)) &&
u.load(function () {
b();
t && t(o.origUrl, e, f);
s && s(o.origUrl, e, f);
r[o.url] = 2;
})));
}
function s(n, t) {
function a(n, o) {
if (n) {
if (c(n))
o ||
(i = function () {
var n = [].slice.call(arguments);
s.apply(this, n);
u();
}),
f(n, i, t, 0, e);
else if (Object(n) === n)
for (r in ((v = (function () {
var t = 0;
for (var i in n) n.hasOwnProperty(i) && t++;
return t;
})()),
n))
n.hasOwnProperty(r) &&
(!o &&
!--v &&
(h(i)
? (i = function () {
var n = [].slice.call(arguments);
s.apply(this, n);
u();
})
: (i[r] = (function (n) {
return function () {
var t = [].slice.call(arguments);
n && n.apply(this, t);
u();
};
})(s[r]))),
f(n[r], i, t, r, e));
} else o || u();
}
var e = !!n.test,
o = n.load || n.both,
i = n.callback || l,
s = i,
u = n.complete || l,
v,
r;
a(e ? n.yep : n.nope, !!o);
o && a(o);
}
var e,
t,
o = this.yepnope.loader;
if (c(n)) f(n, 0, o, 0);
else if (tt(n))
for (e = 0; e < n.length; e++)
(t = n[e]),
c(t) ? f(t, 0, o, 0) : tt(t) ? u(t) : Object(t) === t && s(t, o);
else Object(n) === n && s(n, o);
};
u.addPrefix = function (n, t) {
it[n] = t;
};
u.addFilter = function (n) {
p.push(n);
};
u.errorTimeout = 1e4;
null == t.readyState &&
t.addEventListener &&
((t.readyState = "loading"),
t.addEventListener(
"DOMContentLoaded",
(rt = function () {
t.removeEventListener("DOMContentLoaded", rt, 0);
t.readyState = "complete";
}),
0
));
n.yepnope = b();
n.yepnope.executeStack = f;
n.yepnope.injectJs = function (n, i, r, o, h, c) {
var a = t.createElement("script"),
v,
y,
o = o || u.errorTimeout;
a.src = n;
for (y in r) a.setAttribute(y, r[y]);
i = c ? f : i || l;
a.onreadystatechange = a.onload = function () {
!v &&
w(a.readyState) &&
((v = 1), i(), (a.onload = a.onreadystatechange = null));
};
s(function () {
v || ((v = 1), i(1));
}, o);
h ? a.onload() : e.parentNode.insertBefore(a, e);
};
n.yepnope.injectCss = function (n, i, r, u, o, h) {
var u = t.createElement("link"),
c,
i = h ? f : i || l;
u.href = n;
u.rel = "stylesheet";
u.type = "text/css";
for (c in r) u.setAttribute(c, r[c]);
o || (e.parentNode.insertBefore(u, e), s(i, 0));
};
})(this, document),
(Modernizr.load = function () {
yepnope.apply(window, [].slice.call(arguments, 0));
}),
Modernizr.addTest("ie8compat", function () {
return (
!window.addEventListener &&
document.documentMode &&
document.documentMode === 7
);
}),
(function (n, t) {
function gt(n) {
var t = n.length,
r = i.type(n);
return i.isWindow(n)
? !1
: n.nodeType === 1 && t
? !0
: r === "array" ||
(r !== "function" &&
(t === 0 || (typeof t == "number" && t > 0 && t - 1 in n)));
}
function te(n) {
var t = (ni[n] = {});
return (
i.each(n.match(s) || [], function (n, i) {
t[i] = !0;
}),
t
);
}
function ur(n, r, u, f) {
if (i.acceptData(n)) {
var h,
o,
c = i.expando,
l = n.nodeType,
s = l ? i.cache : n,
e = l ? n[c] : n[c] && c;
if ((e && s[e] && (f || s[e].data)) || u !== t || typeof r != "string")
return (
e || (e = l ? (n[c] = b.pop() || i.guid++) : c),
s[e] || (s[e] = l ? {} : { toJSON: i.noop }),
(typeof r == "object" || typeof r == "function") &&
(f
? (s[e] = i.extend(s[e], r))
: (s[e].data = i.extend(s[e].data, r))),
(o = s[e]),
f || (o.data || (o.data = {}), (o = o.data)),
u !== t && (o[i.camelCase(r)] = u),
typeof r == "string"
? ((h = o[r]), h == null && (h = o[i.camelCase(r)]))
: (h = o),
h
);
}
}
function fr(n, t, r) {
if (i.acceptData(n)) {
var f,
o,
s = n.nodeType,
u = s ? i.cache : n,
e = s ? n[i.expando] : i.expando;
if (u[e]) {
if (t && ((f = r ? u[e] : u[e].data), f)) {
for (
i.isArray(t)
? (t = t.concat(i.map(t, i.camelCase)))
: (t in f)
? (t = [t])
: ((t = i.camelCase(t)), (t = (t in f) ? [t] : t.split(" "))),
o = t.length;
o--;
)
delete f[t[o]];
if (r ? !ti(f) : !i.isEmptyObject(f)) return;
}
(r || (delete u[e].data, ti(u[e]))) &&
(s
? i.cleanData([n], !0)
: i.support.deleteExpando || u != u.window
? delete u[e]
: (u[e] = null));
}
}
}
function er(n, r, u) {
if (u === t && n.nodeType === 1) {
var f = "data-" + r.replace(rr, "-$1").toLowerCase();
if (((u = n.getAttribute(f)), typeof u == "string")) {
try {
u =
u === "true"
? !0
: u === "false"
? !1
: u === "null"
? null
: +u + "" === u
? +u
: ir.test(u)
? i.parseJSON(u)
: u;
} catch (e) {}
i.data(n, r, u);
} else u = t;
}
return u;
}
function ti(n) {
for (var t in n)
if ((t !== "data" || !i.isEmptyObject(n[t])) && t !== "toJSON")
return !1;
return !0;
}
function ct() {
return !0;
}
function g() {
return !1;
}
function cr() {
try {
return r.activeElement;
} catch (n) {}
}
function ar(n, t) {
do n = n[t];
while (n && n.nodeType !== 1);
return n;
}
function fi(n, t, r) {
if (i.isFunction(t))
return i.grep(n, function (n, i) {
return !!t.call(n, i, n) !== r;
});
if (t.nodeType)
return i.grep(n, function (n) {
return (n === t) !== r;
});
if (typeof t == "string") {
if (oe.test(t)) return i.filter(t, n, r);
t = i.filter(t, n);
}
return i.grep(n, function (n) {
return i.inArray(n, t) >= 0 !== r;
});
}
function vr(n) {
var i = yr.split("|"),
t = n.createDocumentFragment();
if (t.createElement) while (i.length) t.createElement(i.pop());
return t;
}
function gr(n, t) {
return i.nodeName(n, "table") &&
i.nodeName(t.nodeType === 1 ? t : t.firstChild, "tr")
? n.getElementsByTagName("tbody")[0] ||
n.appendChild(n.ownerDocument.createElement("tbody"))
: n;
}
function nu(n) {
return (n.type = (i.find.attr(n, "type") !== null) + "/" + n.type), n;
}
function tu(n) {
var t = ye.exec(n.type);
return t ? (n.type = t[1]) : n.removeAttribute("type"), n;
}
function hi(n, t) {
for (var u, r = 0; (u = n[r]) != null; r++)
i._data(u, "globalEval", !t || i._data(t[r], "globalEval"));
}
function iu(n, t) {
if (t.nodeType === 1 && i.hasData(n)) {
var u,
f,
o,
s = i._data(n),
r = i._data(t, s),
e = s.events;
if (e) {
delete r.handle;
r.events = {};
for (u in e)
for (f = 0, o = e[u].length; f < o; f++) i.event.add(t, u, e[u][f]);
}
r.data && (r.data = i.extend({}, r.data));
}
}
function be(n, t) {
var r, f, u;
if (t.nodeType === 1) {
if (
((r = t.nodeName.toLowerCase()),
!i.support.noCloneEvent && t[i.expando])
) {
u = i._data(t);
for (f in u.events) i.removeEvent(t, f, u.handle);
t.removeAttribute(i.expando);
}
r === "script" && t.text !== n.text
? ((nu(t).text = n.text), tu(t))
: r === "object"
? (t.parentNode && (t.outerHTML = n.outerHTML),
i.support.html5Clone &&
n.innerHTML &&
!i.trim(t.innerHTML) &&
(t.innerHTML = n.innerHTML))
: r === "input" && oi.test(n.type)
? ((t.defaultChecked = t.checked = n.checked),
t.value !== n.value && (t.value = n.value))
: r === "option"
? (t.defaultSelected = t.selected = n.defaultSelected)
: (r === "input" || r === "textarea") &&
(t.defaultValue = n.defaultValue);
}
}
function u(n, r) {
var s,
e,
h = 0,
f =
typeof n.getElementsByTagName !== o
? n.getElementsByTagName(r || "*")
: typeof n.querySelectorAll !== o
? n.querySelectorAll(r || "*")
: t;
if (!f)
for (f = [], s = n.childNodes || n; (e = s[h]) != null; h++)
!r || i.nodeName(e, r) ? f.push(e) : i.merge(f, u(e, r));
return r === t || (r && i.nodeName(n, r)) ? i.merge([n], f) : f;
}
function ke(n) {
oi.test(n.type) && (n.defaultChecked = n.checked);
}
function ou(n, t) {
if (t in n) return t;
for (
var r = t.charAt(0).toUpperCase() + t.slice(1), u = t, i = eu.length;
i--;
)
if (((t = eu[i] + r), t in n)) return t;
return u;
}
function ut(n, t) {
return (
(n = t || n),
i.css(n, "display") === "none" || !i.contains(n.ownerDocument, n)
);
}
function su(n, t) {
for (var f, r, o, e = [], u = 0, s = n.length; u < s; u++)
((r = n[u]), r.style) &&
((e[u] = i._data(r, "olddisplay")),
(f = r.style.display),
t
? (e[u] || f !== "none" || (r.style.display = ""),
r.style.display === "" &&
ut(r) &&
(e[u] = i._data(r, "olddisplay", au(r.nodeName))))
: e[u] ||
((o = ut(r)),
((f && f !== "none") || !o) &&
i._data(r, "olddisplay", o ? f : i.css(r, "display"))));
for (u = 0; u < s; u++)
((r = n[u]), r.style) &&
((t && r.style.display !== "none" && r.style.display !== "") ||
(r.style.display = t ? e[u] || "" : "none"));
return n;
}
function hu(n, t, i) {
var r = to.exec(t);
return r ? Math.max(0, r[1] - (i || 0)) + (r[2] || "px") : t;
}
function cu(n, t, r, u, f) {
for (
var e = r === (u ? "border" : "content") ? 4 : t === "width" ? 1 : 0,
o = 0;
e < 4;
e += 2
)
r === "margin" && (o += i.css(n, r + p[e], !0, f)),
u
? (r === "content" && (o -= i.css(n, "padding" + p[e], !0, f)),
r !== "margin" &&
(o -= i.css(n, "border" + p[e] + "Width", !0, f)))
: ((o += i.css(n, "padding" + p[e], !0, f)),
r !== "padding" &&
(o += i.css(n, "border" + p[e] + "Width", !0, f)));
return o;
}
function lu(n, t, r) {
var e = !0,
u = t === "width" ? n.offsetWidth : n.offsetHeight,
f = v(n),
o =
i.support.boxSizing && i.css(n, "boxSizing", !1, f) === "border-box";
if (u <= 0 || u == null) {
if (
((u = y(n, t, f)),
(u < 0 || u == null) && (u = n.style[t]),
lt.test(u))
)
return u;
e = o && (i.support.boxSizingReliable || u === n.style[t]);
u = parseFloat(u) || 0;
}
return u + cu(n, t, r || (o ? "border" : "content"), e, f) + "px";
}
function au(n) {
var u = r,
t = uu[n];
return (
t ||
((t = vu(n, u)),
(t !== "none" && t) ||
((rt = (
rt ||
i("").css(
"cssText",
"display:block !important"
)
).appendTo(u.documentElement)),
(u = (rt[0].contentWindow || rt[0].contentDocument).document),
u.write(""),
u.close(),
(t = vu(n, u)),
rt.detach()),
(uu[n] = t)),
t
);
}
function vu(n, t) {
var r = i(t.createElement(n)).appendTo(t.body),
u = i.css(r[0], "display");
return r.remove(), u;
}
function li(n, t, r, u) {
var f;
if (i.isArray(t))
i.each(t, function (t, i) {
r || fo.test(n)
? u(n, i)
: li(n + "[" + (typeof i == "object" ? t : "") + "]", i, r, u);
});
else if (r || i.type(t) !== "object") u(n, t);
else for (f in t) li(n + "[" + f + "]", t[f], r, u);
}
function gu(n) {
return function (t, r) {
typeof t != "string" && ((r = t), (t = "*"));
var u,
f = 0,
e = t.toLowerCase().match(s) || [];
if (i.isFunction(r))
while ((u = e[f++]))
u[0] === "+"
? ((u = u.slice(1) || "*"), (n[u] = n[u] || []).unshift(r))
: (n[u] = n[u] || []).push(r);
};
}
function nf(n, t, r, u) {
function e(s) {
var h;
return (
(f[s] = !0),
i.each(n[s] || [], function (n, i) {
var s = i(t, r, u);
if (typeof s != "string" || o || f[s]) {
if (o) return !(h = s);
} else return t.dataTypes.unshift(s), e(s), !1;
}),
h
);
}
var f = {},
o = n === yi;
return e(t.dataTypes[0]) || (!f["*"] && e("*"));
}
function pi(n, r) {
var f,
u,
e = i.ajaxSettings.flatOptions || {};
for (u in r) r[u] !== t && ((e[u] ? n : f || (f = {}))[u] = r[u]);
return f && i.extend(!0, n, f), n;
}
function ao(n, i, r) {
for (var s, o, f, e, h = n.contents, u = n.dataTypes; u[0] === "*"; )
u.shift(),
o === t && (o = n.mimeType || i.getResponseHeader("Content-Type"));
if (o)
for (e in h)
if (h[e] && h[e].test(o)) {
u.unshift(e);
break;
}
if (u[0] in r) f = u[0];
else {
for (e in r) {
if (!u[0] || n.converters[e + " " + u[0]]) {
f = e;
break;
}
s || (s = e);
}
f = f || s;
}
if (f) return f !== u[0] && u.unshift(f), r[f];
}
function vo(n, t, i, r) {
var h,
u,
f,
s,
e,
o = {},
c = n.dataTypes.slice();
if (c[1]) for (f in n.converters) o[f.toLowerCase()] = n.converters[f];
for (u = c.shift(); u; )
if (
(n.responseFields[u] && (i[n.responseFields[u]] = t),
!e && r && n.dataFilter && (t = n.dataFilter(t, n.dataType)),
(e = u),
(u = c.shift()),
u)
)
if (u === "*") u = e;
else if (e !== "*" && e !== u) {
if (((f = o[e + " " + u] || o["* " + u]), !f))
for (h in o)
if (
((s = h.split(" ")),
s[1] === u && ((f = o[e + " " + s[0]] || o["* " + s[0]]), f))
) {
f === !0
? (f = o[h])
: o[h] !== !0 && ((u = s[0]), c.unshift(s[1]));
break;
}
if (f !== !0)
if (f && n.throws) t = f(t);
else
try {
t = f(t);
} catch (l) {
return {
state: "parsererror",
error: f ? l : "No conversion from " + e + " to " + u,
};
}
}
return { state: "success", data: t };
}
function rf() {
try {
return new n.XMLHttpRequest();
} catch (t) {}
}
function yo() {
try {
return new n.ActiveXObject("Microsoft.XMLHTTP");
} catch (t) {}
}
function ff() {
return (
setTimeout(function () {
it = t;
}),
(it = i.now())
);
}
function ef(n, t, i) {
for (
var u, f = (ft[t] || []).concat(ft["*"]), r = 0, e = f.length;
r < e;
r++
)
if ((u = f[r].call(i, t, n))) return u;
}
function of(n, t, r) {
var e,
o,
s = 0,
l = pt.length,
f = i.Deferred().always(function () {
delete c.elem;
}),
c = function () {
if (o) return !1;
for (
var s = it || ff(),
t = Math.max(0, u.startTime + u.duration - s),
h = t / u.duration || 0,
i = 1 - h,
r = 0,
e = u.tweens.length;
r < e;
r++
)
u.tweens[r].run(i);
return (
f.notifyWith(n, [u, i, t]),
i < 1 && e ? t : (f.resolveWith(n, [u]), !1)
);
},
u = f.promise({
elem: n,
props: i.extend({}, t),
opts: i.extend(!0, { specialEasing: {} }, r),
originalProperties: t,
originalOptions: r,
startTime: it || ff(),
duration: r.duration,
tweens: [],
createTween: function (t, r) {
var f = i.Tween(
n,
u.opts,
t,
r,
u.opts.specialEasing[t] || u.opts.easing
);
return u.tweens.push(f), f;
},
stop: function (t) {
var i = 0,
r = t ? u.tweens.length : 0;
if (o) return this;
for (o = !0; i < r; i++) u.tweens[i].run(1);
return t ? f.resolveWith(n, [u, t]) : f.rejectWith(n, [u, t]), this;
},
}),
h = u.props;
for (bo(h, u.opts.specialEasing); s < l; s++)
if (((e = pt[s].call(u, n, h, u.opts)), e)) return e;
return (
i.map(h, ef, u),
i.isFunction(u.opts.start) && u.opts.start.call(n, u),
i.fx.timer(i.extend(c, { elem: n, anim: u, queue: u.opts.queue })),
u
.progress(u.opts.progress)
.done(u.opts.done, u.opts.complete)
.fail(u.opts.fail)
.always(u.opts.always)
);
}
function bo(n, t) {
var r, f, e, u, o;
for (r in n)
if (
((f = i.camelCase(r)),
(e = t[f]),
(u = n[r]),
i.isArray(u) && ((e = u[1]), (u = n[r] = u[0])),
r !== f && ((n[f] = u), delete n[r]),
(o = i.cssHooks[f]),
o && "expand" in o)
) {
u = o.expand(u);
delete n[f];
for (r in u) r in n || ((n[r] = u[r]), (t[r] = e));
} else t[f] = e;
}
function ko(n, t, r) {
var u,
a,
v,
c,
e,
y,
s = this,
l = {},
o = n.style,
h = n.nodeType && ut(n),
f = i._data(n, "fxshow");
r.queue ||
((e = i._queueHooks(n, "fx")),
e.unqueued == null &&
((e.unqueued = 0),
(y = e.empty.fire),
(e.empty.fire = function () {
e.unqueued || y();
})),
e.unqueued++,
s.always(function () {
s.always(function () {
e.unqueued--;
i.queue(n, "fx").length || e.empty.fire();
});
}));
n.nodeType === 1 &&
("height" in t || "width" in t) &&
((r.overflow = [o.overflow, o.overflowX, o.overflowY]),
i.css(n, "display") === "inline" &&
i.css(n, "float") === "none" &&
(i.support.inlineBlockNeedsLayout && au(n.nodeName) !== "inline"
? (o.zoom = 1)
: (o.display = "inline-block")));
r.overflow &&
((o.overflow = "hidden"),
i.support.shrinkWrapBlocks ||
s.always(function () {
o.overflow = r.overflow[0];
o.overflowX = r.overflow[1];
o.overflowY = r.overflow[2];
}));
for (u in t)
if (((a = t[u]), po.exec(a))) {
if (
(delete t[u],
(v = v || a === "toggle"),
a === (h ? "hide" : "show"))
)
continue;
l[u] = (f && f[u]) || i.style(n, u);
}
if (!i.isEmptyObject(l)) {
f ? "hidden" in f && (h = f.hidden) : (f = i._data(n, "fxshow", {}));
v && (f.hidden = !h);
h
? i(n).show()
: s.done(function () {
i(n).hide();
});
s.done(function () {
var t;
i._removeData(n, "fxshow");
for (t in l) i.style(n, t, l[t]);
});
for (u in l)
(c = ef(h ? f[u] : 0, u, s)),
u in f ||
((f[u] = c.start),
h &&
((c.end = c.start),
(c.start = u === "width" || u === "height" ? 1 : 0)));
}
}
function f(n, t, i, r, u) {
return new f.prototype.init(n, t, i, r, u);
}
function wt(n, t) {
var r,
i = { height: n },
u = 0;
for (t = t ? 1 : 0; u < 4; u += 2 - t)
(r = p[u]), (i["margin" + r] = i["padding" + r] = n);
return t && (i.opacity = i.width = n), i;
}
function sf(n) {
return i.isWindow(n)
? n
: n.nodeType === 9
? n.defaultView || n.parentWindow
: !1;
}
var et,
bi,
o = typeof t,
hf = n.location,
r = n.document,
ki = r.documentElement,
cf = n.jQuery,
lf = n.$,
ot = {},
b = [],
bt = "1.10.1",
di = b.concat,
kt = b.push,
l = b.slice,
gi = b.indexOf,
af = ot.toString,
k = ot.hasOwnProperty,
dt = bt.trim,
i = function (n, t) {
return new i.fn.init(n, t, bi);
},
st = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
s = /\S+/g,
vf = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
yf = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
nr = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
pf = /^[\],:{}\s]*$/,
wf = /(?:^|:|,)(?:\s*\[)+/g,
bf = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
kf = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
df = /^-ms-/,
gf = /-([\da-z])/gi,
ne = function (n, t) {
return t.toUpperCase();
},
h = function (n) {
(r.addEventListener ||
n.type === "load" ||
r.readyState === "complete") &&
(tr(), i.ready());
},
tr = function () {
r.addEventListener
? (r.removeEventListener("DOMContentLoaded", h, !1),
n.removeEventListener("load", h, !1))
: (r.detachEvent("onreadystatechange", h),
n.detachEvent("onload", h));
},
ni,
ir,
rr,
wi,
at,
nt,
tt,
tf,
vt;
i.fn = i.prototype = {
jquery: bt,
constructor: i,
init: function (n, u, f) {
var e, o;
if (!n) return this;
if (typeof n == "string") {
if (
((e =
n.charAt(0) === "<" &&
n.charAt(n.length - 1) === ">" &&
n.length >= 3
? [null, n, null]
: yf.exec(n)),
e && (e[1] || !u))
) {
if (e[1]) {
if (
((u = u instanceof i ? u[0] : u),
i.merge(
this,
i.parseHTML(
e[1],
u && u.nodeType ? u.ownerDocument || u : r,
!0
)
),
nr.test(e[1]) && i.isPlainObject(u))
)
for (e in u)
i.isFunction(this[e]) ? this[e](u[e]) : this.attr(e, u[e]);
return this;
}
if (((o = r.getElementById(e[2])), o && o.parentNode)) {
if (o.id !== e[2]) return f.find(n);
this.length = 1;
this[0] = o;
}
return (this.context = r), (this.selector = n), this;
}
return !u || u.jquery
? (u || f).find(n)
: this.constructor(u).find(n);
}
return n.nodeType
? ((this.context = this[0] = n), (this.length = 1), this)
: i.isFunction(n)
? f.ready(n)
: (n.selector !== t &&
((this.selector = n.selector), (this.context = n.context)),
i.makeArray(n, this));
},
selector: "",
length: 0,
toArray: function () {
return l.call(this);
},
get: function (n) {
return n == null
? this.toArray()
: n < 0
? this[this.length + n]
: this[n];
},
pushStack: function (n) {
var t = i.merge(this.constructor(), n);
return (t.prevObject = this), (t.context = this.context), t;
},
each: function (n, t) {
return i.each(this, n, t);
},
ready: function (n) {
return i.ready.promise().done(n), this;
},
slice: function () {
return this.pushStack(l.apply(this, arguments));
},
first: function () {
return this.eq(0);
},
last: function () {
return this.eq(-1);
},
eq: function (n) {
var i = this.length,
t = +n + (n < 0 ? i : 0);
return this.pushStack(t >= 0 && t < i ? [this[t]] : []);
},
map: function (n) {
return this.pushStack(
i.map(this, function (t, i) {
return n.call(t, i, t);
})
);
},
end: function () {
return this.prevObject || this.constructor(null);
},
push: kt,
sort: [].sort,
splice: [].splice,
};
i.fn.init.prototype = i.fn;
i.extend = i.fn.extend = function () {
var u,
o,
r,
e,
s,
h,
n = arguments[0] || {},
f = 1,
l = arguments.length,
c = !1;
for (
typeof n == "boolean" && ((c = n), (n = arguments[1] || {}), (f = 2)),
typeof n == "object" || i.isFunction(n) || (n = {}),
l === f && ((n = this), --f);
f < l;
f++
)
if ((s = arguments[f]) != null)
for (e in s)
((u = n[e]), (r = s[e]), n !== r) &&
(c && r && (i.isPlainObject(r) || (o = i.isArray(r)))
? (o
? ((o = !1), (h = u && i.isArray(u) ? u : []))
: (h = u && i.isPlainObject(u) ? u : {}),
(n[e] = i.extend(c, h, r)))
: r !== t && (n[e] = r));
return n;
};
i.extend({
expando: "jQuery" + (bt + Math.random()).replace(/\D/g, ""),
noConflict: function (t) {
return (
n.$ === i && (n.$ = lf), t && n.jQuery === i && (n.jQuery = cf), i
);
},
isReady: !1,
readyWait: 1,
holdReady: function (n) {
n ? i.readyWait++ : i.ready(!0);
},
ready: function (n) {
if (n === !0 ? !--i.readyWait : !i.isReady) {
if (!r.body) return setTimeout(i.ready);
((i.isReady = !0), n !== !0 && --i.readyWait > 0) ||
(et.resolveWith(r, [i]),
i.fn.trigger && i(r).trigger("ready").off("ready"));
}
},
isFunction: function (n) {
return i.type(n) === "function";
},
isArray:
Array.isArray ||
function (n) {
return i.type(n) === "array";
},
isWindow: function (n) {
return n != null && n == n.window;
},
isNumeric: function (n) {
return !isNaN(parseFloat(n)) && isFinite(n);
},
type: function (n) {
return n == null
? String(n)
: typeof n == "object" || typeof n == "function"
? ot[af.call(n)] || "object"
: typeof n;
},
isPlainObject: function (n) {
var r;
if (!n || i.type(n) !== "object" || n.nodeType || i.isWindow(n))
return !1;
try {
if (
n.constructor &&
!k.call(n, "constructor") &&
!k.call(n.constructor.prototype, "isPrototypeOf")
)
return !1;
} catch (u) {
return !1;
}
if (i.support.ownLast) for (r in n) return k.call(n, r);
for (r in n);
return r === t || k.call(n, r);
},
isEmptyObject: function (n) {
for (var t in n) return !1;
return !0;
},
error: function (n) {
throw new Error(n);
},
parseHTML: function (n, t, u) {
if (!n || typeof n != "string") return null;
typeof t == "boolean" && ((u = t), (t = !1));
t = t || r;
var f = nr.exec(n),
e = !u && [];
return f
? [t.createElement(f[1])]
: ((f = i.buildFragment([n], t, e)),
e && i(e).remove(),
i.merge([], f.childNodes));
},
parseJSON: function (t) {
if (n.JSON && n.JSON.parse) return n.JSON.parse(t);
if (t === null) return t;
if (
typeof t == "string" &&
((t = i.trim(t)),
t && pf.test(t.replace(bf, "@").replace(kf, "]").replace(wf, "")))
)
return new Function("return " + t)();
i.error("Invalid JSON: " + t);
},
parseXML: function (r) {
var u, f;
if (!r || typeof r != "string") return null;
try {
n.DOMParser
? ((f = new DOMParser()), (u = f.parseFromString(r, "text/xml")))
: ((u = new ActiveXObject("Microsoft.XMLDOM")),
(u.async = "false"),
u.loadXML(r));
} catch (e) {
u = t;
}
return (
(u &&
u.documentElement &&
!u.getElementsByTagName("parsererror").length) ||
i.error("Invalid XML: " + r),
u
);
},
noop: function () {},
globalEval: function (t) {
t &&
i.trim(t) &&
(
n.execScript ||
function (t) {
n.eval.call(n, t);
}
)(t);
},
camelCase: function (n) {
return n.replace(df, "ms-").replace(gf, ne);
},
nodeName: function (n, t) {
return n.nodeName && n.nodeName.toLowerCase() === t.toLowerCase();
},
each: function (n, t, i) {
var u,
r = 0,
f = n.length,
e = gt(n);
if (i) {
if (e) {
for (; r < f; r++) if (((u = t.apply(n[r], i)), u === !1)) break;
} else for (r in n) if (((u = t.apply(n[r], i)), u === !1)) break;
} else if (e) {
for (; r < f; r++) if (((u = t.call(n[r], r, n[r])), u === !1)) break;
} else for (r in n) if (((u = t.call(n[r], r, n[r])), u === !1)) break;
return n;
},
trim:
dt && !dt.call(" ")
? function (n) {
return n == null ? "" : dt.call(n);
}
: function (n) {
return n == null ? "" : (n + "").replace(vf, "");
},
makeArray: function (n, t) {
var r = t || [];
return (
n != null &&
(gt(Object(n))
? i.merge(r, typeof n == "string" ? [n] : n)
: kt.call(r, n)),
r
);
},
inArray: function (n, t, i) {
var r;
if (t) {
if (gi) return gi.call(t, n, i);
for (
r = t.length, i = i ? (i < 0 ? Math.max(0, r + i) : i) : 0;
i < r;
i++
)
if (i in t && t[i] === n) return i;
}
return -1;
},
merge: function (n, i) {
var f = i.length,
u = n.length,
r = 0;
if (typeof f == "number") for (; r < f; r++) n[u++] = i[r];
else while (i[r] !== t) n[u++] = i[r++];
return (n.length = u), n;
},
grep: function (n, t, i) {
var u,
f = [],
r = 0,
e = n.length;
for (i = !!i; r < e; r++) (u = !!t(n[r], r)), i !== u && f.push(n[r]);
return f;
},
map: function (n, t, i) {
var u,
r = 0,
e = n.length,
o = gt(n),
f = [];
if (o)
for (; r < e; r++)
(u = t(n[r], r, i)), u != null && (f[f.length] = u);
else for (r in n) (u = t(n[r], r, i)), u != null && (f[f.length] = u);
return di.apply([], f);
},
guid: 1,
proxy: function (n, r) {
var f, u, e;
return (typeof r == "string" && ((e = n[r]), (r = n), (n = e)),
!i.isFunction(n))
? t
: ((f = l.call(arguments, 2)),
(u = function () {
return n.apply(r || this, f.concat(l.call(arguments)));
}),
(u.guid = n.guid = n.guid || i.guid++),
u);
},
access: function (n, r, u, f, e, o, s) {
var h = 0,
l = n.length,
c = u == null;
if (i.type(u) === "object") {
e = !0;
for (h in u) i.access(n, r, h, u[h], !0, o, s);
} else if (
f !== t &&
((e = !0),
i.isFunction(f) || (s = !0),
c &&
(s
? (r.call(n, f), (r = null))
: ((c = r),
(r = function (n, t, r) {
return c.call(i(n), r);
}))),
r)
)
for (; h < l; h++) r(n[h], u, s ? f : f.call(n[h], h, r(n[h], u)));
return e ? n : c ? r.call(n) : l ? r(n[0], u) : o;
},
now: function () {
return new Date().getTime();
},
swap: function (n, t, i, r) {
var f,
u,
e = {};
for (u in t) (e[u] = n.style[u]), (n.style[u] = t[u]);
f = i.apply(n, r || []);
for (u in t) n.style[u] = e[u];
return f;
},
});
i.ready.promise = function (t) {
if (!et)
if (((et = i.Deferred()), r.readyState === "complete"))
setTimeout(i.ready);
else if (r.addEventListener)
r.addEventListener("DOMContentLoaded", h, !1),
n.addEventListener("load", h, !1);
else {
r.attachEvent("onreadystatechange", h);
n.attachEvent("onload", h);
var u = !1;
try {
u = n.frameElement == null && r.documentElement;
} catch (e) {}
u &&
u.doScroll &&
(function f() {
if (!i.isReady) {
try {
u.doScroll("left");
} catch (n) {
return setTimeout(f, 50);
}
tr();
i.ready();
}
})();
}
return et.promise(t);
};
i.each(
"Boolean Number String Function Array Date RegExp Object Error".split(
" "
),
function (n, t) {
ot["[object " + t + "]"] = t.toLowerCase();
}
);
(bi = i(r)),
(function (n, t) {
function u(n, t, i, r) {
var p, u, f, l, w, y, k, c, g, d;
if (
((t ? t.ownerDocument || t : v) !== s && nt(t),
(t = t || s),
(i = i || []),
!n || typeof n != "string")
)
return i;
if ((l = t.nodeType) !== 1 && l !== 9) return [];
if (a && !r) {
if ((p = sr.exec(n)))
if ((f = p[1])) {
if (l === 9)
if (((u = t.getElementById(f)), u && u.parentNode)) {
if (u.id === f) return i.push(u), i;
} else return i;
else if (
t.ownerDocument &&
(u = t.ownerDocument.getElementById(f)) &&
et(t, u) &&
u.id === f
)
return i.push(u), i;
} else {
if (p[2]) return b.apply(i, t.getElementsByTagName(n)), i;
if (
(f = p[3]) &&
e.getElementsByClassName &&
t.getElementsByClassName
)
return b.apply(i, t.getElementsByClassName(f)), i;
}
if (e.qsa && (!h || !h.test(n))) {
if (
((c = k = o),
(g = t),
(d = l === 9 && n),
l === 1 && t.nodeName.toLowerCase() !== "object")
) {
for (
y = wt(n),
(k = t.getAttribute("id"))
? (c = k.replace(lr, "\\$&"))
: t.setAttribute("id", c),
c = "[id='" + c + "'] ",
w = y.length;
w--;
)
y[w] = c + bt(y[w]);
g = (ti.test(n) && t.parentNode) || t;
d = y.join(",");
}
if (d)
try {
return b.apply(i, g.querySelectorAll(d)), i;
} catch (tt) {
} finally {
k || t.removeAttribute("id");
}
}
}
return dr(n.replace(yt, "$1"), t, i, r);
}
function ii(n) {
return or.test(n + "");
}
function ri() {
function n(i, u) {
return (
t.push((i += " ")) > r.cacheLength && delete n[t.shift()],
(n[i] = u)
);
}
var t = [];
return n;
}
function c(n) {
return (n[o] = !0), n;
}
function p(n) {
var t = s.createElement("div");
try {
return !!n(t);
} catch (i) {
return !1;
} finally {
t.parentNode && t.parentNode.removeChild(t);
t = null;
}
}
function ui(n, t, i) {
n = n.split("|");
for (var f, u = n.length, e = i ? null : t; u--; )
((f = r.attrHandle[n[u]]) && f !== t) || (r.attrHandle[n[u]] = e);
}
function ar(n, t) {
var i = n.getAttributeNode(t);
return i && i.specified
? i.value
: n[t] === !0
? t.toLowerCase()
: null;
}
function vr(n, t) {
return n.getAttribute(t, t.toLowerCase() === "type" ? 1 : 2);
}
function yr(n) {
if (n.nodeName.toLowerCase() === "input") return n.defaultValue;
}
function bi(n, t) {
var i = t && n,
r =
i &&
n.nodeType === 1 &&
t.nodeType === 1 &&
(~t.sourceIndex || vi) - (~n.sourceIndex || vi);
if (r) return r;
if (i) while ((i = i.nextSibling)) if (i === t) return -1;
return n ? 1 : -1;
}
function pr(n) {
return function (t) {
var i = t.nodeName.toLowerCase();
return i === "input" && t.type === n;
};
}
function wr(n) {
return function (t) {
var i = t.nodeName.toLowerCase();
return (i === "input" || i === "button") && t.type === n;
};
}
function rt(n) {
return c(function (t) {
return (
(t = +t),
c(function (i, r) {
for (var u, f = n([], i.length, t), e = f.length; e--; )
i[(u = f[e])] && (i[u] = !(r[u] = i[u]));
})
);
});
}
function wt(n, t) {
var e,
f,
s,
o,
i,
h,
c,
l = li[n + " "];
if (l) return t ? 0 : l.slice(0);
for (i = n, h = [], c = r.preFilter; i; ) {
(!e || (f = ir.exec(i))) &&
(f && (i = i.slice(f[0].length) || i), h.push((s = [])));
e = !1;
(f = rr.exec(i)) &&
((e = f.shift()),
s.push({ value: e, type: f[0].replace(yt, " ") }),
(i = i.slice(e.length)));
for (o in r.filter)
(f = pt[o].exec(i)) &&
(!c[o] || (f = c[o](f))) &&
((e = f.shift()),
s.push({ value: e, type: o, matches: f }),
(i = i.slice(e.length)));
if (!e) break;
}
return t ? i.length : i ? u.error(n) : li(n, h).slice(0);
}
function bt(n) {
for (var t = 0, r = n.length, i = ""; t < r; t++) i += n[t].value;
return i;
}
function fi(n, t, i) {
var r = t.dir,
u = i && r === "parentNode",
f = di++;
return t.first
? function (t, i, f) {
while ((t = t[r])) if (t.nodeType === 1 || u) return n(t, i, f);
}
: function (t, i, e) {
var h,
s,
c,
l = y + " " + f;
if (e) {
while ((t = t[r]))
if ((t.nodeType === 1 || u) && n(t, i, e)) return !0;
} else
while ((t = t[r]))
if (t.nodeType === 1 || u)
if (
((c = t[o] || (t[o] = {})), (s = c[r]) && s[0] === l)
) {
if ((h = s[1]) === !0 || h === ht) return h === !0;
} else if (
((s = c[r] = [l]),
(s[1] = n(t, i, e) || ht),
s[1] === !0)
)
return !0;
};
}
function ei(n) {
return n.length > 1
? function (t, i, r) {
for (var u = n.length; u--; ) if (!n[u](t, i, r)) return !1;
return !0;
}
: n[0];
}
function kt(n, t, i, r, u) {
for (var e, o = [], f = 0, s = n.length, h = t != null; f < s; f++)
(e = n[f]) && (!i || i(e, r, u)) && (o.push(e), h && t.push(f));
return o;
}
function oi(n, t, i, r, u, f) {
return (
r && !r[o] && (r = oi(r)),
u && !u[o] && (u = oi(u, f)),
c(function (f, e, o, s) {
var l,
c,
a,
p = [],
y = [],
w = e.length,
k = f || kr(t || "*", o.nodeType ? [o] : o, []),
v = n && (f || !t) ? kt(k, p, n, o, s) : k,
h = i ? (u || (f ? n : w || r) ? [] : e) : v;
if ((i && i(v, h, o, s), r))
for (l = kt(h, y), r(l, [], o, s), c = l.length; c--; )
(a = l[c]) && (h[y[c]] = !(v[y[c]] = a));
if (f) {
if (u || n) {
if (u) {
for (l = [], c = h.length; c--; )
(a = h[c]) && l.push((v[c] = a));
u(null, (h = []), l, s);
}
for (c = h.length; c--; )
(a = h[c]) &&
(l = u ? it.call(f, a) : p[c]) > -1 &&
(f[l] = !(e[l] = a));
}
} else (h = kt(h === e ? h.splice(w, h.length) : h)), u ? u(null, e, h, s) : b.apply(e, h);
})
);
}
function si(n) {
for (
var s,
u,
i,
e = n.length,
h = r.relative[n[0].type],
c = h || r.relative[" "],
t = h ? 1 : 0,
l = fi(
function (n) {
return n === s;
},
c,
!0
),
a = fi(
function (n) {
return it.call(s, n) > -1;
},
c,
!0
),
f = [
function (n, t, i) {
return (
(!h && (i || t !== lt)) ||
((s = t).nodeType ? l(n, t, i) : a(n, t, i))
);
},
];
t < e;
t++
)
if ((u = r.relative[n[t].type])) f = [fi(ei(f), u)];
else {
if (((u = r.filter[n[t].type].apply(null, n[t].matches)), u[o])) {
for (i = ++t; i < e; i++) if (r.relative[n[i].type]) break;
return oi(
t > 1 && ei(f),
t > 1 &&
bt(
n
.slice(0, t - 1)
.concat({ value: n[t - 2].type === " " ? "*" : "" })
).replace(yt, "$1"),
u,
t < i && si(n.slice(t, i)),
i < e && si((n = n.slice(i))),
i < e && bt(n)
);
}
f.push(u);
}
return ei(f);
}
function br(n, t) {
var f = 0,
i = t.length > 0,
e = n.length > 0,
o = function (o, h, c, l, a) {
var p,
g,
k,
w = [],
d = 0,
v = "0",
nt = o && [],
tt = a != null,
it = lt,
ut = o || (e && r.find.TAG("*", (a && h.parentNode) || h)),
rt = (y += it == null ? 1 : Math.random() || 0.1);
for (
tt && ((lt = h !== s && h), (ht = f));
(p = ut[v]) != null;
v++
) {
if (e && p) {
for (g = 0; (k = n[g++]); )
if (k(p, h, c)) {
l.push(p);
break;
}
tt && ((y = rt), (ht = ++f));
}
i && ((p = !k && p) && d--, o && nt.push(p));
}
if (((d += v), i && v !== d)) {
for (g = 0; (k = t[g++]); ) k(nt, w, h, c);
if (o) {
if (d > 0) while (v--) nt[v] || w[v] || (w[v] = nr.call(l));
w = kt(w);
}
b.apply(l, w);
tt && !o && w.length > 0 && d + t.length > 1 && u.uniqueSort(l);
}
return tt && ((y = rt), (lt = it)), nt;
};
return i ? c(o) : o;
}
function kr(n, t, i) {
for (var r = 0, f = t.length; r < f; r++) u(n, t[r], i);
return i;
}
function dr(n, t, i, u) {
var s,
f,
o,
c,
l,
h = wt(n);
if (!u && h.length === 1) {
if (
((f = h[0] = h[0].slice(0)),
f.length > 2 &&
(o = f[0]).type === "ID" &&
e.getById &&
t.nodeType === 9 &&
a &&
r.relative[f[1].type])
) {
if (
((t = (r.find.ID(o.matches[0].replace(k, d), t) || [])[0]), !t)
)
return i;
n = n.slice(f.shift().value.length);
}
for (s = pt.needsContext.test(n) ? 0 : f.length; s--; ) {
if (((o = f[s]), r.relative[(c = o.type)])) break;
if (
(l = r.find[c]) &&
(u = l(
o.matches[0].replace(k, d),
(ti.test(f[0].type) && t.parentNode) || t
))
) {
if ((f.splice(s, 1), (n = u.length && bt(f)), !n))
return b.apply(i, u), i;
break;
}
}
}
return dt(n, h)(u, t, !a, i, ti.test(n)), i;
}
function ki() {}
var ut,
e,
ht,
r,
ct,
hi,
dt,
lt,
g,
nt,
s,
l,
a,
h,
tt,
at,
et,
o = "sizzle" + -new Date(),
v = n.document,
y = 0,
di = 0,
ci = ri(),
li = ri(),
ai = ri(),
ot = !1,
vt = function () {
return 0;
},
st = typeof t,
vi = -2147483648,
gi = {}.hasOwnProperty,
w = [],
nr = w.pop,
tr = w.push,
b = w.push,
yi = w.slice,
it =
w.indexOf ||
function (n) {
for (var t = 0, i = this.length; t < i; t++)
if (this[t] === n) return t;
return -1;
},
gt =
"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
f = "[\\x20\\t\\r\\n\\f]",
ft = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
pi = ft.replace("w", "w#"),
wi =
"\\[" +
f +
"*(" +
ft +
")" +
f +
"*(?:([*^$|!~]?=)" +
f +
"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" +
pi +
")|)|)" +
f +
"*\\]",
ni =
":(" +
ft +
")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" +
wi.replace(3, 8) +
")*)|.*)\\)|)",
yt = new RegExp(
"^" + f + "+|((?:^|[^\\\\])(?:\\\\.)*)" + f + "+$",
"g"
),
ir = new RegExp("^" + f + "*," + f + "*"),
rr = new RegExp("^" + f + "*([>+~]|" + f + ")" + f + "*"),
ti = new RegExp(f + "*[+~]"),
ur = new RegExp("=" + f + "*([^\\]'\"]*)" + f + "*\\]", "g"),
fr = new RegExp(ni),
er = new RegExp("^" + pi + "$"),
pt = {
ID: new RegExp("^#(" + ft + ")"),
CLASS: new RegExp("^\\.(" + ft + ")"),
TAG: new RegExp("^(" + ft.replace("w", "w*") + ")"),
ATTR: new RegExp("^" + wi),
PSEUDO: new RegExp("^" + ni),
CHILD: new RegExp(
"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
f +
"*(even|odd|(([+-]|)(\\d*)n|)" +
f +
"*(?:([+-]|)" +
f +
"*(\\d+)|))" +
f +
"*\\)|)",
"i"
),
bool: new RegExp("^(?:" + gt + ")$", "i"),
needsContext: new RegExp(
"^" +
f +
"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
f +
"*((?:-\\d)?\\d*)" +
f +
"*\\)|)(?=[^-]|$)",
"i"
),
},
or = /^[^{]+\{\s*\[native \w/,
sr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
hr = /^(?:input|select|textarea|button)$/i,
cr = /^h\d$/i,
lr = /'|\\/g,
k = new RegExp("\\\\([\\da-f]{1,6}" + f + "?|(" + f + ")|.)", "ig"),
d = function (n, t, i) {
var r = "0x" + t - 65536;
return r !== r || i
? t
: r < 0
? String.fromCharCode(r + 65536)
: String.fromCharCode((r >> 10) | 55296, (r & 1023) | 56320);
};
try {
b.apply((w = yi.call(v.childNodes)), v.childNodes);
w[v.childNodes.length].nodeType;
} catch (gr) {
b = {
apply: w.length
? function (n, t) {
tr.apply(n, yi.call(t));
}
: function (n, t) {
for (var i = n.length, r = 0; (n[i++] = t[r++]); );
n.length = i - 1;
},
};
}
hi = u.isXML = function (n) {
var t = n && (n.ownerDocument || n).documentElement;
return t ? t.nodeName !== "HTML" : !1;
};
e = u.support = {};
nt = u.setDocument = function (n) {
var t = n ? n.ownerDocument || n : v,
i = t.parentWindow;
return t === s || t.nodeType !== 9 || !t.documentElement
? s
: ((s = t),
(l = t.documentElement),
(a = !hi(t)),
i &&
i.frameElement &&
i.attachEvent("onbeforeunload", function () {
nt();
}),
(e.attributes = p(function (n) {
return (
(n.innerHTML = " "),
ui(
"type|href|height|width",
vr,
n.firstChild.getAttribute("href") === "#"
),
ui(gt, ar, n.getAttribute("disabled") == null),
(n.className = "i"),
!n.getAttribute("className")
);
})),
(e.input = p(function (n) {
return (
(n.innerHTML = " "),
n.firstChild.setAttribute("value", ""),
n.firstChild.getAttribute("value") === ""
);
})),
ui("value", yr, e.attributes && e.input),
(e.getElementsByTagName = p(function (n) {
return (
n.appendChild(t.createComment("")),
!n.getElementsByTagName("*").length
);
})),
(e.getElementsByClassName = p(function (n) {
return (
(n.innerHTML =
"
"),
(n.firstChild.className = "i"),
n.getElementsByClassName("i").length === 2
);
})),
(e.getById = p(function (n) {
return (
(l.appendChild(n).id = o),
!t.getElementsByName || !t.getElementsByName(o).length
);
})),
e.getById
? ((r.find.ID = function (n, t) {
if (typeof t.getElementById !== st && a) {
var i = t.getElementById(n);
return i && i.parentNode ? [i] : [];
}
}),
(r.filter.ID = function (n) {
var t = n.replace(k, d);
return function (n) {
return n.getAttribute("id") === t;
};
}))
: (delete r.find.ID,
(r.filter.ID = function (n) {
var t = n.replace(k, d);
return function (n) {
var i =
typeof n.getAttributeNode !== st &&
n.getAttributeNode("id");
return i && i.value === t;
};
})),
(r.find.TAG = e.getElementsByTagName
? function (n, t) {
if (typeof t.getElementsByTagName !== st)
return t.getElementsByTagName(n);
}
: function (n, t) {
var i,
r = [],
f = 0,
u = t.getElementsByTagName(n);
if (n === "*") {
while ((i = u[f++])) i.nodeType === 1 && r.push(i);
return r;
}
return u;
}),
(r.find.CLASS =
e.getElementsByClassName &&
function (n, t) {
if (typeof t.getElementsByClassName !== st && a)
return t.getElementsByClassName(n);
}),
(tt = []),
(h = []),
(e.qsa = ii(t.querySelectorAll)) &&
(p(function (n) {
n.innerHTML =
" ";
n.querySelectorAll("[selected]").length ||
h.push("\\[" + f + "*(?:value|" + gt + ")");
n.querySelectorAll(":checked").length || h.push(":checked");
}),
p(function (n) {
var i = t.createElement("input");
i.setAttribute("type", "hidden");
n.appendChild(i).setAttribute("t", "");
n.querySelectorAll("[t^='']").length &&
h.push("[*^$]=" + f + "*(?:''|\"\")");
n.querySelectorAll(":enabled").length ||
h.push(":enabled", ":disabled");
n.querySelectorAll("*,:x");
h.push(",.*:");
})),
(e.matchesSelector = ii(
(at =
l.webkitMatchesSelector ||
l.mozMatchesSelector ||
l.oMatchesSelector ||
l.msMatchesSelector)
)) &&
p(function (n) {
e.disconnectedMatch = at.call(n, "div");
at.call(n, "[s!='']:x");
tt.push("!=", ni);
}),
(h = h.length && new RegExp(h.join("|"))),
(tt = tt.length && new RegExp(tt.join("|"))),
(et =
ii(l.contains) || l.compareDocumentPosition
? function (n, t) {
var r = n.nodeType === 9 ? n.documentElement : n,
i = t && t.parentNode;
return (
n === i ||
!!(
i &&
i.nodeType === 1 &&
(r.contains
? r.contains(i)
: n.compareDocumentPosition &&
n.compareDocumentPosition(i) & 16)
)
);
}
: function (n, t) {
if (t) while ((t = t.parentNode)) if (t === n) return !0;
return !1;
}),
(e.sortDetached = p(function (n) {
return n.compareDocumentPosition(t.createElement("div")) & 1;
})),
(vt = l.compareDocumentPosition
? function (n, i) {
if (n === i) return (ot = !0), 0;
var r =
i.compareDocumentPosition &&
n.compareDocumentPosition &&
n.compareDocumentPosition(i);
return r
? r & 1 ||
(!e.sortDetached && i.compareDocumentPosition(n) === r)
? n === t || et(v, n)
? -1
: i === t || et(v, i)
? 1
: g
? it.call(g, n) - it.call(g, i)
: 0
: r & 4
? -1
: 1
: n.compareDocumentPosition
? -1
: 1;
}
: function (n, i) {
var r,
u = 0,
o = n.parentNode,
s = i.parentNode,
f = [n],
e = [i];
if (n === i) return (ot = !0), 0;
if (o && s) {
if (o === s) return bi(n, i);
} else
return n === t
? -1
: i === t
? 1
: o
? -1
: s
? 1
: g
? it.call(g, n) - it.call(g, i)
: 0;
for (r = n; (r = r.parentNode); ) f.unshift(r);
for (r = i; (r = r.parentNode); ) e.unshift(r);
while (f[u] === e[u]) u++;
return u
? bi(f[u], e[u])
: f[u] === v
? -1
: e[u] === v
? 1
: 0;
}),
t);
};
u.matches = function (n, t) {
return u(n, null, null, t);
};
u.matchesSelector = function (n, t) {
if (
((n.ownerDocument || n) !== s && nt(n),
(t = t.replace(ur, "='$1']")),
e.matchesSelector &&
a &&
(!tt || !tt.test(t)) &&
(!h || !h.test(t)))
)
try {
var i = at.call(n, t);
if (
i ||
e.disconnectedMatch ||
(n.document && n.document.nodeType !== 11)
)
return i;
} catch (r) {}
return u(t, s, null, [n]).length > 0;
};
u.contains = function (n, t) {
return (n.ownerDocument || n) !== s && nt(n), et(n, t);
};
u.attr = function (n, i) {
(n.ownerDocument || n) !== s && nt(n);
var f = r.attrHandle[i.toLowerCase()],
u = f && gi.call(r.attrHandle, i.toLowerCase()) ? f(n, i, !a) : t;
return u === t
? e.attributes || !a
? n.getAttribute(i)
: (u = n.getAttributeNode(i)) && u.specified
? u.value
: null
: u;
};
u.error = function (n) {
throw new Error("Syntax error, unrecognized expression: " + n);
};
u.uniqueSort = function (n) {
var r,
u = [],
t = 0,
i = 0;
if (
((ot = !e.detectDuplicates),
(g = !e.sortStable && n.slice(0)),
n.sort(vt),
ot)
) {
while ((r = n[i++])) r === n[i] && (t = u.push(i));
while (t--) n.splice(u[t], 1);
}
return n;
};
ct = u.getText = function (n) {
var r,
i = "",
u = 0,
t = n.nodeType;
if (t) {
if (t === 1 || t === 9 || t === 11) {
if (typeof n.textContent == "string") return n.textContent;
for (n = n.firstChild; n; n = n.nextSibling) i += ct(n);
} else if (t === 3 || t === 4) return n.nodeValue;
} else for (; (r = n[u]); u++) i += ct(r);
return i;
};
r = u.selectors = {
cacheLength: 50,
createPseudo: c,
match: pt,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: !0 },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: !0 },
"~": { dir: "previousSibling" },
},
preFilter: {
ATTR: function (n) {
return (
(n[1] = n[1].replace(k, d)),
(n[3] = (n[4] || n[5] || "").replace(k, d)),
n[2] === "~=" && (n[3] = " " + n[3] + " "),
n.slice(0, 4)
);
},
CHILD: function (n) {
return (
(n[1] = n[1].toLowerCase()),
n[1].slice(0, 3) === "nth"
? (n[3] || u.error(n[0]),
(n[4] = +(n[4]
? n[5] + (n[6] || 1)
: 2 * (n[3] === "even" || n[3] === "odd"))),
(n[5] = +(n[7] + n[8] || n[3] === "odd")))
: n[3] && u.error(n[0]),
n
);
},
PSEUDO: function (n) {
var r,
i = !n[5] && n[2];
return pt.CHILD.test(n[0])
? null
: (n[3] && n[4] !== t
? (n[2] = n[4])
: i &&
fr.test(i) &&
(r = wt(i, !0)) &&
(r = i.indexOf(")", i.length - r) - i.length) &&
((n[0] = n[0].slice(0, r)), (n[2] = i.slice(0, r))),
n.slice(0, 3));
},
},
filter: {
TAG: function (n) {
var t = n.replace(k, d).toLowerCase();
return n === "*"
? function () {
return !0;
}
: function (n) {
return n.nodeName && n.nodeName.toLowerCase() === t;
};
},
CLASS: function (n) {
var t = ci[n + " "];
return (
t ||
((t = new RegExp("(^|" + f + ")" + n + "(" + f + "|$)")) &&
ci(n, function (n) {
return t.test(
(typeof n.className == "string" && n.className) ||
(typeof n.getAttribute !== st &&
n.getAttribute("class")) ||
""
);
}))
);
},
ATTR: function (n, t, i) {
return function (r) {
var f = u.attr(r, n);
return f == null
? t === "!="
: t
? ((f += ""),
t === "="
? f === i
: t === "!="
? f !== i
: t === "^="
? i && f.indexOf(i) === 0
: t === "*="
? i && f.indexOf(i) > -1
: t === "$="
? i && f.slice(-i.length) === i
: t === "~="
? (" " + f + " ").indexOf(i) > -1
: t === "|="
? f === i || f.slice(0, i.length + 1) === i + "-"
: !1)
: !0;
};
},
CHILD: function (n, t, i, r, u) {
var s = n.slice(0, 3) !== "nth",
e = n.slice(-4) !== "last",
f = t === "of-type";
return r === 1 && u === 0
? function (n) {
return !!n.parentNode;
}
: function (t, i, h) {
var a,
k,
c,
l,
v,
w,
b = s !== e ? "nextSibling" : "previousSibling",
p = t.parentNode,
g = f && t.nodeName.toLowerCase(),
d = !h && !f;
if (p) {
if (s) {
while (b) {
for (c = t; (c = c[b]); )
if (
f
? c.nodeName.toLowerCase() === g
: c.nodeType === 1
)
return !1;
w = b = n === "only" && !w && "nextSibling";
}
return !0;
}
if (((w = [e ? p.firstChild : p.lastChild]), e && d)) {
for (
k = p[o] || (p[o] = {}),
a = k[n] || [],
v = a[0] === y && a[1],
l = a[0] === y && a[2],
c = v && p.childNodes[v];
(c = (++v && c && c[b]) || (l = v = 0) || w.pop());
)
if (c.nodeType === 1 && ++l && c === t) {
k[n] = [y, v, l];
break;
}
} else if (
d &&
(a = (t[o] || (t[o] = {}))[n]) &&
a[0] === y
)
l = a[1];
else
while (
(c = (++v && c && c[b]) || (l = v = 0) || w.pop())
)
if (
(f
? c.nodeName.toLowerCase() === g
: c.nodeType === 1) &&
++l &&
(d && ((c[o] || (c[o] = {}))[n] = [y, l]), c === t)
)
break;
return (l -= u), l === r || (l % r == 0 && l / r >= 0);
}
};
},
PSEUDO: function (n, t) {
var f,
i =
r.pseudos[n] ||
r.setFilters[n.toLowerCase()] ||
u.error("unsupported pseudo: " + n);
return i[o]
? i(t)
: i.length > 1
? ((f = [n, n, "", t]),
r.setFilters.hasOwnProperty(n.toLowerCase())
? c(function (n, r) {
for (var u, f = i(n, t), e = f.length; e--; )
(u = it.call(n, f[e])), (n[u] = !(r[u] = f[e]));
})
: function (n) {
return i(n, 0, f);
})
: i;
},
},
pseudos: {
not: c(function (n) {
var i = [],
r = [],
t = dt(n.replace(yt, "$1"));
return t[o]
? c(function (n, i, r, u) {
for (var e, o = t(n, null, u, []), f = n.length; f--; )
(e = o[f]) && (n[f] = !(i[f] = e));
})
: function (n, u, f) {
return (i[0] = n), t(i, null, f, r), !r.pop();
};
}),
has: c(function (n) {
return function (t) {
return u(n, t).length > 0;
};
}),
contains: c(function (n) {
return function (t) {
return (t.textContent || t.innerText || ct(t)).indexOf(n) > -1;
};
}),
lang: c(function (n) {
return (
er.test(n || "") || u.error("unsupported lang: " + n),
(n = n.replace(k, d).toLowerCase()),
function (t) {
var i;
do
if (
(i = a
? t.lang
: t.getAttribute("xml:lang") || t.getAttribute("lang"))
)
return (
(i = i.toLowerCase()),
i === n || i.indexOf(n + "-") === 0
);
while ((t = t.parentNode) && t.nodeType === 1);
return !1;
}
);
}),
target: function (t) {
var i = n.location && n.location.hash;
return i && i.slice(1) === t.id;
},
root: function (n) {
return n === l;
},
focus: function (n) {
return (
n === s.activeElement &&
(!s.hasFocus || s.hasFocus()) &&
!!(n.type || n.href || ~n.tabIndex)
);
},
enabled: function (n) {
return n.disabled === !1;
},
disabled: function (n) {
return n.disabled === !0;
},
checked: function (n) {
var t = n.nodeName.toLowerCase();
return (
(t === "input" && !!n.checked) ||
(t === "option" && !!n.selected)
);
},
selected: function (n) {
return (
n.parentNode && n.parentNode.selectedIndex, n.selected === !0
);
},
empty: function (n) {
for (n = n.firstChild; n; n = n.nextSibling)
if (n.nodeName > "@" || n.nodeType === 3 || n.nodeType === 4)
return !1;
return !0;
},
parent: function (n) {
return !r.pseudos.empty(n);
},
header: function (n) {
return cr.test(n.nodeName);
},
input: function (n) {
return hr.test(n.nodeName);
},
button: function (n) {
var t = n.nodeName.toLowerCase();
return (t === "input" && n.type === "button") || t === "button";
},
text: function (n) {
var t;
return (
n.nodeName.toLowerCase() === "input" &&
n.type === "text" &&
((t = n.getAttribute("type")) == null ||
t.toLowerCase() === n.type)
);
},
first: rt(function () {
return [0];
}),
last: rt(function (n, t) {
return [t - 1];
}),
eq: rt(function (n, t, i) {
return [i < 0 ? i + t : i];
}),
even: rt(function (n, t) {
for (var i = 0; i < t; i += 2) n.push(i);
return n;
}),
odd: rt(function (n, t) {
for (var i = 1; i < t; i += 2) n.push(i);
return n;
}),
lt: rt(function (n, t, i) {
for (var r = i < 0 ? i + t : i; --r >= 0; ) n.push(r);
return n;
}),
gt: rt(function (n, t, i) {
for (var r = i < 0 ? i + t : i; ++r < t; ) n.push(r);
return n;
}),
},
};
for (ut in {
radio: !0,
checkbox: !0,
file: !0,
password: !0,
image: !0,
})
r.pseudos[ut] = pr(ut);
for (ut in { submit: !0, reset: !0 }) r.pseudos[ut] = wr(ut);
dt = u.compile = function (n, t) {
var r,
u = [],
f = [],
i = ai[n + " "];
if (!i) {
for (t || (t = wt(n)), r = t.length; r--; )
(i = si(t[r])), i[o] ? u.push(i) : f.push(i);
i = ai(n, br(f, u));
}
return i;
};
r.pseudos.nth = r.pseudos.eq;
ki.prototype = r.filters = r.pseudos;
r.setFilters = new ki();
e.sortStable = o.split("").sort(vt).join("") === o;
nt();
[0, 0].sort(vt);
e.detectDuplicates = ot;
i.find = u;
i.expr = u.selectors;
i.expr[":"] = i.expr.pseudos;
i.unique = u.uniqueSort;
i.text = u.getText;
i.isXMLDoc = u.isXML;
i.contains = u.contains;
})(n);
ni = {};
i.Callbacks = function (n) {
n = typeof n == "string" ? ni[n] || te(n) : i.extend({}, n);
var s,
f,
c,
e,
o,
l,
r = [],
u = !n.once && [],
a = function (t) {
for (
f = n.memory && t, c = !0, o = l || 0, l = 0, e = r.length, s = !0;
r && o < e;
o++
)
if (r[o].apply(t[0], t[1]) === !1 && n.stopOnFalse) {
f = !1;
break;
}
s = !1;
r && (u ? u.length && a(u.shift()) : f ? (r = []) : h.disable());
},
h = {
add: function () {
if (r) {
var t = r.length;
(function u(t) {
i.each(t, function (t, f) {
var e = i.type(f);
e === "function"
? (n.unique && h.has(f)) || r.push(f)
: f && f.length && e !== "string" && u(f);
});
})(arguments);
s ? (e = r.length) : f && ((l = t), a(f));
}
return this;
},
remove: function () {
return (
r &&
i.each(arguments, function (n, t) {
for (var u; (u = i.inArray(t, r, u)) > -1; )
r.splice(u, 1), s && (u <= e && e--, u <= o && o--);
}),
this
);
},
has: function (n) {
return n ? i.inArray(n, r) > -1 : !!(r && r.length);
},
empty: function () {
return (r = []), (e = 0), this;
},
disable: function () {
return (r = u = f = t), this;
},
disabled: function () {
return !r;
},
lock: function () {
return (u = t), f || h.disable(), this;
},
locked: function () {
return !u;
},
fireWith: function (n, t) {
return (
(t = t || []),
(t = [n, t.slice ? t.slice() : t]),
r && (!c || u) && (s ? u.push(t) : a(t)),
this
);
},
fire: function () {
return h.fireWith(this, arguments), this;
},
fired: function () {
return !!c;
},
};
return h;
};
i.extend({
Deferred: function (n) {
var u = [
["resolve", "done", i.Callbacks("once memory"), "resolved"],
["reject", "fail", i.Callbacks("once memory"), "rejected"],
["notify", "progress", i.Callbacks("memory")],
],
f = "pending",
r = {
state: function () {
return f;
},
always: function () {
return t.done(arguments).fail(arguments), this;
},
then: function () {
var n = arguments;
return i
.Deferred(function (f) {
i.each(u, function (u, e) {
var s = e[0],
o = i.isFunction(n[u]) && n[u];
t[e[1]](function () {
var n = o && o.apply(this, arguments);
n && i.isFunction(n.promise)
? n
.promise()
.done(f.resolve)
.fail(f.reject)
.progress(f.notify)
: f[s + "With"](
this === r ? f.promise() : this,
o ? [n] : arguments
);
});
});
n = null;
})
.promise();
},
promise: function (n) {
return n != null ? i.extend(n, r) : r;
},
},
t = {};
return (
(r.pipe = r.then),
i.each(u, function (n, i) {
var e = i[2],
o = i[3];
r[i[1]] = e.add;
o &&
e.add(
function () {
f = o;
},
u[n ^ 1][2].disable,
u[2][2].lock
);
t[i[0]] = function () {
return t[i[0] + "With"](this === t ? r : this, arguments), this;
};
t[i[0] + "With"] = e.fireWith;
}),
r.promise(t),
n && n.call(t, t),
t
);
},
when: function (n) {
var t = 0,
u = l.call(arguments),
r = u.length,
e = r !== 1 || (n && i.isFunction(n.promise)) ? r : 0,
f = e === 1 ? n : i.Deferred(),
h = function (n, t, i) {
return function (r) {
t[n] = this;
i[n] = arguments.length > 1 ? l.call(arguments) : r;
i === o ? f.notifyWith(t, i) : --e || f.resolveWith(t, i);
};
},
o,
c,
s;
if (r > 1)
for (o = new Array(r), c = new Array(r), s = new Array(r); t < r; t++)
u[t] && i.isFunction(u[t].promise)
? u[t]
.promise()
.done(h(t, s, u))
.fail(f.reject)
.progress(h(t, c, o))
: --e;
return e || f.resolveWith(s, u), f.promise();
},
});
i.support = (function (t) {
var a,
e,
f,
h,
c,
l,
v,
y,
s,
u = r.createElement("div");
if (
(u.setAttribute("className", "t"),
(u.innerHTML =
" a "),
(a = u.getElementsByTagName("*") || []),
(e = u.getElementsByTagName("a")[0]),
!e || !e.style || !a.length)
)
return t;
h = r.createElement("select");
l = h.appendChild(r.createElement("option"));
f = u.getElementsByTagName("input")[0];
e.style.cssText = "top:1px;float:left;opacity:.5";
t.getSetAttribute = u.className !== "t";
t.leadingWhitespace = u.firstChild.nodeType === 3;
t.tbody = !u.getElementsByTagName("tbody").length;
t.htmlSerialize = !!u.getElementsByTagName("link").length;
t.style = /top/.test(e.getAttribute("style"));
t.hrefNormalized = e.getAttribute("href") === "/a";
t.opacity = /^0.5/.test(e.style.opacity);
t.cssFloat = !!e.style.cssFloat;
t.checkOn = !!f.value;
t.optSelected = l.selected;
t.enctype = !!r.createElement("form").enctype;
t.html5Clone =
r.createElement("nav").cloneNode(!0).outerHTML !== "<:nav>";
t.inlineBlockNeedsLayout = !1;
t.shrinkWrapBlocks = !1;
t.pixelPosition = !1;
t.deleteExpando = !0;
t.noCloneEvent = !0;
t.reliableMarginRight = !0;
t.boxSizingReliable = !0;
f.checked = !0;
t.noCloneChecked = f.cloneNode(!0).checked;
h.disabled = !0;
t.optDisabled = !l.disabled;
try {
delete u.test;
} catch (p) {
t.deleteExpando = !1;
}
f = r.createElement("input");
f.setAttribute("value", "");
t.input = f.getAttribute("value") === "";
f.value = "t";
f.setAttribute("type", "radio");
t.radioValue = f.value === "t";
f.setAttribute("checked", "t");
f.setAttribute("name", "t");
c = r.createDocumentFragment();
c.appendChild(f);
t.appendChecked = f.checked;
t.checkClone = c.cloneNode(!0).cloneNode(!0).lastChild.checked;
u.attachEvent &&
(u.attachEvent("onclick", function () {
t.noCloneEvent = !1;
}),
u.cloneNode(!0).click());
for (s in { submit: !0, change: !0, focusin: !0 })
u.setAttribute((v = "on" + s), "t"),
(t[s + "Bubbles"] = v in n || u.attributes[v].expando === !1);
u.style.backgroundClip = "content-box";
u.cloneNode(!0).style.backgroundClip = "";
t.clearCloneStyle = u.style.backgroundClip === "content-box";
for (s in i(t)) break;
return (
(t.ownLast = s !== "0"),
i(function () {
var h,
e,
f,
c =
"padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
s = r.getElementsByTagName("body")[0];
s &&
((h = r.createElement("div")),
(h.style.cssText =
"border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"),
s.appendChild(h).appendChild(u),
(u.innerHTML = ""),
(f = u.getElementsByTagName("td")),
(f[0].style.cssText = "padding:0;margin:0;border:0;display:none"),
(y = f[0].offsetHeight === 0),
(f[0].style.display = ""),
(f[1].style.display = "none"),
(t.reliableHiddenOffsets = y && f[0].offsetHeight === 0),
(u.innerHTML = ""),
(u.style.cssText =
"box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"),
i.swap(s, s.style.zoom != null ? { zoom: 1 } : {}, function () {
t.boxSizing = u.offsetWidth === 4;
}),
n.getComputedStyle &&
((t.pixelPosition =
(n.getComputedStyle(u, null) || {}).top !== "1%"),
(t.boxSizingReliable =
(n.getComputedStyle(u, null) || { width: "4px" }).width ===
"4px"),
(e = u.appendChild(r.createElement("div"))),
(e.style.cssText = u.style.cssText = c),
(e.style.marginRight = e.style.width = "0"),
(u.style.width = "1px"),
(t.reliableMarginRight = !parseFloat(
(n.getComputedStyle(e, null) || {}).marginRight
))),
typeof u.style.zoom !== o &&
((u.innerHTML = ""),
(u.style.cssText =
c + "width:1px;padding:1px;display:inline;zoom:1"),
(t.inlineBlockNeedsLayout = u.offsetWidth === 3),
(u.style.display = "block"),
(u.innerHTML = "
"),
(u.firstChild.style.width = "5px"),
(t.shrinkWrapBlocks = u.offsetWidth !== 3),
t.inlineBlockNeedsLayout && (s.style.zoom = 1)),
s.removeChild(h),
(h = u = f = e = null));
}),
(a = h = c = l = e = f = null),
t
);
})({});
ir = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
rr = /([A-Z])/g;
i.extend({
cache: {},
noData: {
applet: !0,
embed: !0,
object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
},
hasData: function (n) {
return (
(n = n.nodeType ? i.cache[n[i.expando]] : n[i.expando]), !!n && !ti(n)
);
},
data: function (n, t, i) {
return ur(n, t, i);
},
removeData: function (n, t) {
return fr(n, t);
},
_data: function (n, t, i) {
return ur(n, t, i, !0);
},
_removeData: function (n, t) {
return fr(n, t, !0);
},
acceptData: function (n) {
if (n.nodeType && n.nodeType !== 1 && n.nodeType !== 9) return !1;
var t = n.nodeName && i.noData[n.nodeName.toLowerCase()];
return !t || (t !== !0 && n.getAttribute("classid") === t);
},
});
i.fn.extend({
data: function (n, r) {
var e,
f,
o = null,
s = 0,
u = this[0];
if (n === t) {
if (
this.length &&
((o = i.data(u)), u.nodeType === 1 && !i._data(u, "parsedAttrs"))
) {
for (e = u.attributes; s < e.length; s++)
(f = e[s].name),
f.indexOf("data-") === 0 &&
((f = i.camelCase(f.slice(5))), er(u, f, o[f]));
i._data(u, "parsedAttrs", !0);
}
return o;
}
return typeof n == "object"
? this.each(function () {
i.data(this, n);
})
: arguments.length > 1
? this.each(function () {
i.data(this, n, r);
})
: u
? er(u, n, i.data(u, n))
: null;
},
removeData: function (n) {
return this.each(function () {
i.removeData(this, n);
});
},
});
i.extend({
queue: function (n, t, r) {
var u;
if (n)
return (
(t = (t || "fx") + "queue"),
(u = i._data(n, t)),
r &&
(!u || i.isArray(r)
? (u = i._data(n, t, i.makeArray(r)))
: u.push(r)),
u || []
);
},
dequeue: function (n, t) {
t = t || "fx";
var r = i.queue(n, t),
e = r.length,
u = r.shift(),
f = i._queueHooks(n, t),
o = function () {
i.dequeue(n, t);
};
u === "inprogress" && ((u = r.shift()), e--);
u &&
(t === "fx" && r.unshift("inprogress"),
delete f.stop,
u.call(n, o, f));
!e && f && f.empty.fire();
},
_queueHooks: function (n, t) {
var r = t + "queueHooks";
return (
i._data(n, r) ||
i._data(n, r, {
empty: i.Callbacks("once memory").add(function () {
i._removeData(n, t + "queue");
i._removeData(n, r);
}),
})
);
},
});
i.fn.extend({
queue: function (n, r) {
var u = 2;
return (typeof n != "string" && ((r = n), (n = "fx"), u--),
arguments.length < u)
? i.queue(this[0], n)
: r === t
? this
: this.each(function () {
var t = i.queue(this, n, r);
i._queueHooks(this, n);
n === "fx" && t[0] !== "inprogress" && i.dequeue(this, n);
});
},
dequeue: function (n) {
return this.each(function () {
i.dequeue(this, n);
});
},
delay: function (n, t) {
return (
(n = i.fx ? i.fx.speeds[n] || n : n),
(t = t || "fx"),
this.queue(t, function (t, i) {
var r = setTimeout(t, n);
i.stop = function () {
clearTimeout(r);
};
})
);
},
clearQueue: function (n) {
return this.queue(n || "fx", []);
},
promise: function (n, r) {
var u,
e = 1,
o = i.Deferred(),
f = this,
s = this.length,
h = function () {
--e || o.resolveWith(f, [f]);
};
for (typeof n != "string" && ((r = n), (n = t)), n = n || "fx"; s--; )
(u = i._data(f[s], n + "queueHooks")),
u && u.empty && (e++, u.empty.add(h));
return h(), o.promise(r);
},
});
var d,
or,
ii = /[\t\r\n\f]/g,
ie = /\r/g,
re = /^(?:input|select|textarea|button|object)$/i,
ue = /^(?:a|area)$/i,
ri = /^(?:checked|selected)$/i,
a = i.support.getSetAttribute,
ht = i.support.input;
i.fn.extend({
attr: function (n, t) {
return i.access(this, i.attr, n, t, arguments.length > 1);
},
removeAttr: function (n) {
return this.each(function () {
i.removeAttr(this, n);
});
},
prop: function (n, t) {
return i.access(this, i.prop, n, t, arguments.length > 1);
},
removeProp: function (n) {
return (
(n = i.propFix[n] || n),
this.each(function () {
try {
this[n] = t;
delete this[n];
} catch (i) {}
})
);
},
addClass: function (n) {
var e,
t,
r,
u,
o,
f = 0,
h = this.length,
c = typeof n == "string" && n;
if (i.isFunction(n))
return this.each(function (t) {
i(this).addClass(n.call(this, t, this.className));
});
if (c)
for (e = (n || "").match(s) || []; f < h; f++)
if (
((t = this[f]),
(r =
t.nodeType === 1 &&
(t.className
? (" " + t.className + " ").replace(ii, " ")
: " ")),
r)
) {
for (o = 0; (u = e[o++]); )
r.indexOf(" " + u + " ") < 0 && (r += u + " ");
t.className = i.trim(r);
}
return this;
},
removeClass: function (n) {
var e,
r,
t,
u,
o,
f = 0,
h = this.length,
c = arguments.length === 0 || (typeof n == "string" && n);
if (i.isFunction(n))
return this.each(function (t) {
i(this).removeClass(n.call(this, t, this.className));
});
if (c)
for (e = (n || "").match(s) || []; f < h; f++)
if (
((r = this[f]),
(t =
r.nodeType === 1 &&
(r.className
? (" " + r.className + " ").replace(ii, " ")
: "")),
t)
) {
for (o = 0; (u = e[o++]); )
while (t.indexOf(" " + u + " ") >= 0)
t = t.replace(" " + u + " ", " ");
r.className = n ? i.trim(t) : "";
}
return this;
},
toggleClass: function (n, t) {
var r = typeof n,
u = typeof t == "boolean";
return i.isFunction(n)
? this.each(function (r) {
i(this).toggleClass(n.call(this, r, this.className, t), t);
})
: this.each(function () {
if (r === "string")
for (
var f, c = 0, h = i(this), e = t, l = n.match(s) || [];
(f = l[c++]);
)
(e = u ? e : !h.hasClass(f)),
h[e ? "addClass" : "removeClass"](f);
else
(r === o || r === "boolean") &&
(this.className &&
i._data(this, "__className__", this.className),
(this.className =
this.className || n === !1
? ""
: i._data(this, "__className__") || ""));
});
},
hasClass: function (n) {
for (var i = " " + n + " ", t = 0, r = this.length; t < r; t++)
if (
this[t].nodeType === 1 &&
(" " + this[t].className + " ").replace(ii, " ").indexOf(i) >= 0
)
return !0;
return !1;
},
val: function (n) {
var u,
r,
e,
f = this[0];
return arguments.length
? ((e = i.isFunction(n)),
this.each(function (u) {
var f;
this.nodeType === 1 &&
((f = e ? n.call(this, u, i(this).val()) : n),
f == null
? (f = "")
: typeof f == "number"
? (f += "")
: i.isArray(f) &&
(f = i.map(f, function (n) {
return n == null ? "" : n + "";
})),
(r =
i.valHooks[this.type] ||
i.valHooks[this.nodeName.toLowerCase()]),
(r && "set" in r && r.set(this, f, "value") !== t) ||
(this.value = f));
}))
: f
? ((r = i.valHooks[f.type] || i.valHooks[f.nodeName.toLowerCase()]),
r && "get" in r && (u = r.get(f, "value")) !== t)
? u
: ((u = f.value),
typeof u == "string" ? u.replace(ie, "") : u == null ? "" : u)
: void 0;
},
});
i.extend({
valHooks: {
option: {
get: function (n) {
var t = i.find.attr(n, "value");
return t != null ? t : n.text;
},
},
select: {
get: function (n) {
for (
var e,
t,
o = n.options,
r = n.selectedIndex,
u = n.type === "select-one" || r < 0,
s = u ? null : [],
h = u ? r + 1 : o.length,
f = r < 0 ? h : u ? r : 0;
f < h;
f++
)
if (
((t = o[f]),
(t.selected || f === r) &&
(i.support.optDisabled
? !t.disabled
: t.getAttribute("disabled") === null) &&
(!t.parentNode.disabled ||
!i.nodeName(t.parentNode, "optgroup")))
) {
if (((e = i(t).val()), u)) return e;
s.push(e);
}
return s;
},
set: function (n, t) {
for (
var u, r, f = n.options, e = i.makeArray(t), o = f.length;
o--;
)
(r = f[o]),
(r.selected = i.inArray(i(r).val(), e) >= 0) && (u = !0);
return u || (n.selectedIndex = -1), e;
},
},
},
attr: function (n, r, u) {
var f,
e,
s = n.nodeType;
if (n && s !== 3 && s !== 8 && s !== 2) {
if (typeof n.getAttribute === o) return i.prop(n, r, u);
if (
((s === 1 && i.isXMLDoc(n)) ||
((r = r.toLowerCase()),
(f = i.attrHooks[r] || (i.expr.match.bool.test(r) ? or : d))),
u !== t)
)
if (u === null) i.removeAttr(n, r);
else
return f && "set" in f && (e = f.set(n, u, r)) !== t
? e
: (n.setAttribute(r, u + ""), u);
else
return f && "get" in f && (e = f.get(n, r)) !== null
? e
: ((e = i.find.attr(n, r)), e == null ? t : e);
}
},
removeAttr: function (n, t) {
var r,
u,
e = 0,
f = t && t.match(s);
if (f && n.nodeType === 1)
while ((r = f[e++]))
(u = i.propFix[r] || r),
i.expr.match.bool.test(r)
? (ht && a) || !ri.test(r)
? (n[u] = !1)
: (n[i.camelCase("default-" + r)] = n[u] = !1)
: i.attr(n, r, ""),
n.removeAttribute(a ? r : u);
},
attrHooks: {
type: {
set: function (n, t) {
if (
!i.support.radioValue &&
t === "radio" &&
i.nodeName(n, "input")
) {
var r = n.value;
return n.setAttribute("type", t), r && (n.value = r), t;
}
},
},
},
propFix: { for: "htmlFor", class: "className" },
prop: function (n, r, u) {
var e,
f,
s,
o = n.nodeType;
if (n && o !== 3 && o !== 8 && o !== 2)
return (
(s = o !== 1 || !i.isXMLDoc(n)),
s && ((r = i.propFix[r] || r), (f = i.propHooks[r])),
u !== t
? f && "set" in f && (e = f.set(n, u, r)) !== t
? e
: (n[r] = u)
: f && "get" in f && (e = f.get(n, r)) !== null
? e
: n[r]
);
},
propHooks: {
tabIndex: {
get: function (n) {
var t = i.find.attr(n, "tabindex");
return t
? parseInt(t, 10)
: re.test(n.nodeName) || (ue.test(n.nodeName) && n.href)
? 0
: -1;
},
},
},
});
or = {
set: function (n, t, r) {
return (
t === !1
? i.removeAttr(n, r)
: (ht && a) || !ri.test(r)
? n.setAttribute((!a && i.propFix[r]) || r, r)
: (n[i.camelCase("default-" + r)] = n[r] = !0),
r
);
},
};
i.each(i.expr.match.bool.source.match(/\w+/g), function (n, r) {
var u = i.expr.attrHandle[r] || i.find.attr;
i.expr.attrHandle[r] =
(ht && a) || !ri.test(r)
? function (n, r, f) {
var e = i.expr.attrHandle[r],
o = f
? t
: (i.expr.attrHandle[r] = t) != u(n, r, f)
? r.toLowerCase()
: null;
return (i.expr.attrHandle[r] = e), o;
}
: function (n, r, u) {
return u
? t
: n[i.camelCase("default-" + r)]
? r.toLowerCase()
: null;
};
});
(ht && a) ||
(i.attrHooks.value = {
set: function (n, t, r) {
if (i.nodeName(n, "input")) n.defaultValue = t;
else return d && d.set(n, t, r);
},
});
a ||
((d = {
set: function (n, i, r) {
var u = n.getAttributeNode(r);
return (
u || n.setAttributeNode((u = n.ownerDocument.createAttribute(r))),
(u.value = i += ""),
r === "value" || i === n.getAttribute(r) ? i : t
);
},
}),
(i.expr.attrHandle.id =
i.expr.attrHandle.name =
i.expr.attrHandle.coords =
function (n, i, r) {
var u;
return r
? t
: (u = n.getAttributeNode(i)) && u.value !== ""
? u.value
: null;
}),
(i.valHooks.button = {
get: function (n, i) {
var r = n.getAttributeNode(i);
return r && r.specified ? r.value : t;
},
set: d.set,
}),
(i.attrHooks.contenteditable = {
set: function (n, t, i) {
d.set(n, t === "" ? !1 : t, i);
},
}),
i.each(["width", "height"], function (n, t) {
i.attrHooks[t] = {
set: function (n, i) {
if (i === "") return n.setAttribute(t, "auto"), i;
},
};
}));
i.support.hrefNormalized ||
i.each(["href", "src"], function (n, t) {
i.propHooks[t] = {
get: function (n) {
return n.getAttribute(t, 4);
},
};
});
i.support.style ||
(i.attrHooks.style = {
get: function (n) {
return n.style.cssText || t;
},
set: function (n, t) {
return (n.style.cssText = t + "");
},
});
i.support.optSelected ||
(i.propHooks.selected = {
get: function (n) {
var t = n.parentNode;
return (
t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex),
null
);
},
});
i.each(
[
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable",
],
function () {
i.propFix[this.toLowerCase()] = this;
}
);
i.support.enctype || (i.propFix.enctype = "encoding");
i.each(["radio", "checkbox"], function () {
i.valHooks[this] = {
set: function (n, t) {
if (i.isArray(t)) return (n.checked = i.inArray(i(n).val(), t) >= 0);
},
};
i.support.checkOn ||
(i.valHooks[this].get = function (n) {
return n.getAttribute("value") === null ? "on" : n.value;
});
});
var ui = /^(?:input|select|textarea)$/i,
fe = /^key/,
ee = /^(?:mouse|contextmenu)|click/,
sr = /^(?:focusinfocus|focusoutblur)$/,
hr = /^([^.]*)(?:\.(.+)|)$/;
i.event = {
global: {},
add: function (n, r, u, f, e) {
var b,
p,
k,
w,
c,
l,
a,
v,
h,
d,
g,
y = i._data(n);
if (y) {
for (
u.handler && ((w = u), (u = w.handler), (e = w.selector)),
u.guid || (u.guid = i.guid++),
(p = y.events) || (p = y.events = {}),
(l = y.handle) ||
((l = y.handle =
function (n) {
return typeof i !== o &&
(!n || i.event.triggered !== n.type)
? i.event.dispatch.apply(l.elem, arguments)
: t;
}),
(l.elem = n)),
r = (r || "").match(s) || [""],
k = r.length;
k--;
)
((b = hr.exec(r[k]) || []),
(h = g = b[1]),
(d = (b[2] || "").split(".").sort()),
h) &&
((c = i.event.special[h] || {}),
(h = (e ? c.delegateType : c.bindType) || h),
(c = i.event.special[h] || {}),
(a = i.extend(
{
type: h,
origType: g,
data: f,
handler: u,
guid: u.guid,
selector: e,
needsContext: e && i.expr.match.needsContext.test(e),
namespace: d.join("."),
},
w
)),
(v = p[h]) ||
((v = p[h] = []),
(v.delegateCount = 0),
(c.setup && c.setup.call(n, f, d, l) !== !1) ||
(n.addEventListener
? n.addEventListener(h, l, !1)
: n.attachEvent && n.attachEvent("on" + h, l))),
c.add &&
(c.add.call(n, a), a.handler.guid || (a.handler.guid = u.guid)),
e ? v.splice(v.delegateCount++, 0, a) : v.push(a),
(i.event.global[h] = !0));
n = null;
}
},
remove: function (n, t, r, u, f) {
var y,
o,
h,
b,
p,
a,
c,
l,
e,
w,
k,
v = i.hasData(n) && i._data(n);
if (v && (a = v.events)) {
for (t = (t || "").match(s) || [""], p = t.length; p--; ) {
if (
((h = hr.exec(t[p]) || []),
(e = k = h[1]),
(w = (h[2] || "").split(".").sort()),
!e)
) {
for (e in a) i.event.remove(n, e + t[p], r, u, !0);
continue;
}
for (
c = i.event.special[e] || {},
e = (u ? c.delegateType : c.bindType) || e,
l = a[e] || [],
h =
h[2] &&
new RegExp("(^|\\.)" + w.join("\\.(?:.*\\.|)") + "(\\.|$)"),
b = y = l.length;
y--;
)
(o = l[y]),
(f || k === o.origType) &&
(!r || r.guid === o.guid) &&
(!h || h.test(o.namespace)) &&
(!u || u === o.selector || (u === "**" && o.selector)) &&
(l.splice(y, 1),
o.selector && l.delegateCount--,
c.remove && c.remove.call(n, o));
b &&
!l.length &&
((c.teardown && c.teardown.call(n, w, v.handle) !== !1) ||
i.removeEvent(n, e, v.handle),
delete a[e]);
}
i.isEmptyObject(a) && (delete v.handle, i._removeData(n, "events"));
}
},
trigger: function (u, f, e, o) {
var a,
v,
s,
w,
l,
c,
b,
p = [e || r],
h = k.call(u, "type") ? u.type : u,
y = k.call(u, "namespace") ? u.namespace.split(".") : [];
if (
((s = c = e = e || r), e.nodeType !== 3 && e.nodeType !== 8) &&
!sr.test(h + i.event.triggered) &&
(h.indexOf(".") >= 0 &&
((y = h.split(".")), (h = y.shift()), y.sort()),
(v = h.indexOf(":") < 0 && "on" + h),
(u = u[i.expando] ? u : new i.Event(h, typeof u == "object" && u)),
(u.isTrigger = o ? 2 : 3),
(u.namespace = y.join(".")),
(u.namespace_re = u.namespace
? new RegExp("(^|\\.)" + y.join("\\.(?:.*\\.|)") + "(\\.|$)")
: null),
(u.result = t),
u.target || (u.target = e),
(f = f == null ? [u] : i.makeArray(f, [u])),
(l = i.event.special[h] || {}),
o || !l.trigger || l.trigger.apply(e, f) !== !1)
) {
if (!o && !l.noBubble && !i.isWindow(e)) {
for (
w = l.delegateType || h, sr.test(w + h) || (s = s.parentNode);
s;
s = s.parentNode
)
p.push(s), (c = s);
c === (e.ownerDocument || r) &&
p.push(c.defaultView || c.parentWindow || n);
}
for (b = 0; (s = p[b++]) && !u.isPropagationStopped(); )
(u.type = b > 1 ? w : l.bindType || h),
(a =
(i._data(s, "events") || {})[u.type] && i._data(s, "handle")),
a && a.apply(s, f),
(a = v && s[v]),
a &&
i.acceptData(s) &&
a.apply &&
a.apply(s, f) === !1 &&
u.preventDefault();
if (
((u.type = h),
!o &&
!u.isDefaultPrevented() &&
(!l._default || l._default.apply(p.pop(), f) === !1) &&
i.acceptData(e) &&
v &&
e[h] &&
!i.isWindow(e))
) {
c = e[v];
c && (e[v] = null);
i.event.triggered = h;
try {
e[h]();
} catch (d) {}
i.event.triggered = t;
c && (e[v] = c);
}
return u.result;
}
},
dispatch: function (n) {
n = i.event.fix(n);
var o,
e,
r,
u,
s,
h = [],
c = l.call(arguments),
a = (i._data(this, "events") || {})[n.type] || [],
f = i.event.special[n.type] || {};
if (
((c[0] = n),
(n.delegateTarget = this),
!f.preDispatch || f.preDispatch.call(this, n) !== !1)
) {
for (
h = i.event.handlers.call(this, n, a), o = 0;
(u = h[o++]) && !n.isPropagationStopped();
)
for (
n.currentTarget = u.elem, s = 0;
(r = u.handlers[s++]) && !n.isImmediatePropagationStopped();
)
(!n.namespace_re || n.namespace_re.test(r.namespace)) &&
((n.handleObj = r),
(n.data = r.data),
(e = (
(i.event.special[r.origType] || {}).handle || r.handler
).apply(u.elem, c)),
e !== t &&
(n.result = e) === !1 &&
(n.preventDefault(), n.stopPropagation()));
return f.postDispatch && f.postDispatch.call(this, n), n.result;
}
},
handlers: function (n, r) {
var e,
o,
f,
s,
c = [],
h = r.delegateCount,
u = n.target;
if (h && u.nodeType && (!n.button || n.type !== "click"))
for (; u != this; u = u.parentNode || this)
if (u.nodeType === 1 && (u.disabled !== !0 || n.type !== "click")) {
for (f = [], s = 0; s < h; s++)
(o = r[s]),
(e = o.selector + " "),
f[e] === t &&
(f[e] = o.needsContext
? i(e, this).index(u) >= 0
: i.find(e, this, null, [u]).length),
f[e] && f.push(o);
f.length && c.push({ elem: u, handlers: f });
}
return h < r.length && c.push({ elem: this, handlers: r.slice(h) }), c;
},
fix: function (n) {
if (n[i.expando]) return n;
var e,
o,
s,
u = n.type,
f = n,
t = this.fixHooks[u];
for (
t ||
(this.fixHooks[u] = t =
ee.test(u) ? this.mouseHooks : fe.test(u) ? this.keyHooks : {}),
s = t.props ? this.props.concat(t.props) : this.props,
n = new i.Event(f),
e = s.length;
e--;
)
(o = s[e]), (n[o] = f[o]);
return (
n.target || (n.target = f.srcElement || r),
n.target.nodeType === 3 && (n.target = n.target.parentNode),
(n.metaKey = !!n.metaKey),
t.filter ? t.filter(n, f) : n
);
},
props:
"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(
" "
),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function (n, t) {
return (
n.which == null &&
(n.which = t.charCode != null ? t.charCode : t.keyCode),
n
);
},
},
mouseHooks: {
props:
"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(
" "
),
filter: function (n, i) {
var u,
o,
f,
e = i.button,
s = i.fromElement;
return (
n.pageX == null &&
i.clientX != null &&
((o = n.target.ownerDocument || r),
(f = o.documentElement),
(u = o.body),
(n.pageX =
i.clientX +
((f && f.scrollLeft) || (u && u.scrollLeft) || 0) -
((f && f.clientLeft) || (u && u.clientLeft) || 0)),
(n.pageY =
i.clientY +
((f && f.scrollTop) || (u && u.scrollTop) || 0) -
((f && f.clientTop) || (u && u.clientTop) || 0))),
!n.relatedTarget &&
s &&
(n.relatedTarget = s === n.target ? i.toElement : s),
n.which ||
e === t ||
(n.which = e & 1 ? 1 : e & 2 ? 3 : e & 4 ? 2 : 0),
n
);
},
},
special: {
load: { noBubble: !0 },
focus: {
trigger: function () {
if (this !== cr() && this.focus)
try {
return this.focus(), !1;
} catch (n) {}
},
delegateType: "focusin",
},
blur: {
trigger: function () {
if (this === cr() && this.blur) return this.blur(), !1;
},
delegateType: "focusout",
},
click: {
trigger: function () {
if (
i.nodeName(this, "input") &&
this.type === "checkbox" &&
this.click
)
return this.click(), !1;
},
_default: function (n) {
return i.nodeName(n.target, "a");
},
},
beforeunload: {
postDispatch: function (n) {
n.result !== t && (n.originalEvent.returnValue = n.result);
},
},
},
simulate: function (n, t, r, u) {
var f = i.extend(new i.Event(), r, {
type: n,
isSimulated: !0,
originalEvent: {},
});
u ? i.event.trigger(f, null, t) : i.event.dispatch.call(t, f);
f.isDefaultPrevented() && r.preventDefault();
},
};
i.removeEvent = r.removeEventListener
? function (n, t, i) {
n.removeEventListener && n.removeEventListener(t, i, !1);
}
: function (n, t, i) {
var r = "on" + t;
n.detachEvent &&
(typeof n[r] === o && (n[r] = null), n.detachEvent(r, i));
};
i.Event = function (n, t) {
if (!(this instanceof i.Event)) return new i.Event(n, t);
n && n.type
? ((this.originalEvent = n),
(this.type = n.type),
(this.isDefaultPrevented =
n.defaultPrevented ||
n.returnValue === !1 ||
(n.getPreventDefault && n.getPreventDefault())
? ct
: g))
: (this.type = n);
t && i.extend(this, t);
this.timeStamp = (n && n.timeStamp) || i.now();
this[i.expando] = !0;
};
i.Event.prototype = {
isDefaultPrevented: g,
isPropagationStopped: g,
isImmediatePropagationStopped: g,
preventDefault: function () {
var n = this.originalEvent;
((this.isDefaultPrevented = ct), n) &&
(n.preventDefault ? n.preventDefault() : (n.returnValue = !1));
},
stopPropagation: function () {
var n = this.originalEvent;
((this.isPropagationStopped = ct), n) &&
(n.stopPropagation && n.stopPropagation(), (n.cancelBubble = !0));
},
stopImmediatePropagation: function () {
this.isImmediatePropagationStopped = ct;
this.stopPropagation();
},
};
i.each(
{ mouseenter: "mouseover", mouseleave: "mouseout" },
function (n, t) {
i.event.special[n] = {
delegateType: t,
bindType: t,
handle: function (n) {
var u,
f = this,
r = n.relatedTarget,
e = n.handleObj;
return (
(r && (r === f || i.contains(f, r))) ||
((n.type = e.origType),
(u = e.handler.apply(this, arguments)),
(n.type = t)),
u
);
},
};
}
);
i.support.submitBubbles ||
(i.event.special.submit = {
setup: function () {
if (i.nodeName(this, "form")) return !1;
i.event.add(this, "click._submit keypress._submit", function (n) {
var u = n.target,
r =
i.nodeName(u, "input") || i.nodeName(u, "button") ? u.form : t;
r &&
!i._data(r, "submitBubbles") &&
(i.event.add(r, "submit._submit", function (n) {
n._submit_bubble = !0;
}),
i._data(r, "submitBubbles", !0));
});
},
postDispatch: function (n) {
n._submit_bubble &&
(delete n._submit_bubble,
this.parentNode &&
!n.isTrigger &&
i.event.simulate("submit", this.parentNode, n, !0));
},
teardown: function () {
if (i.nodeName(this, "form")) return !1;
i.event.remove(this, "._submit");
},
});
i.support.changeBubbles ||
(i.event.special.change = {
setup: function () {
if (ui.test(this.nodeName))
return (
(this.type === "checkbox" || this.type === "radio") &&
(i.event.add(this, "propertychange._change", function (n) {
n.originalEvent.propertyName === "checked" &&
(this._just_changed = !0);
}),
i.event.add(this, "click._change", function (n) {
this._just_changed &&
!n.isTrigger &&
(this._just_changed = !1);
i.event.simulate("change", this, n, !0);
})),
!1
);
i.event.add(this, "beforeactivate._change", function (n) {
var t = n.target;
ui.test(t.nodeName) &&
!i._data(t, "changeBubbles") &&
(i.event.add(t, "change._change", function (n) {
!this.parentNode ||
n.isSimulated ||
n.isTrigger ||
i.event.simulate("change", this.parentNode, n, !0);
}),
i._data(t, "changeBubbles", !0));
});
},
handle: function (n) {
var t = n.target;
if (
this !== t ||
n.isSimulated ||
n.isTrigger ||
(t.type !== "radio" && t.type !== "checkbox")
)
return n.handleObj.handler.apply(this, arguments);
},
teardown: function () {
return i.event.remove(this, "._change"), !ui.test(this.nodeName);
},
});
i.support.focusinBubbles ||
i.each({ focus: "focusin", blur: "focusout" }, function (n, t) {
var u = 0,
f = function (n) {
i.event.simulate(t, n.target, i.event.fix(n), !0);
};
i.event.special[t] = {
setup: function () {
u++ == 0 && r.addEventListener(n, f, !0);
},
teardown: function () {
--u == 0 && r.removeEventListener(n, f, !0);
},
};
});
i.fn.extend({
on: function (n, r, u, f, e) {
var s, o;
if (typeof n == "object") {
typeof r != "string" && ((u = u || r), (r = t));
for (s in n) this.on(s, r, u, n[s], e);
return this;
}
if (
(u == null && f == null
? ((f = r), (u = r = t))
: f == null &&
(typeof r == "string"
? ((f = u), (u = t))
: ((f = u), (u = r), (r = t))),
f === !1)
)
f = g;
else if (!f) return this;
return (
e === 1 &&
((o = f),
(f = function (n) {
return i().off(n), o.apply(this, arguments);
}),
(f.guid = o.guid || (o.guid = i.guid++))),
this.each(function () {
i.event.add(this, n, f, u, r);
})
);
},
one: function (n, t, i, r) {
return this.on(n, t, i, r, 1);
},
off: function (n, r, u) {
var f, e;
if (n && n.preventDefault && n.handleObj)
return (
(f = n.handleObj),
i(n.delegateTarget).off(
f.namespace ? f.origType + "." + f.namespace : f.origType,
f.selector,
f.handler
),
this
);
if (typeof n == "object") {
for (e in n) this.off(e, r, n[e]);
return this;
}
return (
(r === !1 || typeof r == "function") && ((u = r), (r = t)),
u === !1 && (u = g),
this.each(function () {
i.event.remove(this, n, u, r);
})
);
},
trigger: function (n, t) {
return this.each(function () {
i.event.trigger(n, t, this);
});
},
triggerHandler: function (n, t) {
var r = this[0];
if (r) return i.event.trigger(n, t, r, !0);
},
});
var oe = /^.[^:#\[\.,]*$/,
se = /^(?:parents|prev(?:Until|All))/,
lr = i.expr.match.needsContext,
he = { children: !0, contents: !0, next: !0, prev: !0 };
i.fn.extend({
find: function (n) {
var t,
r = [],
u = this,
f = u.length;
if (typeof n != "string")
return this.pushStack(
i(n).filter(function () {
for (t = 0; t < f; t++) if (i.contains(u[t], this)) return !0;
})
);
for (t = 0; t < f; t++) i.find(n, u[t], r);
return (
(r = this.pushStack(f > 1 ? i.unique(r) : r)),
(r.selector = this.selector ? this.selector + " " + n : n),
r
);
},
has: function (n) {
var t,
r = i(n, this),
u = r.length;
return this.filter(function () {
for (t = 0; t < u; t++) if (i.contains(this, r[t])) return !0;
});
},
not: function (n) {
return this.pushStack(fi(this, n || [], !0));
},
filter: function (n) {
return this.pushStack(fi(this, n || [], !1));
},
is: function (n) {
return !!fi(
this,
typeof n == "string" && lr.test(n) ? i(n) : n || [],
!1
).length;
},
closest: function (n, t) {
for (
var r,
f = 0,
o = this.length,
u = [],
e =
lr.test(n) || typeof n != "string" ? i(n, t || this.context) : 0;
f < o;
f++
)
for (r = this[f]; r && r !== t; r = r.parentNode)
if (
r.nodeType < 11 &&
(e
? e.index(r) > -1
: r.nodeType === 1 && i.find.matchesSelector(r, n))
) {
r = u.push(r);
break;
}
return this.pushStack(u.length > 1 ? i.unique(u) : u);
},
index: function (n) {
return n
? typeof n == "string"
? i.inArray(this[0], i(n))
: i.inArray(n.jquery ? n[0] : n, this)
: this[0] && this[0].parentNode
? this.first().prevAll().length
: -1;
},
add: function (n, t) {
var r =
typeof n == "string"
? i(n, t)
: i.makeArray(n && n.nodeType ? [n] : n),
u = i.merge(this.get(), r);
return this.pushStack(i.unique(u));
},
addBack: function (n) {
return this.add(
n == null ? this.prevObject : this.prevObject.filter(n)
);
},
});
i.each(
{
parent: function (n) {
var t = n.parentNode;
return t && t.nodeType !== 11 ? t : null;
},
parents: function (n) {
return i.dir(n, "parentNode");
},
parentsUntil: function (n, t, r) {
return i.dir(n, "parentNode", r);
},
next: function (n) {
return ar(n, "nextSibling");
},
prev: function (n) {
return ar(n, "previousSibling");
},
nextAll: function (n) {
return i.dir(n, "nextSibling");
},
prevAll: function (n) {
return i.dir(n, "previousSibling");
},
nextUntil: function (n, t, r) {
return i.dir(n, "nextSibling", r);
},
prevUntil: function (n, t, r) {
return i.dir(n, "previousSibling", r);
},
siblings: function (n) {
return i.sibling((n.parentNode || {}).firstChild, n);
},
children: function (n) {
return i.sibling(n.firstChild);
},
contents: function (n) {
return i.nodeName(n, "iframe")
? n.contentDocument || n.contentWindow.document
: i.merge([], n.childNodes);
},
},
function (n, t) {
i.fn[n] = function (r, u) {
var f = i.map(this, t, r);
return (
n.slice(-5) !== "Until" && (u = r),
u && typeof u == "string" && (f = i.filter(u, f)),
this.length > 1 &&
(he[n] || (f = i.unique(f)), se.test(n) && (f = f.reverse())),
this.pushStack(f)
);
};
}
);
i.extend({
filter: function (n, t, r) {
var u = t[0];
return (
r && (n = ":not(" + n + ")"),
t.length === 1 && u.nodeType === 1
? i.find.matchesSelector(u, n)
? [u]
: []
: i.find.matches(
n,
i.grep(t, function (n) {
return n.nodeType === 1;
})
)
);
},
dir: function (n, r, u) {
for (
var e = [], f = n[r];
f && f.nodeType !== 9 && (u === t || f.nodeType !== 1 || !i(f).is(u));
)
f.nodeType === 1 && e.push(f), (f = f[r]);
return e;
},
sibling: function (n, t) {
for (var i = []; n; n = n.nextSibling)
n.nodeType === 1 && n !== t && i.push(n);
return i;
},
});
var yr =
"abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
ce = / jQuery\d+="(?:null|\d+)"/g,
pr = new RegExp("<(?:" + yr + ")[\\s/>]", "i"),
ei = /^\s+/,
wr =
/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
br = /<([\w:]+)/,
kr = /\s*$/g,
e = {
option: [1, "", " "],
legend: [1, "", " "],
area: [1, "", " "],
param: [1, "", " "],
thead: [1, ""],
tr: [2, ""],
col: [2, ""],
td: [3, ""],
_default: i.support.htmlSerialize
? [0, "", ""]
: [1, "X", "
"],
},
we = vr(r),
si = we.appendChild(r.createElement("div"));
e.optgroup = e.option;
e.tbody = e.tfoot = e.colgroup = e.caption = e.thead;
e.th = e.td;
i.fn.extend({
text: function (n) {
return i.access(
this,
function (n) {
return n === t
? i.text(this)
: this.empty().append(
((this[0] && this[0].ownerDocument) || r).createTextNode(n)
);
},
null,
n,
arguments.length
);
},
append: function () {
return this.domManip(arguments, function (n) {
if (
this.nodeType === 1 ||
this.nodeType === 11 ||
this.nodeType === 9
) {
var t = gr(this, n);
t.appendChild(n);
}
});
},
prepend: function () {
return this.domManip(arguments, function (n) {
if (
this.nodeType === 1 ||
this.nodeType === 11 ||
this.nodeType === 9
) {
var t = gr(this, n);
t.insertBefore(n, t.firstChild);
}
});
},
before: function () {
return this.domManip(arguments, function (n) {
this.parentNode && this.parentNode.insertBefore(n, this);
});
},
after: function () {
return this.domManip(arguments, function (n) {
this.parentNode && this.parentNode.insertBefore(n, this.nextSibling);
});
},
remove: function (n, t) {
for (
var r, e = n ? i.filter(n, this) : this, f = 0;
(r = e[f]) != null;
f++
)
t || r.nodeType !== 1 || i.cleanData(u(r)),
r.parentNode &&
(t && i.contains(r.ownerDocument, r) && hi(u(r, "script")),
r.parentNode.removeChild(r));
return this;
},
empty: function () {
for (var n, t = 0; (n = this[t]) != null; t++) {
for (n.nodeType === 1 && i.cleanData(u(n, !1)); n.firstChild; )
n.removeChild(n.firstChild);
n.options && i.nodeName(n, "select") && (n.options.length = 0);
}
return this;
},
clone: function (n, t) {
return (
(n = n == null ? !1 : n),
(t = t == null ? n : t),
this.map(function () {
return i.clone(this, n, t);
})
);
},
html: function (n) {
return i.access(
this,
function (n) {
var r = this[0] || {},
f = 0,
o = this.length;
if (n === t)
return r.nodeType === 1 ? r.innerHTML.replace(ce, "") : t;
if (
typeof n == "string" &&
!ae.test(n) &&
(i.support.htmlSerialize || !pr.test(n)) &&
(i.support.leadingWhitespace || !ei.test(n)) &&
!e[(br.exec(n) || ["", ""])[1].toLowerCase()]
) {
n = n.replace(wr, "<$1>$2>");
try {
for (; f < o; f++)
(r = this[f] || {}),
r.nodeType === 1 &&
(i.cleanData(u(r, !1)), (r.innerHTML = n));
r = 0;
} catch (s) {}
}
r && this.empty().append(n);
},
null,
n,
arguments.length
);
},
replaceWith: function () {
var t = i.map(this, function (n) {
return [n.nextSibling, n.parentNode];
}),
n = 0;
return (
this.domManip(
arguments,
function (r) {
var u = t[n++],
f = t[n++];
f &&
(u && u.parentNode !== f && (u = this.nextSibling),
i(this).remove(),
f.insertBefore(r, u));
},
!0
),
n ? this : this.remove()
);
},
detach: function (n) {
return this.remove(n, !0);
},
domManip: function (n, t, r) {
n = di.apply([], n);
var h,
f,
c,
o,
v,
s,
e = 0,
l = this.length,
p = this,
w = l - 1,
a = n[0],
y = i.isFunction(a);
if (
y ||
!(
l <= 1 ||
typeof a != "string" ||
i.support.checkClone ||
!ve.test(a)
)
)
return this.each(function (i) {
var u = p.eq(i);
y && (n[0] = a.call(this, i, u.html()));
u.domManip(n, t, r);
});
if (
l &&
((s = i.buildFragment(n, this[0].ownerDocument, !1, !r && this)),
(h = s.firstChild),
s.childNodes.length === 1 && (s = h),
h)
) {
for (o = i.map(u(s, "script"), nu), c = o.length; e < l; e++)
(f = s),
e !== w &&
((f = i.clone(f, !0, !0)), c && i.merge(o, u(f, "script"))),
t.call(this[e], f, e);
if (c)
for (
v = o[o.length - 1].ownerDocument, i.map(o, tu), e = 0;
e < c;
e++
)
(f = o[e]),
dr.test(f.type || "") &&
!i._data(f, "globalEval") &&
i.contains(v, f) &&
(f.src
? i._evalUrl(f.src)
: i.globalEval(
(f.text || f.textContent || f.innerHTML || "").replace(
pe,
""
)
));
s = h = null;
}
return this;
},
});
i.each(
{
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith",
},
function (n, t) {
i.fn[n] = function (n) {
for (var u, r = 0, f = [], e = i(n), o = e.length - 1; r <= o; r++)
(u = r === o ? this : this.clone(!0)),
i(e[r])[t](u),
kt.apply(f, u.get());
return this.pushStack(f);
};
}
);
i.extend({
clone: function (n, t, r) {
var f,
h,
o,
e,
s,
c = i.contains(n.ownerDocument, n);
if (
(i.support.html5Clone ||
i.isXMLDoc(n) ||
!pr.test("<" + n.nodeName + ">")
? (o = n.cloneNode(!0))
: ((si.innerHTML = n.outerHTML),
si.removeChild((o = si.firstChild))),
(!i.support.noCloneEvent || !i.support.noCloneChecked) &&
(n.nodeType === 1 || n.nodeType === 11) &&
!i.isXMLDoc(n))
)
for (f = u(o), s = u(n), e = 0; (h = s[e]) != null; ++e)
f[e] && be(h, f[e]);
if (t)
if (r)
for (s = s || u(n), f = f || u(o), e = 0; (h = s[e]) != null; e++)
iu(h, f[e]);
else iu(n, o);
return (
(f = u(o, "script")),
f.length > 0 && hi(f, !c && u(n, "script")),
(f = s = h = null),
o
);
},
buildFragment: function (n, t, r, f) {
for (
var h, o, w, s, y, p, l, b = n.length, a = vr(t), c = [], v = 0;
v < b;
v++
)
if (((o = n[v]), o || o === 0))
if (i.type(o) === "object") i.merge(c, o.nodeType ? [o] : o);
else if (le.test(o)) {
for (
s = s || a.appendChild(t.createElement("div")),
y = (br.exec(o) || ["", ""])[1].toLowerCase(),
l = e[y] || e._default,
s.innerHTML = l[1] + o.replace(wr, "<$1>$2>") + l[2],
h = l[0];
h--;
)
s = s.lastChild;
if (
(!i.support.leadingWhitespace &&
ei.test(o) &&
c.push(t.createTextNode(ei.exec(o)[0])),
!i.support.tbody)
)
for (
o =
y === "table" && !kr.test(o)
? s.firstChild
: l[1] === "