var ThemeName = 'WhiteTheme'; var dealerID = '720'; var AppointDate = ''; var AppointMon = 0; var AppointDay = 0; var AppointYer = 0; var objProcessBar; var SID = '0'; var diamodShap=''; var diamondID; var RingURL = ''; var DiamondURL = ''; var locationID = 1; var ipAddress = '0'; var addressList = ''; var locationList = ''; var customerZipcode = ''; var geocoder; var map; var map2; var srcLat = ''; var srcLong = ''; var distance = ''; var marker; var directionsDisplay; var directionsService; var StockNo = ''; var Log_ID = ''; var JCLog_ID = ''; var mileData = ''; var lowestMile = 50; var ipAddress = '0'; var HasRetailerLocator = false; var SelectRetailerAddress = ''; var ID = ''; var IsInJc = ''; var markersmain = []; $(document).ready(function () { RingURL = $('#hndRingUrl').val(); parent_url = RingURL.split(','); for (var i = 0; i < parent_url.length; i++) { if (parent_url[i] != '') XD.postMessage('scrolltop', parent_url[i], parent); } $(window).trigger('resize'); $(".livestrm a").click(function () { for (var i = 0; i < parent_url.length; i++) { if (parent_url[i] != '') XD.postMessage('chat', parent_url[i], parent); } }); }); $(window).resize(function () { setgetwidth(); ChangeScroll(); setTimeout("SendHeight()", 3000); }); function showPositionDetail(position) { var lat = position.coords.latitude; var long = position.coords.longitude; var latlng = new google.maps.LatLng(lat, long) var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'latLng': latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { for (var i = 0; i < results[0].address_components.length; i++) { var address = results[0].address_components[i]; if (address.types[0] == "postal_code") { customerZipcode = address.long_name; $('#txtZipCode').val(customerZipcode); LoadMap(); } } } }); } function showErrorDetail(error) { switch (error.code) { case error.PERMISSION_DENIED: break; case error.POSITION_UNAVAILABLE: break; case error.TIMEOUT: break; case error.UNKNOWN_ERROR: break; } } function setgetwidth() { var width = $(window).width(); var percent = parseInt(width); $(".main_left_side").css("width", '200px'); var rightsidewidth = parseInt(percent) - 210; $(".main_right_side").css("width", parseInt(rightsidewidth) + "px"); } function ChangeScroll() { $('#scroolDetails').jScrollPaneRemove(); LoadGridScroll(); } function onload() { LoadGridScroll(); ScheduleViewingData(); RingURL = $('#hndRingUrl').val(); DiamondURL = $('#hndDiamondUrl').val(); } function LoadGridScroll() { //alert($(".setting_images_bg").width()); //$("#scroolDetails").jScrollPane({ scrollbarWidth: 20, scrollbarMargin: 0, showArrows: true, arrowSize: 0, arrowSize: 16, dragMaxHeight: 100 }); } function ChangeRingImage(ImageLink, SID, imageID, imageClass) { var objImage = document.getElementById(imageID); var strURL = '../ResizeLogo.aspx?img=' + ImageLink + '&wi=650&hi=650'; objImage.src = strURL; $('#divAdditionalImages li').removeClass('AddiImagClassSelected'); $('#divAdditionalImages li.' + imageClass).addClass('AddiImagClassSelected'); var objZoom = document.getElementById('viewZoom'); objZoom.href = strURL; Shadowbox.clearCache(); Shadowbox.setup(); } function getfocus(obj, val) { if (obj.value == val) { obj.value = ''; } } function lostfocus(obj, val) { if (obj.value == '') { obj.value = val; } } function FbShareClick(app_id, imgpath, SettingName, DealerCompany, url) { var u = window.location.href; var qry = u.split("?"); var dealerID = qry[1].split("&"); if (dealerID[0] == "DealerLink=2926" || dealerID[1] == "DealerLink=2926") { u = 'http://www.liordiamonds.com/ring-builder?Step=3&' + qry[1]; } else { var u = url; } window.open('https://www.facebook.com/dialog/feed?app_id=' + app_id + '&display=popup&caption=' + SettingName + '&link=' + encodeURIComponent(u) + '&picture=' + encodeURIComponent(imgpath) + '&redirect_uri=' + encodeURIComponent(u) + '&description=' + encodeURIComponent(DealerCompany) + ''); //window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + SettingName + '&p[url]=' + encodeURIComponent(u) + '&p[summary]=' + encodeURIComponent(DealerCompany) + '&p[images][0]=' + encodeURIComponent(imgpath) + ''); } function HideShow(objShow, objHide, liObj) { $("." + objShow).show(); $("." + objHide).hide(); ChangeScroll(); $("#liItemDetails").removeClass("active"); $("#liSpecification").removeClass("active"); $("#" + liObj.id).addClass("active"); $("#DivEmailtoFriend").hide(); $("#DivDropAHint").hide(); $("#Divletusknow").hide(); $("#divScheduleView").hide(); if (objShow == 'setting_text_bg') setTimeout('LoadSimilar();', 1000); } //For Schedule Viewing(zishan) function ScheduleViewingData() { if (AppointMon != '' && AppointMon != 0 && AppointDay != '' && AppointDay != 0 && AppointYer != '' && AppointYer != 0) { AppointDate = new Date(AppointYer, AppointMon - 1, AppointDay); } $.ajax({ type: "POST", url: "GetDiamondSearchDetailsResp.asmx/BindCustomerAppointments", data: "{DealerLink:'" + dealerID + "',ThemeName:'" + ThemeName + "',AppointDate:'" + AppointDate + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (data) { $("#spnDealerCompany").text(data.d.dtAppointments[0]["DealerCompany"]); $("#spnAddress").text(data.d.dtAppointments[0]["DealerAddress"]); $("#spnCity").text(data.d.dtAppointments[0]["DealerCity"]); $("#spnState").text(data.d.dtAppointments[0]["DealerState"]); $("#spnZip").text(data.d.dtAppointments[0]["DealerZip"]); $("#spnPhone").text(data.d.dtAppointments[0]["DealerPhone"]); $("#divddlAppnt").html(data.d.dtAppointments[0]["HTMLData"]); if (data.d.dtAppointments[0]["HTMLDataTime"].length > 0) $("#divddlAppntTime").html(data.d.dtAppointments[0]["HTMLDataTime"]); }, error: function (msg) { } }); window.location.hash = '#viewZoom'; } function CancelSch() { $("#txtAppntMsg").val(""); $("#txtAppntDate").val(""); $("#ddlAppnt > [value='0']").attr("selected", "true"); $("#ddlAppntTime > [value='0']").attr("selected", "true"); } function ScheduleView(SID) { if (Page_ClientValidate('SchView')) { $.ajax({ type: "POST", url: "GetDiamondSearchDetailsResp.asmx/ScheduleViewing", data: "{DealerLink:'" + dealerID + "',SID:'" + SID + "',DID:'" + qurDID + "',URL:'" + window.location.href + "',qurShape:'" + qurShape + "',qurCTW:'" + qurctw + "',txtAppntMsg:'" + $('#txtAppntMsg').val() + "',txtAppntDate:'" + $('#txtAppntDate').val() + "',hndAppntTime:'" + $('#hndAppntTime').val() + "',ThemeName:'" + ThemeName + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { $('#txtAppntMsg').val(""); $('#txtAppntDate').val(""); $('#hndAppntTime').val(""); $("#ddlAppnt > [value='0']").attr("selected", "true"); $("#ddlAppntTime > [value='0']").attr("selected", "true"); location.reload(); }, error: function (msg) { } }); } else { } } //End Schedule Viewing //For Address Scroll(zishan) function LoadSimilarProductScroll() { setTimeout('LoadSimilar();', 1000); } function LoadSimilar() { $('#MultiAddr_CR').adGallery(); } //End function SendHeight() { var parent_url2 = ''; parent_url2 = DiamondURL; parent_url = RingURL.split(','); //if (dealerID == '2390') { // parent_url = 'http://www.diamondselect.com/ring-builder/'; // parent_url2 = 'https://www.diamondselect.com/ring-builder/'; //} for (var i = 0; i < parent_url.length; i++) { if (parent_url[i] != '') { XD.postMessage($("#complete_ur_diamond").height() + 100, parent_url[i], parent); } } if (parent_url2 != '') XD.postMessage($("#complete_ur_diamond").height() + 100, parent_url2, parent); return false; } //For All Popups(zishan) function HideShowPopup(objShow, objHide) { window.location.hash = '#txtName'; $(".bezel_diamond_text_bg").hide(); $(".setting_text_bg").hide(); $("#DivEmailtoFriend").hide(); $("#DivDropAHint").hide(); $("#Divletusknow").hide(); $("#divScheduleView").hide(); $("#" + objShow).show(); if (objShow == 'DivDropAHint') $("#txtHintRecptName").focus(); else if (objShow == 'Divletusknow') $("#txtName").focus(); else if (objShow == 'DivEmailtoFriend') $("#txtYourName").focus(); else if (objShow == 'divScheduleView') $("#ddlAppnt").focus(); else $("#liItemDetails").focus(); setTimeout("SendHeight()", 3000); } function hideView(objHide) { $(".bezel_diamond_text_bg").show(); $("#" + objHide).hide(); } //End //Code for process image on add to cart function showprocess() { objProcessBar = document.getElementById("divProcessBar"); o = document.getElementById("imgAddtoCart"); $("#imgAddtoCart").attr('onmouseout', 'Themes / WhiteTheme / images / add_to_shoping_cart.jpg'); objProcessBar.style.left = getAbsLeft(o) + 90 + 'px'; objProcessBar.style.top = getAbsTop(o) + 'px'; $("#divProcessBar").css("display", "block"); } function hideprocess() { objProcessBar.style.display = 'none'; } function getAbsLeft(o) { oLeft = o.offsetLeft while (o.offsetParent != null) { oParent = o.offsetParent oLeft += oParent.offsetLeft o = oParent } return oLeft } function getAbsTop(o) { oTop = o.offsetTop while (o.offsetParent != null) { oParent = o.offsetParent oTop += oParent.offsetTop o = oParent } return oTop } function HideSchView() { if ($('#txtAppntMsg').val() == '') { $('#RequiredFieldValidator5').css('display', 'Block'); return false; } var Text = $('#txtAppntDate').val(); if (Text == '' || Text == 'When are you available?') { $('#RequiredFieldValidator6').css('display', 'Block'); return false; } var SelVal = $('#ddlAppntTime :selected').val(); if (SelVal == 0) { $('#AppdateVali').css('display', 'Block'); return false; } $('#divScheduleView').css('display', 'none'); $('#divScheduleViewFinal').css('display', 'block'); $('#AppDate').text($('#txtAppntDate').val()); $('#AppTime').text($('#hndAppntTime').val()); } function ShowAddressView() { $('#divScheduleView').css('display', 'block'); $('#divScheduleViewFinal').css('display', 'none'); } function SearchZip() { var zip = $('#txtZipCode').val(); if (zip != '' && isNaN(zip) == false) { $('#errorZip').text(""); customerZipcode = zip; LoadMap(); } else { $('#errorZip').text("Enter ZipCode"); $('#errorZip').css("color", 'red'); } } function RequestAPreview() { if (navigator.geolocation && customerZipcode == "") { navigator.geolocation.getCurrentPosition(showPositionDetail, showErrorDetail); } else { //NO Location Permission } } function LoadMap() { $("#map_canvas").html(""); $(".DivRetailerList").html(""); $(".SearchRetailer").show(); locationList = ''; addressList = ''; Log_ID = ''; JCLog_ID = ''; map = ''; map2 = ''; lowestMile = 50; mileData = $("#ddlMile").val(); //switch (mileData) { // case "15": // mileData = '15'; // break; // case "20": // mileData = '20'; // break; // case "30": // mileData = '30'; // break; // default: // mileData = '10'; //} google.maps.Map.prototype.clearOverlays = function () { for (var i = 0; i < markersArray.length; i++) { markersArray[i].setMap(null); } markersArray.length = 0; } $('#div_settingdetail').hide(); $('.DivRetailerLocator').show(); if (customerZipcode.length != 0) { $.ajax({ type: "POST", url: "GetDiamondSearchDetailsResp.asmx/GetRetailerList", data: "{DealerID:'" + dealerID + "',zipCode:'" + customerZipcode + "',mileInfo:'" + mileData + "',productid:'" + SID + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (re) { if (re.d.DtRetailerList[0] != null) { for (var i = 0; i < re.d.DtRetailerList.length; i++) { var storeName = re.d.DtRetailerList[i]["StoreName"]; var address = re.d.DtRetailerList[i]["Address"]; var postalCode = re.d.DtRetailerList[i]["Zipcode"]; var state = re.d.DtRetailerList[i]["State"]; var city = re.d.DtRetailerList[i]["City"]; var country = re.d.DtRetailerList[i]["Country"]; var addressOnMap = address + "," + city + "," + state + "," + country + "-" + postalCode; if (addressList.length == 0) { addressList = addressOnMap; } else { addressList = addressList + "$" + addressOnMap; } } var zoomLevel = 8; geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(41.2324, -98.4160); var mapOptions = { zoom: zoomLevel, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: true } map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); directionsService = new google.maps.DirectionsService(); directionsDisplay = new google.maps.DirectionsRenderer(); //map2 = new google.maps.Map(document.getElementById('map-canvas1'), mapOptions); //directionsDisplay.setMap(map2); //directionsDisplay.setPanel(document.getElementById('directions-panel')); var customerAddres = customerZipcode + ", United States"; setTimeout(function () { GetCustomerCurrentLocation(customerAddres); }, 1000); setTimeout(function () { codeAddress(addressList, re.d.DtRetailerList); }, 2000); } else { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(41.2324, -98.4160); var mapOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: true } map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); directionsService = new google.maps.DirectionsService(); directionsDisplay = new google.maps.DirectionsRenderer(); var customerAddres = customerZipcode + ", United States"; setTimeout(function () { GetCustomerCurrentLocation(customerAddres); }, 1000); $(".DivRetailerList").html("