";
htmlContent += "";
$("#divCouponSent_" + popup_id).show();
$("#divCouponSent_" + popup_id).html(htmlContent);
$("#btnSendcoupon_" + popup_id).attr('disabled', false);
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
});
return false;
});
$(document).ready(function () {
if ($('#contactUs_form').length > 0) {
$('#contactUs_form').bootstrapValidator({
feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'},
fields: {
'form[personName]': {
validators: {
notEmpty: {message: front_first_name_msg},
stringLength: {min: 1, max: 100, message: front_first_name_len},
}
},
'form[personLastName]': {
validators: {
notEmpty: {message: front_last_name_msg},
stringLength: {min: 1, max: 100, message: front_last_name_len},
}
},
'form[personEmail]': {
validators: {
notEmpty: {message: front_email_validation},
emailAddress: {message: front_email_valid_msg},
},
},
'form[personPhone]': {
validators: {
notEmpty: {message: front_mobile_number},
regexp: {regexp: /^[^-\s][0-9()+-\s]+(?:,\d+)*$/i, message: front_mobile_number_format}
},
},
'form[contactComments]': {
validators: {
notEmpty: {message: front_enter_comment},
}
},
},
submitHandler: function (validator, form, submitButton) {}
});
$('body').on('success.form.bv', '#contactUs_form', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
var formData = $(this).serialize();
var baseUrl = getBaseUrl();
$.ajax({
url: baseUrl + '/contact/submit',
type: 'post',
data: formData,
beforeSend: function () {
showLoader();//$('body').Wload({text: 'Sending query...'});
},
success: function (result) {
if (result > 0) {
hideLoader();
swal("Thanks!", "Thank you for contacting us, we will be in touch with you very soon!", "success");
$("#contactUs_form").data('bootstrapValidator').resetForm();
$("#contactUs_form")[0].reset();
if($('.g-recaptcha').attr('data-sitekey') != '') {
grecaptcha.reset();
}else {
hideLoader();
swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error");
$("#form_submit").attr('disabled', false);
}
}else {
hideLoader();
swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error");
$("#form_submit").attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
})
});
}
});
$('body').on('success.form.bv', '#frmsubscribe', function (event) {
event.preventDefault();
var formData = $(this).serialize();
$.ajax({
url: siteUrl + '/home/newsubscribe',
type: 'post',
data: formData,
dataType: 'json',
success: function (result) {
if(result.valid == false){
swal("Subscribe!", "Could not complete your request, please try again after refreshing the page.", "error");
$("#btnSubscribe").attr('disabled', false);
}else{
swal({
title:"Subscribe!",
text:"You have subscribed successfully.",
type:"success"},function(){
if (typeof customTrigger === 'function') {
customTrigger();
}
$("#frmsubscribe").data('bootstrapValidator').resetForm();
$("#frmsubscribe")[0].reset();
$.cookie("stickyclose", 1, {expires: 1});
location.reload();
});
}
},
error: function (jqXHR, textStatus, errorThrown) {
$("#frmsubscribe").data('bootstrapValidator').resetForm();
$("#frmsubscribe")[0].reset();
}
})
});
$('body').on('success.form.bv', '#frmsubscribenewsletter', function (event) {
event.preventDefault();
var formData = $(this).serialize();
$.ajax({
url: siteUrl + '/home/newsubscribe',
type: 'post',
data: formData,
dataType: 'json',
success: function (result) {
if(result.valid == false){
swal("Subscribe!", "Could not complete your request, please try again after refreshing the page.", "error");
$("#btnSubscribenewsletter").attr('disabled', false);
}else{
swal({
title:"Subscribe!",
text:"You have subscribed successfully.",
type:"success"},function(){
if (typeof customTrigger === 'function') {
customTrigger();
}
$("#frmsubscribenewsletter").data('bootstrapValidator').resetForm();
$("#frmsubscribenewsletter")[0].reset();
$.cookie("stickyclose", 1, {expires: 1});
location.reload();
});
}
},
error: function (jqXHR, textStatus, errorThrown) {
$("#frmsubscribenewsletter").data('bootstrapValidator').resetForm();
$("#frmsubscribenewsletter")[0].reset();
}
})
});
if ($('#contactUs_form_mapless').length > 0) {
$('#contactUs_form_mapless').bootstrapValidator({
feedbackIcons: {
valid: 'fa',
invalid: 'err',
validating: 'fa'
},
fields: {
'form[source]': {
validators: {
notEmpty: {
message: 'Please select the most appropriate topic concerning your questions'
},
}
},
'form[personName]': {
validators: {
notEmpty: {
message: 'Please enter First Name'
},
stringLength: {
min: 1,
max: 100,
message: 'First Name between 1 to 100 character long'
},
}
},
'form[personLastName]': {
validators: {
notEmpty: {
message: 'Please enter Last Name'
},
stringLength: {
min: 1,
max: 100,
message: 'Last Name between 1 to 100 character long'
},
}
},
'form[address]': {
validators: {
notEmpty: {
message: 'Please enter Address'
},
},
},
'coutact_stateid': {
validators: {
notEmpty: {
message: 'Please select State'
},
},
},
'contact_city_id': {
validators: {
notEmpty: {
message: 'Please select City'
},
},
},
/*
'contact_store_id': {
validators: {
notEmpty: {
message: 'Please select a Store Location'
},
},
},*/
'form[zipcode]': {
validators: {
notEmpty: {
message: 'Please enter Zipcode'
},
stringLength: {max: 10, message: 'Please enter valid Zipcode'}
},
},
'form[personPhone]': {
validators: {
notEmpty: {
message: 'Please enter Phone Number'
},
stringLength: {min: 8, message: 'Phone Number min 8 number long'},
regexp: {regexp: /^[^-\s][0-9()+-\s]+(?:,\d+)*$/i, message: 'Please enter valid Phone Number'},
}
},
'form[personEmail]': {
validators: {
notEmpty: {
message: 'Please enter Email Address'
},
emailAddress: {
message: 'Please enter valid Email Address'
},
},
},
'form[contactComments]': {
validators: {
notEmpty: {
message: 'Please enter Comments'
},
}
},
},
submitHandler: function (validator, form, submitButton) {}
});
}
$('body').on('success.form.bv', '#contactUs_form_mapless', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
var formData = $(this).serialize();
var baseUrl = getBaseUrl();
$.ajax({
url: baseUrl + '/contact/maplessubmit',
type: 'post',
data: formData,
dataType: 'json',
beforeSend: function () {
showLoader();
},
success: function (result) {
if (result.status == 'success') {
hideLoader();
swal("Thanks!", result.message, "success");
$("#contactUs_form_mapless").data('bootstrapValidator').resetForm();
$("#contactUs_form_mapless")[0].reset();
$(".qnsfaqs").addClass('hide');
$(".qnsfaqs").removeClass('show');
$(".qnsforms").addClass('hide');
$(".qnsforms").removeClass('show');
if($('.g-recaptcha').attr('data-sitekey') > 0) {
grecaptcha.reset();
}
} else if (result.status == 'warning') {
swal("Warning!", result.message, "warning");
hideLoader();
$("#form_submit").attr('disabled', false);
} else {
swal("Error!", result.message, "error");
hideLoader();
$("#form_submit").attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
})
});
if ($('#productsafetyform').size() > 0) {
$('#productsafetyform').bootstrapValidator({
feedbackIcons: {
valid: 'fa',
invalid: 'err',
validating: 'fa'
},
fields: {
'form[personName]': {
validators: {
notEmpty: {
message: 'Please enter Name'
},
stringLength: {
min: 1,
max: 150,
message: 'Name between 1 to 150 character long'
},
}
},
'form[personEmail]': {
validators: {
notEmpty: {
message: 'Please enter Email'
},
/*emailAddress: {
message: 'Please enter valid Email'
},*/
regexp: {regexp: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i, message: 'Please enter valid Email'},
},
},
'form[address1]': {
validators: {
notEmpty: {
message: 'Please enter Mailing Address 1'
},
stringLength: {
min: 1,
max: 30,
message: 'Mailing Address 1 between 1 to 30 character long'
},
},
},
'form[countryId]': {
validators: {
notEmpty: {
message: 'Please select Country'
},
},
},
'form[stateId]': {
validators: {
notEmpty: {
message: 'Please select State'
},
},
},
'form[cityId]': {
validators: {
notEmpty: {
message: 'Please enter City'
},
},
},
'form[zipcode]': {
validators: {
notEmpty: {
message: 'Please enter Zipcode'
},
stringLength: {max: 10, message: 'Please enter valid Zipcode'}
},
},
'form[personPhone]': {
validators: {
notEmpty: {
message: 'Please enter Phone Number'
},
stringLength: {min: 8, message: 'Phone Number min 8 number long'},
//regexp: {regexp: /^\d{3}-\d{3}-\d{4}$/i, message: 'Phone Number format as ###-###-####'},
}
},
'form[cedarSerialNumber]': {
validators: {
notEmpty: {
message: 'Please enter Cedar Chest Serial Number'
},
},
},
'form[cedarShapeLatch]': {
validators: {
notEmpty: {
message: 'Please select at least one options'
},
},
},
},
submitHandler: function (validator, form, submitButton) {}
});
}
//$('form[data-toggle="validator"]').on('submit', function (e) {
$('#productsafetyform').bootstrapValidator().on('submit', function (e) {
if (e.isDefaultPrevented()) {
$('html, body').animate({ scrollTop: $(".has-error:first :input").offset().top - 50 }, 500);
$(".has-error:first :input").focus();
} else {
// everything looks good!
}
});
$('body').on('success.form.bv', '#productsafetyform', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
var formData = $(this).serialize();
var baseUrl = getBaseUrl();
$.ajax({
url: baseUrl + '/productsafety/requestsubmit',
type: 'post',
data: formData,
beforeSend: function () {
showLoader();
},
success: function (result) {
if (result > 0) {
hideLoader();
swal("Thank You!", "Thank you for submitting your request, we will be in touch with you very soon!", "success");
$("#productsafetyform").data('bootstrapValidator').resetForm();
$("#productsafetyform")[0].reset();
if($('.g-recaptcha').attr('data-sitekey') != '') {
grecaptcha.reset();
}
} else {
swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error");
hideLoader();
$("#form_submit").attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
})
});
$("body").delegate(".product_inquiry_countryId", "change", function (e) {
var ctryid = "";
ctryid = $(this).val();
if (ctryid > 0 && ctryid != "") {
getCheckoutState(ctryid, '', '','change');
}
});
$("body").delegate(".product_inquiry_stateId", "change", function (e) {
var stateid = "";
stateid = $(this).val();
var site_url1 = getBaseUrl();
if (stateid > 0 && stateid != "") {
getCheckoutCity(stateid, '', '','change')
}
});
if ($('.carousel').length > 0) {
var slider_id = $('.carousel').attr('id');
if (slider_id == 'myCarousel') {
$('#cms_page').find('.ke-advance-padding:first').attr('style', 'padding-top: 0px !important');
}
}
$(function () {
if (site_url.search("find-a-retailer") >= 0 && site_url.search("zipcode") >= 0) {
$("#findaretailer_form #find_retailer").trigger("click");
}
});
$("body").delegate("#find_retailer", "click", function (event) {
var default_country = $("#default_country").val();
var address = $("#retailer_find_zipcode").val();
if($("#retailer_find_radius").val() != ''){
if ($("#retailer_find_zipcode").val() != '') {
address = $("#retailer_find_zipcode").val();
address = address + ',' + default_country;
} else if ($("#retailer_find_city").val() != '' && $("#retailer_find_state").val() != '') {
address = $("#retailer_find_city").val() + ',' + $("#retailer_find_state").val();
}else {
swal("Error!", "Please enter zipcode or city and state.", "error");
return false;
}
}else{
swal("Error!", "Please select radius for search.", "error");
return false;
}
var geocoder = new google.maps.Geocoder();
geocoder.geocode({address: address}, function (results, status) {
console.log(status);
//console.log(results[0].geometry.location);
if (status == google.maps.GeocoderStatus.OK) {
searchLocationsNear(results[0].geometry.location);
$("#map").show();
$("#searched_result_retailers").hide();
} else if(status == google.maps.GeocoderStatus.REQUEST_DENIED){
swal("Error!", "You must enable Billing on the Google Cloud Project, For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key", "error");
} else {
//alert(address + ' not found');
swal("Error!", "Retailer not found from provided location.", "error");
}
});
/* var formData = $("#findaretailer_form").serialize();
var state_id = $('#retailer_find_state option:selected').attr('data_stateCode');
if(state_id != '' && state_id!=undefined)
formData = formData+'&state_id='+state_id;
var baseUrl = getBaseUrl();
$.ajax({url: baseUrl + '/findretailesdata', type: 'post', data:formData,
success: function (result) {
$("#map_canvas").show();
var json_parse_data = $.parseJSON(result);
$('#searched_result_retailers').html(json_parse_data.html);
$('#retailer_pagination').html(json_parse_data.pagination_data);
var data1 = $.parseJSON(json_parse_data.address_data);//$.parseJSON(json_parse_data.address_data);
$.each(data1, function (data,val) {
console.log(val);
addMarkerHtml(val.latitude, val.longitude,val.lat_lng_link);
});
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
});*/
});
$("body").delegate(".findaretailer_pagination", "click", function (event) {
var page_no = $(this).attr('pageid');
var formData = $("#findaretailer_form").serialize();
var state_id = $('#retailer_find_state option:selected').attr('data_stateCode');
if (state_id != '' && state_id != undefined)
formData = formData + '&state_id=' + state_id;
if (page_no != '' && page_no != undefined)
formData = formData + '&pageno=' + page_no;
var baseUrl = getBaseUrl();
$.ajax({
url: baseUrl + '/findretailesdata',
type: 'post',
data: formData,
success: function (result) {
var json_parse_data = $.parseJSON(result);
$('#searched_result_retailers').html(json_parse_data.html);
$('#retailer_pagination').html(json_parse_data.pagination_data);
var data1 = $.parseJSON(json_parse_data.address_data); //$.parseJSON(json_parse_data.address_data);
$.each(data1, function (data, val) {
addMarkerHtml(val.latitude, val.longitude, val.lat_lng_link);
});
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
});
});
/* Google Map */
if ($("#map").length > 0) {
var map;
var markers = [];
var infoWindow;
var locationSelect;
function initMap() {
var sydney = {lat: -33.863276, lng: 151.107977};
map = new google.maps.Map(document.getElementById('map'), {
center: sydney,
zoom: 11,
minZoom: 5,
maxZoom: 15,
gestureHandling: 'cooperative',
mapTypeId: 'roadmap',
mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
});
infoWindow = new google.maps.InfoWindow();
}
function searchLocations() {
var address = document.getElementById("addressInput").value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode({address: address}, function (results, status) {
console.log(results);
alert(results[0]);
if (status == google.maps.GeocoderStatus.OK) {
searchLocationsNear(results[0].geometry.location);
} else {
alert(address + ' not found');
}
});
}
function clearLocations() {
infoWindow.close();
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
markers.length = 0;
locationSelect.innerHTML = "";
var option = document.createElement("option");
option.value = "none";
option.innerHTML = "See all results:";
locationSelect.appendChild(option);
}
function searchLocationsNear(center) {
//clearLocations();
var forUrl = getBaseUrl();
var radius = $("#retailer_find_radius").val(); // document.getElementById('radiusSelect').value;
var is_store_location = '';
if ($("#is_store_location").val() > 0) {
is_store_location = 1;
}
var searchUrl = forUrl + '/findretailermarker?lat=' + center.lat().toFixed(3) + '&lng=' + center.lng().toFixed(3) + '&radius=' + radius + '&is_store_location=' + is_store_location;
downloadUrl(searchUrl, function (data) {
var xml = parseXml(data);
var markerNodes = xml.documentElement.getElementsByTagName("marker");
var bounds = new google.maps.LatLngBounds();
var html = '';
if (markerNodes.length > 0) {
clearMap();
html = '
Showing 1-' + markerNodes.length + ' result of ' + markerNodes.length + '
';
for (var i = 0; i < markerNodes.length; i++) {
console.log(markerNodes[i]);
var id = markerNodes[i].getAttribute("id");
var name = markerNodes[i].getAttribute("name");
var address = markerNodes[i].getAttribute("address");
var city_name = markerNodes[i].getAttribute("city");
var state_name = markerNodes[i].getAttribute("state");
var latlng = new google.maps.LatLng(parseFloat(markerNodes[i].getAttribute("lat")), parseFloat(markerNodes[i].getAttribute("lng")));
var distance = parseFloat(markerNodes[i].getAttribute("distance")).toFixed(2);
var latitude = parseFloat(markerNodes[i].getAttribute("latitude"));
var longitude = parseFloat(markerNodes[i].getAttribute("longitude"));
var store_hours = parseFloat(markerNodes[i].getAttribute("store_hours"));
var storeTime = markerNodes[i].getAttribute("storeTime");
var contact = markerNodes[i].getAttribute("contact");
var website_url = markerNodes[i].getAttribute("website_url");
var direction_link = markerNodes[i].getAttribute("direction_link");
var lat_lng_link = markerNodes[i].getAttribute("lat_lng_link");
var zipcode = markerNodes[i].getAttribute("zipcode");
var email = markerNodes[i].getAttribute("email");
direction_link = '
"],
animateIn : animateInEffect,
animateOut : animateOutEffect,
responsive:{
0:{
items:1
},
600:{
items:1
},
1000:{
items:1
}
},
onInitialize: function (event) {
if ($('.owl-carousel .item').length <= 1) {
this.settings.loop = false;
}
}
});
}
$('.gallery_filter').on('change', function() {
var category = $('#category_list').val();
var gallery_type = $('#galley_type_list').val();
var gallery_sub_type = $('#gallery_sub_type_list').val();
galleryFilter(category, gallery_type, gallery_sub_type);
});
$('.gallery_filter_ul li input').on('click', function() {
galleryFilter();
});
$('#gallery-year').on('change', function() {
galleryFilter();
});
function galleryFilter(){
var category = $("input[name='gallery_category[]']:checked").map(function () {
return this.value;
}).get().join(',');
var gallery_type = $("input[name='gallery_type[]']:checked").map(function () {
return this.value;
}).get().join(',');
var gallery_sub_type = $("input[name='gallery_sub_type[]']:checked").map(function () {
return this.value;
}).get().join(',');
var gallery_month = $("input[name='gallery_month[]']:checked").map(function () {
return this.value;
}).get().join(',');
var gallery_year = $("#gallery-year").val();
$('.reset').show();
$.ajax({
type: "POST",
cache: true,
url: '/galleryfilter',
data: { category: category, gallery_type: gallery_type, gallery_sub_type: gallery_sub_type, gallery_month: gallery_month, gallery_year: gallery_year},
dataType: 'html',
beforeSend: function() {
$(".loader").removeClass("hide");
$(".loader").addClass('show');
},
success: function(result) {
if (result != 0) {
$('#portfolioContainer').html(result);
msnry.reloadItems();
msnry.layout();
} else {
$('#portfolioContainer').html();
}
},
complete: function() {
$(".loader").removeClass("show");
$(".loader").addClass('hide');
//$(".c-layout-page").css({ "margin-top": $(".c-layout-header").height() + "px" });
},
error: function(jqXHR, textStatus, errorThrown) {
return false;
}
});
}
$('#reset_gallery_filter').on('click',function(){
$('#category_list').val('');
$('#galley_type_list').val('');
$('#gallery_sub_type_list').val('');
});
if ($('#frmgetcouponcode').size() > 0) {
$('#frmgetcouponcode').bootstrapValidator({
excluded: ':disabled',
feedbackIcons: {
valid: 'fa',
invalid: 'err',
validating: 'fa'
},
fields: {
'coupon_firstname': {
validators: {
notEmpty: {
message: 'Please enter First Name'
},
stringLength: {
min: 1,
max: 150,
message: 'First Name between 1 to 150 character long'
},
}
},
'coupon_lastname': {
validators: {
notEmpty: {
message: 'Please enter Last Name'
},
stringLength: {
min: 1,
max: 150,
message: 'Last Name between 1 to 150 character long'
},
}
},
'coupon_emailid': {
validators: {
notEmpty: {
message: 'Please enter Email'
},
emailAddress: {
message: 'Please enter valid Email'
},
/*remote: {
type: 'POST',
url: siteUrl + "/checkrelatedcoupon",
data: function (validator, $field, value) {
//emailid = validator.getFieldElements('coupon_emailid').val();
//return {emailid: emailid, };
},
message: 'You have already this coupon code, Please check your email or choose another coupon',
delay: 500
},*/
},
},
'coupon_phone': {
validators: {
notEmpty: {
message: 'Please enter Phone Number'
},
stringLength: {min: 8, message: 'Phone Number min 8 number long'},
regexp: {regexp: /^[^-\s][0-9()+-\s]+(?:,\d+)*$/i, message: 'Please enter valid Phone Number'},
}
},
},
submitHandler: function (validator, form, submitButton) {}
});
}
$('body').on('success.form.bv', '#frmgetcouponcode', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
var formData = $(this).serialize();
var baseUrl = getBaseUrl();
$.ajax({
url: baseUrl + '/checkrelatedcoupon',
type: 'post',
dataType: "json",
data: formData,
success: function (response) {
if (response) {
swal(response.response_name, response.response_msg, response.response_type);
$("#frmgetcouponcode").data('bootstrapValidator').resetForm();
$("#frmgetcouponcode")[0].reset();
$("#hdn_cpid").val('');
} else {
$("#frmgetcouponcode").data('bootstrapValidator').resetForm();
$("#frmgetcouponcode")[0].reset();
$("#hdn_cpid").val('');
swal("Error!", "This coupon is expired or might not be available at the moment.", "error");
}
$('#coupon-form').modal('hide');
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
})
});
$('#coupon-form').on('hidden.bs.modal', function () {
$('#frmgetcouponcode').bootstrapValidator('resetForm', true);
$('#frmgetcouponcode').trigger("reset");
$("#frmgetcouponcode")[0].reset();
$("#hdn_cpid").val('');
});
function getcoupondataid(coupon_id){
if(coupon_id){
$("#hdn_cpid").val(coupon_id);
}else{
$("#hdn_cpid").val('');
}
}
/***************************************Auto Search by REN01*************************/
function autocomplete(inp) {
/*the autocomplete function takes two arguments,
the text field element and an array of possible autocompleted values:*/
var currentFocus;
/*execute a function when someone writes in the text field:*/
inp.addEventListener("input", delay(function(e) {
var a, b, i, val = this.value;
/*close any already open lists of autocompleted values*/
closeAllLists();
if (!val) { return false; }
currentFocus = -1;
/*create a DIV element that will contain the items (values):*/
a = document.createElement("DIV");
a.setAttribute("id", this.id + "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
/*append the DIV element as a child of the autocomplete container:*/
this.parentNode.appendChild(a);
/*for each item in the array...*/
getAutoSearchKeyword(val, function(d) {
//processing the data
var arr = d.split(",");
for (i = 0; i < arr.length; i++) {
/*check if the item starts with the same letters as the text field value:*/
if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {
/*create a DIV element for each matching element:*/
b = document.createElement("DIV");
/*make the matching letters bold:*/
b.innerHTML = "" + arr[i].substr(0, val.length) + "";
b.innerHTML += arr[i].substr(val.length);
/*insert a input field that will hold the current array item's value:*/
b.innerHTML += "";
/*execute a function when someone clicks on the item value (DIV element):*/
b.addEventListener("click", function(e) {
/*insert the value for the autocomplete text field:*/
inp.value = this.getElementsByTagName("input")[0].value;
/*close the list of autocompleted values,
(or any other open lists of autocompleted values:*/
closeAllLists();
});
a.appendChild(b);
}
}
});
//arr = getAutoSearchKeyword(val);
//alert(arr);
},1000));
/*execute a function presses a key on the keyboard:*/
inp.addEventListener("keyup", delay(function(e) {
var x = document.getElementById(this.id + "autocomplete-list");
//$(".autocomplete-items").html('
Loading keyword suggestions...
');
if (x) x = x.getElementsByTagName("div");
if (e.keyCode == 40) {
/*If the arrow DOWN key is pressed,
increase the currentFocus variable:*/
currentFocus++;
/*and and make the current item more visible:*/
addActive(x);
} else if (e.keyCode == 38) { //up
/*If the arrow UP key is pressed,
decrease the currentFocus variable:*/
currentFocus--;
/*and and make the current item more visible:*/
addActive(x);
} else if (e.keyCode == 13) {
/*If the ENTER key is pressed, prevent the form from being submitted,*/
//e.preventDefault();
if (currentFocus > -1) {
/*and simulate a click on the "active" item:*/
if (x) x[currentFocus].click();
}
}
},1000));
function addActive(x) {
/*a function to classify an item as "active":*/
if (!x) return false;
/*start by removing the "active" class on all items:*/
removeActive(x);
if (currentFocus >= x.length) currentFocus = 0;
if (currentFocus < 0) currentFocus = (x.length - 1);
/*add class "autocomplete-active":*/
x[currentFocus].classList.add("autocomplete-active");
}
function removeActive(x) {
/*a function to remove the "active" class from all autocomplete items:*/
for (var i = 0; i < x.length; i++) {
x[i].classList.remove("autocomplete-active");
}
}
function closeAllLists(elmnt) {
/*close all autocomplete lists in the document,
except the one passed as an argument:*/
var x = document.getElementsByClassName("autocomplete-items");
for (var i = 0; i < x.length; i++) {
if (elmnt != x[i] && elmnt != inp) {
x[i].parentNode.removeChild(x[i]);
}
}
}
/*execute a function when someone clicks in the document:*/
document.addEventListener("click", function(e) {
closeAllLists(e.target);
});
}
function getAutoSearchKeyword(text,callback){
var srhText = text;
if($("#hdn_search_term").val() > 0 && $("#hdn_search_term").val() != undefined){
var hdn_search_term = $("#hdn_search_term").val();
}else{
var hdn_search_term = 4;
}
text = text.replace(/\s/g, "");
$(".autocomplete-items").html('
'+front_finding_search_keyword+'
');
if(text.length > hdn_search_term){
$.ajax({
type: "POST",
url: getBaseUrl() + "/home/autosearchkeyword",
data: {keyword:srhText},
async: false,
success: function (result) {
$(".loading-text").hide();
callback(result);
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
});
}
}
if($("#q1").size() > 0){
autocomplete(document.getElementById("q1"));
}
if($("#q2").size() > 0){
autocomplete(document.getElementById("q2"));
}
if ($("#employmentform").length > 0) {
/*$("#form_empLanguage").select2({
placeholder: "Select",
width: '100%'
});*/
/*$("#form_skillSet").select2({
placeholder: "Select",
width: '100%'
});
$("#form_location").select2({
placeholder: "Select",
width: '100%'
});*/
/*$("#form_hearAbout").select2({
placeholder: "Select",
width: '100%'
});
$("#form_state").select2({
placeholder: "Select",
width: '100%'
});*/
}
if ($('#employmentform').size() > 0) {
$('#employmentform').bootstrapValidator({
feedbackIcons: {
valid: 'fa',
invalid: 'err',
validating: 'fa'
},
fields: {
'form[language]': {
validators: {
notEmpty: {
message: 'Please select Preferred Language'
},
}
},
'skillSet[]': {
validators: {
notEmpty: {
message: 'Please select Job skill set'
},
}
},
'form[firstName]': {
validators: {
notEmpty: {
message: 'Please enter First Name'
},
},
},
'form[lastName]': {
validators: {
notEmpty: {
message: 'Please enter Last Name'
},
},
},
'form[address1]': {
validators: {
notEmpty: {
message: 'Please enter Address 1'
},
},
},
'form[city]': {
validators: {
notEmpty: {
message: 'Please enter City'
},
},
},
'form[state]': {
validators: {
notEmpty: {
message: 'Please select State'
},
},
},
'form[zipcode]': {
validators: {
notEmpty: {
message: 'Please enter ZIP Code'
},
stringLength: {max: 10, message: 'Please enter valid ZIP Code'}
},
},
'form[preferContact]': {
validators: {
notEmpty: {
message: 'Please select Preferred to be contacted'
},
},
},
'form[phoneNumber]': {
validators: {
notEmpty: {
message: 'Please enter Phone Number'
},
stringLength: {min: 8, message: 'Phone Number min 8 number long'},
regexp: {regexp: /^[^-\s][0-9()+-\s]+(?:,\d+)*$/i, message: 'Please enter valid Phone Number'},
}
},
'form[emailAddress]': {
validators: {
emailAddress: {
message: 'Please enter valid Email Address'
},
},
},
'location[]': {
validators: {
notEmpty: {
message: 'Please select Job Skill Set or Location you are interested in'
},
},
},
'form[resumeFile]': {
validators: {
file: {
extension: 'pdf',
type: 'application/pdf',
maxSize: 358400, // 350 * 1024
message: 'Please upload Resume file with pdf only and max 350KB size'
}
}
},
'form[verifyInfo]': {
validators: {
notEmpty: {
message: 'Please verify that the information entered above is accurate'
},
},
},
},
submitHandler: function (validator, form, submitButton) {}
}).on('success.field.bv', function(e, data) {
var $parent = data.element.parents('.form-group');
// Remove the has-success class
$parent.removeClass('has-success');
// Hide the success icon
$parent.find('.form-control-feedback[data-bv-icon-for="' + data.field + '"]').hide();
});
}
$('body').on('success.form.bv', '#employmentform', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
//var formData = $(this).serialize();
var formData = new FormData(this);
var files = $('#form_resumeFile')[0].files[0];
formData.append('file',files);
var baseUrl = getBaseUrl();
$.ajax({
url: baseUrl + '/employment/requestsubmit',
type: 'post',
data: formData,
contentType: false,
processData: false,
beforeSend: function () {
showLoader();
},
success: function (result) {
if (result > 0) {
hideLoader();
swal({
title:"Thank you!",
text:"Your information was successfully submitted. A member of our UFI/Lane team will be reviewing your pre-application and will soon reach out to you.",
type:"success"},function(){
location.reload();
});
$("#employmentform").data('bootstrapValidator').resetForm();
$("#employmentform")[0].reset();
if($('.g-recaptcha').attr('data-sitekey') != '') {
grecaptcha.reset();
}
} else {
swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error");
hideLoader();
$("#employmentSubmit").attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
})
});
$('.c-sidebar-menu-toggler').click( function(e) {
$('#mobile-advancefilter-1, #mobile-advancefilter-2').collapse('hide');
});
$('.mobfilter-btn').click( function(e) {
$('#sidebar-menu-1, #sidebar-menu-2').collapse('hide');
});
function delay(callback, ms) {
var timer = 0;
return function() {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
callback.apply(context, args);
}, ms || 0);
};
}
$('.blog-pagination').delegate('.pagination_box', 'click', function (e) {
changeUrl('page', $(this).attr("data-id"));
function changeUrl(key, value, isUncheck = 0) {
var searchUrl = location.search;
if (searchUrl.indexOf("?") == "-1") {
var urlValue = '?' + key + '=' + value;
history.pushState({state: 1, rand: Math.random()}, '', urlValue);
} else {
if (searchUrl.indexOf(key) == "-1") {
var urlValue = searchUrl + '&' + key + '=' + value;
} else {
oldValue = getParameterByName(key);
if (searchUrl.indexOf("?" + key + "=") != "-1") {
urlValue = searchUrl.replace('?' + key + '=' + oldValue, '?' + key + '=' + value);
} else {
urlValue = searchUrl.replace('&' + key + '=' + oldValue, '&' + key + '=' + value);
}
}
history.pushState({state: 1, rand: Math.random()}, '', urlValue);
}
location.reload(true);
}
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
});
if ($.isFunction(window.chkvalidation) === false) {
function chkvalidation() { return true; }
}
if ($('#questionnaire').length > 0) {
$('#questionnaire').on('change', function () {
var show_field_title = 'No';
var source = $('#questionnaire').val();
if($("#hdn_show_field_title").val() != undefined && $("#hdn_show_field_title").val() == 1){
show_field_title = "Yes";
}
if(source != undefined && source != ""){
$.ajax({
type: "POST",
cache: true,
url: '/getcontactquestion',
data: 'qnsid=' + source+'&show_title='+show_field_title,
success: function (result) {
if(result != undefined && result != ''){
result = result.split("||:");
if(result[0] != undefined && result[0] != ''){
$(".qnsfaqs").addClass("show");
$(".qnsfaqs").removeClass("hide");
$('.qnsfaqs').html(result[0]);
}
if(result[1] != undefined && result[1] != ''){
$(".qnsforms").addClass("show");
$(".qnsforms").removeClass("hide");
$('.qnsforms').html(result[1]);
//Revlidate
$("#form_submit").attr('disabled', false);
//$('#captcha-err').show();
$('#storefrmbuilder').bootstrapValidator('destroy');
$('#storefrmbuilder').bootstrapValidator().on('success.form.bv', function(e) {
e.stopImmediatePropagation();
e.preventDefault();
// ajax call
if ( chkvalidation() ){
callajax();
}
});
}
}else{
//Showing blank div in case of no FAQs.
var data=`
`;
$('.qnsfaqs').html(data);
return false;
}
},
error: function (jqXHR, textStatus, errorThrown) {
return false;
}
});
}else{
$(".qnsfaqs").addClass("hide");
$(".qnsfaqs").removeClass("show");
$('.qnsfaqs').html('');
$(".qnsforms").addClass("hide");
$(".qnsforms").removeClass("show");
$('.qnsforms').html('');
}
});
}
function initFormValidation () {
$("#storefrmbuilder").bootstrapValidator();
}
$('.copycheckbox').change(function() {
if ($($(this)).is(":checked")) {
var check = 1;
} else {
var check = 2;
}
const onlyInputs = document.forms["storefrmbuilder"].getElementsByTagName("input");
$(onlyInputs).each(function(items,key){
var itemid = key['id'];
var field_grp = $('#'+itemid).data('fieldgroup');
var boundto = $('#'+itemid).data('frontboundto');
if(check == 1)
{
const onlyInputs = document.forms["storefrmbuilder"].getElementsByTagName("select");
$(onlyInputs).each(function(items,key){
var sel_itemid = key['id'];
var sel_field_grp = $('#'+sel_itemid).data('fieldgroup');
var sel_boundto = $('#'+sel_itemid).data('frontboundto');
var selectedOptionText = $('#'+sel_itemid).find(":selected").text();//selected option text
var selectedOptionVal = $('#'+sel_itemid).find(":selected").val();//selected option value
if(sel_boundto != 'undefined' && sel_boundto != '' && sel_field_grp !='' && sel_field_grp == "from")
{
$("#"+sel_itemid).val($("#"+sel_boundto).val());
}
});
if(boundto != 'undefined' && boundto != '' && field_grp !='' && field_grp == "from")
{
$("#"+itemid).val($("#"+boundto).val());
}
if(boundto == "undefined" && field_grp == "undefined")
{
swal("Failed!", "Please enter values!", "error");
}
}
if(check == 2)
{
const onlyInputs = document.forms["storefrmbuilder"].getElementsByTagName("select");
$(onlyInputs).each(function(items,key){
var sel_itemid = key['id'];
var sel_field_grp = $('#'+sel_itemid).data('fieldgroup');
var sel_boundto = $('#'+sel_itemid).data('frontboundto');
var selectedOptionText = $('#'+sel_itemid).find(":selected").text();//selected option text
var selectedOptionVal = $('#'+sel_itemid).find(":selected").val();//selected option value
if(sel_field_grp == "from")
{
$("#"+sel_itemid).val("");
}
});
}
if(check == 2 && field_grp == "from" )
{
$("#"+itemid).val("");
//$("#"+sel_itemid).val("");
}
});
});
async function getGlbModel(sku, apiKey, clientID) {
try {
const pregenerated = new MxtWebAR.MxtWebArPregenerated({apiKey:apiKey, clientId:clientID});
const url = await pregenerated.getGlb(sku);
addSrcToModelViewer(url);
} catch(e) {
console.error('Failed to get sku web ar asset', e);
return false;
}
}
function addSrcToModelViewer(url) {
const spinElement = document.getElementById('spin');
try {
spinElement.src = url;
} catch(e) {
console.error('Failed to load modal viewer web ar asset', e);
}
}
$("body").delegate(".close_3d", "click", function (e) {
e.preventDefault();
hideLoader();
$("[id^='view3d']").modal('hide');
e.stopPropagation();
});
async function checkForWebArAsset(sku, apiKey, clientID) {
const browserArType = MxtWebAR.MxtWebArHelpers.browserArSupport();
const pregenerated = new MxtWebAR.MxtWebArPregenerated({apiKey:apiKey, clientId:clientID});
const anchorElement = document.getElementById('viewInQr');
try {
const arAssetsAvailable = await pregenerated.getAssetTypesAvailable(sku);
if(arAssetsAvailable.length > 0) {
$("#viewIn3D").show();
$("#viewInQr").show();
if(!browserArType) {
var qr = new QRious({
size: 500,
element: document.getElementById('qr'),
// Remember to make sure the value for the QR code url is absolute, not relative, since the QR will be generated bassed on this text.
value: "https://marxentresearch.com/demo/web-ar/sdk-qr.html?sku="+sku+"&clientId="+clientID+"&apiKey="+apiKey+"&lod=1024#"
});
var qrmodal = document.getElementById("viewqr");
// Get the button that opens the qrmodal
var btn = document.getElementById("viewInQr");
// Get the element that closes the qrmodal
var closebtn = document.getElementsByClassName("close_qr")[0];
// When the user clicks the button, open the qrmodal
btn.onclick = function() {
qrmodal.style.display = "block";
}
// When the user clicks on (x), close the qrmodal
closebtn.onclick = function() {
qrmodal.style.display = "none";
}
} else {
// If the user is on mobile, we again check to see if AR files exist for the specified sku.
// If true, we'll link the button to the appropriate file (usdz for iOS, glb for Android).
// If false, we do something else. For this sample, we're just hiding the button.
try {
console.log("Exists: " + arAssetsAvailable.includes(browserArType));
if(arAssetsAvailable.includes(browserArType)){
try {
const url = await pregenerated.getWebArPregeneratedUrl(sku);
anchorElement.href = url;
} catch(e) {
console.error('Failed to get sku web ar asset', e);
}
} else {
// Hide the button and the model-viewer if no AR files exist for this SKU
$("#viewInQr").hide();
console.log("No AR files exist for this SKU.")
}
} catch(e) {
// Hide the button and the model-viewer if the check for AR files fails.
console.error('Failed to check if sku has web ar asset', e);
$("#viewInQr").hide();
}
}
} else {
// If no AR assets exist for this sku, hide the button and spin viewer on Desktop.
$("#viewIn3D").hide();
$("#viewInQr").hide();
}
} catch(e) {
console.error('Failed to check if sku has web ar asset', e);
}
}