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 InfinityShape = 'Round'; var InfinityCarat = '0.45-0.69'; var InfinityColor = 'Amber'; var RangeID = 1; var HideAllShapes = 0; var RingSettingID = 0; var CenterStoneMinimumCarat = 0; var CenterStoneMaximumCarat = 0; var BindFilter = 'Shape'; var tempColor = 'Amber'; var CntColor = 0; var IsColorSelected = true; var tempsize = '0.45-0.69'; var CntSize = 0; var IsCaratSelected = true; var tempShape = ''; var CntShape = 0; var IsShapeSelected = true; var ColorImageObj = 'imgdiamondq1'; var loginUN = "chetangf"; var api_key = "R_9c8bdd09f76fefee29b23ddb20b9fc3c"; function onload() { $("#divDescription").hide(); LoadStartingPrice(); LoadGridScroll(); setSizeSlider(); SetSilderCSS(); Shadowbox.init(); LoadPopupbox(); $("#ddlRingSize").msDropDown(); $("#ddlMetalDetail").msDropDown(); SetLinkForShadowBox(); if (SelecedShape != '') { $('#' + SelecedShape).closest('li').css('border-bottom', '1px solid #4B68A2'); } ChangeShapeColor(InfinityColor); } function SetCarats() { var Carats = ["0.02-0.05", "0.10-0.19", "0.20-0.34", "0.45-0.69", "0.70-0.89", "0.90-01.19", "1.20-1.39", "1.40-1.59", "1.90-2.09"]; for (var i = 0; i < Carats.length; i++) { var Sizes = Carats[i].split('-'); if (!((parseFloat(Sizes[0]) > parseFloat(CenterStoneMinimumCarat) && parseFloat(Sizes[0]) < parseFloat(CenterStoneMaximumCarat)) || (parseFloat(Sizes[1]) > parseFloat(CenterStoneMinimumCarat) && parseFloat(Sizes[1]) < parseFloat(CenterStoneMaximumCarat)))) { var id = Carats[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#" + id + "").attr("onClick").replace('Size', 'Sizes'); $("#" + id + "").attr("onClick", sript); $("#" + id + "").children('img').addClass("disable"); $("#txt" + id + "").children('p').addClass("disable"); } } } function LoadStartingPrice() { SelectedCarat = $('#hndCarat').val(); SelShape = $('#hndShape').val(); $.ajax({ type: "POST", url: "GetBuildRingStep2DiamondData.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]["PriceForGood"] != null) $('#lblGoodPrice').text(response.d.dtFinal[0]["PriceForGood"]); if (response.d.dtFinal[0]["PriceForBetter"] != null) $('#lblBetterPrice').text(response.d.dtFinal[0]["PriceForBetter"]); if (response.d.dtFinal[0]["PriceForBest"] != null) $('#lblBestPrice').text(response.d.dtFinal[0]["PriceForBest"]); } } }, error: function (msg) { } }); } function LoadSimilarProductScroll() { setTimeout('LoadSimilar();', 9000); } function LoadSimilar() { $('#gallery').adGallery(); } function SetLinkForShadowBox() { Shadowbox.clearCache(); Shadowbox.setup(); } function HidePopup() { var behavior = $find('ReqMore'); behavior.hide(); return false; } function FbShareClick(imgpath, SettingName, DealerCompany, url) { url = url.replace(/(shape=).*?(&)/, '$1' + InfinityShape + '$2'); if (url.indexOf("color") != -1) url = url.replace(/(color=).*?(&)/, '$1' + InfinityColor + '$2'); else url = url + "&color=" + InfinityColor; get_short_url(url, loginUN, api_key, function (short_url) { url = short_url; var objImage = document.getElementById("imgSetting"); imgpath = objImage.src; 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) + ''); }); } 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 LoadGridScroll() { $("#divDescription").jScrollPane({ scrollbarWidth: 11, scrollbarMargin: 0, showArrows: false, arrowSize: 0, maintainPosition: false }); // $("#divItemDetail").jScrollPane({ scrollbarWidth: 11, scrollbarMargin: 0, showArrows: false, arrowSize: 0, maintainPosition: false }); $("#divDescription").show(); //$("#divItemDetail").show(); } //////// Size ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var sizeStep = 0.1; function logpositionCarat(value) { var minp = sldCaratMin; var maxp = sldCaratMax; // The result should be between 100 an 10000000 var minv = Math.log(0.2); var maxv = Math.log(sldCaratMax); // calculate adjustment factor var scale = (maxv - minv) / (maxp - minp); return ((Math.log(value) - minv) / scale + minp).toFixed(2); } function logsliderCarat(position) { if (position == 0) return 0; // position will be between 0 and 100 var minp = sldCaratMin; var maxp = sldCaratMax; // The result should be between 100 an 10000000 var minv = Math.log(0.2); var maxv = Math.log(sldCaratMax); // calculate adjustment factor var scale = (maxv - minv) / (maxp - minp); return (Math.exp(minv + scale * (position - minp))).toFixed(2); } function setSizeSlider() { var Minp = 0; var Maxp = 0; var sldPM = sldCaratMin; var sldPMx = sldCaratMax; if (caratMin != '' || caratMin == 0) { sldPM = caratMin; } if (caratMax != '') sldPMx = caratMax; $("#size-range").slider({ range: true, min: sldCaratMin, max: sldCaratMax, values: [new Number(logpositionCarat(sldPM)).toString(), new Number(logpositionCarat(sldPMx)).toString()], start: function (event, ui) { //curVal = ui.value; //setPriceStepValue(); }, slide: function (event, ui) { Minp = logsliderCarat(ui.values[0]); $("#lblCaratMin").val(Minp); Maxp = logsliderCarat(ui.values[1]); $("#lblCaratMax").val(Maxp); curVal = ui.value; }, stop: function (event, ui) { SetSilderTextColor('size', logsliderCarat(ui.values[0]), logsliderCarat(ui.values[1])); resetControls('size', logsliderCarat(ui.values[0]), logsliderCarat(ui.values[1])); } }); Minp = logsliderCarat($("#size-range").slider("values", 0)); $("#lblCaratMin").val(Minp); var Maxp = logsliderCarat($("#size-range").slider("values", 1)); $("#lblCaratMax").val(Maxp); SetSilderTextColor('size', caratMin, caratMax); } //////// End Size ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function SetSilderTextColor(type, val1, val2) { switch (type) { case 'size': $("#lblCaratMin").text(val1); $("#lblCaratMax").text(val2); break; } } function resetControls(type, val1, val2) { switch (type) { case "size": caratMin = val1; caratMax = val2; break; } } function SetSilderCSS() { //For Carat $('#size-range').css('border-radius', '0'); $('#size-range').css('width', '144px'); $('#size-range').css('height', '31px'); $('#size-range').css('background', 'url("Themes/' + ThemeName + '/images/mid_s_bg.png") repeat-x scroll center bottom transparent'); $('#size-range').find('a').css('margin-top', '1px'); // $('#size-range').find('a').css('background', 'url("Themes/' + ThemeName + '/images/left_line_h.png") repeat-x scroll 50% 50% transparent'); $('#size-range').find('a').css('z-index', '1'); $('#size-range').find('div').css('background', 'url("Themes/' + ThemeName + '/images/sld_main_bg_d.png") repeat-x scroll center bottom transparent'); var divWidth = $('#size-range').find('div').width(); $('#size-range').find('div').css('width', '' + divWidth - 3 + ''); // $('#size-range').find('div').css('border-left', '1px solid #d7d5d6'); // $('#size-range').find('div').css('border-right', '1px solid #d7d5d6'); $('#size-range').find('div').css('z-index', '-1'); $('#lblCaratMin').css('z-index', '99999'); $('#lblCaratMax').css('z-index', '99999'); // pos = $('#size-range').position(); // document.getElementById("trCarat").style.top = pos.top + 5 + 'px'; } function SelectShape(shape) { var shapeList = ''; shapeList = $('#hndSelectShapeList').val(); if (shapeList.indexOf(shape) != -1) { shapeList = shapeList.replace(',' + shape, ''); $('#' + shape).css("border", "1px solid #fff"); } else { $('#' + shape).css("border", "1px solid #C0BDBD"); shapeList = shapeList + ',' + shape; } $('#hndSelectShapeList').val(shapeList); } 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'); if (CntShape == 0) $('#' + shape).closest('li').css('border-bottom', '1px solid #4B68A2'); } function SelectShapenew(shape, SID, imageID) { BindFilter = "Shape"; if (tempShape == '') tempShape = SelecedShape; if (tempShape.toLocaleLowerCase() == shape.toLocaleLowerCase()) { if (CntShape == 1) { tempShape = shape; CntShape = 0; IsShapeSelected = true; } else { tempShape = shape; CntShape = 1; IsShapeSelected = false; } } else { tempShape = shape; CntShape = 0; IsShapeSelected = true; } if (!LoadInfinityDiamondPrice(shape, InfinityCarat, InfinityColor, BindFilter, IsShapeSelected)) { jAlert('This SHAPE of diamond is not available in the size and color you have already selected', 'Custom Styles'); return; } shapeList = $('#hndSelectShapeList').val(); SetShapeCss(shape); var imagePath = ""; if (document.getElementById('hfringImageUrl') != null) imagePath = document.getElementById('hfringImageUrl').value var objImage = document.getElementById(imageID); var strURL = '../dealerid_display/CreateRingImageInfinity.aspx?sn=' + imagePath + '&cs=' + shape + '&ts=false&wi=253&hi=253&sid=' + SID + '&CTW=' + InfinityCarat + '&StoneColor=' + InfinityColor; objImage.src = strURL; if (document.getElementById('hfShape') != null) document.getElementById('hfShape').value = shape; InfinityShape = shape; $('#hndShape').val(shape); GetSmallShape(); ////Change Color Image //if (document.getElementById(ColorImageObj) != null) { // var objImage = document.getElementById(ColorImageObj) // if (CntColor == 1) { // objImage.src = "Themes/" + ThemeName + "/images/8.png"; // } // else { // SetColorImages(objImage, shape, InfinityColor); // } //} } function SetColorImages(objImage, shape, InfinityColor) { var PrefixShape = GetPrefixOfShape(shape); if (PrefixShape != "") { switch (InfinityColor.toString().toLowerCase()) { case 'amber': objImage.src = "Themes/" + ThemeName + "/images/A" + PrefixShape + ".png"; break; case 'yellow': objImage.src = "Themes/" + ThemeName + "/images/Y" + PrefixShape + ".png"; break; case 'red': objImage.src = "Themes/" + ThemeName + "/images/R" + PrefixShape + ".png"; break; case 'blue': objImage.src = "Themes/" + ThemeName + "/images/B" + PrefixShape + ".png"; break; case 'clear': objImage.src = "Themes/" + ThemeName + "/images/C" + PrefixShape + ".png"; break; case 'purple': objImage.src = "Themes/" + ThemeName + "/images/P" + PrefixShape + ".png"; break; default: break; } } else { switch (InfinityColor.toString().toLowerCase()) { case 'amber': objImage.src = "Themes/" + ThemeName + "/images/A.png"; break; case 'yellow': objImage.src = "Themes/" + ThemeName + "/images/Y.png"; break; case 'red': objImage.src = "Themes/" + ThemeName + "/images/R.png"; break; case 'blue': objImage.src = "Themes/" + ThemeName + "/images/8_hover.png"; break; case 'clear': objImage.src = "Themes/" + ThemeName + "/images/C.png"; break; case 'purple': objImage.src = "Themes/" + ThemeName + "/images/P.png"; break; default: break; } } } function SelectShapenews(shape, SID, imageID) { } function SelectDiamondSizes(Size, imageId) { } function SelectDiamondQualitys(quality, imageid, ColorType) { } function SelectDiamondSize(Size, imageId) { BindFilter = "Carats"; if (tempsize.toLocaleLowerCase() == Size.toLocaleLowerCase()) { if (CntSize == 1) { tempsize = Size; CntSize = 0; IsSizSelected = true; } else { tempsize = Size; CntSize = 1; IsSizSelected = false; } } else { tempsize = Size; CntSize = 0; IsSizSelected = true; } var Sizes = Size.split('-'); if (!LoadInfinityDiamondPrice(InfinityShape, Size, InfinityColor, BindFilter, IsSizSelected)) { jAlert('This SIZE diamond is not available in the shape and color you have already selected', 'Custom Styles'); return; } document.getElementById("imgDiamonds1").src = "Themes/" + ThemeName + "/images/1.png"; document.getElementById("imgDiamonds2").src = "Themes/" + ThemeName + "/images/2.png"; document.getElementById("imgDiamonds3").src = "Themes/" + ThemeName + "/images/3.png"; document.getElementById("imgDiamonds4").src = "Themes/" + ThemeName + "/images/4.png"; document.getElementById("imgDiamonds5").src = "Themes/" + ThemeName + "/images/5.png"; document.getElementById("imgDiamonds6").src = "Themes/" + ThemeName + "/images/6.png"; document.getElementById("imgDiamonds7").src = "Themes/" + ThemeName + "/images/7.png"; document.getElementById("imgDiamonds8").src = "Themes/" + ThemeName + "/images/8.png"; document.getElementById("imgDiamonds9").src = "Themes/" + ThemeName + "/images/8.png"; if (document.getElementById("imgDiamonds" + imageId) != null) { if (CntSize == 1) { document.getElementById("imgDiamonds1").src = "Themes/" + ThemeName + "/images/1.png"; document.getElementById("imgDiamonds2").src = "Themes/" + ThemeName + "/images/2.png"; document.getElementById("imgDiamonds3").src = "Themes/" + ThemeName + "/images/3.png"; document.getElementById("imgDiamonds4").src = "Themes/" + ThemeName + "/images/4.png"; document.getElementById("imgDiamonds5").src = "Themes/" + ThemeName + "/images/5.png"; document.getElementById("imgDiamonds6").src = "Themes/" + ThemeName + "/images/6.png"; document.getElementById("imgDiamonds7").src = "Themes/" + ThemeName + "/images/7.png"; document.getElementById("imgDiamonds8").src = "Themes/" + ThemeName + "/images/8.png"; document.getElementById("imgDiamonds9").src = "Themes/" + ThemeName + "/images/8.png"; } else { if (imageId == 9) document.getElementById("imgDiamonds" + imageId).src = "Themes/" + ThemeName + "/images/" + 8 + "_hover.png"; else document.getElementById("imgDiamonds" + imageId).src = "Themes/" + ThemeName + "/images/" + imageId + "_hover.png"; } } if (document.getElementById("hfCaratMin") != null) document.getElementById("hfCaratMin").value = Size; InfinityCarat = Size; //Change Image var imagePath = ""; if (document.getElementById('hfringImageUrl') != null) imagePath = document.getElementById('hfringImageUrl').value var objImage = document.getElementById("imgSetting"); var strURL = '../dealerid_display/CreateRingImageInfinity.aspx?sn=' + imagePath + '&cs=' + InfinityShape + '&ts=false&wi=253&hi=253&sid=' + RingSettingID + '&CTW=' + InfinityCarat + '&StoneColor=' + InfinityColor; objImage.src = strURL; GetSmallShape(); } function SelectDiamondQuality(quality, imageid, ColorType) { BindFilter = "Color"; if (tempColor.toLocaleLowerCase() == ColorType.toLocaleLowerCase()) { if (CntColor == 1) { tempColor = ColorType; CntColor = 0; IsColorSelected = true; } else { tempColor = ColorType; CntColor = 1; IsColorSelected = false; } } else { tempColor = ColorType; CntColor = 0; IsColorSelected = true; } var colorMin, colorMax, ClarityMin, ClarityMax, priceMin, priceMax; if (!LoadInfinityDiamondPrice(InfinityShape, InfinityCarat, ColorType, BindFilter, IsColorSelected)) { jAlert('This COLOR diamond is not available in the shape and size you have already selected', 'Custom Styles'); return; } document.getElementById("imgdiamondq1").src = document.getElementById("imgdiamondq2").src = document.getElementById("imgdiamondq3").src = document.getElementById("imgdiamondq4").src = document.getElementById("imgdiamondq5").src = "Themes/" + ThemeName + "/images/8.png"; // Chamge Color Shape ColorImageObj = imageid; if (document.getElementById(imageid) != null) { var objImage = document.getElementById(imageid) if (CntColor == 1) { objImage.src = "Themes/" + ThemeName + "/images/8.png"; } else { objImage.src = "Themes/" + ThemeName + "/images/8_hover.png"; //SetColorImages(objImage, $('#hndShape').val(), ColorType); } InfinityColor = ColorType; } // Change Shape Color if (CntColor == 1) ChangeShapeColor("clear"); else ChangeShapeColor(ColorType); //Change Image var imagePath = ""; if (document.getElementById('hfringImageUrl') != null) imagePath = document.getElementById('hfringImageUrl').value var objImage = document.getElementById("imgSetting"); var strURL = '../dealerid_display/CreateRingImageInfinity.aspx?sn=' + imagePath + '&cs=' + InfinityShape + '&ts=false&wi=253&hi=253&sid=' + RingSettingID + '&CTW=' + InfinityCarat + '&StoneColor=' + InfinityColor; objImage.src = strURL; GetSmallShape(); } function ClickSimilarSetting(url) { window.location.href = url; } function GetSmallShape() { if (HideAllShapes != 1) return; var imagename = ''; var StoneColor = ''; if (InfinityColor == "Amber") StoneColor = "A"; if (InfinityColor == "Yellow") StoneColor = "Y"; if (InfinityColor == "Red") StoneColor = "R"; if (InfinityColor == "Blue") StoneColor = "B"; if (InfinityColor == "Clear") StoneColor = "C"; if (InfinityColor == "Purple") StoneColor = "P"; if (InfinityShape.toLowerCase() == "round") imagename = "RND-5-" + StoneColor + ".png" if (InfinityShape.toLowerCase() == "marquise") imagename = "M-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "asscher") imagename = "A-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "pear") imagename = "PR-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "oval") imagename = "O-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "heart") imagename = "H-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "cushion") imagename = "C-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "radiant") imagename = "RD-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "princess") imagename = "PRN-5-" + StoneColor + ".png"; if (InfinityShape.toLowerCase() == "emerald") imagename = "E-5-" + StoneColor + ".png"; imagename = "http://dev.gemfind.net/dealerid_display/images/Ring_Stones/CenterStone/InfinityShapesWithoutProng/" + imagename; document.getElementById("imgSmallShape").src = imagename; $("#divSmallShape").show(); $("#divNotActualSize").hide(); } function LoadInfinityDiamondPrice(tmpShape, tmpCaratWeight, tmpColor, BindFilter, IsSelected) { var rtn = false; $.ajax({ type: "POST", url: "GetBuildRingStep2DiamondData.asmx/GetInfinityPrice", data: "{Shape:'" + tmpShape + "',CaratSize:'" + tmpCaratWeight + "',Color:'" + tmpColor + "',BindWhat:'" + BindFilter + "',IsSelected:'" + IsSelected + "'}", contentType: "application/json; charset=utf-8", dataType: "json", async: false, cache: false, processData: false, success: function (response) { if (response != null) { if (response.d.dtFinal.length > 0) { MakeDisable(BindFilter, response.d.dtFinal[0]["HideData"]); SetCarats(); if (response.d.dtFinal[0][tmpColor + tmpShape] == null) { $(".add_btn_pro1").hide(); $("#lblDiaPrice").html("NA"); } else { if (CntColor == 0 && CntShape == 0 && CntSize == 0) { $(".add_btn_pro1").show(); $("#lblDiaPrice").html(formatCurrency(response.d.dtFinal[0][tmpColor + tmpShape])); } else { $(".add_btn_pro1").hide(); $("#lblDiaPrice").html("NA"); } } RangeID = response.d.dtFinal[0]["RangeID"]; //$("#lblDiaPrice").html(formatCurrency(response.d.dtFinal[0][tmpColor + tmpShape])); rtn = true; //Change Image var imagePath = ""; if (document.getElementById('hfringImageUrl') != null) imagePath = document.getElementById('hfringImageUrl').value var objImage = document.getElementById("imgSetting"); var strURL = '../dealerid_display/CreateRingImageInfinity.aspx?sn=' + imagePath + '&cs=' + InfinityShape + '&ts=false&wi=253&hi=253&sid=' + RingSettingID + '&CTW=' + InfinityCarat + '&StoneColor=' + InfinityColor; objImage.src = strURL; } } }, error: function (msg) { } }); return rtn; } //function ChangeColorShape(Shape) { // if (document.getElementById("imgdiamondq1") != null) { // var objImage = document.getElementById("imgdiamondq1") // var Prefix = GetPrefixOfShape(Shape); // if (Prefix != '') { // objImage.src = "Themes/" + ThemeName + "/images/A" + Prefix + ".png"; // } // else { // objImage.src = "Themes/" + ThemeName + "/images/A.png"; // } // } //} function ChangeShapeColor(intColor) { var Color = ""; switch (intColor.toLowerCase()) { case "amber": Color = "A"; break; case "yellow": Color = "Y"; break; case "red": Color = "R"; break; case "blue": Color = "B"; break; case "clear": Color = "C"; break; case "purple": Color = "P"; break; default: Color = "A"; break; } $('#Round').attr('src', 'Themes/' + ThemeName + '/images/R' + Color + '.jpg'); $('#Pear').attr('src', 'Themes/' + ThemeName + '/images/P' + Color + '.jpg'); $('#Marquise').attr('src', 'Themes/' + ThemeName + '/images/M' + Color + '.jpg'); $('#Heart').attr('src', 'Themes/' + ThemeName + '/images/H' + Color + '.jpg'); $('#Radiant').attr('src', 'Themes/' + ThemeName + '/images/RA' + Color + '.jpg'); $('#Oval').attr('src', 'Themes/' + ThemeName + '/images/O' + Color + '.jpg'); $('#Emerald').attr('src', 'Themes/' + ThemeName + '/images/E' + Color + '.jpg'); $('#Princess').attr('src', 'Themes/' + ThemeName + '/images/PR' + Color + '.jpg'); $('#Asscher').attr('src', 'Themes/' + ThemeName + '/images/A' + Color + '.jpg'); } function formatCurrency(priceVal) { var num = new NumberFormat(); num.setInputDecimal('.'); num.setNumber(priceVal); // obj.value is '5000000.50' num.setPlaces('0', false); num.setCurrencyValue('$'); num.setCurrency(true); num.setCurrencyPosition(num.LEFT_OUTSIDE); num.setNegativeFormat(num.LEFT_DASH); num.setNegativeRed(false); num.setSeparators(true, ',', ','); return num.toFormatted(); } function MakeDisable(bindFiler, HideData) { if (HideData != '' && HideData != "$$") { if (bindFiler == 'Shape') { RevertShape(); var Datas = HideData.split('$$'); var CaratDatas = Datas[0]; var ColorDatas = Datas[1]; var Carats = CaratDatas.split('|'); var Colors = ColorDatas.split('|'); if (Carats != '') { for (var i = 0; i < Carats.length; i++) { var id = Carats[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#" + id + "").attr("onClick").replace('Size', 'Sizes'); $("#" + id + "").attr("onClick", sript); $("#" + id + "").children('img').addClass("disable"); $("#txt" + id + "").children('p').addClass("disable"); } } if (Colors != '') { for (var i = 0; i < Colors.length; i++) { var id = Colors[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#div" + id + "").children('ul').children('li.gud_main').attr("onClick").replace('Quality', 'Qualitys'); $("#div" + id + "").children('ul').children('li.gud_main').attr("onClick", sript); $("#div" + id + "").children('ul').children('li.gud_main').children('img').addClass("disable"); $("#div" + id + "").children('ul').children('li.clr_main').addClass("disable"); } } } if (bindFiler == 'Color') { RevertColor(); var Datas = HideData.split('$$'); var CaratDatas = Datas[0]; var ShapeDate = Datas[1]; var Carats = CaratDatas.split('|'); var Shapes = ShapeDate.split('|'); if (Carats != '') { for (var i = 0; i < Carats.length; i++) { var id = Carats[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#" + id + "").attr("onClick").replace('Size', 'Sizes'); $("#" + id + "").attr("onClick", sript); $("#" + id + "").children('img').addClass("disable"); $("#txt" + id + "").children('p').addClass("disable"); } } if (Shapes != '') { for (var i = 0; i < Shapes.length; i++) { var id = Shapes[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#li" + id + "").attr("onClick").replace('new', 'news'); $("#li" + id + "").attr("onClick", sript); $("#li" + id + "").children('img').addClass("disable"); } } } if (bindFiler == 'Carats') { RevertCarats(); var Datas = HideData.split('$$'); var ShapeDate = Datas[0]; var ColorDatas = Datas[1]; var Shapes = ShapeDate.split('|'); var Colors = ColorDatas.split('|'); if (Shapes != '') { for (var i = 0; i < Shapes.length; i++) { var id = Shapes[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#li" + id + "").attr("onClick").replace('new', 'news'); $("#li" + id + "").attr("onClick", sript); $("#li" + id + "").children('img').addClass("disable"); } } if (Colors != '') { for (var i = 0; i < Colors.length; i++) { var id = Colors[i].replace(/\./g, '').replace(/\-/g, ''); var sript = $("#div" + id + "").children('ul').children('li.gud_main').attr("onClick").replace('Quality', 'Qualitys'); $("#div" + id + "").children('ul').children('li.gud_main').attr("onClick", sript); $("#div" + id + "").children('ul').children('li.gud_main').children('img').addClass("disable"); $("#div" + id + "").children('ul').children('li.clr_main').addClass("disable"); } } } } else { if (bindFiler == 'Shape') { RevertShape(); } if (bindFiler == 'Color') { RevertColor(); } if (bindFiler == 'Carats') { RevertCarats(); } } } function RevertShape() { // Carats $(".radio_btn table tr td").each(function (index) { if ($(this).attr("onClick") != undefined) { var sript = $(this).attr("onClick").replace('Sizes', 'Size'); $(this).attr("onClick", sript); $(this).children('img').removeClass("disable"); } else { $(this).children('p').removeClass("disable"); } }); // Colors $(".diamond_qulity div ul li.gud_main").each(function (index) { var sript = $(this).attr("onClick").replace('Qualitys', 'Quality'); $(this).attr("onClick", sript); $(this).children('img').removeClass("disable"); }); $(".diamond_qulity div ul li.clr_main").each(function (index) { $(this).removeClass("disable"); }); } function RevertColor() { //Shape $(".shp_bx1 ul li").each(function (index) { var sript = $(this).attr("onClick").replace('news', 'new'); $(this).attr("onClick", sript); $(this).children('img').removeClass("disable"); }); //Carats $(".radio_btn table tr td").each(function (index) { if ($(this).attr("onClick") != undefined) { var sript = $(this).attr("onClick").replace('Sizes', 'Size'); $(this).attr("onClick", sript); $(this).children('img').removeClass("disable"); } else { $(this).children('p').removeClass("disable"); } }); } function RevertCarats() { //Shape $(".shp_bx1 ul li").each(function (index) { var sript = $(this).attr("onClick").replace('news', 'new'); $(this).attr("onClick", sript); $(this).children('img').removeClass("disable"); }); // Colors $(".diamond_qulity div ul li.gud_main").each(function (index) { var sript = $(this).attr("onClick").replace('Qualitys', 'Quality'); $(this).attr("onClick", sript); $(this).children('img').removeClass("disable"); }); $(".diamond_qulity div ul li.clr_main").each(function (index) { $(this).removeClass("disable"); }); } function GetPrefixOfShape(Shape) { var str = ""; //switch (Shape.toLowerCase()) { // case "round": // str = "R"; // break // case "pear": // break // case "marquise": // break // case "heart": // str = "H"; // break // case "radiant": // break // case "Oval": // break // case "emerald": // break // case "princess": // break // case "asscher": // break // default: // break; //} return str; } function get_short_url(long_url, login, api_key, func) { $.getJSON( "http://api.bitly.com/v3/shorten?callback=?", { "format": "json", "apiKey": api_key, "login": login, "longUrl": long_url }, function (response) { func(response.data.url); } ); }