var site_url = $(location).attr('href'); var siteUrl = document.location.origin; var location_flag = "No"; function getBaseUrl() { return window.location.origin; } var site_url1 = getBaseUrl(); var forUrl = getBaseUrl(); function strstr(haystack, needle, bool) { var pos = 0; haystack += ""; pos = haystack.indexOf(needle); if (pos == -1) { return false; } else { if (bool) { return haystack.substr(0, pos); } else { return haystack.slice(pos); } } } function lastUrlSegment(url) { var lastURLSegment = url.substr(url.lastIndexOf('/') + 1); return lastURLSegment; } function getkey(e) { if (window.event) return window.event.keyCode; else if (e) return e.which; else return null; } function goodchars(e, goods) { var key, keychar; key = getkey(e); if (key == null) return true; keychar = String.fromCharCode(key); keychar = keychar.toLowerCase(); goods = goods.toLowerCase(); if (goods.indexOf(keychar) != -1) return true; if (key == null || key == 0 || key == 8 || key == 9 || key == 13 || key == 27) return true; return false; } function toInteger(a) { var b; a = a.replace(/[$,]/g, ""); if (a.indexOf('.') > 0) { b = a.replace(/[.]/g, ""); } else { b = a * 100; } return b } $(window).load(resizeWindow()); $(window).resize(function () { resizeWindow(); }); function resizeWindow() { if ($('.container').length > 0) { var scrWidth = $(window).width(); var conWidth = $('.container').css('width').replace("px", ""); if (scrWidth < 1920 && scrWidth < conWidth) { $('.container').css('width', scrWidth + 'px'); } } } /*function getCookie(name){ var pattern = RegExp(name + "[0-9]") matched = document.cookie.match(pattern) if(matched){ var cookie = matched[0].split('_') return cookie[1] } return false } */ // Cookies function createCookie(name, value, days) { if (days) {//alert(name); var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else var expires = ""; document.cookie = name + "=" + value + expires + "; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } function eraseCookie(name) { createCookie(name, "", -1); } function showLoader() { $(".loader").addClass('show'); $(".loader").removeClass('hide'); } function hideLoader() { $(".loader").addClass('hide'); $(".loader").removeClass('show'); } $(".closeAddDiv").click(function () { var tempPopupId1 = (this.id).replace("closeAddDiv_", ""); $("#" + tempPopupId1).hide(); $.cookie(tempPopupId1, 1, {expires: 1}); }); //REN12 $('body').delegate('.popovers', 'hover', function (e) { $('[data-toggle="popover"]').popover(); }); /* add the validation for name field and chage placeholder value */ $(document).ready(function () { $('.reset').hide(); $('[data-toggle="popover"]').popover(); if($(".c-cart-number.totalcart").length > 0){ if(parseInt($(".c-cart-number.totalcart")[0].innerHTML) > 0) { loadMiniCart(); } } window.setTimeout(function () { $(".alert").fadeTo(1000, 0).slideUp(1000, function () { $(this).remove(); }); }, 2500); $("[id^='frmPopup_']").each(function (e) { var popup_id = (this.id).replace("frmPopup_", ""); $("#frmPopup_" + popup_id).bootstrapValidator({ feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: { 'name': {validators: {notEmpty: {message: 'Please enter your Name'}, }}, 'email': {validators: {notEmpty: {message: 'Please enter your Email'}, }}, 'zipcode':{validators:{notEmpty:{message: 'Please enter your Zipcode'},stringLength: {max: 10, message: 'Please enter valid Zipcode'}},}, 'phone': { validators: { notEmpty: {message: 'Please enter your Phone'}, /* regexp: {regexp: /^(\+\d{1,3}[- ]?)?\d{8}$/, message: 'Phone is not in Proper Format'}*/ callback: { message: front_phone_number_valid_msg, callback: function(value, validator, $field) { if (value === '') { return true; } var phone_mask = $field.data('phone-mask'); var fieldValue = ""; for (var i = 0; i < value.length; i++) { fieldValue+=value[i].replace(/\d+/,'x'); } if (fieldValue != phone_mask) { return { valid: false, message: front_phone_number_valid_format_msg.replace(/%s/g, phone_mask) }; } return true; } } }, }, }, submitHandler: function (validator, form, submitButton) {}}); }); $("body").delegate(".closePopup", "click", function (e) { var tempPopupId = (this.id).replace("btnClosePopup_", ""); $("#marketing_popup_" + tempPopupId).hide(); $.cookie('marketing-popup-' + tempPopupId, 1, {expires: 1, path: "/"}); }); $("body").delegate(".closeNoThanks", "click", function (e) { var tempPopupId = (this.id).replace("btnNoThanks_", ""); $("#marketing_popup_" + tempPopupId).hide(); $.cookie('marketing-popup-' + tempPopupId, 1, {expires: 1, path: "/"}); }); /*$("#search-suggestions").mouseleave(function () { $("#search-suggestions").hide(); }); $("#q").keyup(function () { $("#search-suggestions").hide(); var search_allow_characters = 3; if ($("#search_charact_number").size() > 0) { search_allow_characters = $("#search_charact_number").val(); } if (($("#q").val()).length >= search_allow_characters) { $.ajax({ type: "POST", url: "/productSearch", data: 'q=' + $(this).val(), beforeSend: function () {}, success: function (data) { $("#search-suggestions").show(); $("#search-suggestions").html(data); $("#q").css("background", "#FFF"); } }); } });*/ $('.captcha-error').hide(); }); /* Ren13:rebuild-ashley-international-updates:8-Sep-20:start comment : fillup the form after display popup and clear cookie and redirect to dashboard */ $('body').on('success.form.bv', "[id^='frmPopup_']", function (event) { event.preventDefault(); event.stopImmediatePropagation(); var baseUrl = getBaseUrl(); popup_id = (this.id).replace("frmPopup_", ""); $.ajax({ url: baseUrl + '/submitPopupAndSendCoupon', type: 'post', data: $("#frmPopup_" + popup_id).serialize(), dataType: "json", beforeSend: function () { showLoader();//$('body').Wload({text: 'Sending query...'}); }, success: function (result) { if (result != '') { hideLoader(); if(result.popup_type == "MarketingPopup"){ $("#marketing_popup_" + popup_id).hide(); swal({ title:"Thank you!", text:"Your information was successfully submitted.", type:"success"},function(){ location.reload(); }); $.cookie('marketing-popup-' + popup_id, 1, {expires: 1, path: "/"}); }else{ $("h3#popup_" + popup_id).html(result.coupon_page_title); $("#divPopupContent_" + popup_id).hide(); htmlContent = ""; htmlContent += '
' + result.message + '
'; htmlContent += "
"; if(result.coupon_content != undefined && result.coupon_content != ''){ htmlContent += '
' + result.coupon_content + '
'; htmlContent += "
"; } if (result.coupon_image != "") { htmlContent += '
' + result.coupon_image + '
'; htmlContent += "
"; } htmlContent += '
' + result.coupon_code + "
"; htmlContent += "
"; htmlContent += '
' + result.coupon_discount + "
"; 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 = ''; 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 = '

Get Directions >

'; if (website_url != '') { website_url = '

View Website >

'; } //var lat_lng_link = ''.$name.'
'.$address.'
'.$city_name.', '.$state_name.' '.$zipcode.'
'.$contact_number.'
'; html += '

' + name + ' (' + distance + 'mi)

'; html += '

' + address + '
' + city_name + ', ' + state_name + ', ' + zipcode + '
' + contact + '
'+ email +'

'; html += '
' + storeTime + '
'; html += '
' + website_url + direction_link + '

