var caratMin = 0; var caratMax = 15.00; var sldCaratMin = 0; var sldCaratMax = 7; var ThemeName = ''; var SelecedShape = ''; var SelectedCarat = 1; var SelShape = 'Round'; var dealerID = '720'; var ManuID = ''; var IsOneStep = ''; var qurShape; var qurctw; var qurDID; var qurSID; var AppointDate = ''; var AppointMon = 0; var AppointDay = 0; var AppointYer = 0; var RingURL = ''; var DiamondURL = ''; function onload() { LoadPopupbox(); LoadStartingPrice(); if (IsOneStep == 'False') { $('#step2').css('display', 'block'); $('#step3').css('display', 'block'); $('#linkChooseYourSetting').html('1 . Choose Your Setting'); //$('#step1').css('background', 'url("../images/right_arrowe.png") no-repeat scroll right center'); $('#step1').css('width', '33%'); $('#divChooseDiamond').css('display', 'block'); $('#divdiamondbrd').css('display', 'block'); } if (SelecedShape != '') { $('#' + SelecedShape).closest('li').css('border-bottom', '1px solid #4B68A2'); } window.location.hash = '#mainbdy'; RingURL = $('#hndRingUrl').val(); DiamondURL = $('#hndDiamondUrl').val(); } $(document).ready(function myfunction() { $(window).trigger('resize'); $(".ad-thumb-list").css('width', '9000px'); }); $(window).resize(function () { setgetwidth(); setTimeout("SendHeight()", 3000); }); 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 LoadStartingPrice() { SelectedCarat = $('#hndCarat').val(); SelShape = $('#hndShape').val(); $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/LoadStartingPrice", data: "{DealerId:'" + dealerID + "',Shapes:'" + SelShape + "',CaratMin:'" + parseFloat(SelectedCarat) + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { if (response != null) { if (response.d.dtFinal.length > 0) { if (response.d.dtFinal[0]["ddlHTML"] != null) { $("#ddlDiamondQuality").html(response.d.dtFinal[0]["ddlHTML"]); if (document.getElementById('ddlRingSize3') != null) { $("#ddlDiamondqulity").msDropDown(); } $(".diamond_quality").show(); $(".spShape").text($('#hfShape').val()); } } } }, error: function (msg) { } }); ScheduleViewingData(); } function LoadPopupbox() { $('a.poplight[href^=#]').click(function () { var popID = $(this).attr('rel'); //Get Popup Name var popURL = $(this).attr('href'); //Get Popup href to define size //Pull Query & Variables from href URL var query = popURL.split('?'); var dim = query[1].split('&'); var popWidth = dim[0].split('=')[1]; //Gets the first query string value //Fade in the Popup and add close button $('#' + popID).fadeIn().css({ 'width': Number(popWidth) }).prepend(''); var popMargTop = ($(window).height() - 80) / 2; var popMargLeft = (parseInt(popWidth) + 85) / 2; //alert(popMargTop); //Apply Margin to Popup $('#' + popID).css({ 'margin-top': -popMargTop, 'margin-left': -popMargLeft }); //Fade in Background $('body').append('
'); //Add the fade layer to bottom of the body tag. $('#fade').css({ 'filter': 'alpha(opacity=80)' }).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies return false; }); //Close Popups and Fade Layer $('a.close, #fade').live('click', function () { //When clicking on the close or fade layer... $('#fade , .popup_block').fadeOut(function () { $('#fade, a.close').remove(); //fade them both out }); return false; }); } function SelectShapenew(shape, SID, imageID) { shapeList = $('#hndSelectShapeList').val(); SetShapeCss(shape); var imagePath = ""; if (document.getElementById('hfringImageUrl') != null) imagePath = document.getElementById('hfringImageUrl').value var objImage = document.getElementById(imageID); var strURL = 'http://apps.gemfind.net/dealerid_display/CreateRingImage.aspx?sn=' + imagePath + '&cs=' + shape + '&ts=false&wi=400&hi=328&sid=' + SID; objImage.src = strURL; if (document.getElementById('hfShape') != null) document.getElementById('hfShape').value = shape; SelShape = shape; $('#hndShape').val(shape); LoadStartingPrice(); var objZoom = document.getElementById('lnkImage'); objZoom.href = strURL; Shadowbox.clearCache(); Shadowbox.setup(); } function SetShapeCss(shape) { $('#Round').closest('li').css('border-bottom', 'none'); $('#Pear').closest('li').css('border-bottom', 'none'); $('#Marquise').closest('li').css('border-bottom', 'none'); $('#Heart').closest('li').css('border-bottom', 'none'); $('#Radiant').closest('li').css('border-bottom', 'none'); $('#Oval').closest('li').css('border-bottom', 'none'); $('#Emerald').closest('li').css('border-bottom', 'none'); $('#Princess').closest('li').css('border-bottom', 'none'); $('#Cushion').closest('li').css('border-bottom', 'none'); $('#Asscher').closest('li').css('border-bottom', 'none'); $('#' + shape).closest('li').css('border-bottom', '1px solid #4B68A2'); } function LoadSimilarProductScroll() { setTimeout('LoadSimilar();', 1000); } function LoadMultiAddr() { setTimeout('LoadAddrs();', 1000); } function LoadSimilar() { $('#gallery').adGallery(); } function LoadAddrs() { $('#MultiAddr').css('margin-left', '-13px'); $('#MultiAddr').adGallery(); } function ClickSimilarSetting(url) { window.location.href = url; } function getfocus(obj, val) { if (obj.value == val) { obj.value = ''; } } function lostfocus(obj, val) { if (obj.value == '') { obj.value = val; } } function SelectDiamondSize(obj) { SelShape dealerID $('#hndCarat').val($("#" + obj.id + " option:selected").val()); LoadStartingPrice(); } function SelectDiamondQuality(obj) { var ColorMin, ColorMax, ClarityMin, ClarityMax, PriceMin, PriceMax, Quality; var vals = $("#" + obj.id + " option:selected").val().split('|'); Quality = vals[0]; PriceMin = vals[1]; PriceMax = vals[2]; if (Quality == 1) { ColorMin = 73; ColorMax = 74; ClarityMin = 8; ClarityMax = 9; } else if (Quality == 2) { ColorMin = 71; ColorMax = 72; ClarityMin = 6; ClarityMax = 7; } else { ColorMin = 68; ColorMax = 70; ClarityMin = 1; ClarityMax = 6; } if (document.getElementById("hfPriceMinMax") != null) document.getElementById('hfPriceMinMax').value = PriceMin + "," + PriceMax + "," + ColorMin + "," + ColorMax + "," + ClarityMin + "," + ClarityMax; } function FbShareClick(imgpath, SettingName, DealerCompany, url) { if (dealerID == "2926") { var u = window.location.href; var qry = u.split("?"); u = 'http://www.liordiamonds.com/ring-builder?Step=1&' + qry[1]; } else { var u = url; } 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) + ''); } //Config Changes function ChangeProductConfiguration(obj) { var MetalType = ''; var MetalColor = ''; var StyleNumber = $('#hdnprd_sku').val(); var URL = window.location.href; var tmpSID; var change = false; var BindWhat = obj.id; if ($("#ddlMetalTypeDetail option:selected").val() != 0) { MetalType = $("#ddlMetalTypeDetail option:selected").val(); } if ($("#ddlMetalTypeDetail option:selected").val() != 0 != "") change = true; if (change) { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/ChangeProductConfig", data: "{DealerLink:'" + dealerID + "',MetalType:'" + MetalType + "',MetalColor:'" + MetalColor + "',StyleNumber:'" + StyleNumber + "',URL:'" + URL + "',QurShape:'" + qurShape + "',QurCTW:'" + qurctw + "',ThemeName:'" + ThemeName + "',QurDID:'" + qurDID + "',BindWhat:'" + BindWhat + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { if (response.d != null) { if (response.d.dtReturn != null) { $('#prd_sku').html(response.d.dtReturn[0]["SettingNumber"]); $('#SetPrice').html('$' + response.d.dtReturn[0]["Cost"]); $('.hone_margin_top').html(response.d.dtReturn[0]["SettingName"]); $('#lftset_num').html(response.d.dtReturn[0]["SettingNumber"]); $('#SpecSettingNumber').html(response.d.dtReturn[0]["SettingNumber"]); $('#lftset_price').html('$' + response.d.dtReturn[0]["Cost"]); $('#SpecSettingPrice').html('$' + response.d.dtReturn[0]["Cost"]); $('#lftset_name').html(response.d.dtReturn[0]["SettingName"]); $('#lftset_cat').html(response.d.dtReturn[0]["Category"]); $('#lftset_mtype').html(response.d.dtReturn[0]["Metal"]); $('#SpecMetalType').html(response.d.dtReturn[0]["Metal"]); $('#divBandMetal').html(response.d.dtReturn[0]["BandMetal"]); $('#desc').html(response.d.dtReturn[0]["Description"]); $('#ulShapes').html(response.d.dtReturn[0]["Alt_Shapes"]); $('#divAdditionalImages').html(response.d.dtReturn[0]["AddImages"]); $('#SpecWidth').html(response.d.dtReturn[0]["Width"]); $('#SpecProngMetal').html(response.d.dtReturn[0]["ProngMetal"]); $('#SpecSettingType').html(response.d.dtReturn[0]["SettingType"]); $('#SpecTab').html(response.d.dtReturn[0]["SpecTab"]); var shp; if ($('#hfShape').val() != '' && $('#hfShape').val() != '0') shp = $('#hfShape').val(); else shp = 'Round'; var Imgsrc = 'http://apps.gemfind.net/dealerid_display/CreateRingImage.aspx?sn=' + response.d.dtReturn[0]["ImageURL"] + '&cs=' + shp + '&ts=false&wi=650&hi=650&sid=' + response.d.dtReturn[0]["SettingID"] + '&diamondCTW=1.50' $('#imgSetting').attr('src', Imgsrc); $('#lnkImage').attr('href', Imgsrc); $('#Img1').attr('src', response.d.dtReturn[0]["ImageURL"]); var VideoURL = response.d.dtReturn[0]["VideoURL"]; if (VideoURL != "" && VideoURL != null) { $('#Video_btn').show(); $('#Video_btn').html("Video"); } Shadowbox.clearCache(); Shadowbox.setup(); $('#hfringImageUrl') $('#Sco_Box').html(response.d.dtReturn[0]["SocialShareData"]); $('#btnPrint').attr('href', response.d.dtReturn[0]["PrintHref"]); $('#lnkbtnBuyWithOutStone').attr('href', 'javascript:BuyWithOutStone(' + response.d.dtReturn[0]["SettingID"] + ')'); $('.select_btn').html(''); $('#Req_info').html('Submit'); $('#DropHint').html('Request'); $('#Mail_Friend').html('Request'); $('#Sch_ViewSub').html('Schedule'); tmpSID = response.d.dtReturn[0]["SettingID"]; if (BindWhat != "ddlMetalTypeDetail") { $('#ringsize_bx').html(response.d.dtReturn[0]["ConfigMetalType"]); $("#ddlMetalTypeDetail").val(MetalType); $("#ddlMetalTypeDetail").msDropDown(); } $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/ChangeProductConfiguration", data: "{DealerLink:'" + dealerID + "',MetalType:'" + MetalType + "',MetalColor:'" + MetalColor + "',SID:'" + qurSID + "',BindWhat:'" + BindWhat + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { if (response.d.dtReturn != null) { if (BindWhat != "ddlMetalTypeDetail") { $('#ringsize_bx').html(response.d.dtReturn[0]["ConfigMetalType"]); $("#ddlMetalTypeDetail").val(MetalType); $("#ddlMetalTypeDetail").msDropDown(); } } }, error: function (msg) { } }); } } }, error: function (msg) { } }); $('#hdnSKU').val(tmpSID); } else { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/ChangeProductConfiguration", data: "{DealerLink:'" + dealerID + "',MetalType:'" + MetalType + "',MetalColor:'" + MetalColor + "',SID:'" + qurSID + "',BindWhat:'" + BindWhat + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { if (response.d.dtReturn != null) { if (BindWhat != "ddlMetalTypeDetail") { $('#ringsize_bx').html(response.d.dtReturn[0]["ConfigMetalType"]); $("#ddlMetalTypeDetail").msDropDown(); } } }, error: function (msg) { } }); } } function GotoSearch(SID) { var Shp; if ($('#hfShape').val() == '0') Shp = qurShape; else Shp = $('#hfShape').val(); var RingSize = $("#ddlRingSize5 option:selected").val() if (Page_ClientValidate('Cart')) { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/GotoDiamondSearch", data: "{DealerLink:'" + dealerID + "',SID:'" + SID + "',RingSize:'" + RingSize + "',hfPriceMinMax:'" + $('#hfPriceMinMax').val() + "',DID:'" + qurDID + "',ThemeName:'" + ThemeName + "',CTW:'" + qurctw + "',hndCarat:'" + $('#hndCarat').val() + "',hfShape:'" + Shp + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { window.location.href = response.d; return false; }, error: function (msg) { } }); } else { $('#RequiredFieldValidator4').show(); } } function BuyWithOutStone(SID) { var RingSize = $("#ddlRingSize5 option:selected").val() if (Page_ClientValidate('Cart')) { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/BuyWithOutDiamond", data: "{DealerLink:'" + dealerID + "',SID:'" + SID + "',RingSize:'" + RingSize + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { window.location.href = response.d; }, error: function (msg) { } }); } else { $('#RequiredFieldValidator4').show(); } } function RequestInfo(SID) { if (Page_ClientValidate('Letus_Know')) { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/InquireAboutItem", data: "{DealerLink:'" + dealerID + "',SID:'" + SID + "',qurShape:'" + qurShape + "',txtEmail:'" + $('#txtEmail').val() + "',txtName:'" + $('#txtName').val() + "',txtComments:'" + $('#txtComments').val() + "',ThemeName:'" + ThemeName + "',txtPhone:'" + $('#txtPhone').val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { $('#txtEmail').val(""); $('#txtName').val(""); $('#txtComments').val(""); $('#txtPhone').val(""); location.reload(); }, error: function (msg) { } }); } else { } } function DropAHint(SID) { if (Page_ClientValidate('HintReq')) { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/DropAHint", data: "{DealerLink:'" + dealerID + "',SID:'" + SID + "',DID:'" + qurDID + "',URL:'" + window.location.href + "',qurShape:'" + qurShape + "',qurCTW:'" + qurctw + "',txtHintRecptEmail:'" + $('#txtHintRecptEmail').val() + "',txtHintRecptName:'" + $('#txtHintRecptName').val() + "',txtHintRecptReason:'" + $('#txtHintRecptReason').val() + "',ThemeName:'" + ThemeName + "',txtHintRecpMessage:'" + $('#txtHintRecpMessage').val() + "',,txtHintRecptGiftDeadline:'" + $('#txtHintRecptGiftDeadline').val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { $('#txtHintRecptEmail').val(""); $('#txtHintRecptName').val(""); $('#txtHintRecptReason').val(""); $('#txtHintRecpMessage').val(""); $('#txtHintRecptGiftDeadline').val(""); location.reload(); }, error: function (msg) { } }); } else { } } function EmailToFriend(SID) { if (Page_ClientValidate('Tell_Friend')) { $.ajax({ type: "POST", url: "HamiltonRingBuilderData.asmx/EmailToFriend", data: "{DealerLink:'" + dealerID + "',SID:'" + SID + "',qurShape:'" + qurShape + "',txtHintRecptEmail:'" + $('#txtHintRecptEmail').val() + "',txtHintRecptName:'" + $('#txtHintRecptName').val() + "',txtHintRecptReason:'" + $('#txtHintRecptReason').val() + "',ThemeName:'" + ThemeName + "',txtHintRecpMessage:'" + $('#txtHintRecpMessage').val() + "',,txtHintRecptGiftDeadline:'" + $('#txtHintRecptGiftDeadline').val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, processData: false, success: function (response) { $('#txtHintRecptEmail').val(""); $('#txtHintRecptName').val(""); $('#txtHintRecptReason').val(""); $('#txtHintRecpMessage').val(""); $('#txtHintRecptGiftDeadline').val(""); location.reload(); }, error: function (msg) { } }); } else { } } //Ends function HideShow(objShow, objHide, liObj) { $("." + objShow).show(); $("." + objHide).hide(); $("#" + objShow).show(); $("#liItemDetails").removeClass("active"); $("#liSpecification").removeClass("active"); $("#" + liObj.id).addClass("active"); $("#DivEmailtoFriend").hide(); $("#DivDropAHint").hide(); $("#Divletusknow").hide(); $("#divScheduleView").hide(); setTimeout("SendHeight()", 500); } //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: "HamiltonRingBuilderData.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) { } }); } 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: "HamiltonRingBuilderData.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 { } } $(document).ready(function myfunction() { setTimeout("MakeChangeInHeight()", 3000); }); function MakeChangeInHeight() { var $imgs = $("#imgSetting"); imgAmount = $imgs.length; imgCounter = 1; var imageLoaded = function () { setTimeout("SendHeight()", 3600); } $('#imgSetting').each(function () { var tmpImg = new Image(); tmpImg.onload = imageLoaded; tmpImg.src = $(this).attr('src'); }); } //End Schedule Viewing 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($("#mainbdy").height() + 100, parent_url[i], parent); } if (parent_url2 != '') XD.postMessage($("#mainbdy").height() + 100, parent_url2, parent); return false; } function isTouchDevice() { return "ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch; } //For All Popups(zishan) function HideShowPopup(objShow, objHide) { //if (!isTouchDevice()) { $(".settingdetail_text_bg").hide(); $(".setting_text_bg").hide(); //} $("#DivEmailtoFriend").hide(); $("#DivDropAHint").hide(); $("#Divletusknow").hide(); $("#divScheduleView").hide(); $("#" + objShow).show(); //$("html,body").scrollTop(0); if ($(window).width() <= 480) { 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) { $(".settingdetail_text_bg").show(); $("#" + objHide).hide(); } //End