/* #################### Slider Code #################### */
var PriceArray = new Array(1);
PriceArray[0] = new Array(4);
PriceArray[0][0] = 200;
PriceArray[0][1] = 200000;
PriceArray[0][2] = 0;
PriceArray[0][3] = 100;
//---------------------- Slider Global Variables--------------//
var SliderBarLeftRightDiff = 0;
var SliderWidth = 16;
//var SliderDiff = 12;
var SliderDiff = 0;
var flgSliderMovementLeft = true;
//---------------------- Slider Global Variables--------------//
var dvDiamonds; //Diamond DataView
var flgRecordFecth = true;
var OrderBy = "fltPrice";
var OrderType = "Asc";
var Shape = "";
var CutMin = 1;
var CutMax = 5;
var ColorMin = 1;
var ColorMax = 7;
var ClarityMin = 1;
var ClarityMax = 10;
var InitialCaratMin = 0.25;
var InitialCaratMax = 10.00;
var CaratMin;
var CaratMax;
var PriceMin;
var PriceMax;
var MouseLeft = 0;
var MouseRight = 0;
//Common variables
var sldMouseLeft = 0;
var sldMouseTop = 0;
//Cut Slider's left Arrow variables
var dosldCutLeftDrag = false;
var sldCutLeftMinLeft = 0;
var sldCutLeftMaxLeft = 0;
//Cut slider's right Arrow variables
var dosldCutRightDrag = false;
var sldCutRightMinLeft = 0;
var sldCutRightMaxLeft = 0;
//Color Slider's left Arrow variables
var dosldColorLeftDrag = false;
var sldColorLeftMinLeft = 0;
var sldColorLeftMaxLeft = 0;
//Color slider's right Arrow variables
var dosldColorRightDrag = false;
var sldColorRightMinLeft = 0;
var sldColorRightMaxLeft = 0;
//Clarity Slider's left Arrow variables
var dosldClarityLeftDrag = false;
var sldClarityLeftMinLeft = 0;
var sldClarityLeftMaxLeft = 0;
//Clarity slider's right Arrow variables
var dosldClarityRightDrag = false;
var sldClarityRightMinLeft = 0;
var sldClarityRightMaxLeft = 0;
//Carat Slider's left Arrow variables
var dosldCaratLeftDrag = false;
var sldCaratLeftMinLeft = 0;
var sldCaratLeftMaxLeft = 0;
//Carat slider's right Arrow variables
var dosldCaratRightDrag = false;
var sldCaratRightMinLeft = 0;
var sldCaratRightMaxLeft = 0;
//Price Slider's left Arrow variables
var dosldPriceLeftDrag = false;
var sldPriceLeftMinLeft = 0;
var sldPriceLeftMaxLeft = 0;
//Price slider's right Arrow variables
var dosldPriceRightDrag = false;
var sldPriceRightMinLeft = 0;
var sldPriceRightMaxLeft = 0;
//Scroll slider
var dosldScrollDrag = false;
var sldScrollMinTop = 0;
var sldScrollMaxTop = 0;
var sldScrollMiddleHeight = 0;
var sldMinSliderHeight = 15;
var sldMaxSliderHeight = 460;
var TimeOutId;
var TimeOptimizeId;
var TimeOptimizeScrollId;
var TimeOutflg = false;
var TimeOutControlflg = false;
var intOptimize = 0;
var XmlHttp;
function fnLearnMoreInfo(source) {
    try {
    var v_learn_more_option = source;
    //Shape 
    if (v_learn_more_option == 1) {
        var v_learn_shape_option = document.getElementById("dv_shape_learn_more_option");
        var v_learn_shape_content = document.getElementById("dv_shape_learn_more_content");
        v_learn_shape_option.style.display = "none";
        v_learn_shape_content.style.display = "block";

        o1 = document.getElementById("td_shape_standard");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
        
    }
    //Price
    else if (v_learn_more_option == 2) {
        var v_learn_price_option = document.getElementById("dv_price_learn_more_option");
        var v_learn_price_content = document.getElementById("dv_price_learn_more_content");
        v_learn_price_option.style.display = "none";
        v_learn_price_content.style.display = "block";

        o1 = document.getElementById("sldPriceLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Carat
    else if (v_learn_more_option == 3) {
        var v_learn_carat_option = document.getElementById("dv_carat_learn_more_option");
        var v_learn_carat_content = document.getElementById("dv_carat_learn_more_content");
        v_learn_carat_option.style.display = "none";
        v_learn_carat_content.style.display = "block";

        o1 = document.getElementById("sldCaratLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Cut
    else if (v_learn_more_option == 4) {
        var v_learn_cut_option = document.getElementById("dv_cut_learn_more_option");
        var v_learn_cut_content = document.getElementById("dv_cut_learn_more_content");
        v_learn_cut_option.style.display = "none";
        v_learn_cut_content.style.display = "block";

        o1 = document.getElementById("sldCutLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Colour
    else if (v_learn_more_option == 5) {
        var v_learn_colour_option = document.getElementById("dv_colour_learn_more_option");
        var v_learn_colour_content = document.getElementById("dv_colour_learn_more_content");
        v_learn_colour_option.style.display = "none";
        v_learn_colour_content.style.display = "block";

        o1 = document.getElementById("sldColorLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Clarity
    else if (v_learn_more_option == 6) {
        var v_learn_clarity_option = document.getElementById("dv_clarity_learn_more_option");
        var v_learn_clarity_content = document.getElementById("dv_clarity_learn_more_content");
        v_learn_clarity_option.style.display = "none";
        v_learn_clarity_content.style.display = "block";

        o1 = document.getElementById("sldClarityLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    fnLoad();
    } catch (Error) { }
}
function fnHideMoreInfo(source) {
    try
    {
    var v_learn_more_option = source;
    //Shape 
    if (v_learn_more_option == 1) {
        var v_learn_shape_option = document.getElementById("dv_shape_learn_more_option");
        var v_learn_shape_content = document.getElementById("dv_shape_learn_more_content");
        v_learn_shape_option.style.display = "block";
        v_learn_shape_content.style.display = "none";

        o1 = document.getElementById("td_shape_standard");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Price
    else if (v_learn_more_option == 2) {
        var v_learn_price_option = document.getElementById("dv_price_learn_more_option");
        var v_learn_price_content = document.getElementById("dv_price_learn_more_content");
        v_learn_price_option.style.display = "block";
        v_learn_price_content.style.display = "none";

        o1 = document.getElementById("sldPriceLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Carat
    else if (v_learn_more_option == 3) {
        var v_learn_carat_option = document.getElementById("dv_carat_learn_more_option");
        var v_learn_carat_content = document.getElementById("dv_carat_learn_more_content");
        v_learn_carat_option.style.display = "block";
        v_learn_carat_content.style.display = "none";

        o1 = document.getElementById("sldCaratLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Cut
    else if (v_learn_more_option == 4) {
        var v_learn_cut_option = document.getElementById("dv_cut_learn_more_option");
        var v_learn_cut_content = document.getElementById("dv_cut_learn_more_content");
        v_learn_cut_option.style.display = "block";
        v_learn_cut_content.style.display = "none";

        o1 = document.getElementById("sldCutLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Colour
    else if (v_learn_more_option == 5) {
        var v_learn_colour_option = document.getElementById("dv_colour_learn_more_option");
        var v_learn_colour_content = document.getElementById("dv_colour_learn_more_content");
        v_learn_colour_option.style.display = "block";
        v_learn_colour_content.style.display = "none";

        o1 = document.getElementById("sldColorLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    //Clarity
    else if (v_learn_more_option == 6) {
        var v_learn_clarity_option = document.getElementById("dv_clarity_learn_more_option");
        var v_learn_clarity_content = document.getElementById("dv_clarity_learn_more_content");
        v_learn_clarity_option.style.display = "block";
        v_learn_clarity_content.style.display = "none";

        o1 = document.getElementById("sldClarityLeft");
        v_obj_stand = document.getElementById("td_standard_diamond_result");
        var v_Top_Stand = getAbsTop(v_obj_stand);
        var v_Top = getAbsTop(o1);
        var v_New_Height;
        if (v_Top > v_Top_Stand) {
            v_New_Height = v_Top - v_Top_Stand;
            if (v_New_Height > 5) {
                v_New_Height = v_New_Height - 5;
            }
        }
        else {
            v_New_Height = 15;
        }
        v_obj = document.getElementById("td_diamond_result_blank_space");
        v_obj.height = v_New_Height + "px";
    }
    fnLoad();
} catch (Error) { }
}
function fnLearnMoreInfo_PopUp(source) {
    try{
    var v_learn_more_option = source;
    //Shape
    if (v_learn_more_option == 1) {
        window.open("/Diamonds/Learn-About-Diamond-Shape/", "", "height=400,width=650,left=10,top=10,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no")
    }
    //Price
    else if (v_learn_more_option == 2) {
        window.open("/Diamonds/Learn-About-Diamond-Price/", "", "height=400,width=650,left=10,top=10,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no")
    }
    //Carat Weight
    else if (v_learn_more_option == 3) {
        window.open("/Diamonds/Learn-About-Diamond-Carat-Weight/", "", "height=400,width=650,left=10,top=10,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no")
    }
    //Cut
    else if (v_learn_more_option == 4) {
        window.open("/Diamonds/Learn-About-Diamond-Cut/", "", "height=400,width=650,left=10,top=10,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no")
    }
    //Colour
    else if (v_learn_more_option == 5) {
        window.open("/Diamonds/Learn-About-Diamond-Colour/", "", "height=400,width=650,left=10,top=10,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no")
    }
    //Clarity
    else if (v_learn_more_option == 6) {
        window.open("/Diamonds/Learn-About-Diamond-Clarity/", "", "height=400,width=650,left=10,top=10,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,resizable=no")
    }
    } catch (Error) { }
}
function fnHideMoreInfo_PopUp(source) {
    var v_learn_more_option = source;
    window.close();
}
function fnServer_Callback_Check(v_Shape_RB, v_Shape_PR, v_Shape_EM, v_Shape_HE, v_Shape_MQ, v_Shape_OV, v_Shape_PE, v_Shape_RD, v_Shape_AS, v_Shape_CS, v_Shape_TR, v_Price_Min, v_Price_Max, v_Carat_Min, v_Carat_Max, v_Cut_Min, v_Cut_Max, v_Colour_Min, v_Colour_Max, v_Clarity_Min, v_Clarity_Max, v_Labs, v_Category_Code, v_Sub_Category_Code, v_Diamond_Search_Type, v_search_option) {
    try
    {
    document.getElementById("hdn_JavaScript_Enabled").value = "1";
    //Parameter Values from Hidden Fields
    //Shapes
    var v_Shapes;
    //Prices
    var v_Prices;
    //Carats
    var v_Carats;
    //Cuts
    var v_Cuts;
    //Colours
    var v_Colours;
    //Clarities
    var v_Clarities;
    //Others
    var v_Others;
    //Combining Shapes
    v_Shapes = v_Shape_RB + "," + v_Shape_PR + "," + v_Shape_EM + "," + v_Shape_HE + "," + v_Shape_MQ + "," + v_Shape_OV + "," + v_Shape_PE + "," + v_Shape_RD + "," + v_Shape_AS + "," + v_Shape_CS + "," + v_Shape_TR;
    //Combining Prices
    v_Prices = v_Price_Min + "," + v_Price_Max;
    //Combining Carats
    v_Carats = v_Carat_Min + "," + v_Carat_Max;
    //Combining Cuts
    v_Cuts = v_Cut_Min + "," + v_Cut_Max;
    //Combining Colours
    v_Colours = v_Colour_Min + "," + v_Colour_Max;
    //Combining Clarities
    v_Clarities = v_Clarity_Min + "," + v_Clarity_Max;
    //Combining Others
    v_Others = v_Category_Code + "," + v_Sub_Category_Code + "," + v_Diamond_Search_Type
    //Setting Cookies Values
    var v_all_values = v_Shapes + "," + v_Prices + "," + v_Carats + "," + v_Cuts + "," + v_Colours + "," + v_Clarities + "," + v_Labs + "," + v_Others;
    var exdate = new Date();
    var expiredays = 365;
    exdate.setDate(exdate.getDate() + expiredays);
    if (v_search_option == "2") {
        //document.cookie = "Matched_Pairs_Search_Cookie=" + escape(v_all_values) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
        
        document.cookie = "Matched_Pairs_Search_Cookie=" + escape(v_all_values) + ";expires=" + exdate.toGMTString() + ";path=/";
    }
    else {
        //document.cookie = "Diamond_Search_Cookie=" + escape(v_all_values) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
        document.cookie = "Diamond_Search_Cookie=" + escape(v_all_values) + ";expires=" + exdate.toGMTString() + ";path=/";
    }
    //return false;
    } catch (Error) { }
}
function sldMouseUp(e) {
    dosldCutLeftDrag = false;
    dosldCutRightDrag = false;
    dosldColorLeftDrag = false;
    dosldColorRightDrag = false;
    dosldClarityLeftDrag = false;
    dosldClarityRightDrag = false;
    dosldCaratLeftDrag = false;
    dosldCaratRightDrag = false;
    dosldPriceLeftDrag = false;
    dosldPriceRightDrag = false;
    dosldScrollDrag = false;
    TimeOutflg = false;
    TimeOutControlflg = false;
    window.clearInterval(TimeOutId);
    return true;
}

/* ######################### Cut Functions ######################### */
function fnCutLeftCheck(Pos) {
    try {
    var Old_CutMin = CutMin;
    for (var i = 1; i <= 5; i++) {
        o = document.getElementById("tdCut_" + i);
        if (Pos >= getAbsLeft(o) && Pos <= getAbsLeft(o) + o.offsetWidth) {
            CutMin = i;
            if (!flgRecordFecth && Old_CutMin != CutMin) {
                fnFetchDiamonds(false);
            }
        }
    }
    document.getElementById("hdn_Min_Cut").value = CutMin;
} catch (Error) { }
}
function fnCutRightCheck(Pos) {
    try{
    var Old_CutMax = CutMax;
    for (var i = 1; i <= 5; i++) {
        o = document.getElementById("tdCut_" + i);
        if (Pos >= getAbsLeft(o) && Pos <= getAbsLeft(o) + o.offsetWidth) {
            CutMax = i;
            if (!flgRecordFecth && Old_CutMax != CutMax) {
                fnFetchDiamonds(false);
            }
        }
    }
    document.getElementById("hdn_Max_Cut").value = CutMax;
} catch (Error) { }
}
function setLeftCutSlider() {
    try{
    //Set Left Diamond
    oTableCell = document.getElementById("tdCut_" + CutMin);
    osldCutLeft = document.getElementById("sldCutLeft");
    newPos = getAbsLeft(oTableCell) + (oTableCell.offsetWidth * (0.50) - osldCutLeft.offsetWidth / 2);
    //Setting Slider To Left
    if ("tdCut_" + CutMin == "tdCut_1") {
        newPos = newPos - 54;
    }
    sldCutRightMinLeft = newPos + SliderBarLeftRightDiff;
    setPosition(osldCutLeft, newPos, sldCutTop);
    o = document.getElementById("sldCutMiddle");
    o.style.left = newPos;
    if (CutMax == CutMin)
        o.style.width = 0;
    else {
        if (sldCutLeftMaxLeft + 10 - newPos < 0)
            o.style.width = 0;
        else
            o.style.width = sldCutLeftMaxLeft + 10 - newPos;
    }
    return false;
} catch (Error) { }
}
function setRightCutSlider() {
    try{
    oTableCell = document.getElementById("tdCut_" + CutMax);
    osldCutRight = document.getElementById("sldCutRight");
    newPos = getAbsLeft(oTableCell) + (oTableCell.offsetWidth * (0.50) - osldCutRight.offsetWidth / 2) - SliderDiff - 3;
    //Setting Slider To Right
    if ("tdCut_" + CutMax == "tdCut_5") {
        newPos = newPos + 55;
    }
    sldCutLeftMaxLeft = newPos - 2;
    setPosition(osldCutRight, newPos, sldCutTop);
    o = document.getElementById("sldCutMiddle");
    if (CutMax == CutMin)
        o.style.width = 0;
    else {
        if (newPos - sldCutRightMinLeft + 10 < 0)
            o.style.width = 0;
        else
            o.style.width = newPos - sldCutRightMinLeft + 10;
    }
    return false;
} catch (Error) { }
}
function sldCutLeftMouseUp(e) {
    try{
    if (!e) { e = window.event }
    dosldCutLeftDrag = true;
    o1 = document.getElementById("sldCutLeft");
    var newPos = e.clientX - sldMouseLeft;
    for (var i = 1; i <= 5; i++) {
        o = document.getElementById("tdCut_" + i);
        if (newPos <= sldCutLeftMinLeft)
        { newPos = sldCutLeftMinLeft };
        if (newPos >= sldCutLeftMaxLeft)
        { newPos = sldCutLeftMaxLeft };
        if (newPos >= getAbsLeft(o) && newPos <= getAbsLeft(o) + o.offsetWidth) {
            newPos = getAbsLeft(o) + (o.offsetWidth * (0.50) - o1.offsetWidth / 2);
            if ("tdCut_" + i == "tdCut_1") {
                newPos = newPos - 54;
            }
            sldCutRightMinLeft = newPos + SliderBarLeftRightDiff;
            o2 = document.getElementById("sldCutLeft");
            setPosition(o2, newPos, sldCutTop);
            fnCutLeftCheck(newPos);
            o2 = document.getElementById("sldCutMiddle");
            o2.style.left = newPos;
            if (sldCutLeftMaxLeft + 10 - newPos > 0) {
                o2.style.width = sldColorLeftMaxLeft + 10 - newPos;
            }
            else {
                o2.style.width = 0;
            }
        }
    }
} catch (Error) { }
}
function sldCutRightMouseUp(e) {
    try{
    if (!e) { e = window.event }
    dosldCutLeftDrag = true;
    o1 = document.getElementById("sldCutLeft");
    var newPos = e.clientX - sldMouseLeft;
    for (var i = 1; i <= 5; i++) {
        o = document.getElementById("tdCut_" + i);
        if (newPos <= sldCutRightMinLeft) { newPos = sldCutRightMinLeft };
        if (newPos >= sldCutRightMaxLeft) { newPos = sldCutRightMaxLeft };
        if (newPos >= getAbsLeft(o) && newPos <= getAbsLeft(o) + o.offsetWidth) {
            newPos = getAbsLeft(o) + (o.offsetWidth * (0.50) - o1.offsetWidth / 2) - SliderDiff - 3;
            if ("tdCut_" + i == "tdCut_5") {
                newPos = newPos + 55;
            }
            sldCutLeftMaxLeft = newPos - SliderBarLeftRightDiff;
            o3 = document.getElementById("sldCutRight");
            setPosition(o3, newPos, sldCutTop);
            fnCutRightCheck(newPos);
            o3 = document.getElementById("sldCutMiddle");
            if (newPos - sldCutRightMinLeft + 10 > 0) {
                o3.style.width = newPos - sldCutRightMinLeft + 10;
            }
            else {
                o3.style.width = 0;
            }
        }
    }
} catch (Error) { }
}
function sldCutLeftMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldCutLeftDrag = true;
    o1 = document.getElementById("sldCutLeft");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
// Mouse Over/Out Functions 
function sldMouseOver(obj) {
    obj.className = "cursor_hand";
}
function sldMouseOut(obj) {
    obj.className = "cursor_normal";
}
function sldCutRightMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldCutRightDrag = true;
    o1 = document.getElementById("sldCutRight");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
/* ######################### Colour Functions ######################### */
function fnColorLeftCheck(Pos) {
    try{
    var Old_ColorMin = ColorMin;
    for (var i = 1; i <= 7; i++) {
        o = document.getElementById("tdColor_" + i);
        if (Pos >= getAbsLeft(o) && Pos <= getAbsLeft(o) + o.offsetWidth) {
            ColorMin = i;
            if (!flgRecordFecth && Old_ColorMin != ColorMin) {
                fnFetchDiamonds(false);
            }
        }
    }
    document.getElementById("hdn_Min_Colour").value = ColorMin;
} catch (Error) { }
}
function fnColorRightCheck(Pos) {
    try{
    var Old_ColorMax = ColorMax;
    for (var i = 1; i <= 7; i++) {
        o = document.getElementById("tdColor_" + i);
        if (Pos >= getAbsLeft(o) && Pos <= getAbsLeft(o) + o.offsetWidth) {
            ColorMax = i;
            if (!flgRecordFecth && Old_ColorMax != ColorMax) {
                fnFetchDiamonds(false);
            }
        }
    }
    document.getElementById("hdn_Max_Colour").value = ColorMax;
} catch (Error) { }
}
function setLeftColorSlider() {
    try {
    //Set Left Diamond
    oTableCell = document.getElementById("tdColor_" + ColorMin);
    osldColorLeft = document.getElementById("sldColorLeft");
    newPos = getAbsLeft(oTableCell) + (oTableCell.offsetWidth * (0.50) - osldColorLeft.offsetWidth / 2);
    //Setting Slider To Left
   if ("tdColor_" + ColorMin == "tdColor_1") {
        newPos = newPos - 37;
    }
    sldColorRightMinLeft = newPos + SliderBarLeftRightDiff;
    setPosition(osldColorLeft, newPos, sldColorTop);
    o = document.getElementById("sldColorMiddle");
    o.style.left = newPos;
    if (ColorMax == ColorMin)
        o.style.width = 0;
    else {
        if (sldColorLeftMaxLeft + 10 - newPos < 0)
            o.style.width = 0;
        else
            o.style.width = sldColorLeftMaxLeft + 10 - newPos;
    }
    return false;
} catch (Error) { }
}
function setRightColorSlider() {
    try{
    oTableCell = document.getElementById("tdColor_" + ColorMax);
    osldColorRight = document.getElementById("sldColorRight");
    newPos = getAbsLeft(oTableCell);
    //newPos = getAbsLeft(oTableCell) + (oTableCell.offsetWidth * (0.50) - osldColorRight.offsetWidth / 2) - SliderDiff - 3;
    //Setting Slider To Right
    if ("tdColor_" + ColorMax == "tdColor_7") {
        newPos = newPos + 69;
    }
    sldColorLeftMaxLeft = newPos - 2;
    setPosition(osldColorRight, newPos, sldColorTop);
    o = document.getElementById("sldColorMiddle");
    if (ColorMax == ColorMin)
        o.style.width = 0;
    else {
        if (newPos - sldColorRightMinLeft + 10 < 0)
            o.style.width = 0;
        else
            o.style.width = newPos - sldColorRightMinLeft + 10;
    }
    return false;
} catch (Error) { }
}
function sldColorLeftMouseUp(e) {
    try{
    if (!e) { e = window.event }
    dosldColorLeftDrag = true;
    o1 = document.getElementById("sldColorLeft");
    var newPos = e.clientX - sldMouseLeft;
    for (var i = 1; i <= 7; i++) {
        o = document.getElementById("tdColor_" + i);
        if (newPos <= sldColorLeftMinLeft)
        { newPos = sldColorLeftMinLeft };
        if (newPos >= sldColorLeftMaxLeft)
        { newPos = sldColorLeftMaxLeft };

        if (newPos >= getAbsLeft(o) && newPos <= getAbsLeft(o) + o.offsetWidth) {
            newPos = getAbsLeft(o) + (o.offsetWidth * (0.50) - o1.offsetWidth / 2);
            if ("tdColor_" + i == "tdColor_1") {
                newPos = newPos - 37;
            }
            sldColorRightMinLeft = newPos + SliderBarLeftRightDiff;
            o2 = document.getElementById("sldColorLeft");
            setPosition(o2, newPos, sldColorTop);
            fnColorLeftCheck(newPos);
            o2 = document.getElementById("sldColorMiddle");
            o2.style.left = newPos;
            if (sldColorLeftMaxLeft + 10 - newPos > 0) {
                o2.style.width = sldColorLeftMaxLeft + 10 - newPos;
            }
            else {
                o2.style.width = 0;
            }
        }
    }
} catch (Error) { }
}
function sldColorRightMouseUp(e) {
    try{
    if (!e) { e = window.event }
    dosldColorLeftDrag = true;
    o1 = document.getElementById("sldColorLeft");
    var newPos = e.clientX - sldMouseLeft;
    for (var i = 1; i <= 7; i++) {
        o = document.getElementById("tdColor_" + i);
        if (newPos <= sldColorRightMinLeft) { newPos = sldColorRightMinLeft };
        if (newPos >= sldColorRightMaxLeft) { newPos = sldColorRightMaxLeft };
        if (newPos >= getAbsLeft(o) && newPos <= getAbsLeft(o) + o.offsetWidth) {
            newPos = getAbsLeft(o) + (o.offsetWidth * (0.50) - o1.offsetWidth / 2) - SliderDiff - 3;
            if ("tdColor_" + i == "tdColor_7") {
                newPos = newPos + 37;
            }
            sldColorLeftMaxLeft = newPos - SliderBarLeftRightDiff;
            o3 = document.getElementById("sldColorRight");
            setPosition(o3, newPos, sldColorTop);
            fnColorRightCheck(newPos);
            o3 = document.getElementById("sldColorMiddle");
            if (newPos - sldColorRightMinLeft + 10 > 0) {
                o3.style.width = newPos - sldColorRightMinLeft + 10;
            }
            else {
                o3.style.width = 0;
            }
        }
    }
} catch (Error) { }
}
function sldColorLeftMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldColorLeftDrag = true;
    o1 = document.getElementById("sldColorLeft");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
function sldColorRightMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldColorRightDrag = true;
    o1 = document.getElementById("sldColorRight");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
/* ######################### Clarity Functions ######################### */
function fnClarityLeftCheck(Pos) {
    try{
    var Old_ClarityMin = ClarityMin;
    for (var i = 1; i <= 10; i++) {
        o = document.getElementById("tdClarity_" + i);
        if (Pos >= getAbsLeft(o) && Pos <= getAbsLeft(o) + o.offsetWidth) {
            ClarityMin = i;
            if (!flgRecordFecth && Old_ClarityMin != ClarityMin) {
                fnFetchDiamonds(false);
            }
        }
    }
    document.getElementById("hdn_Min_Clarity").value = ClarityMin;
} catch (Error) { }
}
function fnClarityRightCheck(Pos) {
    try {
    var Old_ClarityMax = ClarityMax;
    for (var i = 1; i <= 10; i++) {
        o = document.getElementById("tdClarity_" + i);
        if (Pos >= getAbsLeft(o) && Pos <= getAbsLeft(o) + o.offsetWidth) {
            ClarityMax = i;
            if (!flgRecordFecth && Old_ClarityMax != ClarityMax) {
                fnFetchDiamonds(false);
            }
        }
    }
    document.getElementById("hdn_Max_Clarity").value = ClarityMax;
} catch (Error) { }
}
function setLeftClaritySlider() {
    try{
    oTableCell = document.getElementById("tdClarity_" + ClarityMin);
    osldClarityLeft = document.getElementById("sldClarityLeft");
    newPos = getAbsLeft(oTableCell) + (oTableCell.offsetWidth * (0.50) - osldClarityLeft.offsetWidth / 2);
    //Setting Slider To Left
    if ("tdClarity_" + ColorMin == "tdClarity_1") {
        newPos = newPos - 22;
    }
    sldClarityRightMinLeft = newPos + SliderBarLeftRightDiff;
    setPosition(osldClarityLeft, newPos, sldClarityTop);
    o = document.getElementById("sldClarityMiddle");
    o.style.left = newPos;
    if (ClarityMax == ClarityMin)
        o.style.width = 0;
    else {
        if (sldClarityLeftMaxLeft + 10 - newPos < 0)
            o.style.width = 0;
        else
            o.style.width = sldClarityLeftMaxLeft + 10 - newPos;
    }
    return false;
} catch (Error) { }
}
function setRightClaritySlider() {
    try{
    oTableCell = document.getElementById("tdClarity_" + ClarityMax);
    osldClarityRight = document.getElementById("sldClarityRight");
    newPos = getAbsLeft(oTableCell) + (oTableCell.offsetWidth * (0.50) - osldClarityRight.offsetWidth / 2) - SliderDiff - 3;
    //Setting Slider To Right
    if ("tdClarity_" + ClarityMax == "tdClarity_10") {
        newPos = newPos + 23;
    }
    sldClarityLeftMaxLeft = newPos - 2;
    setPosition(osldClarityRight, newPos, sldClarityTop);
    o = document.getElementById("sldClarityMiddle");
    if (ClarityMax == ClarityMin)
        o.style.width = 0;
    else {
        if (newPos - sldClarityRightMinLeft + 10 < 0)
            o.style.width = 0;
        else
            o.style.width = newPos - sldClarityRightMinLeft + 10;
    }
    return false;
} catch (Error) { }
}
function sldClarityLeftMouseUp(e) {
    try {
    if (!e) { e = window.event }
    dosldClarityLeftDrag = true;
    o1 = document.getElementById("sldClarityLeft");
    var newPos = e.clientX - sldMouseLeft;
    for (var i = 1; i <= 10; i++) {
        o = document.getElementById("tdClarity_" + i);
        if (newPos <= sldClarityLeftMinLeft)
        { newPos = sldClarityLeftMinLeft };
        if (newPos >= sldClarityLeftMaxLeft)
        { newPos = sldClarityLeftMaxLeft };
        if (newPos >= getAbsLeft(o) && newPos <= getAbsLeft(o) + o.offsetWidth) {
            newPos = getAbsLeft(o) + (o.offsetWidth * (0.50) - o1.offsetWidth / 2);
            if ("tdClarity_" + i == "tdClarity_1") {
                newPos = newPos - 22;
            }
            sldClarityRightMinLeft = newPos + SliderBarLeftRightDiff;
            o2 = document.getElementById("sldClarityLeft");
            setPosition(o2, newPos, sldClarityTop);
            fnClarityLeftCheck(newPos);
            o2 = document.getElementById("sldClarityMiddle");
            o2.style.left = newPos;
            if (sldClarityLeftMaxLeft + 10 - newPos > 0) {
                o2.style.width = sldClarityLeftMaxLeft + 10 - newPos;
            }
            else {
                o2.style.width = 0;
            }
        }
    }
} catch (Error) { }
}
function sldClarityRightMouseUp(e) {
    try{
    if (!e) { e = window.event }
    dosldClarityLeftDrag = true;
    o1 = document.getElementById("sldClarityLeft");
    var newPos = e.clientX - sldMouseLeft;
    for (var i = 1; i <= 10; i++) {
        o = document.getElementById("tdClarity_" + i);
        if (newPos <= sldClarityRightMinLeft) { newPos = sldClarityRightMinLeft };
        if (newPos >= sldClarityRightMaxLeft) { newPos = sldClarityRightMaxLeft };
        if (newPos >= getAbsLeft(o) && newPos <= getAbsLeft(o) + o.offsetWidth) {
            newPos = getAbsLeft(o) + (o.offsetWidth * (0.50) - o1.offsetWidth / 2) - SliderDiff - 3;
            if ("tdClarity_" + i == "tdClarity_10") {
                newPos = newPos + 23;
            }
            sldClarityLeftMaxLeft = newPos - SliderBarLeftRightDiff;
            o3 = document.getElementById("sldClarityRight");
            setPosition(o3, newPos, sldClarityTop);
            fnClarityRightCheck(newPos);
            o3 = document.getElementById("sldClarityMiddle");
            if (newPos - sldClarityRightMinLeft + 10 > 0) {
                o3.style.width = newPos - sldClarityRightMinLeft + 10;
            }
            else {
                o3.style.width = 0;
            }
        }
    }
} catch (Error) { }
}
function sldClarityLeftMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldClarityLeftDrag = true;
    o1 = document.getElementById("sldClarityLeft");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
function sldClarityRightMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldClarityRightDrag = true;
    o1 = document.getElementById("sldClarityRight");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
/* ######################### Carat Functions ######################### */
function setLeftCaratSlider() {
    try {
    osldCaratLeft = document.getElementById("sldCaratLeft");
    var v_Min_Carat_Position = 0;
    try {
        v_Min_Carat_Position = parseInt(document.getElementById("hdn_Min_Carat_Left").value);
    }
    catch (err) {
        null;
    }
    if (parseFloat(CaratMin) > parseFloat(InitialCaratMin) && v_Min_Carat_Position > 0) {
        var v_carat_weight_diff = parseFloat(CaratMin - InitialCaratMin).toFixed(2);
        var v_intial_left = parseInt(document.getElementById("hdn_Min_Carat_Left").value);
        //Matched Pairs Search
        if (document.getElementById("hdn_Search_Option").value == "2") {
            //0.50ct to 2.00ct
            if (v_carat_weight_diff <= 1.75) {
                var v_carat_left_upto_200 = parseInt(parseFloat((v_carat_weight_diff * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_200) + parseInt(v_Min_Carat_Position);
            }
            //2.00ct to 3.00ct 
            else if (v_carat_weight_diff > 1.75 && v_carat_weight_diff <= 2.75) {
                var v_carat_left_upto_200 = 450;
                var v_carat_left_from_201_to_300 = parseInt(parseFloat(((v_carat_weight_diff - 1.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_200) + parseInt(v_carat_left_from_201_to_300 / 5) + parseInt(v_Min_Carat_Position);
            }
            //3.00ct to 4.00ct 
            else if (v_carat_weight_diff > 2.75 && v_carat_weight_diff <= 3.75) {
                var v_carat_left_upto_200 = 450;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_301_to_400 = parseInt(parseFloat(((v_carat_weight_diff - 2.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_200) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_301_to_400 / 10) + parseInt(v_Min_Carat_Position);
            }
            //4.00ct to 6.00ct 
            else if (v_carat_weight_diff > 3.75 && v_carat_weight_diff <= 5.75) {
                var v_carat_left_upto_200 = 450;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_401_to_600 = parseInt(parseFloat(((v_carat_weight_diff - 3.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_200) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_401_to_600 / 20) + parseInt(v_Min_Carat_Position);
            }
            //6.00ct to 10.00ct 
            else if (v_carat_weight_diff > 5.75 && v_carat_weight_diff <= 9.75) {
                var v_carat_left_upto_200 = 450;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_601_to_1000 = parseInt(parseFloat(((v_carat_weight_diff - 5.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_200) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_601_to_1000 / 40) + parseInt(v_Min_Carat_Position);
            }
            else {
                var percentage = Math.round((CaratMin - InitialCaratMin) * 100 / (InitialCaratMax - InitialCaratMin));
                var newPos = Math.round(((percentage * (sldCaratRightMaxLeft - sldCaratLeftMinLeft)) / 100) + sldCaratLeftMinLeft);
            }
        }
        //Loose Diamonds Search
        else {
            
            //0.25ct to 1.50ct
            if (v_carat_weight_diff <= 1.25) {
                var v_carat_left_upto_150 = parseInt(parseFloat((v_carat_weight_diff * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_150) + parseInt(v_Min_Carat_Position);
            }
            //1.50ct to 2.00ct
            else if (v_carat_weight_diff > 1.25 && v_carat_weight_diff <= 1.75) {
                var v_carat_left_upto_150 = 375;
                var v_carat_left_from_151_to_200 = parseInt(parseFloat(((v_carat_weight_diff - 1.25) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_150) + parseInt(v_carat_left_from_151_to_200 / 2) + parseInt(v_Min_Carat_Position);
            }
            //2.00ct to 3.00ct 
            else if (v_carat_weight_diff > 1.75 && v_carat_weight_diff <= 2.75) {
                var v_carat_left_upto_150 = 375;
                var v_carat_left_from_151_to_200 = 75;
                var v_carat_left_from_201_to_300 = parseInt(parseFloat(((v_carat_weight_diff - 1.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_150) + parseInt(v_carat_left_from_151_to_200) + parseInt(v_carat_left_from_201_to_300 / 5) + parseInt(v_Min_Carat_Position);
            }
            //3.00ct to 4.00ct 
            else if (v_carat_weight_diff > 2.75 && v_carat_weight_diff <= 3.75) {
                var v_carat_left_from_151_to_200 = 75;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_301_to_400 = parseInt(parseFloat(((v_carat_weight_diff - 2.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_150) + parseInt(v_carat_left_from_151_to_200) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_301_to_400 / 10) + parseInt(v_Min_Carat_Position);
            }
            //4.00ct to 6.00ct 
            else if (v_carat_weight_diff > 3.75 && v_carat_weight_diff <= 5.75) {
                var v_carat_left_upto_150 = 375;
                var v_carat_left_from_151_to_200 = 75;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_401_to_600 = parseInt(parseFloat(((v_carat_weight_diff - 3.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_150) + parseInt(v_carat_left_from_151_to_200) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_401_to_600 / 20) + parseInt(v_Min_Carat_Position);
            }
            //6.00ct to 10.00ct 
            else if (v_carat_weight_diff > 5.75 && v_carat_weight_diff <= 9.75) {
                var v_carat_left_upto_150 = 375;
                var v_carat_left_from_151_to_200 = 75;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_601_to_1000 = parseInt(parseFloat(((v_carat_weight_diff - 5.75) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_carat_left_upto_150) + parseInt(v_carat_left_from_151_to_200) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_601_to_1000 / 40) + parseInt(v_Min_Carat_Position);
            }
            else {
                var percentage = Math.round((CaratMin - InitialCaratMin) * 100 / (InitialCaratMax - InitialCaratMin));
                var newPos = Math.round(((percentage * (sldCaratRightMaxLeft - sldCaratLeftMinLeft)) / 100) + sldCaratLeftMinLeft);
            }
        }
    }
    else {
        var percentage = Math.round((CaratMin - InitialCaratMin) * 100 / (InitialCaratMax - InitialCaratMin));
        var newPos = Math.round(((percentage * (sldCaratRightMaxLeft - sldCaratLeftMinLeft)) / 100) + sldCaratLeftMinLeft);
    }
    sldCaratRightMinLeft = newPos;
    setPosition(osldCaratLeft, newPos, sldCaratTop);
    o = document.getElementById("sldCaratMiddle");
    o.style.left = newPos;
    if (CaratMax == CaratMin)
        o.style.width = 0;
    else
        o.style.width = sldCaratLeftMaxLeft + SliderWidth - newPos;
    return false;
} catch (Error) { }
}
function setRightCaratSlider() {
try{
    osldCaratRight = document.getElementById("sldCaratRight");
    var v_Max_Carat_Position = 0;
    try {
        v_Max_Carat_Position = parseInt(document.getElementById("hdn_Max_Carat_Left").value);
    }
    catch (err) {
        null;
    }
    if (parseFloat(CaratMax) < parseFloat(InitialCaratMax) && v_Max_Carat_Position > 0) {
        var v_carat_weight_diff = parseFloat(InitialCaratMax - CaratMax).toFixed(2);
        //Matched Pairs Search
        if (document.getElementById("hdn_Search_Option").value == "2") {
            //6.00ct to 10.00ct
            if (v_carat_weight_diff <= 4.00) {
                var v_carat_left_from_601_to_1000 = parseInt(parseFloat((v_carat_weight_diff * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - parseInt(v_carat_left_from_601_to_1000 / 40);
            }
            //4.00ct to 6.00ct
            else if (v_carat_weight_diff > 4.00 && v_carat_weight_diff <= 6.00) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = parseInt(parseFloat(((v_carat_weight_diff - 4.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600 / 20));
            }
            //3.00ct to 4.00ct
            else if (v_carat_weight_diff > 6.00 && v_carat_weight_diff <= 7.00) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = parseInt(parseFloat(((v_carat_weight_diff - 6.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400 / 10));
            }
            //2.00ct to 3.00ct
            else if (v_carat_weight_diff > 7.00 && v_carat_weight_diff <= 8.00) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_201_to_300 = parseInt(parseFloat(((v_carat_weight_diff - 7.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_201_to_300 / 5));
            }
            //0.50ct to 2.00ct
            else if (v_carat_weight_diff > 8.00 && v_carat_weight_diff <= 9.50) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_upto_200 = parseInt(parseFloat(((v_carat_weight_diff - 8.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_upto_200));
            }
            else {
                var percentage = Math.round((CaratMax - InitialCaratMin) * 100 / (InitialCaratMax - InitialCaratMin));
                var newPos = Math.round(((percentage * (sldCaratRightMaxLeft - sldCaratLeftMinLeft)) / 100) + sldCaratLeftMinLeft);
            }
        }
        //Loose Diamonds Search
        else {
            //6.00ct to 10.00ct
            if (v_carat_weight_diff <= 4.00) {
                var v_carat_left_from_601_to_1000 = parseInt(parseFloat((v_carat_weight_diff * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - parseInt(v_carat_left_from_601_to_1000 / 40);
            }
            //4.00ct to 6.00ct
            else if (v_carat_weight_diff > 4.00 && v_carat_weight_diff <= 6.00) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = parseInt(parseFloat(((v_carat_weight_diff - 4.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600 / 20));
            }
            //3.00ct to 4.00ct
            else if (v_carat_weight_diff > 6.00 && v_carat_weight_diff <= 7.00) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = parseInt(parseFloat(((v_carat_weight_diff - 6.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400 / 10));
            }
            //2.00ct to 3.00ct
            else if (v_carat_weight_diff > 7.00 && v_carat_weight_diff <= 8.00) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_201_to_300 = parseInt(parseFloat(((v_carat_weight_diff - 7.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_201_to_300 / 5));
            }
            //1.50ct to 2.00ct
            else if (v_carat_weight_diff > 8.00 && v_carat_weight_diff <= 8.50) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_151_to_200 = parseInt(parseFloat(((v_carat_weight_diff - 8.00) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_151_to_200 / 2));
            }
            //0.25ct to 1.50ct
            else if (v_carat_weight_diff > 8.50 && v_carat_weight_diff <= 9.75) {
                var v_carat_left_from_601_to_1000 = 30;
                var v_carat_left_from_401_to_600 = 30;
                var v_carat_left_from_301_to_400 = 30;
                var v_carat_left_from_201_to_300 = 60;
                var v_carat_left_from_151_to_200 = 75;
                var v_carat_left_from_upto_151 = parseInt(parseFloat(((v_carat_weight_diff - 8.50) * 3)).toFixed(2) * 100);
                var newPos = parseInt(v_Max_Carat_Position) - (parseInt(v_carat_left_from_601_to_1000) + parseInt(v_carat_left_from_401_to_600) + parseInt(v_carat_left_from_301_to_400) + parseInt(v_carat_left_from_201_to_300) + parseInt(v_carat_left_from_151_to_200) + parseInt(v_carat_left_from_upto_151));
            }
            else {
                var percentage = Math.round((CaratMax - InitialCaratMin) * 100 / (InitialCaratMax - InitialCaratMin));
                var newPos = Math.round(((percentage * (sldCaratRightMaxLeft - sldCaratLeftMinLeft)) / 100) + sldCaratLeftMinLeft);
            }
        }
    }
    else {
        var percentage = Math.round((CaratMax - InitialCaratMin) * 100 / (InitialCaratMax - InitialCaratMin));
        var newPos = Math.round(((percentage * (sldCaratRightMaxLeft - sldCaratLeftMinLeft)) / 100) + sldCaratLeftMinLeft);
    }
    sldCaratLeftMaxLeft = newPos;
    setPosition(osldCaratRight, newPos, sldCaratTop);
    o = document.getElementById("sldCaratMiddle");
    if (CaratMax == CaratMin)
        o.style.width = 0;
    else
        o.style.width = newPos - sldCaratRightMinLeft + SliderWidth;
    return false;
} catch (Error) { }
}
function fnCaratLeftCheck(Pos) {
    try{
    var Old_CaratMin = CaratMin;
    var v_Min_Carat_Position = 0;
    try {
        v_Min_Carat_Position = parseInt(document.getElementById("hdn_Min_Carat_Left").value);
    }
    catch (err) {
        null;
    }
    if (v_Min_Carat_Position > 0 && v_Min_Carat_Position < Pos) {
        //Fixed Carat Movement Logic Here
        var v_difference = parseInt(Pos - v_Min_Carat_Position);
        if (v_difference >= 0) 
        {
            //Matched Pairs Search
            if (document.getElementById("hdn_Search_Option").value == "2") {
                var v_left_carat_position_upto_200 = 0;
                var v_left_carat_position_from_201_to_300 = 0;
                var v_left_carat_position_from_301_to_400 = 0;
                var v_left_carat_position_from_401_to_600 = 0;
                var v_left_carat_position_above_600 = 0;
                var NewCarat_Add = 0;
                if (v_difference <= 3) {
                    NewCarat_Add = 0;
                }
                //0.50ct to 2.00ct
                else if (v_difference > 3 && v_difference <= 450) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_200 = parseFloat(v_exact_difference * 0.01);
                    NewCarat_Add = parseFloat(v_left_carat_position_upto_200).toFixed(2);
                }
                //2.00ct to 3.00ct
                else if (v_difference > 450 && v_difference <= 510) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_200 = (150 * 0.01);
                    v_left_carat_position_from_201_to_300 = ((v_exact_difference - 150) * 0.05);
                    NewCarat_Add = (v_left_carat_position_upto_200 + v_left_carat_position_from_201_to_300);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //3.00ct to 4.00ct
                else if (v_difference > 510 && v_difference <= 540) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_200 = (150 * 0.01);
                    v_left_carat_position_from_201_to_300 = (20 * 0.05);
                    v_left_carat_position_from_301_to_400 = ((v_exact_difference - 170) * 0.10);
                    NewCarat_Add = (v_left_carat_position_upto_200 + v_left_carat_position_from_201_to_300 + v_left_carat_position_from_301_to_400);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //4.00ct to 6.00ct
                else if (v_difference > 540 && v_difference <= 570) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_200 = (150 * 0.01);
                    v_left_carat_position_from_201_to_300 = (20 * 0.05);
                    v_left_carat_position_from_301_to_400 = (10 * 0.10);
                    v_left_carat_position_from_401_to_600 = ((v_exact_difference - 180) * 0.20);
                    NewCarat_Add = (v_left_carat_position_upto_200 + v_left_carat_position_from_201_to_300 + v_left_carat_position_from_301_to_400 + v_left_carat_position_from_401_to_600);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //6.00ct to 10.00ct
                else if (v_difference > 570 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_200 = (150 * 0.01);
                    v_left_carat_position_from_201_to_300 = (20 * 0.05);
                    v_left_carat_position_from_301_to_400 = (10 * 0.10);
                    v_left_carat_position_from_401_to_600 = (10 * 0.20);
                    v_left_carat_position_above_600 = ((v_exact_difference - 190) * 0.40);
                    NewCarat_Add = (v_left_carat_position_upto_200 + v_left_carat_position_from_201_to_300 + v_left_carat_position_from_301_to_400 + v_left_carat_position_from_401_to_600 + v_left_carat_position_above_600);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                else {
                    NewCarat_Add = parseFloat(InitialCaratMax) - parseFloat(InitialCaratMin);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
               
                var NewCarat = (parseFloat(InitialCaratMin) + parseFloat(NewCarat_Add));
                NewCarat = parseFloat(NewCarat).toFixed(2);
                if (parseFloat(CaratMax) < parseFloat(NewCarat))
                { NewCarat = CaratMax; }
                var td_MinCarat = document.getElementById("tdMinCarat");
                td_MinCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
                CaratMin = NewCarat;
            }
            //Loose Diamonds Search
            else {
                var v_left_carat_position_upto_150 = 0;
                var v_left_carat_position_from_151_to_200 = 0;
                var v_left_carat_position_from_201_to_300 = 0;
                var v_left_carat_position_from_301_to_400 = 0;
                var v_left_carat_position_from_401_to_600 = 0;
                var v_left_carat_position_above_600 = 0;
                var NewCarat_Add = 0;
                if (v_difference <= 3) 
                {
                    NewCarat_Add = 0;
                }
                //0.25ct to 1.50ct
                else if (v_difference > 3 && v_difference <= 375) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_150 = parseFloat(v_exact_difference * 0.01);
                    NewCarat_Add = parseFloat(v_left_carat_position_upto_150).toFixed(2);
                }
                //1.50ct to 2.00ct
                else if (v_difference > 375 && v_difference <= 450) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_150 = (125 * 0.01);
                    v_left_carat_position_from_151_to_200 = ((v_exact_difference - 125) * 0.02);
                    NewCarat_Add = (v_left_carat_position_upto_150 + v_left_carat_position_from_151_to_200);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //2.00ct to 3.00ct
                else if (v_difference > 450 && v_difference <= 510) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_150 = (125 * 0.01);
                    v_left_carat_position_from_151_to_200 = (25 * 0.02);
                    v_left_carat_position_from_201_to_300 = ((v_exact_difference - 150) * 0.05);
                    NewCarat_Add = (v_left_carat_position_upto_150 + v_left_carat_position_from_151_to_200 + v_left_carat_position_from_201_to_300);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //3.00ct to 4.00ct
                else if (v_difference > 510 && v_difference <= 540) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_150 = (125 * 0.01);
                    v_left_carat_position_from_151_to_200 = (25 * 0.02);
                    v_left_carat_position_from_201_to_300 = (20 * 0.05);
                    v_left_carat_position_from_301_to_400 = ((v_exact_difference - 170) * 0.10);
                    NewCarat_Add = (v_left_carat_position_upto_150 + v_left_carat_position_from_151_to_200 + v_left_carat_position_from_201_to_300 + v_left_carat_position_from_301_to_400);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //4.00ct to 6.00ct
                else if (v_difference > 540 && v_difference <= 570) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_150 = (125 * 0.01);
                    v_left_carat_position_from_151_to_200 = (25 * 0.02);
                    v_left_carat_position_from_201_to_300 = (20 * 0.05);
                    v_left_carat_position_from_301_to_400 = (10 * 0.10);
                    v_left_carat_position_from_401_to_600 = ((v_exact_difference - 180) * 0.20);
                    NewCarat_Add = (v_left_carat_position_upto_150 + v_left_carat_position_from_151_to_200 + v_left_carat_position_from_201_to_300 + v_left_carat_position_from_301_to_400 + v_left_carat_position_from_401_to_600);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //6.00ct to 10.00ct
                else if (v_difference > 570 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_carat_position_upto_150 = (125 * 0.01);
                    v_left_carat_position_from_151_to_200 = (25 * 0.02);
                    v_left_carat_position_from_201_to_300 = (20 * 0.05);
                    v_left_carat_position_from_301_to_400 = (10 * 0.10);
                    v_left_carat_position_from_401_to_600 = (10 * 0.20);
                    v_left_carat_position_above_600 = ((v_exact_difference - 190) * 0.40);
                    NewCarat_Add = (v_left_carat_position_upto_150 + v_left_carat_position_from_151_to_200 + v_left_carat_position_from_201_to_300 + v_left_carat_position_from_301_to_400 + v_left_carat_position_from_401_to_600 + v_left_carat_position_above_600);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                else {
                    NewCarat_Add = parseFloat(InitialCaratMax) - parseFloat(InitialCaratMin);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                var NewCarat = (parseFloat(InitialCaratMin) + parseFloat(NewCarat_Add));
                NewCarat = parseFloat(NewCarat).toFixed(2);
                if (parseFloat(CaratMax) < parseFloat(NewCarat))
                { NewCarat = CaratMax; }
                var td_MinCarat = document.getElementById("tdMinCarat");
                td_MinCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
                CaratMin = NewCarat;
            }
        }
        else {
            NewCarat_Add = 0;
            NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
            var NewCarat = (parseFloat(InitialCaratMin) + parseFloat(NewCarat_Add));
            NewCarat = parseFloat(NewCarat).toFixed(2);
            if (parseFloat(CaratMax) < parseFloat(NewCarat))
            { NewCarat = CaratMax; }
            var td_MinCarat = document.getElementById("tdMinCarat");
            td_MinCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
            CaratMin = NewCarat;
        }
    }
    else {
        var percentage = Math.round((Pos - sldCaratLeftMinLeft) * 100 / (sldCaratRightMaxLeft - sldCaratLeftMinLeft));
        var NewCarat = ((percentage * (InitialCaratMax - InitialCaratMin)) / 100) + InitialCaratMin;
        if (parseFloat(CaratMax) < parseFloat(NewCarat))
        { NewCarat = CaratMax; }
        var td_MinCarat = document.getElementById("tdMinCarat");
        td_MinCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
        CaratMin = NewCarat;
    }
    if (!flgRecordFecth && Old_CaratMin != CaratMin) {
        fnFetchDiamonds(false);
    }
    document.getElementById("hdn_Min_Carat").value = parseFloat(CaratMin).toFixed(2);
} catch (Error) { }
}
function fnCaratRightCheck(Pos) {
try{
    var Old_CaratMax = CaratMax;
    var v_Max_Carat_Position = 0;
    try {
        v_Max_Carat_Position = parseInt(document.getElementById("hdn_Max_Carat_Left").value);
    }
    catch (err) {
        null;
    }
    if (v_Max_Carat_Position > 0 && (v_Max_Carat_Position+9) >= Pos) {
        //Fixed Carat Movement Logic Here
        var v_difference = parseInt(v_Max_Carat_Position - Pos);
        if (v_difference >= 0) {
            //Matched Pairs Search
            if (document.getElementById("hdn_Search_Option").value == "2") {
                var v_right_carat_position_upto_200 = 0;
                var v_right_carat_position_from_201_to_300 = 0;
                var v_right_carat_position_from_301_to_400 = 0;
                var v_right_carat_position_from_401_to_600 = 0;
                var v_right_carat_position_above_600 = 0;
                var NewCarat_Add = 0;
                if (v_difference <= 3) {
                    NewCarat_Add = 0;
                }
                //6.00ct to 10.00ct
                else if (v_difference > 3 && v_difference <= 30) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (v_exact_difference * 0.40);
                    NewCarat_Add = parseFloat(v_right_carat_position_above_600).toFixed(2);
                }
                //4.00ct to 6.00ct
                else if (v_difference > 30 && v_difference <= 60) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = ((v_exact_difference - 10) * 0.20);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //3.00ct to 4.00ct
                else if (v_difference > 60 && v_difference <= 90) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = ((v_exact_difference - 20) * 0.10);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //2.00ct to 3.00ct
                else if (v_difference > 90 && v_difference <= 150) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = (10 * 0.10);
                    v_right_carat_position_from_201_to_300 = ((v_exact_difference - 30) * 0.05);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400 + v_right_carat_position_from_201_to_300);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //0.50ct to 2.00ct
                else if (v_difference > 150 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = (10 * 0.10);
                    v_right_carat_position_from_201_to_300 = (20 * 0.05);
                    v_right_carat_position_upto_150 = ((v_exact_difference - 50) * 0.01);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400 + v_right_carat_position_from_201_to_300 + v_right_carat_position_upto_150);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                else {
                    NewCarat_Add = parseFloat(InitialCaratMax) - parseFloat(InitialCaratMin);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                var NewCarat = (parseFloat(InitialCaratMax) - parseFloat(NewCarat_Add));
                NewCarat = parseFloat(NewCarat).toFixed(2);
                if (parseFloat(CaratMin) > parseFloat(NewCarat))
                { NewCarat = CaratMin; }
                var td_MaxCarat = document.getElementById("tdMaxCarat");
                td_MaxCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
                CaratMax = NewCarat;
            }
            //Loose Diamonds Search
            else {
                var v_right_carat_position_less_then_150 = 0;
                var v_right_carat_position_from_151_to_200 = 0;
                var v_right_carat_position_from_201_to_300 = 0;
                var v_right_carat_position_from_301_to_400 = 0;
                var v_right_carat_position_from_401_to_600 = 0;
                var v_right_carat_position_above_600 = 0;
                var NewCarat_Add = 0;
                if (v_difference <= 3) {
                    NewCarat_Add = 0;
                }
                //6.00ct to 10.00ct
                else if (v_difference > 3 && v_difference <= 30) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (v_exact_difference * 0.40);
                    NewCarat_Add = parseFloat(v_right_carat_position_above_600).toFixed(2);
                }
                //4.00ct to 6.00ct
                else if (v_difference > 30 && v_difference <= 60) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = ((v_exact_difference - 10) * 0.20);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //3.00ct to 4.00ct
                else if (v_difference > 60 && v_difference <= 90) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = ((v_exact_difference - 20) * 0.10);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //2.00ct to 3.00ct
                else if (v_difference > 90 && v_difference <= 150) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = (10 * 0.10);
                    v_right_carat_position_from_201_to_300 = ((v_exact_difference - 30) * 0.05);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400 + v_right_carat_position_from_201_to_300);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //1.50ct to 2.00ct
                else if (v_difference > 150 && v_difference <= 225) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = (10 * 0.10);
                    v_right_carat_position_from_201_to_300 = (20 * 0.05);
                    v_right_carat_position_from_151_to_200 = ((v_exact_difference - 50) * 0.02);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400 + v_right_carat_position_from_201_to_300 + v_right_carat_position_from_151_to_200);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                //0.25ct to 1.50ct
                else if (v_difference > 225 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_carat_position_above_600 = (10 * 0.40);
                    v_right_carat_position_from_401_to_600 = (10 * 0.20);
                    v_right_carat_position_from_301_to_400 = (10 * 0.10);
                    v_right_carat_position_from_201_to_300 = (20 * 0.05);
                    v_right_carat_position_from_151_to_200 = (25 * 0.02);
                    v_right_carat_position_less_then_150 = ((v_exact_difference - 75) * 0.01);
                    NewCarat_Add = (v_right_carat_position_above_600 + v_right_carat_position_from_401_to_600 + v_right_carat_position_from_301_to_400 + v_right_carat_position_from_201_to_300 + v_right_carat_position_from_151_to_200 + v_right_carat_position_less_then_150);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                else {
                    NewCarat_Add = parseFloat(InitialCaratMax) - parseFloat(InitialCaratMin);
                    NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
                }
                var NewCarat = (parseFloat(InitialCaratMax) - parseFloat(NewCarat_Add));
                NewCarat = parseFloat(NewCarat).toFixed(2);
                if (parseFloat(CaratMin) > parseFloat(NewCarat))
                { NewCarat = CaratMin; }
                var td_MaxCarat = document.getElementById("tdMaxCarat");
                td_MaxCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
                CaratMax = NewCarat;
            }
        }
        else {
            NewCarat_Add = parseFloat(InitialCaratMax) - parseFloat(InitialCaratMax);
            NewCarat_Add = parseFloat(NewCarat_Add).toFixed(2);
            var NewCarat = (parseFloat(InitialCaratMax) - parseFloat(NewCarat_Add));
            NewCarat = parseFloat(NewCarat).toFixed(2);
            if (parseFloat(CaratMin) > parseFloat(NewCarat))
            { NewCarat = CaratMin; }
            var td_MaxCarat = document.getElementById("tdMaxCarat");
            td_MaxCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
            CaratMax = NewCarat;
        }
    }
    else {
        var percentage = Math.round((Pos - sldCaratLeftMinLeft) * 100 / (sldCaratRightMaxLeft - sldCaratLeftMinLeft));
        var NewCarat = ((percentage * (InitialCaratMax - InitialCaratMin)) / 100) + InitialCaratMin;
        if (parseFloat(CaratMin) > parseFloat(NewCarat))
        { NewCarat = CaratMin; }
        var td_MaxCarat = document.getElementById("tdMaxCarat");
        td_MaxCarat.innerHTML = parseFloat(NewCarat).toFixed(2);
        CaratMax = NewCarat;
    }
    if (!flgRecordFecth && Old_CaratMax != CaratMax) {
        fnFetchDiamonds(false);
    }
    document.getElementById("hdn_Max_Carat").value = parseFloat(CaratMax).toFixed(2);
} catch (Error) { }
}
function sldCaratLeftMouseDown(e) {
    try{
    if (!e) { e = window.event }
    dosldCaratLeftDrag = true;
    o1 = document.getElementById("sldCaratLeft");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
function sldCaratRightMouseDown(e) {
try{
    if (!e) { e = window.event }
    dosldCaratRightDrag = true;
    o1 = document.getElementById("sldCaratRight");
    sldMouseLeft = e.clientX - o1.offsetLeft;

    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
/* ######################### Price Functions ######################### */
function sldPriceLeftMouseDown(e) {
try{
    if (!e) { e = window.event }
    dosldPriceLeftDrag = true;
    o1 = document.getElementById("sldPriceLeft");
    sldMouseLeft = e.clientX - o1.offsetLeft;
    
    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);

    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
function sldPriceRightMouseDown(e) {
try{
    if (!e) { e = window.event }
    dosldPriceRightDrag = true;
    o1 = document.getElementById("sldPriceRight");
    sldMouseLeft = e.clientX - o1.offsetLeft;
    
    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    if (e.preventDefault) { e.preventDefault(); }
} catch (Error) { }
}
function fnPriceLeftCheck(Pos)	//Change Price Range
{
try{
    var Old_PriceMin = PriceMin;
    var v_Min_Price_Position = 0;
    try {
        v_Min_Price_Position = parseInt(document.getElementById("hdn_Min_Price_Left").value);
    }
    catch (err) {
        null;
    }
    if (v_Min_Price_Position > 0 && v_Min_Price_Position < Pos) {
         //Fixed Price Movement Logic Here
        var v_difference = parseInt(Pos - v_Min_Price_Position);
        if (v_difference >= 0) 
        {
            //Matched Pairs Search
            if (document.getElementById("hdn_Search_Option").value == "2") {

                var v_left_price_position_upto_1000 = 0;
                var v_left_price_position_from_1001_to_2000 = 0;
                var v_left_price_position_from_2001_to_10000 = 0;
                var v_left_price_position_from_10001_to_20000 = 0;
                var v_left_price_position_from_20001_to_30000 = 0;
                var v_left_price_position_from_30001_to_50000 = 0;
                var v_left_price_position_from_50001_to_100000 = 0;
                var v_left_price_position_from_100001_to_200000 = 0;
                var NewPrice_Add = 0;
                if (v_difference <= 3) {
                    NewPrice_Add = 0;
                }
                //£400 to £1000
                else if (v_difference > 3 && v_difference <= 144) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    var v_diff = parseInt(v_exact_difference / 2);
                    var v_remainder = parseInt(v_exact_difference % 2);
                    var v_diff_10 = 0;
                    var v_diff_15 = parseInt(v_diff);
                    var v_left_price_position_upto_1000_with_10 = 0;
                    var v_left_price_position_upto_1000_with_15 = 0;
                    if (v_remainder > 0) {
                        v_diff_10 = parseInt(v_diff + 1)
                    }
                    else {
                        v_diff_10 = parseInt(v_diff)
                    }
                    v_left_price_position_upto_1000_with_10 = parseFloat(v_diff_10 * 10);
                    v_left_price_position_upto_1000_with_15 = parseFloat(v_diff_15 * 15);
                    v_left_price_position_upto_1000 = (parseFloat(v_left_price_position_upto_1000_with_10) + parseFloat(v_left_price_position_upto_1000_with_15));
                    NewPrice_Add = (v_left_price_position_upto_1000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£1001 to £2,000
                else if (v_difference > 144 && v_difference <= 204) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = ((v_exact_difference - 48) * 50);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£2,001 to £10,000
                else if (v_difference > 204 && v_difference <= 444) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = (20 * 50);
                    v_left_price_position_from_2001_to_10000 = ((v_exact_difference - 68) * 100);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000 + v_left_price_position_from_2001_to_10000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£10,001 to £20,000
                else if (v_difference > 444 && v_difference <= 504) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = (20 * 50);
                    v_left_price_position_from_2001_to_10000 = (80 * 100);
                    v_left_price_position_from_10001_to_20000 = ((v_exact_difference - 148) * 500);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000 + v_left_price_position_from_2001_to_10000 + v_left_price_position_from_10001_to_20000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£20,001 to £30,000
                else if (v_difference > 504 && v_difference <= 534) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = (20 * 50);
                    v_left_price_position_from_2001_to_10000 = (80 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_30000 = ((v_exact_difference - 168) * 1000);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000 + v_left_price_position_from_2001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_30000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£30,001 to £50,000
                else if (v_difference > 534 && v_difference <= 564) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = (20 * 50);
                    v_left_price_position_from_2001_to_10000 = (80 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_30000 = (10 * 1000);
                    v_left_price_position_from_30001_to_50000 = ((v_exact_difference - 178) * 2000);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000 + v_left_price_position_from_2001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_30000 + v_left_price_position_from_30001_to_50000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£50,001 to £100,000
                else if (v_difference > 564 && v_difference <= 594) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = (20 * 50);
                    v_left_price_position_from_2001_to_10000 = (80 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_30000 = (10 * 1000);
                    v_left_price_position_from_30001_to_50000 = (10 * 2000);
                    v_left_price_position_from_50001_to_100000 = ((v_exact_difference - 188) * 5000);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000 + v_left_price_position_from_2001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_30000 + v_left_price_position_from_30001_to_50000 + v_left_price_position_from_50001_to_100000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£100,001 to £200,000
                else if (v_difference > 594 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_1000 = (parseFloat(24 * 10) + parseFloat(24 * 15));
                    v_left_price_position_from_1001_to_2000 = (20 * 50);
                    v_left_price_position_from_2001_to_10000 = (80 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_30000 = (10 * 1000);
                    v_left_price_position_from_30001_to_50000 = (10 * 2000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_left_price_position_from_100001_to_200000 = ((v_exact_difference - 198) * 50000);
                    NewPrice_Add = (v_left_price_position_upto_1000 + v_left_price_position_from_1001_to_2000 + v_left_price_position_from_2001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_30000 + v_left_price_position_from_30001_to_50000 + v_left_price_position_from_50001_to_100000 + v_left_price_position_from_100001_to_200000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                else {
                    NewPrice_Add = parseFloat(PriceArray[0][1]) - parseFloat(PriceArray[0][0]);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                var NewPrice = (parseFloat(PriceArray[0][0]) + parseFloat(NewPrice_Add));
                NewPrice = parseFloat(NewPrice).toFixed(2);
                if (parseFloat(PriceMax) < parseFloat(NewPrice))
                { NewPrice = PriceMax; }
                NewPrice = parseFloat(NewPrice).toFixed(0);
                var td_MinPrice = document.getElementById("tdMinPrice");
                td_MinPrice.innerHTML = "" + parseMoney(NewPrice);
                PriceMin = NewPrice;
            }
            //Loose Diamonds Search
            else {
                var v_left_price_position_upto_500 = 0;
                var v_left_price_position_from_501_to_1000 = 0;
                var v_left_price_position_from_1001_to_10000 = 0;
                var v_left_price_position_from_10001_to_20000 = 0;
                var v_left_price_position_from_20001_to_50000 = 0;
                var v_left_price_position_from_50001_to_100000 = 0;
                var v_left_price_position_from_100001_to_150000 = 0;
                var v_left_price_position_from_150001_to_200000 = 0;
                var NewPrice_Add = 0;
                if (v_difference <= 3) {
                    NewPrice_Add = 0;
                }
                //£200 to £500
                else if (v_difference > 3 && v_difference <= 72) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    var v_diff = parseInt(v_exact_difference / 2);
                    var v_remainder = parseInt(v_exact_difference % 2);
                    var v_diff_10 = 0;
                    var v_diff_15 = parseInt(v_diff);
                    var v_left_price_position_upto_500_with_10 = 0;
                    var v_left_price_position_upto_500_with_15 = 0;
                    if (v_remainder > 0) {
                        v_diff_10 = parseInt(v_diff + 1)
                    }
                    else {
                        v_diff_10 = parseInt(v_diff)
                    }
                    v_left_price_position_upto_500_with_10 = parseFloat(v_diff_10 * 10);
                    v_left_price_position_upto_500_with_15 = parseFloat(v_diff_15 * 15);
                    v_left_price_position_upto_500 = (parseFloat(v_left_price_position_upto_500_with_10) + parseFloat(v_left_price_position_upto_500_with_15));
                    NewPrice_Add = (v_left_price_position_upto_500);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£501 to £1,000
                else if (v_difference > 72 && v_difference <= 132) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = ((v_exact_difference - 24) * 25);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£1,001 to £10,000
                else if (v_difference > 132 && v_difference <= 402) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = (20 * 25);
                    v_left_price_position_from_1001_to_10000 = ((v_exact_difference - 44) * 100);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000 + v_left_price_position_from_1001_to_10000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£10,001 to £20,000
                else if (v_difference > 402 && v_difference <= 462) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = (20 * 25);
                    v_left_price_position_from_1001_to_10000 = (90 * 100);
                    v_left_price_position_from_10001_to_20000 = ((v_exact_difference - 134) * 500);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000 + v_left_price_position_from_1001_to_10000 + v_left_price_position_from_10001_to_20000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£20,001 to £50,000
                else if (v_difference > 462 && v_difference <= 552) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = (20 * 25);
                    v_left_price_position_from_1001_to_10000 = (90 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_50000 = ((v_exact_difference - 154) * 1000);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000 + v_left_price_position_from_1001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_50000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£50,001 to £100,000
                else if (v_difference > 552 && v_difference <= 582) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = (20 * 25);
                    v_left_price_position_from_1001_to_10000 = (90 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_50000 = (30 * 1000);
                    v_left_price_position_from_50001_to_100000 = ((v_exact_difference - 184) * 5000);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000 + v_left_price_position_from_1001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_50000 + v_left_price_position_from_50001_to_100000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£100,001 to £150,000
                else if (v_difference > 582 && v_difference <= 594) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = (20 * 25);
                    v_left_price_position_from_1001_to_10000 = (90 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_50000 = (30 * 1000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_left_price_position_from_100001_to_150000 = ((v_exact_difference - 194) * 12500);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000 + v_left_price_position_from_1001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_50000 + v_left_price_position_from_50001_to_100000 + v_left_price_position_from_100001_to_150000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£150,001 to £200,000
                else if (v_difference > 594 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_left_price_position_upto_500 = (parseFloat(12 * 10) + parseFloat(12 * 15));
                    v_left_price_position_from_501_to_1000 = (20 * 25);
                    v_left_price_position_from_1001_to_10000 = (90 * 100);
                    v_left_price_position_from_10001_to_20000 = (20 * 500);
                    v_left_price_position_from_20001_to_50000 = (30 * 1000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_150001_to_200000 = ((v_exact_difference - 198) * 25000);
                    NewPrice_Add = (v_left_price_position_upto_500 + v_left_price_position_from_501_to_1000 + v_left_price_position_from_1001_to_10000 + v_left_price_position_from_10001_to_20000 + v_left_price_position_from_20001_to_50000 + v_left_price_position_from_50001_to_100000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_150001_to_200000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                else {
                    NewPrice_Add = parseFloat(PriceArray[0][1]) - parseFloat(PriceArray[0][0]);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                var NewPrice = (parseFloat(PriceArray[0][0]) + parseFloat(NewPrice_Add));
                NewPrice = parseFloat(NewPrice).toFixed(2);
                if (parseFloat(PriceMax) < parseFloat(NewPrice))
                { NewPrice = PriceMax; }
                NewPrice = parseFloat(NewPrice).toFixed(0);
                var td_MinPrice = document.getElementById("tdMinPrice");
                td_MinPrice.innerHTML = "" + parseMoney(NewPrice);
                PriceMin = NewPrice;
            }
        }
        else {
            var NewPrice = (parseFloat(PriceArray[0][0]));
            NewPrice = parseFloat(NewPrice).toFixed(2);
            if (parseFloat(PriceMax) < parseFloat(NewPrice))
            { NewPrice = PriceMax; }
            NewPrice = parseFloat(NewPrice).toFixed(0);
            var td_MinPrice = document.getElementById("tdMinPrice");
            td_MinPrice.innerHTML = "" + parseMoney(NewPrice);
            PriceMin = NewPrice;    
        }
    }
    else {
        var percentage = Math.round((Pos - sldPriceLeftMinLeft) * 100 / (sldPriceRightMaxLeft - sldPriceLeftMinLeft));
        var NewPrice;
        for (var i = 0; i < PriceArray.length; i++) {
            if (percentage >= PriceArray[i][2] && percentage <= PriceArray[i][3]) {
                percentage = Math.round((percentage - PriceArray[i][2]) * 100 / (PriceArray[i][3] - PriceArray[i][2]));
                NewPrice = (((PriceArray[i][1] - PriceArray[i][0]) * (percentage)) / 100) + PriceArray[i][0];
                break;
            }
        }
        if (parseFloat(PriceMax) < parseFloat(NewPrice))
        { NewPrice = PriceMax; }
        NewPrice = parseFloat(NewPrice).toFixed(0);
        var td_MinPrice = document.getElementById("tdMinPrice");
        td_MinPrice.innerHTML = "" + parseMoney(NewPrice);
        PriceMin = NewPrice;
    }
    if (!flgRecordFecth && Old_PriceMin != PriceMin) {
        fnFetchDiamonds(false);
    }
    document.getElementById("hdn_Min_Price").value = PriceMin;
} catch (Error) { }
}
function setLeftPriceSlider() {
try{
    //Set Left Diamond
    osldPriceLeft = document.getElementById("sldPriceLeft");
    var v_Min_Price_Position = 0;
    try {
        v_Min_Price_Position = parseInt(document.getElementById("hdn_Min_Price_Left").value);
    }
    catch (err) {
        null;
    }
    if (parseFloat(PriceMin) > parseFloat(PriceArray[0][0]) && v_Min_Price_Position > 0) 
    {
        var v_price_diff = parseFloat(parseFloat(PriceMin) - parseFloat(PriceArray[0][0])).toFixed(2);
        //Matched Pairs Search
        if (document.getElementById("hdn_Search_Option").value == "2") {
            //£400 to £1000
            if (v_price_diff <= 600) {
                var v_price_left_upto_1000 = parseInt(parseFloat(v_price_diff * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000 / 12.5);
            }
            //£1001 to £2,000
            else if (v_price_diff > 600 && v_price_diff <= 1600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = parseInt(parseFloat((v_price_diff - 600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000 / 50);
            }
            //£2,001 to £10,000
            else if (v_price_diff > 1600 && v_price_diff <= 9600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_2001_to_10000 = parseInt(parseFloat((v_price_diff - 1600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_2001_to_10000 / 100);
            }
            //£10,001 to £20,000
            else if (v_price_diff > 9600 && v_price_diff <= 19600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_10001_to_20000 = parseInt(parseFloat((v_price_diff - 9600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_10001_to_20000 / 500);
            }
            //£20,001 to £30,000
            else if (v_price_diff > 19600 && v_price_diff <= 29600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_30000 = parseInt(parseFloat((v_price_diff - 19600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_30000 / 1000);
            }
            //£30,000 to £50,001
            else if (v_price_diff > 29600 && v_price_diff <= 49600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_30001_to_50000 = parseInt(parseFloat((v_price_diff - 29600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_30001_to_50000 / 2000);
            }
            //£50,001 to £100,000
            else if (v_price_diff > 49600 && v_price_diff <= 99600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_50001_to_100000 = parseInt(parseFloat((v_price_diff - 49600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_50001_to_100000 / 5000);
            }
            //£100,001 to £200,000
            else if (v_price_diff > 99600 && v_price_diff <= 199600) {
                var v_price_left_upto_1000 = 144;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_100001_to_200000 = parseInt(parseFloat((v_price_diff - 99600) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_1000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_120001_to_200000 / 50000);
            }
            else {
                var percentage = (PriceMin - PriceArray[0][0]) * 100 / (PriceArray[0][1] - PriceArray[0][0]);
                var newPos = Math.round(((percentage * (sldPriceRightMaxLeft - sldPriceLeftMinLeft)) / 100) + sldPriceLeftMinLeft);
            }
        }
        //Loose Diamonds Search
        else {
            //£200 to £500
            if (v_price_diff <= 300) {
                var v_price_left_upto_500 = 0;
                v_price_left_upto_500 = parseInt(parseFloat(v_price_diff * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500 / 12.5);
            }
            //£501 to £1,000
            else if (v_price_diff > 300 && v_price_diff <= 800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 0;
                v_price_left_from_501_to_1000 = parseInt(parseFloat((v_price_diff - 300) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000 / 25);
            }
            //£1,001 to £10,000
            else if (v_price_diff > 800 && v_price_diff <= 9800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 60;
                var v_price_left_from_1001_to_10000 = 0;
                v_price_left_from_1001_to_10000 = parseInt(parseFloat((v_price_diff - 800) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000) + parseInt(v_price_left_from_1001_to_10000 / 100);
            }
            //£10,001 to £20,000
            else if (v_price_diff > 9800 && v_price_diff <= 19800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_10001_to_20000 = 0;
                v_price_left_from_10001_to_20000 = parseInt(parseFloat((v_price_diff - 9800) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_10001_to_20000 / 500);
            }
            //£20,001 to £50,000
            else if (v_price_diff > 19800 && v_price_diff <= 49800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_50000 = 0;
                v_price_left_from_20001_to_50000 = parseInt(parseFloat((v_price_diff - 19800) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_50000 / 1000);
            }
            //£50,001 to £100,000
            else if (v_price_diff > 49800 && v_price_diff <= 99800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_50001_to_100000 = 0;
                v_price_left_from_50001_to_100000 = parseInt(parseFloat((v_price_diff - 49800) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_50001_to_100000 / 5000);
            }
            //£100,001 to £150,000
            else if (v_price_diff > 99800 && v_price_diff <= 149800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_100001_to_150000 = 0;
                v_price_left_from_100001_to_150000 = parseInt(parseFloat((v_price_diff - 99800) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_100001_to_150000 / 12500);
            }
            //£150,001 to £200,000
            else if (v_price_diff > 149800 && v_price_diff <= 199800) {
                var v_price_left_upto_500 = 72;
                var v_price_left_from_501_to_1000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_150001_to_200000 = 0;
                v_price_left_from_150001_to_200000 = parseInt(parseFloat((v_price_diff - 149800) * 3).toFixed(2));
                var newPos = parseInt(v_Min_Price_Position) + parseInt(v_price_left_upto_500) + parseInt(v_price_left_from_501_to_1000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_150001_to_200000 / 25000);
            }
            else {
                var percentage = (PriceMin - PriceArray[0][0]) * 100 / (PriceArray[0][1] - PriceArray[0][0]);
                var newPos = Math.round(((percentage * (sldPriceRightMaxLeft - sldPriceLeftMinLeft)) / 100) + sldPriceLeftMinLeft);
            }
        }
    }
    else {
        var percentage = (PriceMin - PriceArray[0][0]) * 100 / (PriceArray[0][1] - PriceArray[0][0]);
        var newPos = Math.round(((percentage * (sldPriceRightMaxLeft - sldPriceLeftMinLeft)) / 100) + sldPriceLeftMinLeft);
    }
    sldPriceRightMinLeft = newPos;
    setPosition(osldPriceLeft, newPos, sldPriceTop);
    o = document.getElementById("sldPriceMiddle");
    o.style.left = newPos;
    if (PriceMin == PriceMax)
        o.style.width = 0;
    else
        o.style.width = sldPriceLeftMaxLeft + SliderWidth - newPos;
    return false;
} catch (Error) { }
}
function fnPriceRightCheck(Pos)	//Change Price Range
{
try{
    var Old_PriceMax = PriceMax;
    var v_Max_Price_Position = 0;
    try {
        v_Max_Price_Position = parseInt(document.getElementById("hdn_Max_Price_Left").value);
    }
    catch (err) {
        null;
    }
    if (v_Max_Price_Position > 0 && (v_Max_Price_Position +9) >= Pos) 
    {
        //Fixed Price Movement Logic Here
        var v_difference = parseInt(v_Max_Price_Position - Pos);
        if (v_difference >= 0) {
            //Matched Pairs Search
            if (document.getElementById("hdn_Search_Option").value == "2") {
                var v_right_price_position_upto_1000 = 0;
                var v_right_price_position_from_1001_to_2000 = 0;
                var v_right_price_position_from_2001_to_10000 = 0;
                var v_right_price_position_from_10001_to_20000 = 0;
                var v_right_price_position_from_20001_to_30000 = 0;
                var v_right_price_position_from_30001_to_50000 = 0;
                var v_right_price_position_from_50001_to_100000 = 0;
                var v_right_price_position_from_100001_to_200000 = 0;
                var NewPrice_Add = 0;
                //For Default Start Poistion
                if (v_difference < 3) 
                {
                    NewPrice_Add = 0;
                }
                //£100,001 to £200,000
                else if (v_difference >= 3 && v_difference <= 6) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (v_exact_difference * 50000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£50,001 to £100,000   
                else if (v_difference > 6 && v_difference <= 36) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = ((v_exact_difference - 2) * 5000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£30,001 to £50,000
                else if (v_difference > 36 && v_difference <= 66) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_30001_to_50000 = ((v_exact_difference - 12) * 2000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_30001_to_50000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£20,001 to £30,000
                else if (v_difference > 66 && v_difference <= 96) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_30001_to_50000 = (10 * 2000);
                    v_right_price_position_from_20001_to_30000 = ((v_exact_difference - 22) * 1000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_30001_to_50000 + v_right_price_position_from_20001_to_30000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£10,001 to £20,000
                else if (v_difference > 96 && v_difference <= 156) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_30001_to_50000 = (10 * 2000);
                    v_right_price_position_from_20001_to_30000 = (10 * 1000);
                    v_right_price_position_from_10001_to_20000 = ((v_exact_difference - 32) * 500);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_30001_to_50000 + v_right_price_position_from_20001_to_30000 + v_right_price_position_from_10001_to_20000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£2,001 to £10,000
                else if (v_difference > 156 && v_difference <= 396) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_30001_to_50000 = (10 * 2000);
                    v_right_price_position_from_20001_to_30000 = (10 * 1000);
                    v_right_price_position_from_10001_to_20000 = (20 * 500);
                    v_right_price_position_from_2001_to_10000 = ((v_exact_difference - 52) * 100);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_30001_to_50000 + v_right_price_position_from_20001_to_30000 + v_right_price_position_from_10001_to_20000 + v_right_price_position_from_2001_to_10000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£1,001 to £2,000
                else if (v_difference > 396 && v_difference <= 456) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_30001_to_50000 = (10 * 2000);
                    v_right_price_position_from_20001_to_30000 = (10 * 1000);
                    v_right_price_position_from_10001_to_20000 = (20 * 500);
                    v_right_price_position_from_2001_to_10000 = (80 * 100);
                    v_right_price_position_from_1001_to_2000 = ((v_exact_difference - 132) * 50);
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_30001_to_50000 + v_right_price_position_from_20001_to_30000 + v_right_price_position_from_10001_to_20000 + v_right_price_position_from_2001_to_10000 + v_right_price_position_from_1001_to_2000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£400 to £1,001
                else if (v_difference > 456 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_100001_to_200000 = (2 * 50000);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_30001_to_50000 = (10 * 2000);
                    v_right_price_position_from_20001_to_30000 = (10 * 1000);
                    v_right_price_position_from_10001_to_20000 = (20 * 500);
                    v_right_price_position_from_2001_to_10000 = (80 * 100);
                    v_right_price_position_from_1001_to_2000 = (20 * 50);
                    var v_diff = parseInt((v_exact_difference - 152) / 2);
                    var v_remainder = parseInt((v_exact_difference - 152) % 2);
                    var v_diff_10 = 0;
                    var v_diff_15 = parseInt(v_diff);
                    var v_right_price_position_upto_1000_with_10 = 0;
                    var v_right_price_position_upto_1000_with_15 = 0;
                    if (v_remainder > 0) {
                        v_diff_10 = parseInt(v_diff + 1)
                    }
                    else {
                        v_diff_10 = parseInt(v_diff)
                    }
                    v_right_price_position_upto_1000_with_10 = parseFloat(v_diff_10 * 10);
                    v_right_price_position_upto_1000_with_15 = parseFloat(v_diff_15 * 15);
                    v_right_price_position_upto_1000 = (parseFloat(v_right_price_position_upto_1000_with_10) + parseFloat(v_right_price_position_upto_1000_with_15));
                    NewPrice_Add = parseFloat(v_right_price_position_from_100001_to_200000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_30001_to_50000 + v_right_price_position_from_20001_to_30000 + v_right_price_position_from_10001_to_20000 + v_right_price_position_from_2001_to_10000 + v_right_price_position_from_1001_to_2000 + v_right_price_position_upto_1000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                else {
                    NewPrice_Add = (parseFloat(PriceArray[0][1]) - parseFloat(PriceArray[0][0]));
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                var NewPrice = (parseFloat(PriceArray[0][1]) - parseFloat(NewPrice_Add));
                NewPrice = parseFloat(NewPrice).toFixed(2);
                if (parseFloat(PriceMin) > parseFloat(NewPrice))
                { NewPrice = PriceMin; }
                NewPrice = parseFloat(NewPrice).toFixed(0);
                var td_MaxPrice = document.getElementById("tdMaxPrice");
                td_MaxPrice.innerHTML = "" + parseMoney(NewPrice);
                PriceMax = NewPrice;
            }
            //Loose Diamonds Search
            else {
                var v_right_price_position_upto_500 = 0;
                var v_right_price_position_from_501_to_1000 = 0;
                var v_right_price_position_from_1001_to_10000 = 0;
                var v_right_price_position_from_10001_to_20000 = 0;
                var v_right_price_position_from_20001_to_50000 = 0;
                var v_right_price_position_from_50001_to_100000 = 0;
                var v_right_price_position_from_100001_to_150000 = 0;
                var v_right_price_position_from_150001_to_200000 = 0;
                var NewPrice_Add = 0;
                //For Default Start Poistion
                if (v_difference < 3) {
                    NewPrice_Add = 0;
                }
                //£150,001 to £200,000
                else if (v_difference >= 3 && v_difference <= 6) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (v_exact_difference * 25000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£100,001 to £150,000
                else if (v_difference > 6 && v_difference <= 18) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = ((v_exact_difference - 2) * 12500);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£50,001 to £100,000   
                else if (v_difference > 18 && v_difference <= 48) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_50001_to_100000 = ((v_exact_difference - 6) * 5000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_50001_to_100000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£20,001 to £50,000
                else if (v_difference > 48 && v_difference <= 138) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_20001_to_50000 = ((v_exact_difference - 16) * 1000);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_20001_to_50000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£10,001 to £20,000
                else if (v_difference > 138 && v_difference <= 198) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_20001_to_50000 = (30 * 1000);
                    v_right_price_position_from_10001_to_20000 = ((v_exact_difference - 46) * 500);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_20001_to_50000 + v_right_price_position_from_10001_to_20000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£1,001 to £10,000
                else if (v_difference > 198 && v_difference <= 468) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_20001_to_50000 = (30 * 1000);
                    v_right_price_position_from_10001_to_20000 = (20 * 500);
                    v_right_price_position_from_1001_to_10000 = ((v_exact_difference - 66) * 100);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_20001_to_50000 + v_right_price_position_from_10001_to_20000 + v_right_price_position_from_1001_to_10000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£501 to £1,000
                else if (v_difference > 468 && v_difference <= 528) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_20001_to_50000 = (30 * 1000);
                    v_right_price_position_from_10001_to_20000 = (20 * 500);
                    v_right_price_position_from_1001_to_10000 = (90 * 100);
                    v_right_price_position_from_501_to_1000 = ((v_exact_difference - 156) * 25);
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_20001_to_50000 + v_right_price_position_from_10001_to_20000 + v_right_price_position_from_1001_to_10000 + v_right_price_position_from_501_to_1000);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                //£200 to £500
                else if (v_difference > 528 && v_difference <= 600) {
                    var v_exact_difference = parseInt(v_difference / 3);
                    v_right_price_position_from_150001_to_200000 = (2 * 25000);
                    v_left_price_position_from_100001_to_150000 = (4 * 12500);
                    v_left_price_position_from_50001_to_100000 = (10 * 5000);
                    v_right_price_position_from_20001_to_50000 = (30 * 1000);
                    v_right_price_position_from_10001_to_20000 = (20 * 500);
                    v_right_price_position_from_1001_to_10000 = (90 * 100);
                    v_right_price_position_from_501_to_1000 = (20 * 25);
                    var v_diff = parseInt((v_exact_difference - 176) / 2);
                    var v_remainder = parseInt((v_exact_difference - 176) % 2);
                    var v_diff_10 = 0;
                    var v_diff_15 = parseInt(v_diff);
                    var v_right_price_position_upto_500_with_10 = 0;
                    var v_right_price_position_upto_500_with_15 = 0;
                    if (v_remainder > 0) {
                        v_diff_10 = parseInt(v_diff + 1)
                    }
                    else {
                        v_diff_10 = parseInt(v_diff)
                    }
                    v_right_price_position_upto_500_with_10 = parseFloat(v_diff_10 * 10);
                    v_right_price_position_upto_500_with_15 = parseFloat(v_diff_15 * 15);
                    v_right_price_position_upto_500 = (parseFloat(v_right_price_position_upto_500_with_10) + parseFloat(v_right_price_position_upto_500_with_15));
                    NewPrice_Add = parseFloat(v_right_price_position_from_150001_to_200000 + v_left_price_position_from_100001_to_150000 + v_left_price_position_from_50001_to_100000 + v_right_price_position_from_20001_to_50000 + v_right_price_position_from_10001_to_20000 + v_right_price_position_from_1001_to_10000 + v_right_price_position_from_501_to_1000 + v_right_price_position_upto_500);
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                else {
                    NewPrice_Add = (parseFloat(PriceArray[0][1]) - parseFloat(PriceArray[0][0]));
                    NewPrice_Add = parseFloat(NewPrice_Add).toFixed(2);
                }
                var NewPrice = (parseFloat(PriceArray[0][1]) - parseFloat(NewPrice_Add));
                NewPrice = parseFloat(NewPrice).toFixed(2);
                if (parseFloat(PriceMin) > parseFloat(NewPrice))
                { NewPrice = PriceMin; }
                NewPrice = parseFloat(NewPrice).toFixed(0);
                var td_MaxPrice = document.getElementById("tdMaxPrice");
                td_MaxPrice.innerHTML = "" + parseMoney(NewPrice);
                PriceMax = NewPrice;
            }
        }
        else {
            var NewPrice = (parseFloat(PriceArray[0][1]));
            NewPrice = parseFloat(NewPrice).toFixed(2);
            if (parseFloat(PriceMin) > parseFloat(NewPrice))
            { NewPrice = PriceMin; }
            NewPrice = parseFloat(NewPrice).toFixed(0);
            var td_MaxPrice = document.getElementById("tdMaxPrice");
            td_MaxPrice.innerHTML = "" + parseMoney(NewPrice);
            PriceMax = NewPrice;
        }
    }
    else 
    {
        var percentage = Math.round((Pos - sldPriceLeftMinLeft) * 100 / (sldPriceRightMaxLeft - sldPriceLeftMinLeft));
        var NewPrice;
        for (var i = 0; i < PriceArray.length; i++) {
            if (percentage >= PriceArray[i][2] && percentage <= PriceArray[i][3]) {
                percentage = Math.round((percentage - PriceArray[i][2]) * 100 / (PriceArray[i][3] - PriceArray[i][2]));
                NewPrice = (((PriceArray[i][1] - PriceArray[i][0]) * (percentage)) / 100) + PriceArray[i][0];
                break;
            }
        }
        if (parseFloat(PriceMin) > parseFloat(NewPrice))
        { NewPrice = PriceMin; }
        NewPrice = parseFloat(NewPrice).toFixed(0);
        var td_MaxPrice = document.getElementById("tdMaxPrice");
        td_MaxPrice.innerHTML = "" + parseMoney(NewPrice);
        PriceMax = NewPrice;
    }
    if (!flgRecordFecth && Old_PriceMax != PriceMax) {
        fnFetchDiamonds(false);
    }
    document.getElementById("hdn_Max_Price").value = PriceMax;
} catch (Error) { }
}
function setRightPriceSlider() {
try{
    //Set Right Diamond
    osldPriceRight = document.getElementById("sldPriceRight");
    var v_Max_Price_Position = 0;
    try {
        v_Max_Price_Position = parseInt(document.getElementById("hdn_Max_Price_Left").value);
    }
    catch (err) {
        null;
    }
    if (parseFloat(PriceMax) < parseFloat(PriceArray[0][1]) && v_Max_Price_Position > 0) {
        var v_price_diff = parseFloat(parseFloat(PriceArray[0][1]) - parseFloat(PriceMax)).toFixed(2);
        //Matched Pairs Search
        if (document.getElementById("hdn_Search_Option").value == "2") {
            //£100,001 to £200,000
            if (v_price_diff <= 100000) {
                var v_price_left_from_100001_to_200000 = parseInt(parseFloat(v_price_diff * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - parseInt(v_price_left_from_100001_to_200000 / 50000);
            }
            //£50,001 to £100,000
            else if (v_price_diff > 100000 && v_price_diff <= 150000) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = parseInt(parseFloat((v_price_diff - 100000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000 / 5000));
            }
            //£30,001 to £50,000
            else if (v_price_diff > 150000 && v_price_diff <= 170000) {
                var v_price_left_from_100001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_30001_to_50000 = parseInt(parseFloat((v_price_diff - 150000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_30001_to_50000 / 2000));
            }
            //£20,001 to £30,000
            else if (v_price_diff > 170000 && v_price_diff <= 180000) {
                var v_price_left_from_100001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_20001_to_30000 = parseInt(parseFloat((v_price_diff - 170000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_20001_to_30000 / 1000));
            }
            //£10,001 to £20,000
            else if (v_price_diff > 180000 && v_price_diff <= 190000) {
                var v_price_left_from_100001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_10001_to_20000 = parseInt(parseFloat((v_price_diff - 180000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_10001_to_20000 / 500));
            }
            //£2,001 to £10,000
            else if (v_price_diff > 190000 && v_price_diff <= 198000) {
                var v_price_left_from_100001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_2001_to_10000 = parseInt(parseFloat((v_price_diff - 190000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_2001_to_10000 / 100));
            }
            //£1,001 to £2,000
            else if (v_price_diff > 198000 && v_price_diff <= 199000) {
                var v_price_left_from_100001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_1001_to_2000 = parseInt(parseFloat((v_price_diff - 198000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_1001_to_2000 / 50));
            }
            //£400 to £1,001
            else if (v_price_diff > 199000 && v_price_diff <= 199600) {
                var v_price_left_from_100001_to_200000 = 6;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_30001_to_50000 = 30;
                var v_price_left_from_20001_to_30000 = 30;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_2001_to_10000 = 240;
                var v_price_left_from_1001_to_2000 = 60;
                var v_price_left_from_400_to_1000 = parseInt(parseFloat((v_price_diff - 199000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_100001_to_200000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_30001_to_50000) + parseInt(v_price_left_from_20001_to_30000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_2001_to_10000) + parseInt(v_price_left_from_1001_to_2000) + parseInt(v_price_left_from_400_to_1000 / 12.5));
            }
            else {
                var percentage = (PriceMax - PriceArray[0][0]) * 100 / (PriceArray[0][1] - PriceArray[0][0]);
                var newPos = Math.round(((percentage * (sldPriceRightMaxLeft - sldPriceLeftMinLeft)) / 100) + sldPriceLeftMinLeft);
            }
        }
        //Loose Diamonds Search
        else {

            //£150,001 to £200,000
            if (v_price_diff <= 50000) {
                var v_price_left_from_150001_to_200000 = parseInt(parseFloat(v_price_diff * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - parseInt(v_price_left_from_150001_to_200000 / 25000);
            }
            //£100,001 to £150,000
            else if (v_price_diff > 50000 && v_price_diff <= 100000) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = parseInt(parseFloat((v_price_diff - 50000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000 / 12500));
            }
            //£50,001 to £100,000
            else if (v_price_diff > 100000 && v_price_diff <= 150000) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_50001_to_100000 = parseInt(parseFloat((v_price_diff - 100000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_50001_to_100000 / 5000));
            }
            //£20,001 to £50,000
            else if (v_price_diff > 150000 && v_price_diff <= 180000) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_20001_to_50000 = parseInt(parseFloat((v_price_diff - 150000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_20001_to_50000 / 1000));
            }
            //£10,001 to £20,000
            else if (v_price_diff > 180000 && v_price_diff <= 190000) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_10001_to_20000 = parseInt(parseFloat((v_price_diff - 180000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_10001_to_20000 / 500));
            }
            //£1,001 to £10,000
            else if (v_price_diff > 190000 && v_price_diff <= 199000) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_1001_to_10000 = parseInt(parseFloat((v_price_diff - 190000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_1001_to_10000 / 100));
            }
            //£501 to £1,000
            else if (v_price_diff > 199000 && v_price_diff <= 199500) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_501_to_1001 = parseInt(parseFloat((v_price_diff - 199000) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_501_to_1001 / 25));
            }
            //£200 to £500
            else if (v_price_diff > 199500 && v_price_diff <= 199800) {
                var v_price_left_from_150001_to_200000 = 6;
                var v_price_left_from_100001_to_150000 = 12;
                var v_price_left_from_50001_to_100000 = 30;
                var v_price_left_from_20001_to_50000 = 90;
                var v_price_left_from_10001_to_20000 = 60;
                var v_price_left_from_1001_to_10000 = 270;
                var v_price_left_from_501_to_1001 = 60;
                var v_price_left_from_upto_500 = parseInt(parseFloat((v_price_diff - 199500) * 3).toFixed(2));
                var newPos = parseInt(v_Max_Price_Position) - (parseInt(v_price_left_from_150001_to_200000) + parseInt(v_price_left_from_100001_to_150000) + parseInt(v_price_left_from_50001_to_100000) + parseInt(v_price_left_from_20001_to_50000) + parseInt(v_price_left_from_10001_to_20000) + parseInt(v_price_left_from_1001_to_10000) + parseInt(v_price_left_from_501_to_1001) + parseInt(v_price_left_from_upto_500 / 12.5));
            }
            else {
                var percentage = (PriceMax - PriceArray[0][0]) * 100 / (PriceArray[0][1] - PriceArray[0][0]);
                var newPos = Math.round(((percentage * (sldPriceRightMaxLeft - sldPriceLeftMinLeft)) / 100) + sldPriceLeftMinLeft);
            }
        }
    }
    else {
        var percentage = (PriceMax - PriceArray[0][0]) * 100 / (PriceArray[0][1] - PriceArray[0][0]);
        var newPos = Math.round(((percentage * (sldPriceRightMaxLeft - sldPriceLeftMinLeft)) / 100) + sldPriceLeftMinLeft);
    }
    sldPriceLeftMaxLeft = newPos;
    setPosition(osldPriceRight, newPos, sldPriceTop);
    o = document.getElementById("sldPriceMiddle");
    if (PriceMax == PriceMin)
        o.style.width = 0;
    else
        o.style.width = newPos - sldPriceRightMinLeft + SliderWidth;
    return false;
} catch (Error) { }
}
function parseMoney(parseString) {
try{
    if (parseInt(parseString / 1000) >= 1) {
        var modString = parseInt(parseString % 1000);
        if (modString < 100) {
            if (modString < 10)
                modString = "00" + modString;
            else
                modString = "0" + modString;
        }
        parseString = parseMoney(parseInt(parseString / 1000)) + "," + modString;
        return parseString;
    }
    else
        return parseString;
} catch (Error) { }
}

/* ######################### Shape Functions ######################### */
function fnShapeCheck(v_shape) {
try{
    var v_clicked_shape = v_shape;
    //Shape Condition
    //RB
    if (v_clicked_shape == "1") {
        o = document.getElementById("hdn_Shape_RB");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //PR
    else if (v_clicked_shape == "2") {
        o = document.getElementById("hdn_Shape_PR");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //EM
    else if (v_clicked_shape == "3") {
        o = document.getElementById("hdn_Shape_EM");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //HE
    else if (v_clicked_shape == "4") {
        o = document.getElementById("hdn_Shape_HE");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //MQ
    else if (v_clicked_shape == "5") {
        o = document.getElementById("hdn_Shape_MQ");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //OV
    else if (v_clicked_shape == "6") {
        o = document.getElementById("hdn_Shape_OV");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //PE
    else if (v_clicked_shape == "7") {
        o = document.getElementById("hdn_Shape_PE");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //RD
    else if (v_clicked_shape == "8") {
        o = document.getElementById("hdn_Shape_RD");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //AS
    else if (v_clicked_shape == "9") {
        o = document.getElementById("hdn_Shape_AS");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //CS
    else if (v_clicked_shape == "10") {
        o = document.getElementById("hdn_Shape_CS");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //TR
    else if (v_clicked_shape == "11") {
        o = document.getElementById("hdn_Shape_TR");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }

    o1 = document.getElementById("td_shape_standard");
    v_obj_stand = document.getElementById("td_standard_diamond_result");
    var v_Top_Stand = getAbsTop(v_obj_stand);
    var v_Top = getAbsTop(o1);
    var v_New_Height;
    if (v_Top > v_Top_Stand) {
        v_New_Height = v_Top - v_Top_Stand;
        if (v_New_Height > 5) {
            v_New_Height = v_New_Height - 5;
        }
    }
    else {
        v_New_Height = 15;
    }
    v_obj = document.getElementById("td_diamond_result_blank_space");
    v_obj.height = v_New_Height + "px";
    
    setShapeCheckbox();
} catch (Error) { }
}
function fnShapeCheck_Basic(v_shape) {
try{
    var v_clicked_shape = v_shape;
    //Shape Condition
    //RB
    if (v_clicked_shape == "1") {
        o = document.getElementById("hdn_Shape_RB");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //PR
    else if (v_clicked_shape == "2") {
        o = document.getElementById("hdn_Shape_PR");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //EM
    else if (v_clicked_shape == "3") {
        o = document.getElementById("hdn_Shape_EM");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //HE
    else if (v_clicked_shape == "4") {
        o = document.getElementById("hdn_Shape_HE");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //MQ
    else if (v_clicked_shape == "5") {
        o = document.getElementById("hdn_Shape_MQ");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //OV
    else if (v_clicked_shape == "6") {
        o = document.getElementById("hdn_Shape_OV");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //PE
    else if (v_clicked_shape == "7") {
        o = document.getElementById("hdn_Shape_PE");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //RD
    else if (v_clicked_shape == "8") {
        o = document.getElementById("hdn_Shape_RD");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //AS
    else if (v_clicked_shape == "9") {
        o = document.getElementById("hdn_Shape_AS");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //CS
    else if (v_clicked_shape == "10") {
        o = document.getElementById("hdn_Shape_CS");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    //TR
    else if (v_clicked_shape == "11") {
        o = document.getElementById("hdn_Shape_TR");
        if (o.value == "1") {
            o.value = "0";
        }
        else {
            o.value = "1";
        }
    }
    setShapeCheckbox_Basic();
} catch (Error) { }
}
function setShapeCheckbox_Basic() {
try{
    //RB
    o = document.getElementById("hdn_Shape_RB");
    o1 = document.getElementById("chk_shape_rb_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //PR
    o = document.getElementById("hdn_Shape_PR");
    o1 = document.getElementById("chk_shape_pr_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //EM
    o = document.getElementById("hdn_Shape_EM");
    o1 = document.getElementById("chk_shape_em_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //HE
    o = document.getElementById("hdn_Shape_HE");
    o1 = document.getElementById("chk_shape_he_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //MQ
    o = document.getElementById("hdn_Shape_MQ");
    o1 = document.getElementById("chk_shape_mq_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //OV
    o = document.getElementById("hdn_Shape_OV");
    o1 = document.getElementById("chk_shape_ov_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //PE
    o = document.getElementById("hdn_Shape_PE");
    o1 = document.getElementById("chk_shape_pe_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //RD
    o = document.getElementById("hdn_Shape_RD");
    o1 = document.getElementById("chk_shape_rd_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //AS
    o = document.getElementById("hdn_Shape_AS");
    o1 = document.getElementById("chk_shape_as_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //CS
    o = document.getElementById("hdn_Shape_CS");
    o1 = document.getElementById("chk_shape_cs_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
    //TR
    o = document.getElementById("hdn_Shape_TR");
    o1 = document.getElementById("chk_shape_tr_basic");
    if (o.value == "1") {
        o1.checked = true;
    }
    else {
        o1.checked = false;
    }
} catch (Error) { }
    
}
function setShapeCheckbox() {
try{
    //RB
    o = document.getElementById("hdn_Shape_RB");
    o1 = document.getElementById("img_shape_rb");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //PR
    o = document.getElementById("hdn_Shape_PR");
    o1 = document.getElementById("img_shape_pr");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //EM
    o = document.getElementById("hdn_Shape_EM");
    o1 = document.getElementById("img_shape_em");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //HE
    o = document.getElementById("hdn_Shape_HE");
    o1 = document.getElementById("img_shape_he");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //MQ
    o = document.getElementById("hdn_Shape_MQ");
    o1 = document.getElementById("img_shape_mq");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //OV
    o = document.getElementById("hdn_Shape_OV");
    o1 = document.getElementById("img_shape_ov");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //PE
    o = document.getElementById("hdn_Shape_PE");
    o1 = document.getElementById("img_shape_pe");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //RD
    o = document.getElementById("hdn_Shape_RD");
    o1 = document.getElementById("img_shape_rd");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //AS
    o = document.getElementById("hdn_Shape_AS");
    o1 = document.getElementById("img_shape_as");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //CS
    o = document.getElementById("hdn_Shape_CS");
    o1 = document.getElementById("img_shape_cs");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    //TR
    o = document.getElementById("hdn_Shape_TR");
    o1 = document.getElementById("img_shape_tr");
    if (o.value == "1") {
        o1.src = "/Images/chk_on.gif";
    }
    else {
        o1.src = "/Images/chk_off.gif";
    }
    fnFetchDiamonds(false);
} catch (Error) { }
}
function sldMouseMove(e)	// Generic mouse move handler
{
try{
    if (!e) { e = window.event }
    MouseLeft = e.clientX;
    MouseRight = e.clientY;
    if (dosldColorLeftDrag)	// If drag action is on going
    {
        o = document.getElementById("sldColorLeft");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldColorLeftMinLeft) { newPos = sldColorLeftMinLeft }; // Check slider's container boundaries
        if (newPos >= sldColorLeftMaxLeft) { newPos = sldColorLeftMaxLeft };
        sldColorRightMinLeft = newPos + SliderBarLeftRightDiff;
        setPosition(o, newPos, sldColorTop); // Set slider's head new position
        fnColorLeftCheck(newPos);
        o = document.getElementById("sldColorMiddle");
        o.style.left = newPos;
        o.style.width = sldColorLeftMaxLeft + 10 - newPos;
        return false;
    }
    else if (dosldColorRightDrag) {
        o = document.getElementById("sldColorRight");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldColorRightMinLeft) { newPos = sldColorRightMinLeft }; // Check slider's container boundaries
        if (newPos >= sldColorRightMaxLeft) { newPos = sldColorRightMaxLeft };
        sldColorLeftMaxLeft = newPos - SliderBarLeftRightDiff;
        setPosition(o, newPos, sldColorTop); // Set slider's head new position
        fnColorRightCheck(newPos);
        o = document.getElementById("sldColorMiddle");
        o.style.width = newPos - sldColorRightMinLeft + 10;
        return false;
    }
    else if (dosldClarityLeftDrag)	// If drag action is on going
    {
        o = document.getElementById("sldClarityLeft");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldClarityLeftMinLeft) { newPos = sldClarityLeftMinLeft }; // Check slider's container boundaries
        if (newPos >= sldClarityLeftMaxLeft) { newPos = sldClarityLeftMaxLeft };
        sldClarityRightMinLeft = newPos + SliderBarLeftRightDiff;
        setPosition(o, newPos, sldClarityTop); // Set slider's head new position
        fnClarityLeftCheck(newPos);
        o = document.getElementById("sldClarityMiddle");
        o.style.left = newPos;
        o.style.width = sldClarityLeftMaxLeft + 10 - newPos;
        return false;
    }
    else if (dosldClarityRightDrag) {
        o = document.getElementById("sldClarityRight");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldClarityRightMinLeft) { newPos = sldClarityRightMinLeft }; // Check slider's container boundaries
        if (newPos >= sldClarityRightMaxLeft) { newPos = sldClarityRightMaxLeft };
        sldClarityLeftMaxLeft = newPos - SliderBarLeftRightDiff;
        setPosition(o, newPos, sldClarityTop); // Set slider's head new position
        fnClarityRightCheck(newPos);
        o = document.getElementById("sldClarityMiddle");
        o.style.width = newPos - sldColorRightMinLeft + 10;
        return false;
    }
    else if (dosldCutLeftDrag)	// If drag action is on going
    {
        o = document.getElementById("sldCutLeft");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldCutLeftMinLeft) { newPos = sldCutLeftMinLeft }; // Check slider's container boundaries
        if (newPos >= sldCutLeftMaxLeft) { newPos = sldCutLeftMaxLeft };
        sldCutRightMinLeft = newPos + SliderBarLeftRightDiff;
        setPosition(o, newPos, sldCutTop); // Set slider's head new position
        fnCutLeftCheck(newPos);
        o = document.getElementById("sldCutMiddle");
        o.style.left = newPos;
        o.style.width = sldCutLeftMaxLeft + 10 - newPos;
        return false;
    }
    else if (dosldCutRightDrag) {
        o = document.getElementById("sldCutRight");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldCutRightMinLeft) { newPos = sldCutRightMinLeft }; // Check slider's container boundaries
        if (newPos >= sldCutRightMaxLeft) { newPos = sldCutRightMaxLeft };
        sldCutLeftMaxLeft = newPos - SliderBarLeftRightDiff;
        setPosition(o, newPos, sldCutTop); // Set slider's head new position
        fnCutRightCheck(newPos);
        o = document.getElementById("sldCutMiddle");
        o.style.width = newPos - sldCutRightMinLeft + 10;
        return false;
    }
    else if (dosldCaratLeftDrag)	// If drag action is on going
    {
        o = document.getElementById("sldCaratLeft");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldCaratLeftMinLeft) { newPos = sldCaratLeftMinLeft }; // Check slider's container boundaries
        if (newPos >= sldCaratLeftMaxLeft) { newPos = sldCaratLeftMaxLeft };
        sldCaratRightMinLeft = newPos;
        setPosition(o, newPos, sldCaratTop); // Set slider's head new position
        fnCaratLeftCheck(newPos);
        o = document.getElementById("sldCaratMiddle");
        o.style.left = newPos;
        o.style.width = sldCaratLeftMaxLeft + SliderWidth - newPos;
        return false;
    }
    else if (dosldCaratRightDrag) {
        o = document.getElementById("sldCaratRight");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldCaratRightMinLeft) { newPos = sldCaratRightMinLeft }; // Check slider's container boundaries
        if (newPos >= sldCaratRightMaxLeft) { newPos = sldCaratRightMaxLeft };
        sldCaratLeftMaxLeft = newPos - SliderBarLeftRightDiff;
        setPosition(o, newPos, sldCaratTop); // Set slider's head new position
        fnCaratRightCheck(newPos);
        o = document.getElementById("sldCaratMiddle");
        o.style.width = newPos - sldCaratRightMinLeft + SliderWidth;
        return false;
    }
    else if (dosldPriceLeftDrag)	// If drag action is on going
    {
        o = document.getElementById("sldPriceLeft");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldPriceLeftMinLeft) { newPos = sldPriceLeftMinLeft }; // Check slider's container boundaries
        if (newPos >= sldPriceLeftMaxLeft) { newPos = sldPriceLeftMaxLeft };
        sldPriceRightMinLeft = newPos;
        setPosition(o, newPos, sldPriceTop); // Set slider's head new position
        fnPriceLeftCheck(newPos);
        o = document.getElementById("sldPriceMiddle");
        o.style.left = newPos;
        o.style.width = sldPriceLeftMaxLeft + SliderWidth - newPos;
        return false;
    }
    else if (dosldPriceRightDrag) {
        o = document.getElementById("sldPriceRight");
        var newPos = e.clientX - sldMouseLeft; // Get slider's head new position
        if (newPos <= sldPriceRightMinLeft) { newPos = sldPriceRightMinLeft }; // Check slider's container boundaries
        if (newPos >= sldPriceRightMaxLeft) { newPos = sldPriceRightMaxLeft };
        sldPriceLeftMaxLeft = newPos - SliderBarLeftRightDiff;
        setPosition(o, newPos, sldPriceTop); // Set slider's head new position
        fnPriceRightCheck(newPos);
        o = document.getElementById("sldPriceMiddle");
        o.style.width = newPos - sldPriceRightMinLeft + SliderWidth;
        return false;
    }
} catch (Error) { }
}
function fnLoad()	//Initialize variables
{
try{
    //Set Intial Values for Carat & Price
    set_IntialValues();
    //Calling Get Cookies Function
    getCookie();
    if (document.getElementById("hdn_Search_Type_Cookie").value != null) {
        document.getElementById("hdn_Search_Type").value = document.getElementById("hdn_Search_Type_Cookie").value;
    }
    if (document.getElementById("hdn_Search_Type").value == "1") {
        var dv_search_option_sliders = document.getElementById("dv_search_option_sliders");
        var dv_diamonds_search_sliders = document.getElementById("dv_diamonds_search_sliders");
        var dv_search_option_basic = document.getElementById("dv_search_option_basic");
        var dv_diamonds_search_basic = document.getElementById("dv_diamonds_search_basic");
        
        dv_search_option_basic.style.display = 'block';
        dv_diamonds_search_basic.style.display = 'block';
        dv_search_option_sliders.style.display = 'none';
        dv_diamonds_search_sliders.style.display = 'none';
        setBasicSearchControls_Intial();
    }
    else {
        var dv_search_option_sliders = document.getElementById("dv_search_option_sliders");
        var dv_diamonds_search_sliders = document.getElementById("dv_diamonds_search_sliders");
        var dv_search_option_basic = document.getElementById("dv_search_option_basic");
        var dv_diamonds_search_basic = document.getElementById("dv_diamonds_search_basic");
        dv_search_option_basic.style.display = 'none';
        dv_diamonds_search_basic.style.display = 'none';
        dv_search_option_sliders.style.display = 'block';
        dv_diamonds_search_sliders.style.display = 'block';
        //Calling set Sliders Function
        setSliders_Intial();
    }
} catch (Error) { }
}
function set_IntialValues() {
   //Intial Minimum Price
    try
    {
        o = document.getElementById("hdn_Initial_Min_Price");
        PriceArray[0][0] = parseInt(o.value);
    }
    catch (err) {
        null;
    }
    //Intial Maximum Price
    try {
        o = document.getElementById("hdn_Initial_Max_Price");
        PriceArray[0][1] = parseInt(o.value);
    }
    catch (err) {
        null;
    }
    //Intial Minimum Carat
    try {
        o = document.getElementById("hdn_Initial_Min_Carat");
        InitialCaratMin = parseFloat(o.value).toFixed(2);
    }
    catch (err) {
        null;
    }
    //Intial Maximum Carat
    try {
        o = document.getElementById("hdn_Initial_Max_Carat");
        InitialCaratMax = parseFloat(o.value).toFixed(2);
    }
    catch (err) {
        null;
    }
    
}
function setSliders_Intial() {

    flgRecordFecth = true;
   //****** Price Slider ******
    //Slider Price Left Arrow Variables
   try {
    o = document.getElementById("sldPriceLeft");
    o1 = document.getElementById("tblPriceSlider");
    sldPriceLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldPriceLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - 17;
    var v_Min_Price_Left = parseInt(sldPriceLeftMinLeft);
    obj = document.getElementById("hdn_Min_Price_Left");
    obj.value = v_Min_Price_Left;
    //sldPriceLeftMaxLeft = sldPriceLeftMaxLeft + 8;
    sldPriceTop = getAbsTop(o1);
    setTop(o, sldPriceTop);
    setPosition(o, sldPriceLeftMinLeft, sldPriceTop);
    fnPriceLeftCheck(sldPriceLeftMinLeft);
    }
    catch (err) {
        null;
    }
    //Slider Price Right Arrow Variables
    try {
    o = document.getElementById("sldPriceRight");
    sldPriceRightMinLeft = sldPriceLeftMinLeft;
    sldPriceRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    var v_Max_Price_Left = parseInt(sldPriceRightMaxLeft);
    obj = document.getElementById("hdn_Max_Price_Left");
    obj.value = v_Max_Price_Left;
    setTop(o, sldPriceTop);
    setPosition(o, sldPriceRightMaxLeft, sldPriceTop);
    o = document.getElementById("sldPriceMiddle");
    o.style.top = sldPriceTop + 1;
    o.style.left = sldPriceLeftMinLeft;
    o.style.width = sldPriceRightMaxLeft - sldPriceLeftMinLeft;
    fnPriceRightCheck(sldPriceRightMaxLeft);
    }
    catch (err) {
        null;
    }
    //****** Carat Slider ******
    //Slider Carat Left Arrow Variables
    try {
    o = document.getElementById("sldCaratLeft");
    o1 = document.getElementById("tblCaratSlider");
    sldCaratLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldCaratLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - 17;
    var v_Min_Carat_Left = parseInt(sldCaratLeftMinLeft);
    obj = document.getElementById("hdn_Min_Carat_Left");
    obj.value = v_Min_Carat_Left;
    sldCaratTop = getAbsTop(o1);
    setTop(o, sldCaratTop);
    setPosition(o, sldCaratLeftMinLeft, sldCaratTop);
    fnCaratLeftCheck(sldCaratLeftMinLeft);
    }
    catch (err) {
        null;
    }
    //Slider Carat Right Arrow Variables
    try {
    o = document.getElementById("sldCaratRight");
    sldCaratRightMinLeft = sldCaratLeftMinLeft;
    sldCaratRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    var v_Max_Carat_Left = parseInt(sldCaratRightMaxLeft);
    obj = document.getElementById("hdn_Max_Carat_Left");
    obj.value = v_Max_Carat_Left;
    setTop(o, sldCaratTop);
    setPosition(o, sldCaratRightMaxLeft, sldCaratTop);
    o = document.getElementById("sldCaratMiddle");
    o.style.top = sldCaratTop + 1;
    o.style.left = sldCaratLeftMinLeft;
    o.style.width = sldCaratRightMaxLeft - sldCaratLeftMinLeft;
    fnCaratRightCheck(sldCaratRightMaxLeft);
    }
    catch (err) {
        null;
    }
    //****** Cut Slider ******
    //Slider Cut Left Arrow Variables
    try {
    o = document.getElementById("sldCutLeft");
    o1 = document.getElementById("tblCutSlider");
    sldCutLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldCutLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth;
    sldCutTop = getAbsTop(o1);
    setTop(o, sldCutTop);
    setPosition(o, sldCutLeftMinLeft, sldCutTop);
    fnCutLeftCheck(sldCutLeftMinLeft);
     }
    catch (err) {
        null;
    }
    //Slider Cut Right Arrow Variables
    try {
    o = document.getElementById("sldCutRight");
    sldCutRightMinLeft = sldCutLeftMinLeft + SliderWidth;
    sldCutRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldCutTop);
    setPosition(o, sldCutRightMaxLeft, sldCutTop);
    o = document.getElementById("sldCutMiddle");
    o.style.top = sldCutTop + 1;
    o.style.left = sldCutLeftMinLeft;
    o.style.width = sldCutRightMaxLeft - sldCutLeftMinLeft;
    fnCutRightCheck(sldCutRightMaxLeft);
     }
    catch (err) {
        null;
    }
    //****** Color Slider ******
    //Slider Color Left Arrow Variables
    try {
    o = document.getElementById("sldColorLeft");
    o1 = document.getElementById("tblColorSlider");
    sldColorLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldColorLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth;
    sldColorTop = getAbsTop(o1);
    setTop(o, sldColorTop);
    setPosition(o, sldColorLeftMinLeft, sldColorTop);
    fnColorLeftCheck(sldColorLeftMinLeft);
     }
    catch (err) {
        null;
    }
    //Slider Color Right Arrow Variables
    try {
    o = document.getElementById("sldColorRight");
    sldColorRightMinLeft = sldColorLeftMinLeft + SliderWidth;
    sldColorRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldColorTop);
    setPosition(o, sldColorRightMaxLeft, sldColorTop);
    o = document.getElementById("sldColorMiddle");
    o.style.top = sldColorTop + 1;
    o.style.left = sldColorLeftMinLeft;
    o.style.width = sldColorRightMaxLeft - sldColorLeftMinLeft;
    fnColorRightCheck(sldColorRightMaxLeft);
     }
    catch (err) {
        null;
    }
    //****** Clarity Slider ******
    //Slider Clarity Left Arrow Variables
    try {
    o = document.getElementById("sldClarityLeft");
    o1 = document.getElementById("tblClaritySlider");
    sldClarityLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldClarityLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth;
    sldClarityTop = getAbsTop(o1);
    setTop(o, sldClarityTop);
    setPosition(o, sldClarityLeftMinLeft, sldClarityTop);
    fnClarityLeftCheck(sldClarityLeftMinLeft);
    }
    catch (err) {
        null;
    }
    //Slider Clarity Right Arrow Variables
    try {
    o = document.getElementById("sldClarityRight");
    sldClarityRightMinLeft = sldClarityLeftMinLeft + SliderWidth;
    sldClarityRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldClarityTop);
    setPosition(o, sldClarityRightMaxLeft, sldClarityTop);
    o = document.getElementById("sldClarityMiddle");
    o.style.top = sldClarityTop + 1;
    o.style.left = sldClarityLeftMinLeft;
    o.style.width = sldClarityRightMaxLeft - sldClarityLeftMinLeft;
    fnClarityRightCheck(sldClarityRightMaxLeft);
    }
    catch (err) {
        null;
    }
    //Initial stage of sliders
    //Shape
    try {
    //Shape
    if (document.getElementById("hdn_Shape_RB_Cookie").value != null) {
        document.getElementById("hdn_Shape_RB").value = document.getElementById("hdn_Shape_RB_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_PR_Cookie").value != null) {
        document.getElementById("hdn_Shape_PR").value = document.getElementById("hdn_Shape_PR_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_EM_Cookie").value != null) {
        document.getElementById("hdn_Shape_EM").value = document.getElementById("hdn_Shape_EM_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_HE_Cookie").value != null) {
        document.getElementById("hdn_Shape_HE").value = document.getElementById("hdn_Shape_HE_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_MQ_Cookie").value != null) {
        document.getElementById("hdn_Shape_MQ").value = document.getElementById("hdn_Shape_MQ_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_OV_Cookie").value != null) {
        document.getElementById("hdn_Shape_OV").value = document.getElementById("hdn_Shape_OV_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_PE_Cookie").value != null) {
        document.getElementById("hdn_Shape_PE").value = document.getElementById("hdn_Shape_PE_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_RD_Cookie").value != null) {
        document.getElementById("hdn_Shape_RD").value = document.getElementById("hdn_Shape_RD_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_AS_Cookie").value != null) {
        document.getElementById("hdn_Shape_AS").value = document.getElementById("hdn_Shape_AS_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_CS_Cookie").value != null) {
        document.getElementById("hdn_Shape_CS").value = document.getElementById("hdn_Shape_CS_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_TR_Cookie").value != null) {
        document.getElementById("hdn_Shape_TR").value = document.getElementById("hdn_Shape_TR_Cookie").value;
    }
    setShapeCheckbox();
     }
    catch (err) {
        null;
    }
    //Price
    try {
    PriceMin = document.getElementById("hdn_Min_Price_Cookie").value;
    var td_MinPrice = document.getElementById("tdMinPrice");
    td_MinPrice.innerHTML = PriceMin;
    document.getElementById("hdn_Min_Price").value = document.getElementById("hdn_Min_Price_Cookie").value;
    PriceMax = document.getElementById("hdn_Max_Price_Cookie").value;
    var td_MaxPrice = document.getElementById("tdMaxPrice");
    td_MaxPrice.innerHTML = PriceMax;
    document.getElementById("hdn_Max_Price").value = document.getElementById("hdn_Max_Price_Cookie").value;
    setLeftPriceSlider();
    setRightPriceSlider();
    }
    catch (err) {
        null;
    }
    //Carat
    try {
    CaratMin = document.getElementById("hdn_Min_Carat_Cookie").value;
    var td_MinCarat = document.getElementById("tdMinCarat");
    td_MinCarat.innerHTML = CaratMin;
    document.getElementById("hdn_Min_Carat").value = document.getElementById("hdn_Min_Carat_Cookie").value;
    CaratMax = document.getElementById("hdn_Max_Carat_Cookie").value;
    var td_MaxCarat = document.getElementById("tdMaxCarat");
    td_MaxCarat.innerHTML = CaratMax;
    document.getElementById("hdn_Max_Carat").value = document.getElementById("hdn_Max_Carat_Cookie").value;
    setLeftCaratSlider();
    setRightCaratSlider();
    }
    catch (err) {
        null;
    }
    //Cut
    try {
    if (document.getElementById("hdn_Min_Cut_Cookie").value != null) {
        CutMin = document.getElementById("hdn_Min_Cut_Cookie").value;
        document.getElementById("hdn_Min_Cut").value = document.getElementById("hdn_Min_Cut_Cookie").value;
    }
    if (document.getElementById("hdn_Max_Cut_Cookie").value != null) {
        CutMax = document.getElementById("hdn_Max_Cut_Cookie").value;
        document.getElementById("hdn_Max_Cut").value = document.getElementById("hdn_Max_Cut_Cookie").value;
    }
    setLeftCutSlider();
    setRightCutSlider();
    }
    catch (err) {
        null;
    }
    //Colour
    try {
    if (document.getElementById("hdn_Min_Colour_Cookie").value != null) {
        ColorMin = document.getElementById("hdn_Min_Colour_Cookie").value;
        document.getElementById("hdn_Min_Colour").value = document.getElementById("hdn_Min_Colour_Cookie").value;
    }
    if (document.getElementById("hdn_Max_Colour_Cookie").value != null) {
        ColorMax = document.getElementById("hdn_Max_Colour_Cookie").value;
        document.getElementById("hdn_Max_Colour").value = document.getElementById("hdn_Max_Colour_Cookie").value;
    }
    setLeftColorSlider();
    setRightColorSlider();
    }
    catch (err) {
        null;
    }
    //Clarity
    try {
    if (document.getElementById("hdn_Min_Clarity_Cookie").value != null) {
        ClarityMin = document.getElementById("hdn_Min_Clarity_Cookie").value;
        document.getElementById("hdn_Min_Clarity").value = document.getElementById("hdn_Min_Clarity_Cookie").value;
    }
    if (document.getElementById("hdn_Max_Clarity_Cookie").value != null) {
        ClarityMax = document.getElementById("hdn_Max_Clarity_Cookie").value;
        document.getElementById("hdn_Max_Clarity").value = document.getElementById("hdn_Max_Clarity_Cookie").value;
    }
    setLeftClaritySlider();
    setRightClaritySlider();
    }
    catch (err) {
        null;
    }
    fnFetchDiamonds(true);
    flgRecordFecth = false;
}
function setSliders() {
try{
    flgRecordFecth = true;
    //****** Color Slider ******
    //Slider Color Left Arrow Variables
    o = document.getElementById("sldColorLeft");
    o1 = document.getElementById("tblColorSlider");
    sldColorLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldColorLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth;
    sldColorTop = getAbsTop(o1);
    setTop(o, sldColorTop);
    setPosition(o, sldColorLeftMinLeft, sldColorTop);
    fnColorLeftCheck(sldColorLeftMinLeft);
    //Slider Color Right Arrow Variables
    o = document.getElementById("sldColorRight");
    sldColorRightMinLeft = sldColorLeftMinLeft + SliderWidth;
    sldColorRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldColorTop);
    setPosition(o, sldColorRightMaxLeft, sldColorTop);
    o = document.getElementById("sldColorMiddle");
    o.style.top = sldColorTop + 1;
    o.style.left = sldColorLeftMinLeft;
    o.style.width = sldColorRightMaxLeft - sldColorLeftMinLeft;
    fnColorRightCheck(sldColorRightMaxLeft);
    //****** Clarity Slider ******
    //Slider Clarity Left Arrow Variables
    o = document.getElementById("sldClarityLeft");
    o1 = document.getElementById("tblClaritySlider");
    sldClarityLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldClarityLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth;
    sldClarityTop = getAbsTop(o1);
    setTop(o, sldClarityTop);
    setPosition(o, sldClarityLeftMinLeft, sldClarityTop);
    fnClarityLeftCheck(sldClarityLeftMinLeft);
    //Slider Clarity Right Arrow Variables
    o = document.getElementById("sldClarityRight");
    sldClarityRightMinLeft = sldClarityLeftMinLeft + SliderWidth;
    sldClarityRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldClarityTop);
    setPosition(o, sldClarityRightMaxLeft, sldClarityTop);
    o = document.getElementById("sldClarityMiddle");
    o.style.top = sldClarityTop + 1;
    o.style.left = sldClarityLeftMinLeft;
    o.style.width = sldClarityRightMaxLeft - sldClarityLeftMinLeft;
    fnClarityRightCheck(sldClarityRightMaxLeft);
    //****** Cut Slider ******
    //Slider Cut Left Arrow Variables
    o = document.getElementById("sldCutLeft");
    o1 = document.getElementById("tblCutSlider");
    sldCutLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldCutLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth;
    sldCutTop = getAbsTop(o1);
    setTop(o, sldCutTop);
    setPosition(o, sldCutLeftMinLeft, sldCutTop);
    fnCutLeftCheck(sldCutLeftMinLeft);
    //Slider Cut Right Arrow Variables
    o = document.getElementById("sldCutRight");
    sldCutRightMinLeft = sldCutLeftMinLeft + SliderWidth;
    sldCutRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldCutTop);
    setPosition(o, sldCutRightMaxLeft, sldCutTop);
    o = document.getElementById("sldCutMiddle");
    o.style.top = sldCutTop + 1;
    o.style.left = sldCutLeftMinLeft;
    o.style.width = sldCutRightMaxLeft - sldCutLeftMinLeft;
    fnCutRightCheck(sldCutRightMaxLeft);
    //****** Carat Slider ******
    //Slider Carat Left Arrow Variables
    o = document.getElementById("sldCaratLeft");
    o1 = document.getElementById("tblCaratSlider");
    sldCaratLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldCaratLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - 17;
    sldCaratTop = getAbsTop(o1);
    setTop(o, sldCaratTop);
    setPosition(o, sldCaratLeftMinLeft, sldCaratTop);
    fnCaratLeftCheck(sldCaratLeftMinLeft);
    //Slider Carat Right Arrow Variables
    o = document.getElementById("sldCaratRight");
    sldCaratRightMinLeft = sldCaratLeftMinLeft;
    sldCaratRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldCaratTop);
    setPosition(o, sldCaratRightMaxLeft, sldCaratTop);
    o = document.getElementById("sldCaratMiddle");
    o.style.top = sldCaratTop + 1;
    o.style.left = sldCaratLeftMinLeft;
    o.style.width = sldCaratRightMaxLeft - sldCaratLeftMinLeft;
    fnCaratRightCheck(sldCaratRightMaxLeft);
    //****** Price Slider ******
    //Slider Price Left Arrow Variables
    o = document.getElementById("sldPriceLeft");
    o1 = document.getElementById("tblPriceSlider");
    sldPriceLeftMinLeft = getAbsLeft(o1) + SliderBarLeftRightDiff;
    sldPriceLeftMaxLeft = getAbsLeft(o1) + o1.offsetWidth - 17;
    //sldPriceLeftMaxLeft = sldPriceLeftMaxLeft + 8;
    sldPriceTop = getAbsTop(o1);
    setTop(o, sldPriceTop);
    setPosition(o, sldPriceLeftMinLeft, sldPriceTop);
    fnPriceLeftCheck(sldPriceLeftMinLeft);
    //Slider Price Right Arrow Variables
    o = document.getElementById("sldPriceRight");
    sldPriceRightMinLeft = sldPriceLeftMinLeft;
    sldPriceRightMaxLeft = getAbsLeft(o1) + o1.offsetWidth - SliderWidth - SliderBarLeftRightDiff;
    setTop(o, sldPriceTop);
    setPosition(o, sldPriceRightMaxLeft, sldPriceTop);
    o = document.getElementById("sldPriceMiddle");
    o.style.top = sldPriceTop + 1;
    o.style.left = sldPriceLeftMinLeft;
    o.style.width = sldPriceRightMaxLeft - sldPriceLeftMinLeft;
    fnPriceRightCheck(sldPriceRightMaxLeft);
    //Initial stage of sliders
    //Colour
    if (document.getElementById("hdn_Min_Colour_Basic_Search").value != null) {
        ColorMin = document.getElementById("hdn_Min_Colour_Basic_Search").value;
        document.getElementById("hdn_Min_Colour").value = document.getElementById("hdn_Min_Colour_Basic_Search").value;
    }
    if (document.getElementById("hdn_Max_Colour_Basic_Search").value != null) {
        ColorMax = document.getElementById("hdn_Max_Colour_Basic_Search").value;
        document.getElementById("hdn_Max_Colour").value = document.getElementById("hdn_Max_Colour_Basic_Search").value;
    }
    setLeftColorSlider();
    setRightColorSlider();
    //Clarity
    if (document.getElementById("hdn_Min_Clarity_Basic_Search").value != null) {
        ClarityMin = document.getElementById("hdn_Min_Clarity_Basic_Search").value;
        document.getElementById("hdn_Min_Clarity").value = document.getElementById("hdn_Min_Clarity_Basic_Search").value;
    }
    if (document.getElementById("hdn_Max_Clarity_Basic_Search").value != null) {
        ClarityMax = document.getElementById("hdn_Max_Clarity_Basic_Search").value;
        document.getElementById("hdn_Max_Clarity").value = document.getElementById("hdn_Max_Clarity_Basic_Search").value;
    }
    setLeftClaritySlider();
    setRightClaritySlider();
    //Cut
    if (document.getElementById("hdn_Min_Cut_Basic_Search").value != null) {
        CutMin = document.getElementById("hdn_Min_Cut_Basic_Search").value;
        document.getElementById("hdn_Min_Cut").value = document.getElementById("hdn_Min_Cut_Basic_Search").value;
    }
    if (document.getElementById("hdn_Max_Cut_Basic_Search").value != null) {
        CutMax = document.getElementById("hdn_Max_Cut_Basic_Search").value;
        document.getElementById("hdn_Max_Cut").value = document.getElementById("hdn_Max_Cut_Basic_Search").value;
    }
    setLeftCutSlider();
    setRightCutSlider();
    //Carat
    CaratMin = document.getElementById("hdn_Min_Carat_Basic_Search").value;
    var td_MinCarat = document.getElementById("tdMinCarat");
    td_MinCarat.innerHTML = CaratMin;
    document.getElementById("hdn_Min_Carat").value = document.getElementById("hdn_Min_Carat_Basic_Search").value;
    CaratMax = document.getElementById("hdn_Max_Carat_Basic_Search").value;
    var td_MaxCarat = document.getElementById("tdMaxCarat");
    td_MaxCarat.innerHTML = CaratMax;
    document.getElementById("hdn_Max_Carat").value = document.getElementById("hdn_Max_Carat_Basic_Search").value;
    setLeftCaratSlider();
    setRightCaratSlider();
    //Price
    PriceMin = document.getElementById("hdn_Min_Price_Basic_Search").value;
    var td_MinPrice = document.getElementById("tdMinPrice");
    td_MinPrice.innerHTML = PriceMin;
    document.getElementById("hdn_Min_Price").value = document.getElementById("hdn_Min_Price_Basic_Search").value;
    PriceMax = document.getElementById("hdn_Max_Price_Basic_Search").value;
    var td_MaxPrice = document.getElementById("tdMaxPrice");
    td_MaxPrice.innerHTML = PriceMax;
    document.getElementById("hdn_Max_Price").value = document.getElementById("hdn_Max_Price_Basic_Search").value;
    setLeftPriceSlider();
    setRightPriceSlider();
    //Shape
    setShapeCheckbox();
    fnFetchDiamonds(true);
    flgRecordFecth = false;
} catch (Error) { }
}
function setBasicSearchControls_Intial() {
try{

    //Colour
    if (document.getElementById("hdn_Min_Colour_Cookie").value != null) {
        ColorMin = document.getElementById("hdn_Min_Colour_Cookie").value;
        document.getElementById("hdn_Min_Colour_Basic_Search").value = document.getElementById("hdn_Min_Colour_Cookie").value;
    }
    if (document.getElementById("hdn_Max_Colour_Cookie").value != null) {
        ColorMax = document.getElementById("hdn_Max_Colour_Cookie").value;
        document.getElementById("hdn_Max_Colour_Basic_Search").value = document.getElementById("hdn_Max_Colour_Cookie").value;
    }
    setBasicSearch_Colours();
    //Clarity
    if (document.getElementById("hdn_Min_Clarity_Cookie").value != null) {
        ClarityMin = document.getElementById("hdn_Min_Clarity_Cookie").value;
        document.getElementById("hdn_Min_Clarity_Basic_Search").value = document.getElementById("hdn_Min_Clarity_Cookie").value;
    }
    if (document.getElementById("hdn_Max_Clarity_Cookie").value != null) {
        ClarityMax = document.getElementById("hdn_Max_Clarity_Cookie").value;
        document.getElementById("hdn_Max_Clarity_Basic_Search").value = document.getElementById("hdn_Max_Clarity_Cookie").value;
    }
    setBasicSearch_Clarities();
    //Cut
    if (document.getElementById("hdn_Min_Cut_Cookie").value != null) {
        CutMin = document.getElementById("hdn_Min_Cut_Cookie").value;
        document.getElementById("hdn_Min_Cut_Basic_Search").value = document.getElementById("hdn_Min_Cut_Cookie").value;
    }
    if (document.getElementById("hdn_Max_Cut_Cookie").value != null) {
        CutMax = document.getElementById("hdn_Max_Cut_Cookie").value;
        document.getElementById("hdn_Max_Cut_Basic_Search").value = document.getElementById("hdn_Max_Cut_Cookie").value;
    }
    setBasicSearch_Cuts();
    //Carat
    CaratMin = document.getElementById("hdn_Min_Carat_Cookie").value;
    var txt_MinCarat = document.getElementById("txt_carat_from_basic");
    txt_MinCarat.value = CaratMin;
    document.getElementById("hdn_Min_Carat_Basic_Search").value = document.getElementById("hdn_Min_Carat_Cookie").value;
    CaratMax = document.getElementById("hdn_Max_Carat_Cookie").value;
    var txt_MaxCarat = document.getElementById("txt_carat_to_basic");
    txt_MaxCarat.value = CaratMax;
    document.getElementById("hdn_Max_Carat_Basic_Search").value = document.getElementById("hdn_Max_Carat_Cookie").value;
    //Price
    PriceMin = document.getElementById("hdn_Min_Price_Cookie").value;
    var txt_MinPrice = document.getElementById("txt_price_from_basic");
    txt_MinPrice.value = PriceMin;
    document.getElementById("hdn_Min_Price_Basic_Search").value = document.getElementById("hdn_Min_Price_Cookie").value;
    PriceMax = document.getElementById("hdn_Max_Price_Cookie").value;
    var txt_MaxPrice = document.getElementById("txt_price_to_basic");
    txt_MaxPrice.value = PriceMax;
    document.getElementById("hdn_Max_Price_Basic_Search").value = document.getElementById("hdn_Max_Price_Cookie").value;
    //Shape
    if (document.getElementById("hdn_Shape_RB_Cookie").value != null) {
        document.getElementById("hdn_Shape_RB").value = document.getElementById("hdn_Shape_RB_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_PR_Cookie").value != null) {
        document.getElementById("hdn_Shape_PR").value = document.getElementById("hdn_Shape_PR_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_EM_Cookie").value != null) {
        document.getElementById("hdn_Shape_EM").value = document.getElementById("hdn_Shape_EM_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_HE_Cookie").value != null) {
        document.getElementById("hdn_Shape_HE").value = document.getElementById("hdn_Shape_HE_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_MQ_Cookie").value != null) {
        document.getElementById("hdn_Shape_MQ").value = document.getElementById("hdn_Shape_MQ_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_OV_Cookie").value != null) {
        document.getElementById("hdn_Shape_OV").value = document.getElementById("hdn_Shape_OV_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_PE_Cookie").value != null) {
        document.getElementById("hdn_Shape_PE").value = document.getElementById("hdn_Shape_PE_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_RD_Cookie").value != null) {
        document.getElementById("hdn_Shape_RD").value = document.getElementById("hdn_Shape_RD_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_AS_Cookie").value != null) {
        document.getElementById("hdn_Shape_AS").value = document.getElementById("hdn_Shape_AS_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_CS_Cookie").value != null) {
        document.getElementById("hdn_Shape_CS").value = document.getElementById("hdn_Shape_CS_Cookie").value;
    }
    if (document.getElementById("hdn_Shape_TR_Cookie").value != null) {
        document.getElementById("hdn_Shape_TR").value = document.getElementById("hdn_Shape_TR_Cookie").value;
    }
    setShapeCheckbox_Basic();
} catch (Error) { }
}
function setBasicSearch_Colours() {
try{
    //Min Colour
    var v_colour_from_list = document.getElementById("lst_colour_from_basic");
    if (ColorMin == 1) {
        v_colour_from_list.selectedIndex = 0;
    }
    else if (ColorMin == 2) {
        v_colour_from_list.selectedIndex = 1;
    }
    else if (ColorMin == 3) {
        v_colour_from_list.selectedIndex = 2;
    }
    else if (ColorMin == 4) {
        v_colour_from_list.selectedIndex = 3;
    }
    else if (ColorMin == 5) {
        v_colour_from_list.selectedIndex = 4;
    }
    else if (ColorMin == 6) {
        v_colour_from_list.selectedIndex = 5;
    }
    else if (ColorMin == 7) {
        v_colour_from_list.selectedIndex = 6;
    }
    else {
        v_colour_from_list.selectedIndex = 0;
    }
    //Max Colour
    var v_colour_to_list = document.getElementById("lst_colour_to_basic");
    if (ColorMax == 1) {
        v_colour_to_list.selectedIndex = 0;
    }
    else if (ColorMax == 2) {
    v_colour_to_list.selectedIndex = 1;
    }
    else if (ColorMax == 3) {
    v_colour_to_list.selectedIndex = 2;
    }
    else if (ColorMax == 4) {
    v_colour_to_list.selectedIndex = 3;
    }
    else if (ColorMax == 5) {
    v_colour_to_list.selectedIndex = 4;
    }
    else if (ColorMax == 6) {
    v_colour_to_list.selectedIndex = 5;
    }
    else if (ColorMax == 7) {
    v_colour_to_list.selectedIndex = 6;
    }
    else {
        v_colour_to_list.selectedIndex = 6;
    }
} catch (Error) { }
}
function setBasicSearch_Clarities() {
try{
    //Min Clarity
    var v_clarity_from_list = document.getElementById("lst_clarity_from_basic");
    if (ClarityMin == 1) {
        v_clarity_from_list.selectedIndex = 0;
    }
    else if (ClarityMin == 2) {
        v_clarity_from_list.selectedIndex = 1;
    }
    else if (ClarityMin == 3) {
        v_clarity_from_list.selectedIndex = 2;
    }
    else if (ClarityMin == 4) {
        v_clarity_from_list.selectedIndex = 3;
    }
    else if (ClarityMin == 5) {
        v_clarity_from_list.selectedIndex = 4;
    }
    else if (ClarityMin == 6) {
        v_clarity_from_list.selectedIndex = 5;
    }
    else if (ClarityMin == 7) {
        v_clarity_from_list.selectedIndex = 6;
    }
    else if (ClarityMin == 8) {
        v_clarity_from_list.selectedIndex = 7;
    }
    else if (ClarityMin == 9) {
        v_clarity_from_list.selectedIndex = 8;
    }
    else if (ClarityMin == 10) {
        v_clarity_from_list.selectedIndex = 9;
    }
    else {
        v_clarity_from_list.selectedIndex = 0;
    }
    //Max Clarity
    var v_clarity_to_list = document.getElementById("lst_clarity_to_basic");
    if (ClarityMax == 1) {
        v_clarity_to_list.selectedIndex = 0;
    }
    else if (ClarityMax == 2) {
    v_clarity_to_list.selectedIndex = 1;
    }
    else if (ClarityMax == 3) {
    v_clarity_to_list.selectedIndex = 2;
    }
    else if (ClarityMax == 4) {
    v_clarity_to_list.selectedIndex = 3;
    }
    else if (ClarityMax == 5) {
    v_clarity_to_list.selectedIndex = 4;
    }
    else if (ClarityMax == 6) {
    v_clarity_to_list.selectedIndex = 5;
    }
    else if (ClarityMax == 7) {
    v_clarity_to_list.selectedIndex = 6;
    }
    else if (ClarityMax == 8) {
    v_clarity_to_list.selectedIndex = 7;
    }
    else if (ClarityMax == 9) {
    v_clarity_to_list.selectedIndex = 8;
    }
    else if (ClarityMax == 10) {
    v_clarity_to_list.selectedIndex = 9;
    }
    else {
        v_clarity_to_list.selectedIndex = 9;
    }
} catch (Error) { }
}
function setBasicSearch_Cuts() {
try{
    //Min Cut
    var v_cut_from_list = document.getElementById("lst_cut_from_basic");
    if (CutMin == 1) {
        v_cut_from_list.selectedIndex = 0;
    }
    else if (CutMin == 2) {
        v_cut_from_list.selectedIndex = 1;
    }
    else if (CutMin == 3) {
        v_cut_from_list.selectedIndex = 2;
    }
    else if (CutMin == 4) {
        v_cut_from_list.selectedIndex = 3;
    }
    else if (CutMin == 5) {
        v_cut_from_list.selectedIndex = 4;
    }
    else {
        v_cut_from_list.selectedIndex = 0;
    }
    //Max Cut
    var v_cut_to_list = document.getElementById("lst_cut_to_basic");
    if (CutMax == 1) {
        v_cut_to_list.selectedIndex = 0;
    }
    else if (CutMax == 2) {
    v_cut_to_list.selectedIndex = 1;
    }
    else if (CutMax == 3) {
    v_cut_to_list.selectedIndex = 2;
    }
    else if (CutMax == 4) {
    v_cut_to_list.selectedIndex = 3;
    }
    else if (CutMax == 5) {
    v_cut_to_list.selectedIndex = 4;
    }
    else {
        v_cut_to_list.selectedIndex = 5;
    }
} catch (Error) { }
}
function setBasicSearchControls() {
try{

    //Colour
    ColorMin = document.getElementById("hdn_Min_Colour_Basic_Search").value;
    ColorMax = document.getElementById("hdn_Max_Colour_Basic_Search").value;
    setBasicSearch_Colours();
    //Clarity
    ClarityMin = document.getElementById("hdn_Min_Clarity_Basic_Search").value;
    ClarityMax = document.getElementById("hdn_Max_Clarity_Basic_Search").value;
    setBasicSearch_Clarities();
    //Cut
    CutMin = document.getElementById("hdn_Min_Cut_Basic_Search").value;
    CutMax = document.getElementById("hdn_Max_Cut_Basic_Search").value;
    setBasicSearch_Cuts();
    //Carat
    CaratMin = document.getElementById("hdn_Min_Carat_Basic_Search").value;
    var txt_MinCarat = document.getElementById("txt_carat_from_basic");
    txt_MinCarat.value = CaratMin;
    CaratMax = document.getElementById("hdn_Max_Carat_Basic_Search").value;
    var txt_MaxCarat = document.getElementById("txt_carat_to_basic");
    txt_MaxCarat.value = CaratMax;
    //Price
    PriceMin = document.getElementById("hdn_Min_Price_Basic_Search").value;
    var txt_MinPrice = document.getElementById("txt_price_from_basic");
    txt_MinPrice.value = PriceMin;
    PriceMax = document.getElementById("hdn_Max_Price_Basic_Search").value;
    var txt_MaxPrice = document.getElementById("txt_price_to_basic");
    txt_MaxPrice.value = PriceMax;
    setShapeCheckbox_Basic();
} catch (Error) { }
}
function getCookie() {
    try {
        var c_name = "Diamond_Search_Cookie";
        if (document.getElementById("hdn_Search_Option").value == "2") {
            c_name = "Matched_Pairs_Search_Cookie";
        }
        else {
            c_name = "Diamond_Search_Cookie";
        }
        var v_diamond_search_cookies_values = "";
        if (document.cookie.length > 0) {
            var c_start = document.cookie.indexOf(c_name + "=");
            if (c_start != -1) {
                c_start = c_start + c_name.length + 1;
                var c_end = document.cookie.indexOf(";", c_start);
                if (c_end == -1) c_end = document.cookie.length;
                v_diamond_search_cookies_values = unescape(document.cookie.substring(c_start, c_end));
            }
        }
        //Getting values From Cookies
        var v_diamond_search_values;
        if (v_diamond_search_cookies_values != null && v_diamond_search_cookies_values.length > 0) {
            v_diamond_search_values = v_diamond_search_cookies_values.split(",");
        }
        if (v_diamond_search_values.length > 0) {
            //Shapes
            var v_Shape_RB, v_Shape_PR, v_Shape_EM, v_Shape_HE, v_Shape_MQ, v_Shape_OV, v_Shape_PE, v_Shape_RD, v_Shape_AS, v_Shape_CS, v_Shape_TR;
            //Round
            try 
            {
                if (v_diamond_search_values[0] != null) 
                {
                    v_Shape_RB = v_diamond_search_values[0];
                    o = document.getElementById("hdn_Shape_RB_Cookie");
                    o.value = v_Shape_RB;
                }
            }
            catch (err) 
            {
                null;
            }
            //Princess
            try 
            {
                if (v_diamond_search_values[1] != null) 
                {
                    v_Shape_PR = v_diamond_search_values[1];
                    o = document.getElementById("hdn_Shape_PR_Cookie");
                    o.value = v_Shape_PR;
                }
            }
            catch (err) 
            {
                null;
            }
            //Emerald
            try 
            {
                if (v_diamond_search_values[2] != null) 
                {
                    v_Shape_EM = v_diamond_search_values[2];
                    o = document.getElementById("hdn_Shape_EM_Cookie");
                    o.value = v_Shape_EM;
                }
            }
            catch (err) 
            {
                null;
            }
            //Heart
            try 
            {
                if (v_diamond_search_values[3] != null) 
                {
                    v_Shape_HE = v_diamond_search_values[3];
                    o = document.getElementById("hdn_Shape_HE_Cookie");
                    o.value = v_Shape_HE;
                }
            }
            catch (err) 
            {
                null;
            }
            //Marquise
            try 
            {
                if (v_diamond_search_values[4] != null) 
                {
                    v_Shape_MQ = v_diamond_search_values[4];
                    o = document.getElementById("hdn_Shape_MQ_Cookie");
                    o.value = v_Shape_MQ;
                }
            }
            catch (err) 
            {
                null;
            }
            //Oval
            try 
            {
                if (v_diamond_search_values[5] != null) 
                {
                    v_Shape_OV = v_diamond_search_values[5];
                    o = document.getElementById("hdn_Shape_OV_Cookie");
                    o.value = v_Shape_OV;
                }
            }
            catch (err) 
            {
                null;
            }
            //Pear
            try 
            {
                if (v_diamond_search_values[6] != null) 
                {
                    v_Shape_PE = v_diamond_search_values[6];
                    o = document.getElementById("hdn_Shape_PE_Cookie");
                    o.value = v_Shape_PE;
                }
            }
            catch (err) 
            {
                null;
            }
            //Radiant
            try 
            {
                if (v_diamond_search_values[7] != null) 
                {
                    v_Shape_RD = v_diamond_search_values[7];
                    o = document.getElementById("hdn_Shape_RD_Cookie");
                    o.value = v_Shape_RD;
                }
            }
            catch (err) 
            {
                null;
            }
            //Asscher
            try 
            {
                if (v_diamond_search_values[8] != null) 
                {
                    v_Shape_AS = v_diamond_search_values[8];
                    o = document.getElementById("hdn_Shape_AS_Cookie");
                    o.value = v_Shape_AS;
                }
            }
            catch (err) 
            {
                null;
            }
            //Cushion
            try 
            {
                if (v_diamond_search_values[9] != null) 
                {
                    v_Shape_CS = v_diamond_search_values[9];
                    o = document.getElementById("hdn_Shape_CS_Cookie");
                    o.value = v_Shape_CS;
                }
            }
            catch (err) 
            {
                null;
            }
            //Trillion
            try 
            {
                if (v_diamond_search_values[10] != null) 
                {
                    v_Shape_TR = v_diamond_search_values[10];
                    o = document.getElementById("hdn_Shape_TR_Cookie");
                    o.value = v_Shape_TR;
                }
            }
            catch (err) 
            {
                null;
            }
            //Prices
            var v_Min_Price, v_Max_Price;
            //Min Price
            try 
            {
                if (v_diamond_search_values[11] != null) 
                {
                    v_Min_Price = v_diamond_search_values[11];
                    o = document.getElementById("hdn_Min_Price_Cookie");
                    o.value = v_Min_Price;
                }
            }
            catch (err) 
            {
                null;
            }
            //Max Price
            try 
            {
                if (v_diamond_search_values[12] != null) 
                {
                    v_Max_Price = v_diamond_search_values[12];
                    o = document.getElementById("hdn_Max_Price_Cookie");
                    o.value = v_Max_Price;
                }
            }
            catch (err) 
            {
                null;
            }
            //Carats
            var v_Min_Carat, v_Max_Carat;
            //Min Carat
            try 
            {
                if (v_diamond_search_values[13] != null) 
                {
                    v_Min_Carat = v_diamond_search_values[13];
                    o = document.getElementById("hdn_Min_Carat_Cookie");
                    o.value = v_Min_Carat;
                }
            }
            catch (err) 
            {
                null;
            }
            //Max Carat 
            try 
            {
                if (v_diamond_search_values[14] != null) 
                {
                    v_Max_Carat = v_diamond_search_values[14];
                    o = document.getElementById("hdn_Max_Carat_Cookie");
                    o.value = v_Max_Carat;
                }
            }
            catch (err) 
            {
                null;
            }
            //Cuts
            var v_Min_Cut, v_Max_Cut;
            //Min Cut
            try 
            {
                if (v_diamond_search_values[15] != null) 
                {
                    v_Min_Cut = v_diamond_search_values[15];
                    o = document.getElementById("hdn_Min_Cut_Cookie");
                    o.value = v_Min_Cut;
                }
            }
            catch (err) 
            {
                null;
            }
            //Max Cut
            try 
            {
                if (v_diamond_search_values[16] != null) 
                {
                    v_Max_Cut = v_diamond_search_values[16];
                    o = document.getElementById("hdn_Max_Cut_Cookie");
                    o.value = v_Max_Cut;
                }
            }
            catch (err) 
            {
                null;
            }
            //Colours
            var v_MinColor, v_MaxColor;
            //Min Colour
            try 
            {
                if (v_diamond_search_values[17] != null) 
                {
                    v_MinColor = v_diamond_search_values[17];
                    o = document.getElementById("hdn_Min_Colour_Cookie");
                    o.value = v_MinColor;
                }
            }
            catch (err) 
            {
                null;
            }
            //Max Colour
            try 
            {
                if (v_diamond_search_values[18] != null) 
                {
                    v_MaxColor = v_diamond_search_values[18];
                    o = document.getElementById("hdn_Max_Colour_Cookie");
                    o.value = v_MaxColor;
                }
            }
            catch (err) 
            {
                null;
            }
            //Clarities
            var v_Min_Clarity, v_Max_Clarity;
            //Min Clarity
            try 
            {
                if (v_diamond_search_values[19] != null) 
                {
                    v_Min_Clarity = v_diamond_search_values[19];
                    o = document.getElementById("hdn_Min_Clarity_Cookie");
                    o.value = v_Min_Clarity;
                }
            }
            catch (err) 
            {
                null;
            }
            //Max Clarity
            try 
            {
                if (v_diamond_search_values[20] != null) 
                {
                    v_Max_Clarity = v_diamond_search_values[20];
                    o = document.getElementById("hdn_Max_Clarity_Cookie");
                    o.value = v_Max_Clarity;
                }
            }
            catch (err) 
            {
                null;
            }
            //Labs
            var v_Labs;
            try {
                if (v_diamond_search_values[21] != null) {
                    v_Labs = v_diamond_search_values[21];
                    o = document.getElementById("hdn_Labs_Cookie");
                    o.value = v_Labs;
                }
            }
            catch (err) {
                null;
            }
            //Category Code
            var v_Category_Code;
            try 
            {
                if (v_diamond_search_values[22] != null) 
                {
                    v_Category_Code = v_diamond_search_values[22];
                    o = document.getElementById("hdn_Category_Cookie");
                    o.value = v_Category_Code;
                }
            }
            catch (err) 
            {
                null;
            }
            //Sub Category Code
            var v_Sub_Category_Code;
            try 
            {
                if (v_diamond_search_values[23] != null) 
                {
                    v_Sub_Category_Code = v_diamond_search_values[23];
                    o = document.getElementById("hdn_Sub_Category_Cookie");
                    o.value = v_Sub_Category_Code;
                }
            }
            catch (err) 
            {
                null;
            }
            //Search Type
            //Sub Category Code
            var v_Search_Type;
            try 
            {
                if (v_diamond_search_values[24] != null) {
                    v_Search_Type = v_diamond_search_values[24];
                    o = document.getElementById("hdn_Search_Type_Cookie");
                    o.value = v_Search_Type;
                }
            }
            catch (err) {
                null;
            }
        }
    }
    catch (err) {
        null;
    }
}
function fnFetchDiamonds(flgOptimized) {
try{
    //objDivWait.style.display = 'block';
    window.clearTimeout(TimeOptimizeId);
    if (flgOptimized) {
        TimeOptimizeId = window.setInterval("fnFetchDiamondsOptimize();", 1);
    }
    else {
        TimeOptimizeId = window.setInterval("fnFetchDiamondsOptimize();", 100);
    }
} catch (Error) { }
}
function fnSet_BasicSearchValues() {
try{
    //Passing Value Between Switch View - From Basic to Sliders
    //Shapes
    //RB
    if (document.getElementById("chk_shape_rb_basic").checked == true) {
        document.getElementById("hdn_Shape_RB").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_RB").value = "0";
    }
    //PR
    if (document.getElementById("chk_shape_pr_basic").checked == true) {
        document.getElementById("hdn_Shape_PR").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_PR").value = "0";
    }
    //EM
    if (document.getElementById("chk_shape_em_basic").checked == true) {
        document.getElementById("hdn_Shape_EM").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_EM").value = "0";
    }
    //HE
    if (document.getElementById("chk_shape_he_basic").checked == true) {
        document.getElementById("hdn_Shape_HE").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_HE").value = "0";
    }
    //MQ
    if (document.getElementById("chk_shape_mq_basic").checked == true) {
        document.getElementById("hdn_Shape_MQ").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_MQ").value = "0";
    }
    //OV
    if (document.getElementById("chk_shape_ov_basic").checked == true) {
        document.getElementById("hdn_Shape_OV").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_OV").value = "0";
    }
    //PE
    if (document.getElementById("chk_shape_pe_basic").checked == true) {
        document.getElementById("hdn_Shape_PE").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_PE").value = "0";
    }
    //RD
    if (document.getElementById("chk_shape_rd_basic").checked == true) {
        document.getElementById("hdn_Shape_RD").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_RD").value = "0";
    }
    //AS
    if (document.getElementById("chk_shape_as_basic").checked == true) {
        document.getElementById("hdn_Shape_AS").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_AS").value = "0";
    }
    //CS
    if (document.getElementById("chk_shape_cs_basic").checked == true) {
        document.getElementById("hdn_Shape_CS").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_CS").value = "0";
    }
    //TR
    if (document.getElementById("chk_shape_tr_basic").checked == true) {
        document.getElementById("hdn_Shape_TR").value = "1";
    }
    else {
        document.getElementById("hdn_Shape_TR").value = "0";
    }
    //Min Cut
    var v_min_cut_index = document.getElementById("lst_cut_from_basic").selectedIndex;
    v_min_cut_index = parseInt(v_min_cut_index) + 1;
    //Max Cut
    var v_max_cut_index = document.getElementById("lst_cut_to_basic").selectedIndex;
    v_max_cut_index = parseInt(v_max_cut_index) + 1;
    //Setting Cut Into Hidden Fields
    document.getElementById("hdn_Min_Cut_Basic_Search").value = v_min_cut_index;
    document.getElementById("hdn_Max_Cut_Basic_Search").value = v_max_cut_index;
    //Min Colour
    var v_min_colour_index = document.getElementById("lst_colour_from_basic").selectedIndex;
    v_min_colour_index = parseInt(v_min_colour_index) + 1;
    //Max Colour
    var v_max_colour_index = document.getElementById("lst_colour_to_basic").selectedIndex;
    v_max_colour_index = parseInt(v_max_colour_index) + 1;
    //Setting Colour Into Hidden Fields
    document.getElementById("hdn_Min_Colour_Basic_Search").value = v_min_colour_index;
    document.getElementById("hdn_Max_Colour_Basic_Search").value = v_max_colour_index;
    //Min Clarity
    var v_min_clarity_index = document.getElementById("lst_clarity_from_basic").selectedIndex;
    v_min_clarity_index = parseInt(v_min_clarity_index) + 1;
    //Max Clarity
    var v_max_clarity_index = document.getElementById("lst_clarity_to_basic").selectedIndex;
    v_max_clarity_index = parseInt(v_max_clarity_index) + 1;
    //Setting Clarity Into Hidden Fields
    document.getElementById("hdn_Min_Clarity_Basic_Search").value = v_min_clarity_index;
    document.getElementById("hdn_Max_Clarity_Basic_Search").value = v_max_clarity_index;
    //Min Price
    var v_min_price = parseFloat(document.getElementById("txt_price_from_basic").value).toFixed(2);
    if (v_min_price >= parseFloat(PriceArray[0][0])) {
        document.getElementById("hdn_Min_Price_Basic_Search").value = v_min_price;
    }
    //Max Price
    var v_max_price = parseFloat(document.getElementById("txt_price_to_basic").value).toFixed(2);
    if (v_max_price <= parseFloat(PriceArray[0][1])) {
        document.getElementById("hdn_Max_Price_Basic_Search").value = v_max_price;
    }
    //Min Carat
    var v_min_carat = parseFloat(document.getElementById("txt_carat_from_basic").value).toFixed(2);
    if (v_min_carat >= parseFloat(InitialCaratMin)) {
        document.getElementById("hdn_Min_Carat_Basic_Search").value = v_min_carat;
    }
    //Max Carat
    var v_max_carat = parseFloat(document.getElementById("txt_carat_to_basic").value).toFixed(2);
    if (v_max_carat <= parseFloat(InitialCaratMax)) {
        document.getElementById("hdn_Max_Carat_Basic_Search").value = v_max_carat;
    }
} catch (Error) { }
}
function fnSet_Cookies() {
try{
    //Parameter Values from Hidden Fields
    //Shapes
    var v_Shapes, v_Shape_RB, v_Shape_PR, v_Shape_EM, v_Shape_HE, v_Shape_MQ, v_Shape_OV, v_Shape_PE, v_Shape_RD, v_Shape_AS, v_Shape_CS, v_Shape_TR;
    //Prices
    var v_Prices, v_Min_Price, v_Max_Price;
    //Carats
    var v_Carats, v_Min_Carat, v_Max_Carat;
    //Cuts
    var v_Cuts, v_Min_Cut, v_Max_Cut;
    //Colours
    var v_Colours, v_MinColor, v_MaxColor;
    //Clarities
    var v_Clarities, v_Min_Clarity, v_Max_Clarity;
    //Labs
    var v_Labs
    //Others
    var v_Others, v_Category_Code, v_Sub_Category_Code, v_Diamond_Search_Type, v_IP_Address
    //Diamonds Search & Pairs Search
    var v_search_option = 1;
    //Diamond Search Type
    o = document.getElementById("hdn_Search_Type");
    v_Diamond_Search_Type = o.value;
    if (v_Diamond_Search_Type == "1") {
        //****************** Basic Search ************//
        fnSet_BasicSearchValues();
        //Getting Shapes **************
        //Round
        o = document.getElementById("hdn_Shape_RB");
        v_Shape_RB = o.value;
        //Princess
        o = document.getElementById("hdn_Shape_PR");
        v_Shape_PR = o.value;
        //Emerald
        o = document.getElementById("hdn_Shape_EM");
        v_Shape_EM = o.value;
        //Heart
        o = document.getElementById("hdn_Shape_HE");
        v_Shape_HE = o.value;
        //Marquise
        o = document.getElementById("hdn_Shape_MQ");
        v_Shape_MQ = o.value;
        //Oval
        o = document.getElementById("hdn_Shape_OV");
        v_Shape_OV = o.value;
        //Pear
        o = document.getElementById("hdn_Shape_PE");
        v_Shape_PE = o.value;
        //Radiant
        o = document.getElementById("hdn_Shape_RD");
        v_Shape_RD = o.value;
        //Asscher
        o = document.getElementById("hdn_Shape_AS");
        v_Shape_AS = o.value;
        //Cushion
        o = document.getElementById("hdn_Shape_CS");
        v_Shape_CS = o.value;
        //Trillion
        o = document.getElementById("hdn_Shape_TR");
        v_Shape_TR = o.value;
        //Combining Shapes
        v_Shapes = v_Shape_RB + "," + v_Shape_PR + "," + v_Shape_EM + "," + v_Shape_HE + "," + v_Shape_MQ + "," + v_Shape_OV + "," + v_Shape_PE + "," + v_Shape_RD + "," + v_Shape_AS + "," + v_Shape_CS + "," + v_Shape_TR;
        //Getting Prices **************
        //Min Price
        o = document.getElementById("hdn_Min_Price_Basic_Search");
        v_Price_Min = o.value;
        o = document.getElementById("hdn_Min_Price");
        o.value = v_Price_Min;
        //Max Price
        o = document.getElementById("hdn_Max_Price_Basic_Search");
        v_Price_Max = o.value;
        o = document.getElementById("hdn_Max_Price");
        o.value = v_Price_Max;
        //Combining Prices
        v_Prices = v_Price_Min + "," + v_Price_Max;
        //Getting Carats **************
        //Min Carat
        o = document.getElementById("hdn_Min_Carat_Basic_Search");
        v_Carat_Min = o.value;
        o = document.getElementById("hdn_Min_Carat");
        o.value = v_Carat_Min;
        //Max Carat
        o = document.getElementById("hdn_Max_Carat_Basic_Search");
        v_Carat_Max = o.value;
        o = document.getElementById("hdn_Max_Carat");
        o.value = v_Carat_Max;
        //Combining Carats
        v_Carats = v_Carat_Min + "," + v_Carat_Max;
        //Getting Cuts **************
        //Min Cut
        o = document.getElementById("hdn_Min_Cut_Basic_Search");
        v_Cut_Min = o.value;
        o = document.getElementById("hdn_Min_Cut");
        o.value = v_Cut_Min;
        //Max Cut
        o = document.getElementById("hdn_Max_Cut_Basic_Search");
        v_Cut_Max = o.value;
        o = document.getElementById("hdn_Max_Cut");
        o.value = v_Cut_Max;
        //Combining Cuts
        v_Cuts = v_Cut_Min + "," + v_Cut_Max;
        //Getting Colours **************
        //Min Colour
        o = document.getElementById("hdn_Min_Colour_Basic_Search");
        v_Colour_Min = o.value;
        o = document.getElementById("hdn_Min_Colour");
        o.value = v_Colour_Min;
        //Max Colour
        o = document.getElementById("hdn_Max_Colour_Basic_Search");
        v_Colour_Max = o.value;
        o = document.getElementById("hdn_Max_Colour");
        o.value = v_Colour_Max;
        //Combining Colours
        v_Colours = v_Colour_Min + "," + v_Colour_Max;
        //Getting Clarities **************
        //Min Clarity
        o = document.getElementById("hdn_Min_Clarity_Basic_Search");
        v_Clarity_Min = o.value;
        o = document.getElementById("hdn_Min_Clarity");
        o.value = v_Clarity_Min;
        //Max Clarity
        o = document.getElementById("hdn_Max_Clarity_Basic_Search");
        v_Clarity_Max = o.value;
        o = document.getElementById("hdn_Max_Clarity");
        o.value = v_Clarity_Max;
        //Combining Clarities
        v_Clarities = v_Clarity_Min + "," + v_Clarity_Max;
        //Getting Labs
        o = document.getElementById("hdn_Labs");
        v_Labs = o.value;
        //Getting Others
        //Category
        o = document.getElementById("hdn_Category");
        v_Category_Code = o.value;
        //Sub Category
        o = document.getElementById("hdn_Sub_Category");
        v_Sub_Category_Code = o.value;
        //IP Address
        o = document.getElementById("hdn_IP_Address");
        v_IP_Address = o.value;
        //Combining Others
        v_Others = v_Category_Code + "," + v_Sub_Category_Code + "," + v_Diamond_Search_Type
        //Search Options
        o = document.getElementById("hdn_Search_Option");
        v_search_option = o.value;
    }
    else {
        //****************** Dynamic Search ************//
        //Getting Shapes **************
        //Round
        o = document.getElementById("hdn_Shape_RB");
        v_Shape_RB = o.value;
        //Princess
        o = document.getElementById("hdn_Shape_PR");
        v_Shape_PR = o.value;
        //Emerald
        o = document.getElementById("hdn_Shape_EM");
        v_Shape_EM = o.value;
        //Heart
        o = document.getElementById("hdn_Shape_HE");
        v_Shape_HE = o.value;
        //Marquise
        o = document.getElementById("hdn_Shape_MQ");
        v_Shape_MQ = o.value;
        //Oval
        o = document.getElementById("hdn_Shape_OV");
        v_Shape_OV = o.value;
        //Pear
        o = document.getElementById("hdn_Shape_PE");
        v_Shape_PE = o.value;
        //Radiant
        o = document.getElementById("hdn_Shape_RD");
        v_Shape_RD = o.value;
        //Asscher
        o = document.getElementById("hdn_Shape_AS");
        v_Shape_AS = o.value;
        //Cushion
        o = document.getElementById("hdn_Shape_CS");
        v_Shape_CS = o.value;
        //Trillion
        o = document.getElementById("hdn_Shape_TR");
        v_Shape_TR = o.value;
        //Combining Shapes
        v_Shapes = v_Shape_RB + "," + v_Shape_PR + "," + v_Shape_EM + "," + v_Shape_HE + "," + v_Shape_MQ + "," + v_Shape_OV + "," + v_Shape_PE + "," + v_Shape_RD + "," + v_Shape_AS + "," + v_Shape_CS + "," + v_Shape_TR;
        //Getting Prices **************
        //Min Price
        o = document.getElementById("hdn_Min_Price");
        v_Price_Min = o.value;
        //Max Price
        o = document.getElementById("hdn_Max_Price");
        v_Price_Max = o.value;
        //Combining Prices
        v_Prices = v_Price_Min + "," + v_Price_Max;
        //Getting Carats **************
        //Min Carat
        o = document.getElementById("hdn_Min_Carat");
        v_Carat_Min = o.value;
        //Max Carat
        o = document.getElementById("hdn_Max_Carat");
        v_Carat_Max = o.value;
        //Combining Carats
        v_Carats = v_Carat_Min + "," + v_Carat_Max;
        //Getting Cuts **************
        //Min Cut
        o = document.getElementById("hdn_Min_Cut");
        v_Cut_Min = o.value;
        //Max Cut
        o = document.getElementById("hdn_Max_Cut");
        v_Cut_Max = o.value;
        //Combining Cuts
        v_Cuts = v_Cut_Min + "," + v_Cut_Max;
        //Getting Colours **************
        //Min Colour
        o = document.getElementById("hdn_Min_Colour");
        v_Colour_Min = o.value;
        //Max Colour
        o = document.getElementById("hdn_Max_Colour");
        v_Colour_Max = o.value;
        //Combining Colours
        v_Colours = v_Colour_Min + "," + v_Colour_Max;
        //Getting Clarities **************
        //Min Clarity
        o = document.getElementById("hdn_Min_Clarity");
        v_Clarity_Min = o.value;
        //Max Clarity
        o = document.getElementById("hdn_Max_Clarity");
        v_Clarity_Max = o.value;
        //Combining Clarities
        v_Clarities = v_Clarity_Min + "," + v_Clarity_Max;
        //Getting Labs
        o = document.getElementById("hdn_Labs");
        v_Labs = o.value;
        //Getting Others
        //Category
        o = document.getElementById("hdn_Category");
        v_Category_Code = o.value;
        //Sub Category
        o = document.getElementById("hdn_Sub_Category");
        v_Sub_Category_Code = o.value;
        //IP Address
        o = document.getElementById("hdn_IP_Address");
        v_IP_Address = o.value;
        //Combining Others
        v_Others = v_Category_Code + "," + v_Sub_Category_Code + "," + v_Diamond_Search_Type
        //Search Options
        o = document.getElementById("hdn_Search_Option");
        v_search_option = o.value;
    }
    //Setting Cookies Values
    var v_all_values = v_Shapes + "," + v_Prices + "," + v_Carats + "," + v_Cuts + "," + v_Colours + "," + v_Clarities + "," + v_Labs + "," + v_Others;
    var exdate = new Date();
    var expiredays = 365;
    exdate.setDate(exdate.getDate() + expiredays);
    if (v_search_option == "2") {
        //document.cookie = "Matched_Pairs_Search_Cookie=" + escape(v_all_values) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
        document.cookie = "Matched_Pairs_Search_Cookie=" + escape(v_all_values) + ";expires=" + exdate.toGMTString() + ";path=/";
    }
    else {
        //document.cookie = "Diamond_Search_Cookie=" + escape(v_all_values) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
        document.cookie = "Diamond_Search_Cookie=" + escape(v_all_values) + ";expires=" + exdate.toGMTString() + ";path=/";
    }
} catch (Error) { }
}
function fnFetchDiamondsOptimize() {
try{
    //Parameter Values from Hidden Fields
    //Shapes
    var v_Shapes, v_Shape_RB, v_Shape_PR, v_Shape_EM, v_Shape_HE, v_Shape_MQ, v_Shape_OV, v_Shape_PE, v_Shape_RD, v_Shape_AS, v_Shape_CS, v_Shape_TR;
    //Prices
    var v_Prices, v_Min_Price, v_Max_Price;
    //Carats
    var v_Carats, v_Min_Carat, v_Max_Carat;
    //Cuts
    var v_Cuts, v_Min_Cut, v_Max_Cut;
    //Colours
    var v_Colours, v_MinColor, v_MaxColor;
    //Clarities
    var v_Clarities, v_Min_Clarity, v_Max_Clarity;
    //Labs
    var v_Labs
    //Others
    var v_Category_Code, v_Sub_Category_Code, v_Diamond_Search_Type, v_IP_Address;
    //Diamonds Search & Pairs Search
    var v_Search_Option = 1;
    //Getting Shapes **************
    //Round
    o = document.getElementById("hdn_Shape_RB");
    v_Shape_RB = o.value;
    //Princess
    o = document.getElementById("hdn_Shape_PR");
    v_Shape_PR = o.value;
    //Emerald
    o = document.getElementById("hdn_Shape_EM");
    v_Shape_EM = o.value;
    //Heart
    o = document.getElementById("hdn_Shape_HE");
    v_Shape_HE = o.value;
    //Marquise
    o = document.getElementById("hdn_Shape_MQ");
    v_Shape_MQ = o.value;
    //Oval
    o = document.getElementById("hdn_Shape_OV");
    v_Shape_OV = o.value;
    //Pear
    o = document.getElementById("hdn_Shape_PE");
    v_Shape_PE = o.value;
    //Radiant
    o = document.getElementById("hdn_Shape_RD");
    v_Shape_RD = o.value;
    //Asscher
    o = document.getElementById("hdn_Shape_AS");
    v_Shape_AS = o.value;
    //Cushion
    o = document.getElementById("hdn_Shape_CS");
    v_Shape_CS = o.value;
    //Trillion
    o = document.getElementById("hdn_Shape_TR");
    v_Shape_TR = o.value;
    //Combining Shapes
    v_Shapes = v_Shape_RB + "," + v_Shape_PR + "," + v_Shape_EM + "," + v_Shape_HE + "," + v_Shape_MQ + "," + v_Shape_OV + "," + v_Shape_PE + "," + v_Shape_RD + "," + v_Shape_AS + "," + v_Shape_CS + "," + v_Shape_TR;
    //Getting Prices **************
    //Min Price
    o = document.getElementById("hdn_Min_Price");
    v_Price_Min = o.value;
    //Max Price
    o = document.getElementById("hdn_Max_Price");
    v_Price_Max = o.value;
    //Combining Prices
    v_Prices = v_Price_Min + "," + v_Price_Max;
    //Getting Carats **************
    //Min Carat
    o = document.getElementById("hdn_Min_Carat");
    v_Carat_Min = o.value;
    //Max Carat
    o = document.getElementById("hdn_Max_Carat");
    v_Carat_Max = o.value;
    //Combining Carats
    v_Carats = v_Carat_Min + "," + v_Carat_Max;
    //Getting Cuts **************
    //Min Cut
    o = document.getElementById("hdn_Min_Cut");
    v_Cut_Min = o.value;
    //Max Cut
    o = document.getElementById("hdn_Max_Cut");
    v_Cut_Max = o.value;
    //Combining Cuts
    v_Cuts = v_Cut_Min + "," + v_Cut_Max;
    //Getting Colours **************
    //Min Colour
    o = document.getElementById("hdn_Min_Colour");
    v_Colour_Min = o.value;
    //Max Colour
    o = document.getElementById("hdn_Max_Colour");
    v_Colour_Max = o.value;
    //Combining Colours
    v_Colours = v_Colour_Min + "," + v_Colour_Max;
    //Getting Clarities **************
    //Min Clarity
    o = document.getElementById("hdn_Min_Clarity");
    v_Clarity_Min = o.value;
    //Max Clarity
    o = document.getElementById("hdn_Max_Clarity");
    v_Clarity_Max = o.value;
    //Combining Clarities
    v_Clarities = v_Clarity_Min + "," + v_Clarity_Max;
    //Getting Labs
    o = document.getElementById("hdn_Labs");
    v_Labs = o.value;
    //Getting Others
    //Category
    o = document.getElementById("hdn_Category");
    v_Category_Code = o.value;
    //Sub Category
    o = document.getElementById("hdn_Sub_Category");
    v_Sub_Category_Code = o.value;
    //IP Address
    o = document.getElementById("hdn_IP_Address");
    v_IP_Address = o.value;
    //Diamond Search Type
    o = document.getElementById("hdn_Search_Type");
    v_Diamond_Search_Type = o.value;
    //Search Options
    o = document.getElementById("hdn_Search_Option");
    v_Search_Option = o.value;
    //Calling Set Cookies Function
    fnSet_Cookies();
    //Calling Web Service
    DiamondSearchWebService.DiamondsSearchService(v_Shapes, v_Prices, v_Carats, v_Cuts, v_Colours, v_Clarities, v_Labs, v_Category_Code, v_Sub_Category_Code, v_IP_Address, v_Diamond_Search_Type,v_Search_Option, FetchDiamonds_OnWSRequestComplete, FetchDiamonds_OnWSRequestFailed);
    window.clearTimeout(TimeOptimizeId);
} catch (Error) { }
}
function FetchDiamonds_OnWSRequestComplete(results) {
try{
    if (results != null) {
        spn_diamonds = document.getElementById("spn_result_no_of_diamonds");
        var v_results = parseInt(results);
        if (v_results <= 0) {
            var v_dv_search_result_button = document.getElementById("dv_search_result_button");
            var v_dv_search_no_result = document.getElementById("dv_search_no_result");
            v_dv_search_no_result.style.display = "block";
            v_dv_search_result_button.style.display = "none";
            spn_diamonds.innerHTML = "0";
        }
        else {
            var v_dv_search_result_button = document.getElementById("dv_search_result_button");
            var v_dv_search_no_result = document.getElementById("dv_search_no_result");
            v_dv_search_no_result.style.display = "none";
            v_dv_search_result_button.style.display = "block";
            spn_diamonds.innerHTML = v_results
        }
    }
} catch (Error) { }
}
function FetchDiamonds_OnWSRequestFailed(error) {
    alert("Error Occured :"  + error);
}
function fnSearchView(v_view) {
try{
    var v_search_view = v_view;
    var dv_search_option_sliders = document.getElementById("dv_search_option_sliders");
    var dv_diamonds_search_sliders = document.getElementById("dv_diamonds_search_sliders");
    var dv_search_option_basic = document.getElementById("dv_search_option_basic");
    var dv_diamonds_search_basic = document.getElementById("dv_diamonds_search_basic");
    if (v_search_view == 1) {
        document.getElementById("hdn_Search_Type").value = "1";
        dv_search_option_basic.style.display = 'block';
        dv_diamonds_search_basic.style.display = 'block';
        dv_search_option_sliders.style.display = 'none';
        dv_diamonds_search_sliders.style.display = 'none';
        //Passing Value Between Switch View - From Sliders to Basic
        //Min Cut
        document.getElementById("hdn_Min_Cut_Basic_Search").value = document.getElementById("hdn_Min_Cut").value;
        //Max Cut
        document.getElementById("hdn_Max_Cut_Basic_Search").value = document.getElementById("hdn_Max_Cut").value;
        //Min Colour
        document.getElementById("hdn_Min_Colour_Basic_Search").value = document.getElementById("hdn_Min_Colour").value;
        //Max Colour
        document.getElementById("hdn_Max_Colour_Basic_Search").value = document.getElementById("hdn_Max_Colour").value;
        //Min Clarity
        document.getElementById("hdn_Min_Clarity_Basic_Search").value = document.getElementById("hdn_Min_Clarity").value;
        //Max Clarity
        document.getElementById("hdn_Max_Clarity_Basic_Search").value = document.getElementById("hdn_Max_Clarity").value;
        //Min Price
        document.getElementById("hdn_Min_Price_Basic_Search").value = document.getElementById("hdn_Min_Price").value;
        //Max Price
        document.getElementById("hdn_Max_Price_Basic_Search").value = document.getElementById("hdn_Max_Price").value;
        //Min Carat
        document.getElementById("hdn_Min_Carat_Basic_Search").value = document.getElementById("hdn_Min_Carat").value;
        //Max Carat
        document.getElementById("hdn_Max_Carat_Basic_Search").value = document.getElementById("hdn_Max_Carat").value;
        setBasicSearchControls();
    }
    else 
    {
        document.getElementById("hdn_Search_Type").value = "0";
        fnSet_BasicSearchValues();
        dv_search_option_basic.style.display = 'none';
        dv_diamonds_search_basic.style.display = 'none';
        dv_search_option_sliders.style.display = 'block';
        dv_diamonds_search_sliders.style.display = 'block';
        //Shapes
        setSliders();
    }
} catch (Error) { }
}
