$(function () {
var msg = $('#lblMessage').text();
var type_ = $('#lblMessage').attr('class');
if (type_ == "failure") {
type_ = "error";
}
if (msg != '') {
MessageAlert(msg, type_);
$('#lblMessage').text('');
}
});
$(document).ready(function () {
setTimeout(function () {
$('html,body').animate({ scrollTop: 0 }, 'slow');
}, 1000);
$('.sellg').change(function () {
$('.hdnLga').val($(this).val() + '*' + $(this).find(':selected').text());
window.localStorage.setItem('LGA', $(this).val());
});
$('select.selstate').change(function () {
var stateid = $(this).val();
loadLGs(stateid);
});
var loadLGs = function (stateid) {
if(!stateid) return;
$.support.cors = true;
var searchUrl = "/Universal/Webservices/delsupin.asmx/GetLGA";
var ds = { StateId: stateid };
$.ajax({
url: searchUrl, type: "POST",
dataType: "json",
crossDomain: true,
ifModified: true,
cache: true,
data: JSON.stringify(ds),
contentType: "application/json; charset=utf-8",
beforeSend: function () {
return true;
}
}).done(function (results) {
//console.log(results);
//console.log(results.d);
var lgs = JSON.parse(results.d);
$('select.sellg').empty();
var defaultLGid; var defaultLGName;
for (var i = 0; i < lgs.length; i++) {
if (i == 0) {
defaultLGid = lgs[i].id; defaultLGName = lgs[i].name;
}
console.log('');
$('select.sellg').append('');
}
try
{
var LG = window.localStorage.getItem('LGA');
if (LG) {
$('select.sellg').val(LG);
$('.hdnLga').val($('select.sellg').val() + '*' + $('select.sellg').find(':selected').text());
} else {
$('.hdnLga').val(defaultLGid + '*' + defaultLGName);
}
}
catch(ex){}
$('.chosen-select').trigger('chosen:updated');
}
).fail(function (jpXHR, textStatus, thrownError) {
console.log("--------------------");
console.log(textStatus);
console.log(jpXHR);
console.log(thrownError);
console.log("--------------------");
}
);
}
var sid = $('select.selstate').val();
loadLGs(sid);
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%'
});
$.getScript("/newapplicant_skin/plugin/chosen/chosen.jquery.min.js", function (data, textStatus, jqxhr) {
console.log("Chosen Load was performed.");
$.getScript("/newapplicant_skin/plugin/chosen/docsupport/prism.js", function (data, textStatus, jqxhr) {
console.log("Prism Load was performed.");
var config = {
'.chosen-select': { display_selected_options: false },
'.chosen-select-deselect': { allow_single_deselect: true },
'.chosen-select-no-single': { disable_search_threshold: 10 },
'.chosen-select-no-results': { no_results_text: 'Oops, nothing found!' },
'.chosen-select-width': { width: "95%" }
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
});
}); //chosen/docsupport/prism.js
});