'; //createOption(name, distance, i); createMarker(latlng, name, lat_lng_link); bounds.extend(latlng); } } else { html = 'No Records Found'; } $("#searched_result_retailers").show(); $("#searched_result_retailers").html(html); map.fitBounds(bounds); }); } function createMarker(latlng, name, address) { var html = "" + name + "
" + address; var marker = new google.maps.Marker({ map: map, position: latlng }); google.maps.event.addListener(marker, 'click', function () { infoWindow.setContent(html); infoWindow.open(map, marker); }); markers.push(marker); } function createOption(name, distance, num) { var option = document.createElement("option"); option.value = num; option.innerHTML = name; locationSelect.appendChild(option); } function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest; request.onreadystatechange = function () { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request.responseText, request.status); } }; request.open('GET', url, true); request.send(null); } function parseXml(str) { if (window.ActiveXObject) { var doc = new ActiveXObject('Microsoft.XMLDOM'); doc.loadXML(str); return doc; } else if (window.DOMParser) { return (new DOMParser).parseFromString(str, 'text/xml'); } } function clearMap(){ document.getElementById('map').innerHTML = ''; initMap(); } function doNothing() {} $("document").ready(function(){ initMap(); }); } /* Google Map */ $("#filter").delegate(".c-arrow, .c-content-toggler", "click", function (event) { $('ul#sidebar-menu-1 li').removeClass('c-open'); }); $("#filter").delegate(".c-arrow, .c-content-toggler", "click", function (event) { $('ul#mobile-advancefilter-1 li').removeClass('c-open'); }); if ($('#fmdstore').length > 0 && $('.c-layout-page').length > 1) { //$('#cms_page').parent('.c-layout-page').attr('style', 'margin: 0px !important'); } $(".login_form").click(function () { //$('a.dropdown-toggle').parent("li").removeClass('open'); $(this).parent("li").toggleClass('open'); }); /* Tax Calucalation PopUp Header: START */ $('#calculatetaxmodal').on('shown.bs.modal', function (e) { $('#taxcalculationfrm #locationCountry').focus(); if ($(".select2").length > 0) { $("#locationCountry").select2({placeholder: countryPlaceholder, allowClear: true, width: '100%', dropdownParent: $("#calculatetaxmodal"), }); $("#locationState").select2({placeholder: statePlaceholder, allowClear: true, width: '100%', dropdownParent: $("#calculatetaxmodal"), }); //$("#locationCity").select2({placeholder: cityPlaceholder, allowClear: true, width: '100%', dropdownParent: $("#calculatetaxmodal"), }); } $('#taxcalculationfrm').bootstrapValidator({excluded: ':disabled', feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: {'locationCountry': {validators: {notEmpty: {message: front_country_err_msg}, }}, 'locationState': {validators: {notEmpty: {message: front_state_err_msg}, }}, 'locationCity': {validators: {notEmpty: {message: front_city_err_msg}, }}, 'locationZipcode': {validators: {notEmpty: {message: front_zipcode_err_msg}, stringLength: {max: 15, message: front_valid_zipcode_msg}, }}, }, submitHandler: function (validator, form, submitButton) {}}); }); $('body').on('success.form.bv', '#taxcalculationfrm', function (event) { event.preventDefault(); event.stopImmediatePropagation(); var baseUrl = getBaseUrl(); var formData = $("#taxcalculationfrm").serialize(); var countryId = $("#locationCountry").val(); var stateId = $("#locationState").val(); var city = $("#locationCity").val(); var zipcode = $("#locationZipcode").val(); $.ajax({ type: "POST", dataType: "json", url: baseUrl + "/shippingcharge", cache: false, data: {countryId:countryId,stateId:stateId,city:city,zipcode:zipcode}, success: function (response) { if(response['is_error'] <= 0){ $(".locerror").html(response["shipping_data"]["ShippingHtml"]); }else{ $.ajax({ type: "POST", dataType: "json", url: baseUrl + "/location_details", cache: false, data: formData, success: function (response) { if (response > 0) { $('#calculatetaxmodal').modal('hide'); location.reload(true); } } }); } return false; } }); }); $('#locationCountry').on('select2:unselecting', function (e) { $("#locationState").val(null).trigger("change"); //$("#locationCity").val(null).trigger("change"); }); $('#locationState').on('select2:unselecting', function (e) { //$("#locationCity").val(null).trigger("change"); }); /* Tax Calucalation PopUp Header: END */ function loadMiniCart(callback) { $.ajax({ type: "GET", url: forUrl + '/minicartajax', cache: false, dataType: 'json', success: function (result) { $(".modshopcartbox").html(result.cartHtml); if (result.cartCount > 0) { $('.totalcart').removeClass('hide'); $('.totalcart').html(result.cartCount); } else { $('.totalcart').html(''); $('.totalcart').addClass('hide'); } if(callback){ callback(); } }, error: function (jqXHR, textStatus, errorThrown) { return false; }, }); } $("body").delegate(".addtowishlist", "click", function (e) { if ($("#landingpagepopup").size() > 0) { return; } var custid = $("#hdn_custid").val(); if (custid == "") { $('#login-form').modal('show'); return false; } var prdid = ""; prdid = $(this).attr("data-name"); var product_original_name = ''; product_original_name = $(this).attr('data-original-name'); var commaseparated_attrid = $("#commaseparated_attribute_id").val(); if (commaseparated_attrid == undefined) { commaseparated_attrid = ''; } var site_url1 = getBaseUrl(); if (prdid != "") { if ($(this).hasClass('save-wishlist')) { var prodIdStr = $(this).attr('id'); var prodId = prodIdStr.replace("wishlistadd", ""); $(this).find('img').attr("src",'/assets/theme/ashleystore/images/rwd2wishlist.png'); $("[data-wish-pid='"+prodId+"']").attr('style','color: #f68d2d !important;'); //console.log("[data-wish-pid='"+prodId+"']"); } else { $(this).attr('style','color: #f68d2d !important;'); } $.ajax({ url: site_url1 + '/product/addtowishlist', type: 'post', data: 'prdname=' + prdid + '&custid=' + custid + '&commaseparated_attrid=' + commaseparated_attrid, success: function (result) { if (result > 0) { if (!$(".wishlist_counter").hasClass('c-wish-number')) { $(".wishlist_counter").addClass('c-wish-number'); } $(".wishlist_counter").html(result); if (wbGoogleAnalyticId != '' && wbStandardTracking == 1 && wbEcommerceTracking == 1) { gtag('event', 'add_to_wishlist', {"event_label": product_original_name}); } swal(front_wishlist, front_wishlist_add, "success"); } else { swal(front_wishlist, front_wishlist_exist, "info"); } }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); } }); $('.marking_label').on('click', function () { if (wbGoogleAnalyticId != '' && wbStandardTracking == 1) { var marking_id = $(this).data('id'); var marking_name = $(this).data('name'); if (marking_id != '' && marking_name != '') { gtag('event', 'select_content', {"event_label": "promotions", "promotions": [{"id": marking_id, "name": marking_name}]}); } } }); if ($('#container_flipbook').length > 0) { var arr = []; $.each(array_data, function (key, value) { arr.push({"src": value['src'], "thumb": value['thumb'], "title": value['title'], "htmlContent": value['htmlContent'] }); }); var ecircularId = $("#ecircularId").val(); var ecircularPdf = $("#ecircularPdf").val(); $("#container_flipbook").flipBook({ pages: arr, btnAutoplay: { enabled: menuOptions.btnAutoplay, title: "Autoplay", icon: "fa-play", iconAlt: "fa-pause" }, btnZoomIn: { enabled: menuOptions.btnZoomIn, title: "Zoom in", icon: "fa-plus" }, btnZoomOut: { enabled: menuOptions.btnZoomOut, title: "Zoom out", icon: "fa-minus" }, btnToc: { enabled: menuOptions.btnToc, title: "Table of content", icon: "fa-list-ol" }, btnThumbs: { enabled: menuOptions.btnThumbs, title: "Pages", icon: "fa-th-large" }, btnShare: { enabled: menuOptions.btnShare, title: "Share", icon: "fa-link" }, btnDownloadPages: { enabled: menuOptions.btnDownloadPages, title: "Download pages", icon: "fa-download", url: forUrl + "/admin/contentcms/ecircular/downloadpdf/" + ecircularId, }, btnPrint: { enabled: menuOptions.btnPrint, title: "Print", icon: "fa-print" }, btnDownloadPdf: { enabled: menuOptions.btnDownloadPdf, title: "Download PDF", icon: "fa-file", url: forUrl + "/assets/uploads/ecircular/pdf/" + ecircularPdf, }, btnSound: { enabled: menuOptions.btnSound, title: "Sound", icon: "fa-volume-up", iconAlt: "fa-volume-off", }, btnExpand: { enabled: menuOptions.btnExpand, title: "Toggle fullscreen", icon: "fa-expand", iconAlt: "fa-compress", }, facebook: { enabled: true, url: forUrl + '/ecircular/show/id/' + ecircularId, }, google_plus: { enabled: true, url: forUrl + '/ecircular/show/id/' + ecircularId, }, twitter: { enabled: true, url: forUrl + '/ecircular/show/id/' + ecircularId, }, pinterest: { enabled: true, url: forUrl + '/ecircular/show/id/' + ecircularId, }, email: { enabled: false, }, }); var screen_height = $(window).height(); $("#container_flipbook").css({"height": "445px"}); $(".flipbook-main-wrapper").css({"margin-top": "40px"}); } if($("#ecircularId").size() > 0 && $("#ecircularId").val() != ''){ //Quickview: Start $("body").delegate("area", "click", function (e) { $(document).off('focusin.modal'); var href = $(this).attr('href'); var lastsegment = href.split('/'); var id = lastsegment[lastsegment.length - 1]; if($.isNumeric(id) == true || typeof id === 'string'){ e.preventDefault(); var ecircularId = $("#ecircularId").val(); quickViewDisplay(id, ecircularId); } }); } $("body").delegate("[id^='quickview_modal_']", "click", function (e) { if ($("#landingpagepopup").size() > 0) { return; } e.stopPropagation(); var productId = (this.id).replace("quickview_modal_", ""); var quickviewfor =(this.name); var ecircularId = $("#ecircularId").val(); quickViewDisplay(productId, ecircularId,quickviewfor); }); $("body").delegate("[id^='quickview_div']", "click", function (e) { if ($("#landingpagepopup").size() > 0) { return; } e.stopPropagation(); var product_url = $(this).data('url'); window.location.href = product_url; }); function quickViewDisplay(productId, ecircularId,quickviewfor='') { var url = forUrl + '/product/quickview/id/' + productId; // if (ecircularId != '' && ecircularId != undefined) { // var id = 0; // } else { // var id = productId; // } var id = productId; $(".quickview").on('click', function() { if(quickviewfor==''){ $("#quickview-form_" + id).modal('hide'); $("#quickview-form_" + id).css("display","none"); }else{ $("#" + quickviewfor).modal('hide'); $("#" + quickviewfor).css("display","none"); } $("#mobile_category_products_list" + id).css("display","none"); }); $("body").delegate(".ecircularClose", "click", function (e) { hideLoader(); }); $.ajax({ url: url, data: {product_id: productId,ecircularId:ecircularId}, beforeSend: function () { $(".loader").removeClass("hide"); $(".loader").addClass('show'); }, success: function (res) { //console.log(res);return false; if(quickviewfor==''){ $("#eCircular_quickview-form_" + id).modal({backdrop: 'static', keyboard: false}); $("#eCircular_quickview-form_" + id).modal('hide'); $("#eCircular_quickview-form_" + id).modal('toggle'); $("#eCircular_quickview-form_" + id).css("display","block"); }else{ $("#" + quickviewfor).modal({backdrop: 'static', keyboard: false}); $("#" + quickviewfor).modal('hide'); $("#" + quickviewfor).modal('toggle'); $("#" + quickviewfor).css("display","block"); } $("#mobile_category_products_list" + id).css("display","block"); $(".ps-current").remove(); $(".quickview_" + id).html(res); hideLoader(); zibbyaffirm(); $("img.lazy").lazyload({effect : "fadeIn"}); $("#quickview_body .ps-current ul li").remove(); if($('.pgwSlideshow').length > 0){ $('.pgwSlideshow').pgwSlideshow({ autoSlide: false, displayList: true, displayControls: true, touchControls: false }); $('.ps-current ul li').zoom(); if ($("[id^='reviewrate']").size() > 0) { //ratingbar(); } } }, complete: function () { $(".loader").removeClass("show"); $(".loader").addClass('hide'); }, }); } $("body").delegate(".quickview", "click", function (e) { $("[id^='quickview-form_']").modal('hide'); $("[id^='quickview_body']").html(''); }); //Quickview: End // Product Sharing: Start var shareCaptcha; var shareCorrectCaptcha = function (response) { $("[id^='mailForm'] [id^='sharecaptcharesponse']").val(response); $("[id^='productshareform']").bootstrapValidator('revalidateField', "sharecaptcharesponse"); }; function productShareDisplay(productId, captcha_site_key) { $("[id^='mailForm" + productId + "']").find('form').trigger('reset'); $("[id^='mailForm" + productId + "']").on('shown.bs.modal', function() { $(this).css("z-index", parseInt($('.modal-backdrop').css('z-index')) + 1); }); $("[id^='mailForm" + productId + "']").modal('show'); if ($("[id^='productshareform']").size() > 0) { $("[id^='productshareform']").bootstrapValidator({excluded: ':disabled', feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: {'yourname': {validators: {notEmpty: {message: 'Please Enter Your Name'}, }}, 'youremail': {validators: {notEmpty: {message: 'Please Enter Your Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'friendname': {validators: {notEmpty: {message: 'Please enter Friend\'s name'}, }}, 'friendemail': {validators: {notEmpty: {message: 'Please enter Friend\'s Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'subject': {validators: {notEmpty: {message: 'Please enter Subject'}, }}, 'message': {validators: {notEmpty: {message: 'Please enter Message'}, }}, }, submitHandler: function (validator, form, submitButton) {}}) $("[id^='productshareform']").data('bootstrapValidator').resetForm(); } if(captcha_site_key != '' && $('#sharecaptcha' + productId).length){ shareCaptcha = grecaptcha.render('sharecaptcha' + productId, { 'sitekey': captcha_site_key, }); } } $("body").delegate("[id^='share_']", "click", function (e) { var productId = (this.closest('form').id).replace("productshareform", ""); var baseUrl = getBaseUrl(); $("#productshareform" + productId).bootstrapValidator({excluded: ':disabled', feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: {'yourname': {validators: {notEmpty: {message: 'Please Enter Your Name'}, }}, 'youremail': {validators: {notEmpty: {message: 'Please Enter Your Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'friendname': {validators: {notEmpty: {message: 'Please enter Friend\'s name'}, }}, 'friendemail': {validators: {notEmpty: {message: 'Please enter Friend\'s Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'subject': {validators: {notEmpty: {message: 'Please enter Subject'}, }}, 'message': {validators: {notEmpty: {message: 'Please enter Message'}, }}, }, submitHandler: function (validator, form, submitButton) {}}) }); $('body').on('success.form.bv', "[id^='productshareform']", function (event) { event.preventDefault(); event.stopImmediatePropagation(); var productId = (this.id).replace("productshareform", ""); $("#share" + productId).attr('disabled', false); var baseUrl = getBaseUrl(); var formData = $("form#productshareform" + productId).serialize(); $.ajax({ type: "POST", url: baseUrl + "/product/productshare", cache: false, data: formData, beforeSend: function () { $(".loader").removeClass("hide"); $(".loader").addClass('show'); }, success: function (response) { if (response > 0) { if(shareCaptcha > 0){ grecaptcha.reset(shareCaptcha); } //$('body').Wload('hide', {time: 5}); $("[id^='mailForm']").modal('hide'); $("[id^='productshareform']").data('bootstrapValidator').resetForm(); $("[id^='productshareform']")[0].reset(); swal("Mail Sent!", "This product has been shared successfully!", "success"); } else { $("[id^='mailForm']").modal('hide'); swal({title: 'Error!', text: 'Please Complete the Captcha by clicking the Checkbox', type: 'error'}, function () { $("[id^='mailForm']").modal('show'); }); $("[id^='productshareform']").data('bootstrapValidator').resetForm(); } }, complete: function () { $(".loader").removeClass("show"); $(".loader").addClass('hide'); }, }); }); $("body").delegate(".close_mailform", "click", function (e) { $(".show_ss_email_modal").modal('hide'); }); //Product Sharing: End // eCircular Sharing: Start(03-05-2023) var ecircularshareCaptcha; var ecircularshareCorrectCaptcha = function (response) { $("[id^='show_ss_email'] [id^='sharecaptcharesponse']").val(response); $("[id^='ecircularshareform']").bootstrapValidator('revalidateField', "sharecaptcharesponse"); }; function eCircularShareDisplay(ecircularId, captcha_site_key) { $("[id^='ecircularmailForm" + ecircularId + "']").find('form').trigger('reset'); $("[id^='ecircularmailForm" + ecircularId + "']").on('shown.bs.modal', function() { $(this).css("z-index", parseInt($('.modal-backdrop').css('z-index')) + 1); }); $("[id^='ecircularmailForm" + ecircularId + "']").modal('show'); if ($("[id^='ecircularshareform']").size() > 0) { $("[id^='ecircularshareform']").bootstrapValidator({excluded: ':disabled', feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: {'yourname': {validators: {notEmpty: {message: 'Please Enter Your Name'}, }}, 'youremail': {validators: {notEmpty: {message: 'Please Enter Your Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'friendname': {validators: {notEmpty: {message: 'Please enter Friend\'s name'}, }}, 'friendemail': {validators: {notEmpty: {message: 'Please enter Friend\'s Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'subject': {validators: {notEmpty: {message: 'Please enter Subject'}, }}, 'message': {validators: {notEmpty: {message: 'Please enter Message'}, }}, }, submitHandler: function (validator, form, submitButton) {}}) $("[id^='ecircularshareform']").data('bootstrapValidator').resetForm(); } if(captcha_site_key != '' && $('#ecircularsharecaptcha' + ecircularId).length){ ecircularshareCaptcha = grecaptcha.render('ecircularsharecaptcha' + ecircularId, { 'sitekey': captcha_site_key, }); } } $("body").delegate("[id^='ecircularshare_']", "click", function (e) { var ecircularId = (this.closest('form').id).replace("ecircularshareform", ""); var baseUrl = getBaseUrl(); $("#ecircularshareform" + ecircularId).bootstrapValidator({excluded: ':disabled', feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: {'yourname': {validators: {notEmpty: {message: 'Please Enter Your Name'}, }}, 'youremail': {validators: {notEmpty: {message: 'Please Enter Your Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'friendname': {validators: {notEmpty: {message: 'Please enter Friend\'s name'}, }}, 'friendemail': {validators: {notEmpty: {message: 'Please enter Friend\'s Email'}, emailAddress: {message: 'Please enter valid Email-Id'}, }}, 'subject': {validators: {notEmpty: {message: 'Please enter Subject'}, }}, 'message': {validators: {notEmpty: {message: 'Please enter Message'}, }}, }, submitHandler: function (validator, form, submitButton) {}}) }); $('body').on('success.form.bv', "[id^='ecircularshareform']", function (event) { event.preventDefault(); event.stopImmediatePropagation(); var ecircularId = (this.id).replace("ecircularshareform", ""); $("#ecircularshare_" + ecircularId).attr('disabled', false); var baseUrl = getBaseUrl(); var formData = $("form#ecircularshareform" + ecircularId).serialize(); $.ajax({ type: "POST", url: baseUrl + "/ecircular/eCircularshare", cache: false, data: formData, beforeSend: function () { $(".loader").removeClass("hide"); $(".loader").addClass('show'); }, success: function (response) { if (response > 0) { if(ecircularshareCaptcha > 0){ grecaptcha.reset(ecircularshareCaptcha); } //$('body').Wload('hide', {time: 5}); $("[id^='ecircularmailForm']").modal('hide'); $("[id^='ecircularshareform']").data('bootstrapValidator').resetForm(); $("[id^='ecircularshareform']")[0].reset(); swal("Mail Sent!", "This eCircular has been shared successfully!", "success"); } else { $("[id^='ecircularmailForm']").modal('hide'); swal({title: 'Error!', text: 'Please Complete the Captcha by clicking the Checkbox', type: 'error'}, function () { $("[id^='ecircularmailForm']").modal('show'); }); $("[id^='ecircularshareform']").data('bootstrapValidator').resetForm(); } }, complete: function () { $(".loader").removeClass("show"); $(".loader").addClass('hide'); $(".ecircular_show_ss_email").modal('hide'); }, }); }); $("body").delegate(".ecircularclose_mailform", "click", function (e) { $(".ecircular_show_ss_email").modal('hide'); }); //eCircular Sharing: End //Product Inquiry: Start var inquiryCaptcha; function productInquiryDisplay(productId, captcha_site_key, type) { if ($("#landingpagepopup").size() > 0) { return; } //alert('again productId ' + productId) var productId = productId; if($("#inqModal" + productId).hasClass('in')) { //alert('again111 productId ' + productId) $("[id^='inqModal" + productId + "']").modal('hide'); $('body').removeClass('modal-open'); $('.modal-backdrop').remove(); return; } var captcha_site_key = captcha_site_key; var baseUrl = getBaseUrl(); $("[id^='inqModal" + productId + "']").html(''); $("[id^='inqDetailModal" + productId + "']").html(''); //alert('productId ' + productId) showLoader(); $.ajax({ type: "POST", url: baseUrl + '/../getProductInquiry', cache: false, data: 'productId=' + productId, beforeSend: function () { $("#inqModal" + productId).modal('hide'); $("#inqDetailModal" + productId).modal('hide'); }, success: function (response) { //console.log(response); if (type == 'detail') { $("[id^='inqDetailModal" + productId + "']").modal('show'); $("[id^='inqDetailModal" + productId + "']").html(response); //$("[id^='inqModal" + productId + "']").modal('show'); //$("[id^='inqModal" + productId + "']").html(response); $('#offerform' + productId + ' #btnofferform').attr('disabled', false); } else { $("[id^='inqModal" + productId + "']").modal('show'); $("[id^='inqModal" + productId + "']").html(response); $('#offerform' + productId + ' #btnofferform').attr('disabled', false); } $('#offerform' + productId + ' #btnofferform').addClass('activeForm'); if(captcha_site_key != '') { var inquiryObj = document.getElementById('inquiryCaptcha' + productId); if(inquiryObj != null) { inquiryCaptcha = grecaptcha.render('captcha' + productId, { sitekey: captcha_site_key, }); getCheckoutState($("#countryId" + productId).val(), '', ''); if (screen.width < 768) { var width = $("[id^='offerform" + productId + "']").width(); var scale = 0.80;//width / 302; $('.g-recaptcha').css('transform', 'scale(' + scale + ')'); $('.g-recaptcha').css('-webkit-transform', 'scale(' + scale + ')'); $('.g-recaptcha').css('transform-origin', '0 0'); $('.g-recaptcha').css('-webkit-transform-origin', '0 0'); } } } }, complete: function () { hideLoader(); }, }); } var correctCaptcha = function (response) { $("[id^='inqModal'] [id^='captcharesponse']").val(response); $("[id^='inqDetailModal'] [id^='captcharesponse']").val(response); $("[id^='offerform']").bootstrapValidator('revalidateField', "captcharesponse"); }; $(document.body).on('click', '#btnofferform.activeForm', function () { var productId = $(this).attr('productid'); $(".manufacturerofferform").bootstrapValidator({feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: {'name': {excluded: false, validators: {notEmpty: {message: 'Please Enter Your Name'}, }}, 'phone': {validators: {notEmpty: {message: 'Please enter Phone Number'}, stringLength: {min: 8, message: 'Phone Number min 8 number long'}, regexp: {regexp: /^([0|\(\+[0-9]{1,5}\))?([0-9][0-9]{8})$/, message: 'Please enter valid Phone Number'}, }}, 'dealer_id': {validators: {notEmpty: {message: 'Please Select Store'}, }}, 'country_id': {validators: {notEmpty: {message: 'Please Select Country'}, }}, 'state': {validators: {notEmpty: {message: 'Please Select State'}, }}, 'city': {validators: {notEmpty: {message: 'Please Select City'}, }}, 'zip': {validators: {notEmpty: {message: 'Please enter Zip'}, }}, 'question': {validators: {notEmpty: {message: 'Please enter Question'}, }}, 'email': {validators: {notEmpty: {message: 'Please enter Email Address'}, regexp: {regexp: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/, message: 'Please enter valid Email-Id'}, }}, }, submitHandler: function (validator, form, submitButton) {}}); $('body').on('success.form.bv', ".manufacturerofferform", function (e) { e.preventDefault(); e.stopImmediatePropagation(); var form = this; var formData = $("#offerform" + productId).serializeArray(); var baseUrl = getBaseUrl(); // $("[id^='captcharesponse" + productId + "']") //var googleResponse = jQuery('#captcharesponse').val(); var googleResponse = jQuery("#captcharesponse").val(); if (googleResponse == "") { $('.inquiry_modal ').css('z-index', 999); swal({title: "Error!", text: "Please Complete the Captcha by clicking the Checkbox", type: "error"}, function () { $('.inquiry_modal ').css('z-index', 10060); $('#offerform' + productId + ' #btnofferform').attr('disabled', false); }); } else { $.ajax({ url: baseUrl + '/../manufacturersendinquiry', type: 'post', data: formData, beforeSend: function () { $("#inqModal" + productId).modal('hide'); $("#inqDetailModal" + productId).modal('hide'); $(".loader").removeClass("hide"); $(".loader").addClass('show'); }, success: function (response) { if (response == 1) { $("#inqModal" + productId).modal('hide'); $("#inqDetailModal" + productId).modal('hide'); $("#ecircular_quickview-form").modal('hide'); $("#inqEircularModal").modal('hide'); swal("Success!", "Inquiry Sent successfully", "success"); $('#offerform' + productId + ' #btnofferform').attr('disabled', false); return true; } }, complete: function (xhr) { $(".loader").removeClass("show"); $(".loader").addClass('hide'); }, }) } }); $("[id^='offerform" + productId + "']").bootstrapValidator({ feedbackIcons: {valid: 'fa', invalid: 'err', validating: 'fa'}, fields: { 'name': { excluded: false, validators: { notEmpty: { message: 'Please Enter Your Name' }, } }, 'phone': { validators: { notEmpty: { message: 'Please enter Phone Number' }, stringLength: { min: 10, message: 'Phone Number min 10 number long' }, regexp: { regexp: /^[^-\s][0-9()+-\s]+(?:,\d+)*$/i, message: 'Please enter valid Phone Number' }, } }, 'dealer_id': { validators: { notEmpty: { message: 'Please Select Store' }, } }, 'countryId': { validators: { notEmpty: { message: 'Please Select Country' }, } }, 'state': { validators: { notEmpty: { message: 'Please Select State' }, } }, 'city': { validators: { notEmpty: { message: 'Please Select City' }, } }, 'zip': { validators: { notEmpty: { message: 'Please enter Zip' }, } }, 'question': { validators: { notEmpty: { message: 'Please enter Question' }, } }, 'email': { validators: { notEmpty: { message: 'Please enter Email Address' }, regexp: { regexp: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i, message: 'Please enter valid Email-Id' } } }, }, submitHandler: function (validator, form, submitButton) {}}); $('body').on('success.form.bv', "[id^='offerform" + productId + "']", function (e) { e.preventDefault(); e.stopImmediatePropagation(); var form = this; var formData = $("[id^='offerform" + productId + "']").serializeArray(); // console.log(formData); var baseUrl = getBaseUrl(); /* var googleResponse = jQuery('#g-recaptcha-response').val(); alert(googleResponse);return false; //var googleResponse = jQuery('#recaptcha-token').val(); if (!googleResponse) { swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error"); return false; }*/ $.ajax({ url: baseUrl + '/../sendinquiry', type: 'post', data: formData, beforeSend: function () { $(".loader").removeClass("hide"); $(".loader").addClass('show'); }, success: function (response) { if (response == 1) { $("[id^='inqModal" + productId + "']").modal('hide'); $("[id^='inqDetailModal" + productId + "']").modal('hide'); $("#ecircular_quickview-form").modal('hide'); $("#inqEircularModal").modal('hide'); $('#offerform' + productId + ' #btnofferform').attr('disabled', false); swal("Success!", "Inquiry Sent successfully", "success"); return true; } else if (response == 0) { $('#offerform' + productId + ' #btnofferform').attr('disabled', false); swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error"); return false; } }, complete: function () { $(".loader").removeClass("show"); $(".loader").addClass('hide'); }, }) }); }); $("body").delegate(".close_inquiry", "click", function (e) { e.preventDefault(); hideLoader();//To hide the loader on close icon click var cproductId = $(this).data('pid'); //productId = (this.id).replace("close_", ""); $("[id^='inqModal" + cproductId + "']").modal('hide'); $("[id^='inqDetailModal" + cproductId + "']").modal('hide'); $("#inqEircularModal").modal('hide'); $('#offerform' + cproductId + ' #btnofferform').removeClass('activeForm'); e.stopPropagation(); }); //Product Inquiry: End $("body").delegate(".form_builder_cls", "submit", function (e) { var baseUrl = getBaseUrl(); var post_data = $(this).serializeArray(); $.ajax({ type: "POST", url: baseUrl + '/fbpostdata', data: post_data, success: function (result) { $(e.target).closest('.form-horizontal').prepend("
Form submitted successfully!
"); setTimeout(function () { $('.flash_msg').remove(); $('form.form_builder_cls')[0].reset(); }, 2000); return true; }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); return false; }); function zibbyaffirm() { if ($("#affirm_public_api_key").length > 0 && $("#hdn_sale_price").length > 0) { var hdn_sale_price = $("#hdn_sale_price").val(); hdn_sale_price = hdn_sale_price.replace(".", ""); var public_api_key = $("#affirm_public_api_key").val(); var affirm_script = $("#affirm_script").val(); var _affirm_config = {public_api_key: public_api_key, script: affirm_script}; (function (l, g, m, e, a, f, b) { var d, c = l[m] || {}, h = document.createElement(f), n = document.getElementsByTagName(f)[0], k = function (a, b, c) { return function () { a[b]._.push([c, arguments]) } }; c[e] = k(c, e, "set"); d = c[e]; c[a] = {}; c[a]._ = []; d._ = []; c[a][b] = k(c, a, b); a = 0; for (b = "set add save post open empty reset on off trigger ready setProduct".split(" "); a < b.length; a++) d[b[a]] = k(c, e, b[a]); a = 0; for (b = ["get", "token", "url", "items"]; a < b.length; a++) d[b[a]] = function () {}; h.async = !0; h.src = g[f]; n.parentNode.insertBefore(h, n); delete g[f]; d(g); l[m] = c })(window, _affirm_config, "affirm", "checkout", "ui", "script", "ready"); affirm.ui.ready(function () { GetAffirmAsLowAs(hdn_sale_price) }); function GetAffirmAsLowAs(amount) { if ((amount == null)) { return; } var options = {apr: "0.10", months: 12, amount: amount}; try { typeof affirm.ui.payments.get_estimate; } catch (e) { return; } function handleEstimateResponse(payment_estimate) { var hdn_currency = $("#hdn_currency").val(); var dollars = ((payment_estimate.payment + 99) / 100) | 0; var a = document.getElementById("afirm-learn-more"); var iText = ("innerText" in a) ? "innerText" : "textContent"; a[iText] = "Learn More"; var amountInfo = document.getElementById("amounut-info"); amountInfo.innerHTML = "
" + hdn_currency + dollars + " / month with
"; amountInfo.style.visibility = "visible"; var checkouttext = document.getElementById("checkout-text"); checkouttext.innerHTML = "at checkout"; checkouttext.style.visibility = "visible"; a.onclick = payment_estimate.open_modal; a.style.visibility = "visible"; } ; affirm.ui.payments.get_estimate(options, handleEstimateResponse); } } if ($("#zibby_pubilc_token").length > 0) { var zibby_pubilc_token = $("#zibby_pubilc_token").val(); var zibby_mode_url = $("#zibby_mode_url").val(); var _zibby_config = {api_key: zibby_pubilc_token, environment: zibby_mode_url}; !function (e, t) { e.zibby = e.zibby || {}; var n, i, r; i = !1, n = document.createElement("script"), n.type = "text/javascript", n.async = 1, n.src = t.environment + "/plugin/js/zibby.js", n.onload = n.onreadystatechange = function () { i || this.readyState && "complete" != this.readyState || (i = 0, e.zibby.setConfig(t.api_key)) }, r = document.getElementsByTagName("script")[0], r.parentNode.insertBefore(n, r); var s = document.createElement("link"); s.setAttribute("rel", "stylesheet"), s.setAttribute("type", "text/css"), s.setAttribute("href", t.environment + "/plugin/css/zibby.css"); var a = document.querySelector("head"); a.insertBefore(s, a.firstChild) }(window, _zibby_config); } } //HD JS START if ($("#request_consultation_model").size() > 0) { $('#consultation_form').bootstrapValidator({ feedbackIcons: { valid: 'fa', invalid: 'err', validating: 'fa' }, fields: { 'consult_firstname': { excluded: false, validators: { notEmpty: { message: 'Please enter First Name' }, } }, 'consult_lastname': { validators: { notEmpty: { message: 'Please enter Last Name' }, } }, 'consult_email': { validators: { notEmpty: { message: 'Please enter Email Address' }, emailAddress: { message: 'Please enter valid Email Address' }, } }, 'consult_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'}, } }, 'consult_address': { validators: { notEmpty: { message: 'Please enter Address' }, } }, 'consult_country': { validators: { notEmpty: { message: 'Please enter Country' }, } }, 'consult_state': { validators: { notEmpty: { message: 'Please enter State' }, } }, 'consult_city': { validators: { notEmpty: { message: 'Please enter City' }, } }, 'consult_zip': { validators: { notEmpty: { message: 'Please enter Zipcode' }, } }, 'consult_message': { validators: { notEmpty: { message: 'Please enter Message' }, } }, }, submitHandler: function (validator, form, submitButton) {} }); $('body').on('success.form.bv', '#consultation_form', function (e) { e.preventDefault(); var form = this; var formData = $("#consultation_form").serializeArray(); var baseUrl = getBaseUrl(); if($('#header_rc_captcha .g-recaptcha').attr('data-sitekey') != ''){ var googleResponse = $('#header_rc_captcha .g-recaptcha-response').val(); if (googleResponse == '' ) { $('#consultation_form .captcha-error').show(); return false; } } $.ajax({ url: '/sendconsultation', type: 'post', data: formData, dataType: 'json', beforeSend: function () { }, success: function (response) { if (response.status == 'success') { $("#request_consultation_model").modal('hide'); swal("Success!", response.message, "success"); window.location.reload(true); } else if (response.status == 'warning') { $("#request_consultation_model").modal('show'); swal("Warning!", response.message, "warning"); //window.location.reload(true); } else { swal("Error!", response.message, "error"); } }, }) }); } if ($("#footer-request-a-consultation").size() > 0) { $('#footer-request-a-consultation').bootstrapValidator({ feedbackIcons: { valid: 'fa', invalid: 'err', validating: 'fa' }, fields: { 'consult_firstname': { excluded: false, validators: { notEmpty: { message: 'Please enter First Name' }, } }, 'consult_lastname': { validators: { notEmpty: { message: 'Please enter Last Name' }, } }, 'consult_email': { validators: { notEmpty: { message: 'Please enter Email Address' }, emailAddress: { message: 'Please enter valid Email Address' }, } } }, submitHandler: function (validator, form, submitButton) {} }); $('body').on('success.form.bv', '#footer-request-a-consultation', function (e) { e.preventDefault(); var form = this; var formData = $("#footer-request-a-consultation").serializeArray(); var baseUrl = getBaseUrl(); if($('#header_fc_captcha .g-recaptcha').attr('data-sitekey') != ''){ var googleResponse = jQuery('#header_fc_captcha .g-recaptcha-response').val(); if (googleResponse == '') { $('#footer-request-a-consultation .captcha-error').show(); return false; } } $.ajax({ url: '/sendconsultation', type: 'post', data: formData, dataType: 'json', beforeSend: function () { }, success: function (response) { if (response.status == 'success') { $("#request_consultation_model").modal('hide'); swal("Success!", response.message, "success"); window.location.reload(true); } else if (response.status == 'warning') { $("#request_consultation_model").modal('hide'); swal("Warning!", response.message, "warning"); // window.location.reload(true); } else { swal("Error!", response.message, "error"); } }, }) }); } if ($("#footer-request-a-consultation-custom").size() > 0) { $('#footer-request-a-consultation-custom').bootstrapValidator({ feedbackIcons: { valid: 'fa', invalid: 'err', validating: 'fa' }, fields: { 'consult_fullname': { excluded: false, validators: { notEmpty: { message: 'Please enter Full Name' }, } }, 'consult_phone': { validators: { notEmpty: { message: 'Please enter Phone Number' }, } }, 'consult_email': { validators: { notEmpty: { message: 'Please enter Email Address' }, emailAddress: { message: 'Please enter valid Email Address' }, } } }, submitHandler: function (validator, form, submitButton) {} }); $('body').on('success.form.bv', '#footer-request-a-consultation-custom', function (e) { e.preventDefault(); var form = this; var formData = $("#footer-request-a-consultation-custom").serializeArray(); var baseUrl = getBaseUrl(); $.ajax({ url: '/sendconsultationcustom', type: 'post', data: formData, dataType: 'json', beforeSend: function () { }, success: function (response) { if (response.status == 'success') { $("#request_consultation_model").modal('hide'); swal("Success!", response.message, "success"); window.location.reload(true); } else if (response.status == 'warning') { $("#request_consultation_model").modal('hide'); swal("Warning!", response.message, "warning"); //window.location.reload(true); } else { swal("Error!", response.message, "error"); } }, }) }); } if ($('#consult_country').length > 0) { $('#consult_country').on('change', function () { var country = $('#consult_country').val(); $.ajax({ type: "POST", cache: true, url: '/getstate', data: 'ctrid=' + country, success: function (result) { $('#consult_state').html(result); }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); }); } if ($('#consult_state').length > 0) { $('#consult_state').on('change', function () { var state = $('#consult_state').val(); $.ajax({ type: "POST", cache: true, url: '/getcity', data: 'stateid=' + state, success: function (result) { $('#consult_city').html(result); }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); }); } /*if ($("div#portfolioFilter div select").size() > 0) { $(window).load(function () { var $container = $('#portfolioContainer'); $container.isotope({ filter: '*', animationOptions: { duration: 750, easing: 'linear', queue: true } }); $('div#portfolioFilter div select ').click(function () { var selector = $(this).attr('data-filter'); $container.isotope({ filter: selector, animationOptions: { duration: 750, easing: 'linear', queue: true } }); return true; }); }); }*/ //REN12 //REN12 start $('#category_images').on('change',function () { $('.reset').show(); var category = $('#category_images').val(); if(category == '' ) { location.reload(); } $.ajax({ type: "POST", cache: true, url: '/imagegallery', data: 'ctrid=' + category, 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'); }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); //product dropdown $.ajax({ type: "POST", cache: true, url: '/getcategory', data: 'ctrid=' + category, success: function (result) { if(result != 0){ $('#product_image').html(result); }else{ $('#product_image').html(); } }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); }); $('#product_image').on('change',function () { $('.reset').show(); var product = $('#product_image').val(); var category = $('#category_images').val(); var media = $('#media').val(); if(product == ''){ location.reload(); } if(category != ''){ var category = $('#category_images').val();} $.ajax({ type: "POST", cache: true, url: '/imagegallery', data: {product_id: product,ctrid:category},//'ctrid=' + category + 'product_id=' + product, 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'); }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); }); // shapes js $('#shapes').on('change',function () { var shapes_id = $('#shapes').val(); var product_id = $('#product_image').val(); var category = $('#category_images').val(); var media = $('#media').val(); if(shapes_id == '') { location.reload();} $('.reset').show(); if(product_id != ''){ var product_id = $('#product_image').val();} if(category != ''){ var category = $('#category_images').val();} $.ajax({ type: "POST", cache: true, url: '/imagegallery', data: {shapes_id:shapes_id,product_id:product_id,ctrid:category}, 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'); }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); }); $('.reset').on('click' , function () { $('#category_images').trigger('change'); $('#product_image').trigger('change'); $('#shapes').trigger('change'); $('#media').trigger('change'); location.reload(); }); //media js $('#media').on('change',function () { var media = $('#media').val(); var shapes_id = $('#shapes').val(); var product = $('#product_image').val(); var category = $('#category_images').val(); $('.reset').show(); if(media == '') {location.reload(); } if(product_id != ''){ var product_id = $('#product_image').val();} if(category != ''){ var category = $('#category_images').val();} if(shapes_id != ''){ var shapes_id = $('#shapes').val();} $.ajax({ type: "POST", cache: true, url: '/vedioimages', data: {media: media,product_id: product,ctrid: category,shapes_id: shapes_id},//'ctrid=' + category + 'product_id=' + product, 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'); }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); }); if ($(".fancybox").size() > 0) { $(".fancybox").fancybox({ beforeShow: function () { if (this.title) { // Add tweet button this.title += ''; //pintrest button this.title += ''; // Add FaceBook like button this.title += ''; } }, buttons : [ 'slideShow', 'fb', 'tw', 'zoom', 'fullScreen', 'close' ], openEffect: 'elastic', closeEffect: 'elastic', helpers: { title: { type: 'inside' }, //<-- add a comma to separate the following option buttons: {} //<-- add this for buttons }, }); } //REN12 end if ($("#gmapbg").length > 0) { var PageContact = function () { var _init = function () { var address_data = $("#hdn_store_address").val(); var mapbg = new GMaps({ div: '#gmapbg', lat: 0, lng: 0, zoom: 10, scrollwheel: true, }); GMaps.geocode({ address: address_data, callback: function(results, status) { if (status == 'OK') { var latlng = results[0].geometry.location; mapbg.fitBounds(results[0].geometry.viewport); mapbg.addMarker({ lat: latlng.lat(), lng: latlng.lng(), //title: 'Your Location', infoWindow: { content: address_data } }); } } }); } return { //main function to initiate the module init: function () { _init(); } }; }(); PageContact.init(); $(window).resize(function () { PageContact.init(); }); } function recaptcha_callback_consultation_frm() { if($('.g-recaptcha').attr('data-sitekey') != ''){ var googleResponse = jQuery('#header_rc_captcha .g-recaptcha-response').attr('id'); } if (googleResponse == 'g-recaptcha-response-1') { if(googleResponse == ''){ $('#consultation_form .captcha-error').show(); return false; }else { $('#consultation_form .captcha-error').hide(); $("#btnconsultation_form").attr('disabled', false); return true; } } else if (googleResponse == 'g-recaptcha-response-2') { if(googleResponse == ''){ $('#consultation_form .captcha-error').show(); return false; }else { $('#consultation_form .captcha-error').hide(); $("#btnconsultation_form").attr('disabled', false); return true; } } else if (googleResponse == 'g-recaptcha-response') { if(googleResponse == ''){ $('#consultation_form .captcha-error').show(); return false; }else { $('#consultation_form .captcha-error').hide(); $("#btnconsultation_form").attr('disabled', false); return true; } }else { $('#consultation_form .captcha-error').hide(); $("#btnconsultation_form").attr('disabled', false); return true; } } function recaptcha_callback() { //return true; if($('.g-recaptcha').attr('data-sitekey') != ''){ var googleResponse = jQuery('#header_fc_captcha .g-recaptcha-response').val(); } if (googleResponse == '') { $('#footer-request-a-consultation .captcha-error').show(); return false; } else { $("#footer-request-a-consultation button").attr('disabled', false); $('#footer-request-a-consultation .captcha-error').hide(); return true; } } /*if ($("#contact_store_id").length > 0) { $("#contact_store_id").select2({minimumInputLength: 3, placeholder: "Select a Store Location", allowClear: true, width: '100%', }); }*/ /*if ($("#form_source").length > 0) { $("#form_source").select2({placeholder: "Please select the most appropriate topic concerning your questions", allowClear: true, width: '100%', }); }*/ //REN12 if($('#searchfrm1').length > 0){ $('#search_submit').on('click',function () { if($('#q1').length > 0 ) { var search_val = $('#q1').val(); if (search_val == '') { site_url = site_url.replace(/search/g, ".."); site_url1 = strstr(site_url, '..', true); if(site_url1){ window.location.replace(site_url1); } return false; }else{ return true; } } }) } if ($('#searchfrm').length > 0) { $("#searchfrm").submit(function (event) { var search_val = search_val1 = search_val2 = search_val3 = ''; if ($('#q').length > 0){ search_val1 = $('#q').val(); } if($('#q1').length > 0){ search_val2 = $('#q1').val(); } if($('#q2').length > 0){ search_val3 = $('#q2').val(); } search_val = search_val1 + '' + search_val2 + '' + search_val3; if (search_val.trim() == '') { return false; } }); } if ($('#searchfrmmobile').length > 0) { $("#searchfrmmobile").submit(function (event) { if ($('#q1').length > 0 || $('#q').length > 0) { var search_val = $('#q1').val(); var search_val1 = $('#q').val(); if (search_val == '' && search_val1 == '') { return false; } } }); } //$('#storefrmbuilder').bootstrapValidator(); if($("#storefrmbuilder").size() > 0){ $('#storefrmbuilder').bootstrapValidator().on('success.form.bv', function(e) { e.preventDefault(); e.stopImmediatePropagation(); // ajax call if ( chkvalidation() ){ callajax(); } }); } function callajax() { theurl = $('#storefrmbuilder').attr('action'); // var formfields = $('#storefrmbuilder').serialize(); var formfields = new FormData($("#storefrmbuilder")[0]); if(jQuery('#storefrmbuilder')[0].files != undefined){ jQuery.each(jQuery('#storefrmbuilder')[0].files, function(i, file) { formfields.append('file-'+i, file); }); } $.ajax({ type: "POST", cache: true, url: theurl, data: formfields, processData: false, contentType: false, //dataType: "JSON", beforeSend: function () { showLoader();//$('body').Wload({text: 'Processing...'}); }, success: function (result) { //console.log(result); //return false; $('#captcha-err').hide(); if (result == '0'){ hideLoader(); swal("Error!", "Please Complete the Captcha by clicking the Checkbox", "error"); $("#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{ hideLoader(); location.href = result; } }, error: function (jqXHR, textStatus, errorThrown) { return false; } }); } /*if ($(".select2").length > 0) { $(".select2").select2({allowClear: true, width: '100%'}); }*/ $("body").delegate(".title-mob-accordion", "click", function (e) { $('.title-mob-accordion').removeClass('tab-downup-arrow'); $(this).addClass('tab-downup-arrow'); }); $('#checkout_login').on('click', function (e) { e.preventDefault(); var email = $('#emailid').val(); var password = $('#password').val(); var action = $('#url').val(); var csrf_token = $('#csrftoken').val(); var recaptchatoken = $('#g-recaptcha-response').val(); if(email === ""){ $('#required_email').show(); }else{ $('#required_email').hide(); $.ajax({ type: 'POST', url: getBaseUrl() + "/home/checkregister", data : {emailid:email}, success: function (result) { if(result){ }else{ $('#required_email').html('Your Email-Id is not register with us'); } }, }); var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'post'; f.action = action; var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'cust_emailid'); m.setAttribute('value', email); f.appendChild(m); var m1 = document.createElement('input'); m1.setAttribute('type', 'hidden'); m1.setAttribute('name', '_csrf_token'); m1.setAttribute('value', csrf_token); f.appendChild(m1); var m2 = document.createElement('input'); m2.setAttribute('type', 'hidden'); m2.setAttribute('name', 'g-recaptcha-response'); m2.setAttribute('value', recaptchatoken); f.appendChild(m2); var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'cust_password'); m.setAttribute('value', password); f.appendChild(m); f.submit(); } if(password == ""){ $('#required_password').show(); }else{ $('#required_password').hide(); } /*var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'post'; f.action = action; var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'email'); m.setAttribute('value', email); f.appendChild(m); var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', 'password'); m.setAttribute('value', password); f.appendChild(m); f.submit();*/ }) function sameasabove(valchk) { var flds = ["payer_address", "payer_city", "payer_state", "payer_zip", "payer_cell_phone", "payer_secondary_phone", "payer_email"]; if ( valchk ) { $('#payer_address').val($('#store_address').val()); $('#payer_city').val($('#city_text').val()); $('#payer_state').val($('#state_text').val()); $('#payer_zip').val($('#zipcode').val()); $('#payer_cell_phone').val($('#cell_phone').val()); $('#payer_secondary_phone').val($('#secondary_phone').val()); $('#payer_email').val($('#personal_email').val()); } else { for(i=0; i'); var att1 = document.createAttribute("type"); att1.value = "text/javascript"; var scjs = document.createElement('script'); scjs.setAttributeNode(att1); scjs.src = 'https://cdn.rencdn.com/assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js'; att2 = document.createAttribute("async"); scjs.setAttributeNode(att2); document.head.appendChild(scjs); $('head').append(''); jscssadded = 1; } //html = '
'; //$( "body" ).append(html); $('#allow-admin-edit-common').on('click', function() { if ( toolbaropen == 0 ){ formfields = 'config=Common'; theurl = '/admin/system/appearance/loadconfig'; $.ajax({ type: "POST", url: theurl, data: formfields, beforeSend: function( xhr ) { } }).done(function(data) { $('#allow-admin-edit-common-content').html(data); $('.colorSelector').colorpicker().on('changeColor', function(ev) { id = $(this).attr('id'); if ( $(this).attr('data-color-format') == 'rgba' ) clr = 'rgba('+ev.color.toRGB().r+','+ev.color.toRGB().g+','+ev.color.toRGB().b+','+ev.color.toRGB().a+')'; else clr = ev.color.toHex(); $('#'+id).val(clr); $('#'+id+'-bgcolor').css({"background-color": clr}); }); $('[data-switch=true]').bootstrapSwitch(); $("#allow-admin-edit-common").animate({right: "300px"}); $("#allow-admin-edit-common-buttons").animate({right: "0px"}); $("#allow-admin-edit-common-content").animate({right: "0px"}); $('#allow-admin-edit-close').on('click', function() { $("#allow-admin-edit-common").animate({right: "0px"}); $("#allow-admin-edit-common-buttons").animate({right: "-300px"}); $("#allow-admin-edit-common-content").animate({right: "-300px"}); toolbaropen = 0; }); $('#allow-admin-edit-preview').on('click', function() { general_option = $("[name^='general_option']").serialize(); formfields = 'config=Common&&task=preview&'+general_option; theurl = '/admin/system/appearance/saveconfig'; $.ajax({ type: "POST", url: theurl, data: formfields, beforeSend: function( xhr ) { } }).done(function(data) { location.reload(); }); }); $('#allow-admin-edit-apply').on('click', function() { general_option = $("[name^='general_option']").serialize(); formfields = 'config=Common&&task=apply&'+general_option; theurl = '/admin/system/appearance/saveconfig'; $.ajax({ type: "POST", url: theurl, data: formfields, beforeSend: function( xhr ) { } }).done(function(data) { location.reload(); }); }); $('#allow-admin-edit-revert').on('click', function() { general_option = $("[name^='general_option']").serialize(); formfields = 'config=Common&task=revert&'+general_option; theurl = '/admin/system/appearance/saveconfig'; $.ajax({ type: "POST", url: theurl, data: formfields, beforeSend: function( xhr ) { } }).done(function(data) { location.reload(); }); }); }); toolbaropen = 1; }else{ $("#allow-admin-edit-common").animate({right: "0px"}); $("#allow-admin-edit-common-buttons").animate({right: "-300px"}); $("#allow-admin-edit-common-content").animate({right: "-300px"}); toolbaropen = 0; } }); } //$('.panel-title').css({'top': '0px', 'position': 'relative', 'width': '288px'}); $('#allow-admin-edit-common-content').scroll(function() { //console.log($('#heading02').offset().top); }); }); //REN00 if($('.owl-carousel').length > 0){ var optionArr = [] optionArr["fade"] = {"inEffect":"fadeIn", "outEffect":"fadeOut"}; optionArr["slide"] = {"inEffect":"slideInLeft", "outEffect":"slideOutRight"}; optionArr["zoom"] = {"inEffect":"zoomIn", "outEffect":"zoomOut"}; optionArr["roll"] = {"inEffect":"rollIn", "outEffect":"rollOut"}; var animateInEffect = "fadeIn"; var animateOutEffect = "fadeOut"; if( optionArr[sliderEffect] !== undefined ) { animateInEffect = optionArr[sliderEffect]['inEffect']; animateOutEffect = optionArr[sliderEffect]['outEffect']; } var rtlFlag = (slider_lang_code == "ar") ? true : false; $('.owl-carousel').owlCarousel({ loop:true, margin:10, rtl:rtlFlag, dots:true, lazyLoad: true, autoplay:true, //navText: ["", ""], 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); } }