
var firstClick = false; var clearPanel = false; var tooltip; var ti = 0; var g_getHandlerUrl = 'http://www.adiamor.com/AjaxSearch.aspx'; var g_imagePath = 'http://www.adiamor.com/media/Adiamor/'; var g_grid; var g_mainSliders; var g_smallSliders; var g_miniSliders; var g_mappings = { 'Fluor': { '43': 'F', '44': 'MB', '42': 'N', '45': 'SB', '46': 'VS' }, 'Cut': { '141': 'Excellent', '144': 'Fair', '143': 'Good', '147': 'Ideal', '146': 'None', '145': 'Poor', '142': 'Very Good', '211': 'Premium', '999': 'Affinity' }, 'Shape': { '67': 'Asscher', '68': 'Baguette', '113': 'Cushion', '18': 'Emerald', '20': 'Heart', '19': 'Marquise', '65': 'Oval', '21': 'Pear', '17': 'Princess', '22': 'Radiant', '16': 'Round', '66': 'Trilliant' }, 'Clar': { '31': 'IF', '36': 'SI1', '37': 'SI2', '34': 'VS1', '35': 'VS2', '32': 'VVS1', '33': 'VVS2' }, 'Color': { '23': 'D', '24': 'E', '25': 'F', '26': 'G', '27': 'H', '28': 'I', '29': 'J', '30': 'K' }, 'Cert': { '38': 'GIA', '39': 'EGL', '41': 'AGS' }, 'Pol': { '61': 'EX', '64': 'F', '63': 'G', '136': 'I', '62': 'VG' }, 'Sym': { '61': 'EX', '64': 'F', '63': 'G', '136': 'I', '62': 'VG' }, 'Culet': { '58': 'None', '59': 'Very Small', '60': 'Small', '115': 'Medium', '116': 'Large', '135': 'Pointed' }, 'Cut1': { '141': 'EX', '144': 'F', '143': 'G', '147': 'I', '146': 'N', '145': 'P', '142': 'VG', '211': 'P', '999': 'AI'} }; var g_inverseMappings = { 'Shape': { 'asscher': '67', 'baguette': '68', 'cushion': '113', 'emerald': '18', 'heart': '20', 'marquise': '19', 'oval': '65', 'pear': '21', 'princess': '17', 'radiant': '22', 'round': '16', 'trilliant': '66'} }; var g_activeSlider = null; var g_miniSlidersSync = false; var g_diamondData; var Adiamor; if (typeof (Adiamor) == "undefined") { Adiamor = {}; }
function PriceChange(value, limit) {
    if (value == '') { value = null; }
    g_diamondData.setParam("price_" + limit, value); g_grid.render();
}
function CaratChange(value, limit) {
    if (value == '') { value = null; }
    g_diamondData.setParam("carat_" + limit, value); g_grid.render();
}
function checkNonRound() {
    var bool = false; if (document.getElementById("marquise-qr_cb").checked) { bool = true; }
    if (document.getElementById("heart-qr_cb").checked) { bool = true; }
    if (document.getElementById("pear-qr_cb").checked) { bool = true; }
    if (document.getElementById("radiant-qr_cb").checked) { bool = true; }
    if (document.getElementById("oval-qr_cb").checked) { bool = true; }
    if (document.getElementById("cushion-qr_cb").checked) { bool = true; }
    return bool;
}
function onlyRound() {
    var bool = true; if (!(document.getElementById("round-qr_cb").checked)) { bool = false; }
    if (document.getElementById("princess-qr_cb").checked) { bool = false; }
    if (document.getElementById("emerald-qr_cb").checked) { bool = false; }
    if (document.getElementById("marquise-qr_cb").checked) { bool = false; }
    if (document.getElementById("heart-qr_cb").checked) { bool = false; }
    if (document.getElementById("pear-qr_cb").checked) { bool = false; }
    if (document.getElementById("radiant-qr_cb").checked) { bool = false; }
    if (document.getElementById("oval-qr_cb").checked) { bool = false; }
    if (document.getElementById("asscher-qr_cb").checked) { bool = false; }
    if (document.getElementById("cushion-qr_cb").checked) { bool = false; }
    return bool;
}
function GetColumnWidth(item, vc) {
    var width = item.OriginalWidth; switch (item.Name) {
        case "Shape": if (vc < 10) { width = 90; g_types.image.Formatter = Adiamor.ui.Viewport.renderImage; $('h' + item.Name).innerHTML = "SHAPE"; }
            else { width = 30; g_types.image.Formatter = Adiamor.ui.Viewport.renderImageOnly; $('h' + item.Name).innerHTML = "SH"; }
            break; case "Carat": if (vc < 10) { $('h' + item.Name).innerHTML = "CARAT"; width = 45; }
            else { $('h' + item.Name).innerHTML = "CT"; width = 30; }
            break; case "Color": if (vc < 10) { $('h' + item.Name).innerHTML = "COLOR"; width = 43; }
            else { $('h' + item.Name).innerHTML = "CLR"; width = 30; }
            break; case "Clar": if (vc < 10) { $('h' + item.Name).innerHTML = "CLARITY"; width = 51; }
            else { $('h' + item.Name).innerHTML = "CLAR"; width = 30; }
            break; case "Cut": if (vc < 10) { width = 85; }
            else { width = 30; }
            break; case "Cert": if (vc < 10) { $('h' + item.Name).innerHTML = "CERT"; width = 57; }
            else { $('h' + item.Name).innerHTML = "CERT"; width = 30; }
            break; case "SPrice": if (vc < 10) { $('h' + item.Name).innerHTML = "PRICE"; width = 108; }
            else { $('h' + item.Name).innerHTML = "PRICE"; width = 83; }
            break; case "Selected": if (vc < 12) { width = 51; }
            else { width = 51; }
            break; case "Info": if (vc < 14) { $('h' + item.Name).innerHTML = "DETAILS"; width = 174; }
            else { $('h' + item.Name).innerHTML = "DETAILS"; width = 174; }
            break; case "Pol": if (vc < 15) { $('h' + item.Name).innerHTML = "POLISH"; width = 39; }
            else { $('h' + item.Name).innerHTML = "P"; width = 26; }
            break; case "Sym": if (vc < 15) { $('h' + item.Name).innerHTML = "SYMMETRY"; width = 39; }
            else { $('h' + item.Name).innerHTML = "S"; width = 26; }
            break; case "Depth": if (vc < 15) { $('h' + item.Name).innerHTML = "DEPTH"; width = 39; }
            else { $('h' + item.Name).innerHTML = "D"; width = 26; }
            break; case "Tbl": if (vc < 15) { $('h' + item.Name).innerHTML = "TABLE"; width = 39; }
            else { $('h' + item.Name).innerHTML = "T"; width = 26; }
            break; case "Fluor": if (vc < 15) { $('h' + item.Name).innerHTML = "FLUOR"; width = 39; }
            else { $('h' + item.Name).innerHTML = "FL"; width = 30; }
            break; default: break;
    }
    return width;
}
function ShapeChange(value) { document.getElementById("round-qr_cb").checked = true; document.getElementById("round_cb").checked = true; g_diamondData.setParam('shape_round'); document.getElementById("princess-qr_cb").checked = true; document.getElementById("princess_cb").checked = true; g_diamondData.setParam('shape_princess'); document.getElementById("emerald-qr_cb").checked = true; document.getElementById("emerald_cb").checked = true; g_diamondData.setParam('shape_emerald'); document.getElementById("marquise-qr_cb").checked = true; document.getElementById("marquise_cb").checked = true; g_diamondData.setParam('shape_marquise'); document.getElementById("heart-qr_cb").checked = true; document.getElementById("heart_cb").checked = true; g_diamondData.setParam('shape_heart'); document.getElementById("pear-qr_cb").checked = true; document.getElementById("pear_cb").checked = true; g_diamondData.setParam('shape_pear'); document.getElementById("radiant-qr_cb").checked = true; document.getElementById("radiant_cb").checked = true; g_diamondData.setParam('shape_radiant'); document.getElementById("oval-qr_cb").checked = true; document.getElementById("oval_cb").checked = true; g_diamondData.setParam('shape_oval'); document.getElementById("asscher-qr_cb").checked = true; document.getElementById("asscher_cb").checked = true; g_diamondData.setParam('shape_asscher'); document.getElementById("cushion-qr_cb").checked = true; document.getElementById("cushion_cb").checked = true; g_diamondData.setParam('shape_cushion'); document.getElementById(value + "-qr_cb").checked = true; document.getElementById(value + "_cb").checked = true; g_diamondData.setParam('shape_' + value, g_inverseMappings.Shape[value]); updateSliders(0); updateSliders(1); }
function formatCarat(val) {
    var caratPrecision = 2; if (val > 5) { caratPrecision = 1; }
    return Adiamor.lang.formatNumber(val, caratPrecision) + 'ct';
}
function formatMoney0(val) { return Adiamor.lang.formatMoney(val, 0); }
function formatMoney0_detail(val) {
    var ca = document.cookie.split(';'), currency, i, c; for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("country") == 0) { currency = unescape(c.substring(("country=").length, c.length)); } }
    if (currency == "BP") { return '&#163;' + Adiamor.lang.formatNumber(val, 0); }
    else { return '$' + Adiamor.lang.formatNumber(val, 0); } 
}
function formatNumber1(val) { return Adiamor.lang.formatNumber(val, 1); }
function formatNumber2(val) { return Adiamor.lang.formatNumber(val, 2); }
function formatDouble(val) { return Math.round(val); }
function parseValues(aValue) {
    if (isNaN(aValue)) { return aValue; } else {
        if (typeof (aValue) != "string") { aValue = aValue.toString(); }
        if (aValue.indexOf(".") > 0) { return parseFloat(aValue); } else { return parseInt(aValue, 10); } 
    } 
}
function getDocHeight() { var D = document; return Math.max(Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight)); }
function getDocWidth() { var D = document; return Math.max(Math.max(D.body.scrollWidth, D.documentElement.scrollWidth), Math.max(D.body.offsetWidth, D.documentElement.offsetWidth), Math.max(D.body.clientWidth, D.documentElement.clientWidth)); }
function OpenOptions(o) {
    var c = [7, 8, 9, 10, 11], i, item, width; if (o) {
        $('normalOptions').style.display = "none"; $('additionalOptions').style.display = "block"; $('OptionsContainer').style.display = "none"; $('OutsideDiv').style.display = "block"; for (i = 0; i < c.length; i += 1) { item = g_grid.Columns[c[i]]; item.cssStyle.display = 'none'; item.Display = false; }
        for (i = 0; i < g_grid.Columns.length; i += 1) { item = g_grid.Columns[i]; width = GetColumnWidth(item, 1); if (width != null) { item.cssStyle.width = width + 'px'; item.Width = width; } } 
    } else {
        $('normalOptions').style.display = "block"; $('additionalOptions').style.display = "none"; $('OptionsContainer').style.display = "block"; $('OptionsContainer').style.height = "auto"; $('OptionsContainer').style.visibility = "visible"; $('OutsideDiv').style.display = "none"; for (i = 0; i < c.length; i += 1) { item = g_grid.Columns[c[i]]; item.cssStyle.display = ''; item.Display = true; }
        for (i = 0; i < g_grid.Columns.length; i += 1) { item = g_grid.Columns[i]; width = GetColumnWidth(item, 100); if (width != null) { item.cssStyle.width = width + 'px'; item.Width = width; } } 
    }
    g_grid.render();
}
function CompleteTransition() { Adiamor.ui.Effects.OPEN = !(Adiamor.ui.Effects.OPEN); }
function FeedbackHide(e) { document.getElementById('FeedbackDiv').style.display = "none"; }
function FadeOptions(arg1, arg2) {
    if (typeof (Adiamor.ui.Effects.OPEN) == "undefined") { Adiamor.ui.Effects.OPEN = false; }
    if (typeof (this.lastOption) == "undefined") { this.lastOption = arg1; }
    if (Adiamor.ui.Effects.OPEN && this.lastOption != null) { $('slider-label-' + this.lastOption).style.display = "none"; }
    if (arg2 != null) { this.lastOption = arg2; } else { this.lastOption = arg1; }
    FeedbackHide(null); if (Adiamor.ui.Effects.OPEN) { $('OptionsContainer').style.visibility = "hidden"; $('slider-label-' + arg1).style.display = "none"; OpenOptions(arg1, this.lastOption); }
    else { $('ob' + arg1).onclick = function () { FadeOptions(arg1); }; $('OptionsContainer').style.visibility = "visible"; $('slider-label-' + arg1).style.display = "inline"; CompleteTransition(); } 
}
function FeedbackShow() {
    if (Adiamor.ui.Effects.OPEN) { document.getElementById('FeedbackDiv').style.right = "-127px"; document.getElementById('FeedbackDiv').style.borderRight = "0px solid #C1C1C1"; document.getElementById('FeedbackDiv').style.borderLeft = "1px solid #C1C1C1"; }
    else { document.getElementById('FeedbackDiv').style.right = "-146px"; document.getElementById('FeedbackDiv').style.borderRight = "1px solid #C1C1C1"; document.getElementById('FeedbackDiv').style.borderLeft = "0px solid #C1C1C1"; }
    document.getElementById('FeedbackDiv').style.display = "inline";
}
var rowArguments = null; function RowDim(e, image, bordercolor, backcolor) { rowArguments = { 'e': e, 'image': image, 'bordercolor': bordercolor, 'backcolor': backcolor }; }
function RowHighlight(e, image, bordercolor, backcolor, dim) {
    if (!dim && rowArguments != null) { RowHighlight(rowArguments.e, rowArguments.image, rowArguments.bordercolor, rowArguments.backcolor, true); }
    var i = 0, j = 0; e.style.backgroundImage = image; while (i < e.childNodes.length) {
        if (e.childNodes[i].nodeName == "TD") {
            j = 0; while (j < e.childNodes[i].childNodes.length) {
                if (e.childNodes[i].childNodes[j].nodeName == "DIV") {
                    e.childNodes[i].childNodes[j].style.borderBottom = "solid 1px " + bordercolor; e.childNodes[i].childNodes[j].style.borderRight = "solid 1px " + bordercolor; if (dim) { e.childNodes[i].childNodes[j].style.borderLeft = "solid 1px " + backcolor; }
                    else { e.childNodes[i].childNodes[j].style.borderLeft = "solid 1px " + bordercolor; } 
                }
                j += 1;
            } 
        }
        i += 1;
    } 
}
var g_checkboxes = [{ name: 'round' }, { name: 'princess' }, { name: 'emerald' }, { name: 'marquise' }, { name: 'heart' }, { name: 'pear' }, { name: 'radiant' }, { name: 'oval' }, { name: 'asscher' }, { name: 'cushion'}]; if (typeof (Adiamor.lang) == "undefined") { Adiamor.lang = {}; }
Adiamor.lang.defineNs = function (namespace) { var names = namespace.split("."), currentNamespace = "", dot = "", i; for (i = 0; i < names.length; i += 1) { currentNamespace += dot + names[i]; dot = "."; if (typeof (eval(currentNamespace)) == "undefined") { eval(currentNamespace + "={}"); } } }; Adiamor.lang.extend = function (subClass, baseClass) {
    function inheritance() { }
    inheritance.prototype = baseClass.prototype; subClass.prototype = new inheritance(); subClass.prototype.constructor = subClass; subClass.baseConstructor = baseClass; if (baseClass.base) { baseClass.prototype.base = baseClass.base; }
    subClass.base = baseClass.prototype;
}; Adiamor.lang.implement = function (class1, interface1) {
    var msg, member; if (!(typeof (interface1) == "undefined" || interface1 == null)) { for (member in interface1.prototype) { if (interface1.prototype.hasOwnProperty(member)) { class1.prototype[member] = interface1.prototype[member]; } } }
    else { msg = "Adiamor.lang.implement argument interface_ is null or undefined.  The most likely cause of this is that a js file has not been included, or has been included in the wrong order."; Adiamor.lang.throwError(msg); } 
}; Adiamor.lang.isDefined = function (a) { return (typeof (a) != "undefined"); }; Adiamor.lang.close = function (context, func, params) {
    if (null == params) { return function () { return func.apply(context, arguments); }; }
    else { return function () { return func.apply(context, params); }; } 
}; Adiamor.lang.forEach = function (arr, func) {
    var len = arr.length, i; for (i = 0; i < len; i += 1) { func.call(this, arr[i], i); }
    func = null;
}; Adiamor.lang.parseNumber = function (val) { var num = parseInt(val, 10); return (isNaN(num) ? 0 : num); }; Adiamor.lang.formatMoney = function (val, decimals) {
    if (decimals == null) { decimals = 2; }
    if (val == null) { val = "NA"; }
    else { val = '$' + Adiamor.lang.formatNumber(val, decimals); }
    return val;
}; Adiamor.lang.formatNumber = function (nStr, decimals) {
    nStr += ''; decimals = (decimals == null ? 2 : decimals); var x = nStr.split('.'), x1 = x[0], x2 = (x[1] != null ? (x[1]) : ('')), dot = '', rgx; if (decimals > 0) { dot = '.'; x2 = x2.substring(0, decimals); while (x2.length < decimals) { x2 = x2 + '0'; } } else { x2 = ""; x1 = (Math.round(nStr) + '').split('.')[0]; }
    rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); }
    return x1 + dot + x2;
}; $ = function (id) { return document.getElementById(id); }; Adiamor.lang.defineNs("Adiamor.base"); if (typeof (Adiamor.base) == "undefined") { Adiamor.base = function () { }; }
Adiamor.base.uid = 1; Adiamor.base.getUid = function () { return "Adiamor__uid__" + (Adiamor.base.uid++); }; Adiamor.base.Object = function () { }; Adiamor.base.Object.prototype.setValues = function (values) {
    var item; for (item in values) {
        if (this[item] != null) { this[item] = values[item]; }
        else if (this[item] instanceof Function) { this[item](values[item]); }
        else if (this['set' + item] instanceof Function) { this['set' + item](values[item]); }
        else { this[item] = values[item]; } 
    } 
}; Adiamor.base.Object.prototype.dispose = function () {
    var item, disposalLength, i; if (this.disposing) { return; }
    this.disposing = true; if (this.disposal != null) {
        disposalLength = this.disposal.length; for (i = 0; i < disposalLength; i += 1) {
            if (disposal[i] instanceof Function) { disposal[i].call(context); }
            disposal[i] = null;
        } 
    }
    for (item in this) {
        if (this.hasOwnProperty(item)) {
            if (this[item] != null && this[item].dispose instanceof Function) { this[item].dispose.call(this[item]); }
            this[item] = null;
        } 
    } 
}; Adiamor.lang.defineNs("Adiamor.base"); Adiamor.base.SubjectHelper = function () { this.handlers = {}; this.guid = 0; }; Adiamor.base.SubjectHelper.prototype.subscribe = function (method, context) {
    var func = method, guid; if (typeof context == "object" && method instanceof Function) { func = Adiamor.lang.close(context, method); }
    guid = func.observer_guid || method.observer_guid || this.guid++; func.observer_guid = guid; method.observer_guid = guid; this.handlers[guid] = func;
}; Adiamor.base.SubjectHelper.prototype.unSubscribe = function (guid) {
    if (guid instanceof Function) { guid = guid.observer_guid; }
    this.handlers[guid] = null; delete this.handlers[guid];
}; Adiamor.base.SubjectHelper.prototype.notify = function (evtArgs) {
    var fail = false, item, handler, rv; for (item in this.handlers) { if (this.handlers.hasOwnProperty(item)) { handler = this.handlers[item]; if (handler instanceof Function) { rv = (handler.apply(this, arguments) == false); fail = fail || rv; } } }
    return !fail;
}; Adiamor.base.SubjectHelper.prototype.dispose = function () {
    for (handler in this.handlers) { if (this.handlers.hasOwnProperty(handler)) { this.handlers[handler] = null; } }
    this.handlers = null;
}; Adiamor.lang.defineNs("Adiamor.browser"); if (typeof (Adiamor.browser) == "undefined") { Adiamor.browser = function () { }; }
Adiamor.browser.UNKNOWN = true; Adiamor.browser.IE = false; Adiamor.browser.IE6 = false; Adiamor.browser.IE7 = false; var browser = "Unknown", subString = "", dataString = "", i, dataProp; if (typeof (dataString) == "undefined") { Adiamor.browser.IE8 = false; }
else { Adiamor.browser.IE8 = (dataString.indexOf('MSIE 8.0') != -1); }
if (typeof (dataString) == "undefined") { Adiamor.browser.IE9 = false; }
else { Adiamor.browser.IE9 = (dataString.indexOf('MSIE 9.0') != -1); }
Adiamor.browser.MOZ = false; Adiamor.browser.SAFARI = false; Adiamor.browser.OPERA = false; Adiamor.browser.CHROME = false; Adiamor.browser.XHR_ENABLED = false; Adiamor.browser.detect = function () {
    var data = [{ string: navigator.vendor, subString: "Apple", identity: "Safari" }, { prop: window.opera, identity: "Opera" }, { string: navigator.vendor, subString: "iCab", identity: "iCab" }, { string: navigator.vendor, subString: "KDE", identity: "Konqueror" }, { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, { string: navigator.userAgent, subString: "Netscape", identity: "Netscape" }, { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" }, { string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" }, { string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla"}]; for (i = 0; i < data.length; i += 1) {
        dataString = data[i].string; dataProp = data[i].prop; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) { browser = data[i].identity; subString = data[i].subString; break; } }
        else if (dataProp) { browser = data[i].identity; subString = data[i].subString; break; } 
    }
    Adiamor.browser.IE = (browser == "Explorer"); Adiamor.browser.IE6 = (Adiamor.browser.IE && !window.XMLHttpRequest); Adiamor.browser.IE7 = (Adiamor.browser.IE && window.XMLHttpRequest); Adiamor.browser.IE8 = (dataString.indexOf('MSIE 8.0') != -1); Adiamor.browser.IE9 = (dataString.indexOf('MSIE 9.0') != -1 || dataString.indexOf('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;') != -1); Adiamor.browser.MOZ = (browser == "Netscape" || browser == "Firefox"); Adiamor.browser.SAFARI = (browser == "Safari"); Adiamor.browser.OPERA = (browser == "Opera"); Adiamor.browser.CHROME = (browser + subString == "MozillaGecko"); Adiamor.browser.IPHONE = (navigator.appVersion.toLowerCase().indexOf('iphone') != -1); Adiamor.browser.IPAD = (navigator.appVersion.toLowerCase().indexOf('ipad') != -1); Adiamor.browser.XHR_ENABLED = Adiamor.browser.OPERA || Adiamor.browser.SAFARI || Adiamor.browser.MOZ || Adiamor.browser.IE || Adiamor.browser.CHROME; Adiamor.browser.UNKNOWN = !(Adiamor.browser.IE || Adiamor.browser.MOZ || Adiamor.browser.SAFARI || Adiamor.browser.CHROME); if (Adiamor.browser.UNKNOWN || Adiamor.browser.IPHONE || Adiamor.browser.IPAD) { window.location = "../diamondsearch.aspx"; }
    Adiamor.browser.DocumentWidth = getDocWidth(); Adiamor.browser.DocumentHeight = getDocHeight();
}; Adiamor.browser.detect(); Adiamor.browser.History = function () {
    this.lastPage = ""; this.currentPage = ""; this.OnChange = new Adiamor.base.SubjectHelper(); this.locked = false; if (!this.compat()) { return; }
    this.iframeObject = document.createElement('iframe'); this.iframeObject.style.border = "solid 1px black"; this.iframeObject.style.width = "100px"; this.iframeObject.style.height = "100px"; this.iframeObject.style.display = "none"; this.iframeObject.setAttribute('name', 'ntb_history'); this.iframeObject.setAttribute('id', 'ntb_history'); document.body.appendChild(this.iframeObject); this.iframe = frames.ntb_history; this.monitor();
}; Adiamor.browser.History.prototype.add = function (path) {
    if (!this.compat()) { return; }
    this.locked = true; this.currentPage = path.substr(path.indexOf("#") + 1); this.lagePage = this.currentPage; this.iframe.location.href = path; this.locked = false;
}; Adiamor.browser.History.prototype.monitor = function () {
    if (!this.compat()) { return; }
    var alocation = this.iframe.location.href.split("#"); this.currentPage = alocation[1]; if (this.currentPage != this.lastPage && !this.locked) { this.OnChange.notify(alocation[0].substring(alocation[0].lastIndexOf("/") + 1), this.currentPage); this.lastPage = this.currentPage; }
    window.setTimeout(Adiamor.lang.close(this, this.monitor), 500);
}; Adiamor.browser.History.prototype.compat = function () {
    if (!Adiamor.browser.IE && !Adiamor.browser.MOZ) { return false; }
    return true;
}; Adiamor.lang.defineNs("Adiamor.html"); if (typeof (Adiamor.html) == "undefined") { Adiamor.html = function () { }; }
Adiamor.html.addClass = function (element, className) { var css = element.className, re = new RegExp(className, 'gi'); css = css.replace(re, ""); element.className = css + ' ' + className; }; Adiamor.html.removeClass = function (element, className) { var css = element.className, re = new RegExp(className, 'gi'); css = css.replace(re, ""); element.className = css; }; Adiamor.html.getClass = function (cssClass) { cssClass = "." + cssClass.toLowerCase(); var ss, rules, rule, ruleItem; for (ss = 0; ss < document.styleSheets.length; ss += 1) { rules = document.styleSheets[ss].rules || document.styleSheets[ss].cssRules; for (rule = 0; rule < rules.length; rule += 1) { ruleItem = rules.item(rule) || rules[rule]; if (ruleItem.selectorText.toLowerCase() == cssClass) { return ruleItem.style; } } } }; Adiamor.html.getCoords = function (element) {
    var coords = { 'x': 0, 'y': 0, 'width': element.offsetWidth, 'height': element.offsetHeight }; while (element) {
        if (!Adiamor.browser.SAFARI && !Adiamor.browser.MOZ && !Adiamor.browser.CHROME) { coords.x += element.offsetLeft; coords.y += element.offsetTop; element = element.offsetParent; }
        else {
            if (typeof (element.offsetLeft) == "undefined") { }
            else { coords.x += element.offsetLeft; }
            if (typeof (element.offsetTop) == "undefined") { }
            else { coords.y += element.offsetTop; }
            element = Adiamor.html.getParent(element);
        } 
    }
    return coords;
}; Adiamor.html.getParent = function (element) {
    var op = false; while (!op) {
        if (element.offsetParent == null) {
            if (element.parentNode != null) { element = element.parentNode; }
            else { element = null; op = true; } 
        }
        else { op = true; element = element.offsetParent; } 
    }
    return element;
}; Adiamor.html.getUniqueId = function (elem) {
    if (elem.uniqueID) { return elem.uniqueID; }
    else { var t = (new Date()).getTime(); elem.uniqueID = t; return t; } 
}; if (Adiamor.browser.IE) {
    Adiamor.html.getFirstChild = function (node) {
        if (node != null) { return node.firstChild; }
        else { return $('slider-extension-container').firstChild; } 
    };
}
else {
    Adiamor.html.getFirstChild = function (node) {
        var i = 0; while (i < node.childNodes.length && node.childNodes[i].nodeType == 3) { i += 1; }
        return node.childNodes[i];
    };
}
Adiamor.html.align = function (source, target, AlignBit_HWTBLRCM, oh, ow, oy, ox) {
    oh = oh || 0; ow = ow || 0; oy = oy || 0; ox = ox || 0; var a = AlignBit_HWTBLRCM, td, sd, tt, tb, tl, tr, th, tw, st, sb, sl, sr, sh, sw, s; if (Adiamor.browser.IE) { td = target.getBoundingClientRect(); sd = source.getBoundingClientRect(); tt = td.top; tb = td.bottom; tl = td.left; tr = td.right; th = Math.abs(tb - tt); tw = Math.abs(tr - tl); st = sd.top; sb = sd.bottom; sl = sd.left; sr = sd.right; sh = Math.abs(sb - st); sw = Math.abs(sr - sl); }
    else if (Adiamor.browser.MOZ) { td = target.getBoundingClientRect(); sd = source.getBoundingClientRect(); tt = td.top; tb = td.bottom; tl = td.left; tr = td.right; th = Math.abs(tb - tt); tw = Math.abs(tr - tl); st = sd.top; sb = sd.bottom; sl = sd.left; sr = sd.right; sh = Math.abs(sb - st); sw = Math.abs(sr - sl); }
    else { td = Adiamor.html.getCoords(target); sd = Adiamor.html.getCoords(source); tt = td.y; tl = td.x; tw = td.width; th = td.height; st = sd.y; sl = sd.x; sw = sd.width; sh = sd.height; }
    s = source.style; if (a & 0x10000000) { s.height = (th + oh) + 'px'; }
    if (a & 0x01000000) { s.width = (tw + ow) + 'px'; }
    if (a & 0x00100000) { s.top = (parseInt(Adiamor.dom.getStyle(source, 'top'), 10) + tt - st + oy) + 'px'; }
    if (a & 0x00010000) { s.top = (parseInt(Adiamor.dom.getStyle(source, 'top'), 10) + tt - st + th - sh + oy) + 'px'; }
    if (a & 0x00001000) { s.left = (parseInt(Adiamor.dom.getStyle(source, 'left'), 10) - sl + tl + ox) + 'px'; }
    if (a & 0x00000100) { s.left = (parseInt(Adiamor.dom.getStyle(source, 'left'), 10) - sl + tl + tw - sw + ox) + 'px'; }
    if (a & 0x00000010) { s.top = (parseInt(Adiamor.dom.getStyle(source, 'top'), 10) + tt - st + oy + Math.floor((th - sh) / 2)) + 'px'; }
    if (a & 0x00000001) { s.left = (parseInt(Adiamor.dom.getStyle(source, 'left'), 10) - sl + tl + ox + Math.floor((tw - sw) / 2)) + 'px'; } 
}; Adiamor.ah = 0x10000000; Adiamor.aw = 0x01000000; Adiamor.at = 0x00100000; Adiamor.ab = 0x00010000; Adiamor.al = 0x00001000; Adiamor.ar = 0x00000100; Adiamor.amv = 0x00000010; Adiamor.amh = 0x00000001; Adiamor.html.Event = function () { }; Adiamor.html.handlerId = 0; Adiamor.html.elementId = 0; Adiamor.html.elements = []; Adiamor.html.unload = []; Adiamor.html.unloadCalled = false; Adiamor.html.attachEvents = function (element, events, context) { var i, e; for (i = 0; i < events.length; i += 1) { e = events[i]; Adiamor.html.attachEvent(element, e.type, e.handler, context, e.capture || false); } }; Adiamor.html.attachEvent = function (element, type, handler, context, capture) {
    if (element == null) { return; }
    var handlerGuid = this.handlerId++, elementGuid = this.elementId++; if (typeof (handler.ebaguid) != "undefined") { handlerGuid = handler.ebaguid; }
    else { handler.ebaguid = handlerGuid; }
    if (typeof (element) == "string") { element = document.getElementById(element); }
    if (this.elements == null) { this.elements = []; }
    if (typeof (element.ebaguid) == "undefined") { element.ebaguid = elementGuid; this.elements[elementGuid] = element; }
    if (typeof (element.eba_events) == "undefined") { element.eba_events = {}; }
    if (element.eba_events[type] == null) {
        element.eba_events[type] = {}; if (element.attachEvent) { element['eba_event_' + type] = function () { Adiamor.html.notify.call(element, window.event); }; element.attachEvent('on' + type, element['eba_event_' + type]); if (capture) { element.setCapture(true); } }
        else if (element.addEventListener) { element.addEventListener(type, function () { Adiamor.html.notify.call(element, arguments[0]); }, capture); } 
    }
    element.eba_events[type][handlerGuid] = { handler: handler, context: context };
}; Adiamor.html.notify = function (e) {
    if (!Adiamor.browser.IE) { e.srcElement = e.target; e.fromElement = e.relatedTarget; e.toElement = e.relatedTarget; }
    Adiamor.html.Event = e; var element = this, handlerGuid, event1; Adiamor.html.Event.ebaEventSrc = element; for (handlerGuid in element.eba_events[e.type]) {
        if (element.eba_events[e.type].hasOwnProperty(handlerGuid)) {
            event1 = element.eba_events[e.type][handlerGuid]; if (typeof (event1.context) == "object") { event1.handler.call(event1.context, e, element); }
            else { event1.handler.call(element, e, element); } 
        } 
    } 
}; Adiamor.html.detachEvents = function (element, events) { var i, e; for (i = 0; i < events.length; i += 1) { e = events[i]; Adiamor.html.detachEvent(element, e.type, e.handler); } }; Adiamor.html.detachEvent = function (element, type, handler) {
    if (typeof (element) == "string") { element = document.getElementById(element); }
    if (element.eba_events != null && element.eba_events[type] != null && element.eba_events[type][handler.ebaguid] != null) { var handlers = element.eba_events[type]; handlers[handler.ebaguid] = null; delete handlers[handler.ebaguid]; if (Adiamor.collections.isHashEmpty(handlers)) { this.m_detach(element, type, element['eba_event_' + type]); element['eba_event_' + type] = null; element.eba_events[type] = null; handlers = null; if (element.nodeType == 3) { element.removeAttribute('eba_event_' + type); } } } 
}; Adiamor.html.m_detach = function (element, type, handler) {
    var i; if (element.detachEvent) { element.detachEvent('on' + type, handler); }
    else if (element.removeEventListener) { element.removeEventListener(type, handler, false); }
    element['on' + type] = null; if (type == "unload") { for (i = 0; i < this.unload.length; i += 1) { this.unload[i].call(this); this.unload[i] = null; } } 
}; Adiamor.html.detachAllEvents = function () {
    var i, eventType, j; for (i = 0; i < Adiamor.html.elements.length; i += 1) {
        if (typeof (Adiamor.html.elements[i]) != "undefined") {
            for (eventType in Adiamor.html.elements[i].eba_events) {
                if (Adiamor.html.elements[i].eba_events.hasOwnProperty(eventType)) {
                    Adiamor.html.m_detach(Adiamor.html.elements[i], eventType, Adiamor.html.elements[i]['eba_event_' + eventType]); if (typeof (Adiamor.html.elements[i]) != "undefined" && Adiamor.html.elements[i].eba_events[eventType] != null) { for (j = 0; j < Adiamor.html.elements[i].eba_events[eventType].length; j += 1) { Adiamor.html.elements[i].eba_events[eventType][j] = null; } }
                    Adiamor.html.elements[i]['eba_event_' + eventType] = null;
                } 
            } 
        } 
    }
    Adiamor.html.elements = null;
}; Adiamor.html.addUnload = function (funcRef) { this.unload.push(funcRef); }; Adiamor.html.cancelEvent = function (evt) {
    if (evt == null) { return; }
    if (Adiamor.browser.MOZ) { evt.preventDefault(); evt.stopPropagation(); }
    else if (Adiamor.browser.IE) { evt.cancelBubble = true; evt.returnValue = false; } 
}; Adiamor.html.stopEvent = function (evt) {
    if (evt == null) { return; }
    if (Adiamor.browser.MOZ) { evt.stopPropagation(); }
    else if (Adiamor.browser.IE) { evt.cancelBubble = true; } 
}; Adiamor.html.cancelBubble = function (e, v) { e.returnValue = false; e.cancelBubble = true; if (v != null) { e.keyCode = v; } }; Adiamor.html.getEventCoords = function (evt) {
    var coords = { 'x': evt.clientX, 'y': evt.clientY }; if (Adiamor.browser.IE) { coords.x += document.documentElement.scrollLeft + document.body.scrollLeft; coords.y += document.documentElement.scrollTop + document.body.scrollTop; }
    else { coords.x += window.scrollX; coords.y += window.scrollY; }
    return coords;
}; Adiamor.html.attachEvent(window, "unload", Adiamor.html.detachAllEvents, Adiamor.html, false); Adiamor.lang.defineNs("Adiamor.dom"); Adiamor.dom.getTop = function (elem) { return Number(elem.style.top.replace(/p.*/, '')); }; Adiamor.dom.getLeft = function (elem) { return Number(elem.style.left.replace(/p.*/, '')); }; Adiamor.dom.getUniqueId = function (elem) {
    if (elem.uniqueID) { return elem.uniqueID; }
    else { var t = (new Date()).getTime(); elem.uniqueID = t; return t; } 
}; Adiamor.dom.setOpacity = function (element, opacity) {
    var s = element.style; if (opacity < 100) { s.filter = "alpha(opacity=" + opacity + ")"; s.opacity = (opacity / 100); }
    else {
        if (s.filter != null) { s.filter = s.filter.replace(/alpha\(opacity\=\.\[\^\)\]\*\]\)/, ''); }
        s.opacity = "1";
    } 
}; Adiamor.dom.getOpacity = function (element) { return Math.abs(element.style.opacity ? element.style.opacity * 100 : 0); }; Adiamor.dom.getStyle = function (oElm, strCssRule) {
    var strValue = ""; if (oElm.style[strCssRule]) { return oElm.style[strCssRule]; }
    else if (oElm.currentStyle) { strCssRule = strCssRule.replace(/([A-Z])/g, "-$1"); strValue = oElm.currentStyle[strCssRule]; }
    else if (document.defaultView && document.defaultView.getComputedStyle) { strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule); }
    return strValue;
}; if (typeof (Adiamor.ajax) == "undefined") { Adiamor.ajax = function () { }; }
Adiamor.ajax.createXmlHttp = function () {
    if (Adiamor.browser.IE) {
        var reservedObj = null; try { reservedObj = new ActiveXObject("Msxml2.XMLHTTP"); }
        catch (e) {
            try { reservedObj = new ActiveXObject("Microsoft.XMLHTTP"); }
            catch (ee) { } 
        }
        return reservedObj;
    }
    else if (Adiamor.browser.XHR_ENABLED) { return new XMLHttpRequest(); } 
}; Adiamor.lang.defineNs("Adiamor.ajax"); Adiamor.ajax.HttpRequestPool_MAXCONNECTIONS = 64; Adiamor.ajax.HttpRequest = function () { this.handler = ''; this.async = true; this.responseType = "xml"; this.httpObj = Adiamor.ajax.createXmlHttp(); this.OnPostComplete = new Adiamor.base.SubjectHelper(); this.OnGetComplete = new Adiamor.base.SubjectHelper(); this.OnError = new Adiamor.base.SubjectHelper(); this.timeout = 5000; this.retry = 2; this.timeoutId = null; this.params = null; this.data = ""; this.status = "complete"; }; Adiamor.lang.extend(Adiamor.ajax.HttpRequest, Adiamor.base.Object); Adiamor.ajax.HttpRequest.prototype.handleResponse = function () {
    var result = null, message; try {
        if (this.responseType == "xml") { result = this.httpObj.responseXML; }
        else if (this.responseType == "text") { result = this.httpObj.responseText; }
        else { result = this.httpObj; } 
    }
    catch (err) { message = (err.description) || err; }
    finally { return result; } 
}; Adiamor.ajax.HttpRequest.prototype.post = function (data) {
    this.data = data; this.status = "pending"; if (!this.httpObj) { this.httpObj = Adiamor.ajax.createXmlHttp(); }
    this.httpObj.open("POST", this.handler, this.async, "", ""); if (this.async) { this.httpObj.onreadystatechange = Adiamor.lang.close(this, this.postComplete); }
    if (this.responseType == "xml") { this.httpObj.setRequestHeader("Content-Type", "text/xml"); }
    else { this.httpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); }
    this.httpObj.send(data);
}; Adiamor.ajax.HttpRequest.prototype.postComplete = function () { if (this.httpObj.readyState == 4) { this.status = "complete"; this.OnPostComplete.notify({ 'response': this.handleResponse(), 'params': this.params }); } }; Adiamor.ajax.HttpRequest.prototype.postXml = function (xmlData) {
    this.setTimeout(); if (("undefined" == typeof (xmlData.documentElement)) || (null == xmlData.documentElement) || ("undefined" == typeof (xmlData.documentElement.childNodes)) || (1 > xmlData.documentElement.childNodes.length)) { ebaErrorReport("updategram is empty. No request sent. xmlData[" + xmlData + "]\nxmlData.xml[" + xmlData.xml + "]"); return; }
    if (null == xmlData.xml) { var xmlSerializer = new XMLSerializer(); xmlData.xml = xmlSerializer.serializeToString(xmlData); }
    this.post(xmlData.xml);
}; Adiamor.ajax.HttpRequest.prototype.get = function () {
    this.setTimeout(); this.status = "pending"; try { this.httpObj.open("GET", this.handler, this.async); }
    catch (e) { throw (e); }
    if (this.async) { this.httpObj.onreadystatechange = Adiamor.lang.close(this, this.getComplete); }
    if (this.responseType == "xml") { this.httpObj.setRequestHeader("Content-Type", "text/xml"); }
    this.httpObj.send(null); if (!this.async) { return this.handleResponse(); } 
}; Adiamor.ajax.HttpRequest.prototype.setTimeout = function () { if (this.timeout > 0) { this.timeoutId = window.setTimeout(Adiamor.lang.close(this, this.abort), this.timeout); } }; Adiamor.ajax.HttpRequest.prototype.getComplete = function () { if (this.httpObj.readyState == 4) { this.status = "complete"; this.OnGetComplete.notify({ 'response': this.handleResponse(), 'params': this.params }); } }; Adiamor.ajax.HttpRequest.prototype.abort = function () { this.httpObj.onreadystatechange = function () { }; this.httpObj.abort(); if (this.retry) { this.retry -= 1; this.get(); } }; Adiamor.ajax.HttpRequest.prototype.clear = function () { this.handler = ''; this.async = true; this.onPostComplete = null; this.onGetComplete = null; this.params = null; }; Adiamor.ajax.HttpRequest.prototype.cacheBust = function (url) {
    var urlArray = url.split('?'), param = 'Adiamor_cachebust=' + (new Date().getTime()); if (urlArray.length == 1) { url += '?' + param; }
    else { url += '&' + param; }
    return url;
}; Adiamor.ajax.HttpRequestPool = function (maxObjects) { this.inUse = []; this.free = []; this.max = maxObjects || Adiamor.ajax.HttpRequestPool_MAXCONNECTIONS; this.locked = false; this.context = null; }; Adiamor.ajax.HttpRequestPool.prototype.reserve = function () {
    this.locked = true; var reservedObj; if (this.free.length) { reservedObj = this.free.pop(); reservedObj.clear(); this.inUse.push(reservedObj); }
    else if (this.inUse.length < this.max) {
        try { reservedObj = new Adiamor.ajax.HttpRequest(); }
        catch (e) { reservedObj = null; }
        this.inUse.push(reservedObj);
    }
    else { throw "No request objects available"; }
    this.locked = false; return reservedObj;
}; Adiamor.ajax.HttpRequestPool.prototype.release = function (resource) {
    var found = false, i; this.locked = true; if (null != resource) { for (i = 0; i < this.inUse.length; i += 1) { if (resource == this.inUse[i]) { this.free.push(this.inUse[i]); this.inUse.splice(i, 1); found = true; break; } } }
    this.locked = false; return null;
}; Adiamor.ajax.HttpRequestPool.prototype.dispose = function () {
    var i, j; for (i = 0; i < this.inUse.length; i += 1) { this.inUse[i].dispose(); }
    this.inUse = null; for (j = 0; j < this.free.length; j += 1) { this.free[i].dispose(); }
    this.free = null;
}; Adiamor.lang.defineNs('Adiamor.data'); if (typeof (Adiamor.data) == "undefined") { Adiamor.data = function () { }; }
Adiamor.data.JsonDataView = function () { this.uid = Adiamor.base.getUid(); this.fieldMap = { "xi": 0 }; this.Schema = [{ 'Name': 'xi', 'Type': 'number', 'Default': 0, 'Decimals': 0 }, { 'Name': 'ID', 'Type': 'text', 'Default': '0' }, { 'Name': 'Shape', 'Type': 'image', 'Default': '' }, { 'Name': 'Carat', 'Type': 'number', 'Default': '', 'Decimals': 2 }, { 'Name': 'Color', 'Type': 'text', 'Default': '' }, { 'Name': 'Clar', 'Type': 'text', 'Default': '' }, { 'Name': 'Cut', 'Type': 'text', 'Default': '' }, { 'Name': 'Pol', 'Type': 'text', 'Default': '' }, { 'Name': 'Sym', 'Type': 'text', 'Default': '' }, { 'Name': 'Depth', 'Type': 'number', 'Default': '', 'Decimals': 1 }, { 'Name': 'Tbl', 'Type': 'text', 'Default': '' }, { 'Name': 'Fluor', 'Type': 'text', 'Default': '' }, { 'Name': 'Size', 'Type': 'number', 'Default': '', 'Decimals': 2 }, { 'Name': 'Cert', 'Type': 'text', 'Default': '' }, { 'Name': 'SPrice', 'Type': 'money', 'Default': '0' }, { 'Name': 'Selected', 'Type': 'boolean', 'Default': '0' }, { 'Name': 'Info', 'Type': 'empty', 'Default': '' }, { 'Name': 'Girdle', 'Type': 'text', 'Default': '' }, { 'Name': 'Meas', 'Type': 'text', 'Default': '' }, { 'Name': 'Culet', 'Type': 'text', 'Default': ''}]; this.OnRowCountChanged = new Adiamor.base.SubjectHelper(); this.OnDataReady = new Adiamor.base.SubjectHelper(); }; Adiamor.lang.extend(Adiamor.data.JsonDataView, Adiamor.base.Object); Adiamor.data.JsonDataView.prototype.initialize = function (values) { this.flush(); this.params = {}; this.getHandler = ""; this.ajaxCallbackPool = new Adiamor.ajax.HttpRequestPool(); this.async = true; this.setValues(values); }; Adiamor.data.JsonDataView.prototype.initializeData = function (oData) { this.data = oData; }; Adiamor.data.JsonDataView.prototype.replaceData = function (oData) { this.initializeData(oData); }; Adiamor.data.JsonDataView.prototype.mergeData = function (oData) {
    if (oData[0] == null) { this.data = []; return; }
    var startXi = oData[0][this.fieldMap.xi], remove, len, i; this.data[startXi] = ""; remove = 0; len = oData.length; for (i = 0; i < len; i += 1) {
        if (oData[i] != null) { remove = 1; }
        else { remove = 0; }
        this.data.splice(oData[i][this.fieldMap.xi], remove, oData[i]);
    } 
}; Adiamor.data.JsonDataView.prototype.flush = function () { this.data = []; }; Adiamor.data.JsonDataView.prototype.getRecord = function (index) { var data = this.data[index]; return data; }; Adiamor.data.JsonDataView.prototype.setRemoteRowCount = function (rows) { var previousCount = this.remoteRowCount; this.remoteRowCount = rows; if (this.remoteRowCount != previousCount || this.remoteRowCount == 0) { this.OnRowCountChanged.notify(rows); } }; Adiamor.data.JsonDataView.prototype.getRemoteRowCount = function () { return this.remoteRowCount; }; Adiamor.data.JsonDataView.prototype.getRows = function () { return this.data.length; }; function capitalizeMe(obj) {
    var newVal = '', c; obj = obj.split(' '); for (c = 0; c < obj.length; c += 1) {
        newVal += obj[c].substring(0, 1).toUpperCase() +
obj[c].substring(1, obj[c].length);
    }
    return newVal;
}
var getMappedValueByPosition = function (val, col) {
    var colMappings = g_mappings[col], mappedVal; if (colMappings != null) { mappedVal = colMappings[val]; return mappedVal; }
    return null;
}; Adiamor.data.JsonDataView.prototype.get = function (callback, errorCallback, params) {
    this.errorCallback = errorCallback; var postData = '', index, i, g_cb, n, name, column, shapes, val, ajaxCallback; if (document.getElementById('affinityinit') != null) {
        index = 0; for (i = 0; i < g_checkboxes.length; i += 1) {
            g_cb = g_checkboxes[i]; n = g_cb.name; if (n == "round") { g_diamondData.setParam('shape_' + n, g_inverseMappings.Shape[n]); }
            else { g_diamondData.setParam('shape_' + n); } 
        }
        for (name in this.params) {
            column = capitalizeMe(name.substring(0, name.indexOf("_"))); if (column == "Cut" || column == "Shape" || name == "sortcol" || name == "sortdir" || name == "start" || name == "page_size") {
                if (name == "cut_low") { if (this.params.hasOwnProperty(name)) { this.params[name] = 4; postData += escape(name) + "=" + escape(this.params[name]) + "&"; } }
                else if (name == "cut_high") { if (this.params.hasOwnProperty(name)) { this.params[name] = 5; postData += escape(name) + "=" + escape(this.params[name]) + "&"; } }
                else { if (this.params.hasOwnProperty(name)) { postData += escape(name) + "=" + escape(this.params[name]) + "&"; } } 
            }
            else { if (this.params.hasOwnProperty(name)) { this.params[name] = null; } }
            index += 1;
        } 
    }
    else {
        shapes = ''; for (name in this.params) {
            if (this.params.hasOwnProperty(name)) {
                postData += escape(name) + "=" + escape(this.params[name]) + "&"; column = capitalizeMe(name.substring(0, name.indexOf("_"))); if (column == "Shape") { pageTracker._trackEvent('Diamond Searches', 'Shape Search', capitalizeMe(name.substring(name.indexOf("_") + 1)), 1); }
                else if (column == "Price" || column == "Carat" || column == "Depth" || column == "Size" || column == "Table" || column == "Sortcol") { pageTracker._trackEvent('Diamond Searches', capitalizeMe(name) + ' Search', this.params[name], 1); }
                else if (column == "Color" || column == "Clarity" || column == "Fluor" || column == "Polish" || column == "Sym") {
                    if (name.substring(name.indexOf("_") + 1) == "high") { pageTracker._trackEvent('Diamond Searches', capitalizeMe(name) + ' Search', getMappedValueByPosition(this.params[name] - 1, column), 1); }
                    else { pageTracker._trackEvent('Diamond Searches', capitalizeMe(name) + ' Search', getMappedValueByPosition(this.params[name], column), 1); } 
                }
                else if (column == "Cut") {
                    val = this.params[name]; if (name.substring(name.indexOf("_") + 1) == "high") { val -= 1; }
                    if (val == "0") { pageTracker._trackEvent('Diamond Searches', 'Cut Search', 'Fair', 1); }
                    else if (val == "1") { pageTracker._trackEvent('Diamond Searches', 'Cut Search', 'Good', 1); }
                    else if (val == "2") { pageTracker._trackEvent('Diamond Searches', 'Cut Search', 'Very Good', 1); }
                    else if (val == "3") { pageTracker._trackEvent('Diamond Searches', 'Cut Search', 'Premium', 1); }
                    else if (val == "4") { pageTracker._trackEvent('Diamond Searches', 'Cut Search', 'Ideal', 1); } 
                } 
            } 
        } 
    }
    postData = postData.substring(0, postData.length - 1); ajaxCallback = this.ajaxCallbackPool.reserve(); ajaxCallback.handler = this.getHandler; ajaxCallback.OnPostComplete.subscribe(this.getComplete, this); ajaxCallback.async = this.async; ajaxCallback.responseType = "text"; ajaxCallback.params = { 'params': this.params, 'requestObject': ajaxCallback, 'source': this, 'callback': callback }; return ajaxCallback.post(postData);
}; Adiamor.data.JsonDataView.prototype.setGetHandler = function (getHandler, preserve) {
    var getHandlerArray = getHandler.split('?'), paramArray = getHandlerArray.length == 2 ? getHandlerArray[1].split('&') : [], i, pair; if (preserve == null || !preserve) { this.params = {}; }
    for (i = 0; i < paramArray.length; i += 1) { pair = paramArray[i].split('='); this.params[unescape(pair[0])] = unescape(pair[1]); }
    this.getHandler = getHandlerArray[0];
}; Adiamor.data.JsonDataView.prototype.setParam = function (name, value) {
    if (value == null) { delete this.params[name]; }
    else { this.params[name] = value; }
    $('filters-list').innerHTML = UpdateFilters(this);
}; function clearFilter(item) {
    var type = item, n, cb, ncb, image, img; if (type.indexOf("shape") > -1) { type = "shape"; }
    switch (type) { case 'price_low': g_miniSliders[0].Slider.LeftValue = g_miniSliders[0].Slider.Min; g_miniSliders[0].Slider.LeftTooltip.m_HtmlElementHandle.value = g_miniSliders[0].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[0].Slider }, g_miniSliders[0].name); g_miniSliders[0].Slider.updateLeftGrabby(g_miniSliders[0].Slider); g_miniSliders[0].Slider.RightValue = g_miniSliders[0].Slider.Max; g_miniSliders[0].Slider.RightTooltip.m_HtmlElementHandle.value = g_miniSliders[0].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[0].Slider }, g_miniSliders[0].name); g_miniSliders[0].Slider.updateRightGrabby(g_miniSliders[0].Slider); break; case 'price_high': g_miniSliders[0].Slider.LeftValue = g_miniSliders[0].Slider.Min; g_miniSliders[0].Slider.LeftTooltip.m_HtmlElementHandle.value = g_miniSliders[0].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[0].Slider }, g_miniSliders[0].name); g_miniSliders[0].Slider.updateLeftGrabby(g_miniSliders[0].Slider); g_miniSliders[0].Slider.RightValue = g_miniSliders[0].Slider.Max; g_miniSliders[0].Slider.RightTooltip.m_HtmlElementHandle.value = g_miniSliders[0].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[0].Slider }, g_miniSliders[0].name); g_miniSliders[0].Slider.updateRightGrabby(g_miniSliders[0].Slider); break; case 'carat_low': g_miniSliders[1].Slider.LeftValue = g_miniSliders[1].Slider.Min; g_miniSliders[1].Slider.LeftTooltip.m_HtmlElementHandle.value = g_miniSliders[1].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[1].Slider }, g_miniSliders[1].name); g_miniSliders[1].Slider.updateLeftGrabby(g_miniSliders[1].Slider); g_miniSliders[1].Slider.RightValue = g_miniSliders[1].Slider.Max; g_miniSliders[1].Slider.RightTooltip.m_HtmlElementHandle.value = g_miniSliders[1].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[1].Slider }, g_miniSliders[1].name); g_miniSliders[1].Slider.updateRightGrabby(g_miniSliders[1].Slider); break; case 'carat_high': g_miniSliders[1].Slider.LeftValue = g_miniSliders[1].Slider.Min; g_miniSliders[1].Slider.LeftTooltip.m_HtmlElementHandle.value = g_miniSliders[1].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[1].Slider }, g_miniSliders[1].name); g_miniSliders[1].Slider.updateLeftGrabby(g_miniSliders[1].Slider); g_miniSliders[1].Slider.RightValue = g_miniSliders[1].Slider.Max; g_miniSliders[1].Slider.RightTooltip.m_HtmlElementHandle.value = g_miniSliders[1].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[1].Slider }, g_miniSliders[1].name); g_miniSliders[1].Slider.updateRightGrabby(g_miniSliders[1].Slider); break; case 'cut_low': g_miniSliders[2].Slider.LeftValue = g_miniSliders[2].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[2].Slider }, g_miniSliders[2].name); g_miniSliders[2].Slider.RightValue = g_miniSliders[2].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[2].Slider }, g_miniSliders[2].name); break; case 'cut_high': g_miniSliders[2].Slider.LeftValue = g_miniSliders[2].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[2].Slider }, g_miniSliders[2].name); g_miniSliders[2].Slider.RightValue = g_miniSliders[2].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[2].Slider }, g_miniSliders[2].name); break; case 'color_low': g_miniSliders[3].Slider.LeftValue = g_miniSliders[3].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[3].Slider }, g_miniSliders[3].name); g_miniSliders[3].Slider.RightValue = g_miniSliders[3].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[3].Slider }, g_miniSliders[3].name); break; case 'color_high': g_miniSliders[3].Slider.LeftValue = g_miniSliders[3].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[3].Slider }, g_miniSliders[3].name); g_miniSliders[3].Slider.RightValue = g_miniSliders[3].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[3].Slider }, g_miniSliders[3].name); break; case 'clarity_low': g_miniSliders[4].Slider.LeftValue = g_miniSliders[4].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[4].Slider }, g_miniSliders[4].name); g_miniSliders[4].Slider.stopLeftDrag({ "DragElement": g_miniSliders[4].Slider.LeftGrabby, "Event": g_miniSliders[4].Slider, "Tooltip": true }); g_miniSliders[4].Slider.RightValue = g_miniSliders[4].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[4].Slider }, g_miniSliders[4].name); g_miniSliders[4].Slider.stopRightDrag({ "DragElement": g_miniSliders[4].Slider.RightGrabby, "Event": g_miniSliders[4].Slider, "Tooltip": true }); break; case 'clarity_high': g_miniSliders[4].Slider.LeftValue = g_miniSliders[4].Slider.Min; updateDataViewSliderParams({ "slider": g_miniSliders[4].Slider }, g_miniSliders[4].name); g_miniSliders[4].Slider.stopLeftDrag({ "DragElement": g_miniSliders[4].Slider.LeftGrabby, "Event": g_miniSliders[4].Slider, "Tooltip": true }); g_miniSliders[4].Slider.RightValue = g_miniSliders[4].Slider.Max; updateDataViewSliderParams({ "slider": g_miniSliders[4].Slider }, g_miniSliders[4].name); g_miniSliders[4].Slider.stopRightDrag({ "DragElement": g_miniSliders[4].Slider.RightGrabby, "Event": g_miniSliders[4].Slider, "Tooltip": true }); break; case 'polish_low': g_smallSliders[0].Slider.LeftValue = g_smallSliders[0].Slider.Min; g_smallSliders[0].Slider.LeftGrabby.setX(g_smallSliders[0].Slider.getWidth() * g_smallSliders[0].Slider.setValueFunction(g_smallSliders[0].Slider.LeftValue), g_smallSliders[0].Slider.LeftValue); updateDataViewSliderParams({ "slider": g_smallSliders[0].Slider }, g_smallSliders[0].name); g_smallSliders[0].Slider.stopLeftDrag({ "DragElement": g_smallSliders[0].Slider.LeftGrabby, "Event": g_smallSliders[0].Slider, "Tooltip": true }); g_smallSliders[0].Slider.RightGrabby.setX(g_smallSliders[0].Slider.getWidth() * g_smallSliders[0].Slider.setValueFunction(g_smallSliders[0].Slider.RightValue) - g_smallSliders[0].Slider.getWidth(), g_smallSliders[0].Slider.RightValue); g_smallSliders[0].Slider.RightValue = g_smallSliders[0].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[0].Slider }, g_smallSliders[0].name); g_smallSliders[0].Slider.stopRightDrag({ "DragElement": g_smallSliders[0].Slider.RightGrabby, "Event": g_smallSliders[0].Slider, "Tooltip": true }); break; case 'polish_high': g_smallSliders[0].Slider.LeftValue = g_smallSliders[0].Slider.Min; g_smallSliders[0].Slider.LeftGrabby.setX(g_smallSliders[0].Slider.getWidth() * g_smallSliders[0].Slider.setValueFunction(g_smallSliders[0].Slider.LeftValue), g_smallSliders[0].Slider.LeftValue); updateDataViewSliderParams({ "slider": g_smallSliders[0].Slider }, g_smallSliders[0].name); g_smallSliders[0].Slider.stopLeftDrag({ "DragElement": g_smallSliders[0].Slider.LeftGrabby, "Event": g_smallSliders[0].Slider, "Tooltip": true }); g_smallSliders[0].Slider.RightGrabby.setX(g_smallSliders[0].Slider.getWidth() * g_smallSliders[0].Slider.setValueFunction(g_smallSliders[0].Slider.RightValue) - g_smallSliders[0].Slider.getWidth(), g_smallSliders[0].Slider.RightValue); g_smallSliders[0].Slider.RightValue = g_smallSliders[0].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[0].Slider }, g_smallSliders[0].name); g_smallSliders[0].Slider.stopRightDrag({ "DragElement": g_smallSliders[0].Slider.RightGrabby, "Event": g_smallSliders[0].Slider, "Tooltip": true }); break; case 'sym_low': g_smallSliders[1].Slider.LeftValue = g_smallSliders[1].Slider.Min; g_smallSliders[1].Slider.LeftGrabby.setX(g_smallSliders[1].Slider.getWidth() * g_smallSliders[1].Slider.setValueFunction(g_smallSliders[1].Slider.LeftValue), g_smallSliders[1].Slider.LeftValue); updateDataViewSliderParams({ "slider": g_smallSliders[1].Slider }, g_smallSliders[1].name); g_smallSliders[1].Slider.stopLeftDrag({ "DragElement": g_smallSliders[1].Slider.LeftGrabby, "Event": g_smallSliders[1].Slider, "Tooltip": true }); g_smallSliders[1].Slider.RightGrabby.setX(g_smallSliders[1].Slider.getWidth() * g_smallSliders[1].Slider.setValueFunction(g_smallSliders[1].Slider.RightValue) - g_smallSliders[1].Slider.getWidth(), g_smallSliders[1].Slider.RightValue); g_smallSliders[1].Slider.RightValue = g_smallSliders[1].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[1].Slider }, g_smallSliders[1].name); g_smallSliders[1].Slider.stopRightDrag({ "DragElement": g_smallSliders[1].Slider.RightGrabby, "Event": g_smallSliders[1].Slider, "Tooltip": true }); break; case 'sym_high': g_smallSliders[1].Slider.LeftValue = g_smallSliders[1].Slider.Min; g_smallSliders[1].Slider.LeftGrabby.setX(g_smallSliders[1].Slider.getWidth() * g_smallSliders[1].Slider.setValueFunction(g_smallSliders[1].Slider.LeftValue), g_smallSliders[1].Slider.LeftValue); updateDataViewSliderParams({ "slider": g_smallSliders[1].Slider }, g_smallSliders[1].name); g_smallSliders[1].Slider.stopLeftDrag({ "DragElement": g_smallSliders[1].Slider.LeftGrabby, "Event": g_smallSliders[1].Slider, "Tooltip": true }); g_smallSliders[1].Slider.RightGrabby.setX(g_smallSliders[1].Slider.getWidth() * g_smallSliders[1].Slider.setValueFunction(g_smallSliders[1].Slider.RightValue) - g_smallSliders[1].Slider.getWidth(), g_smallSliders[1].Slider.RightValue); g_smallSliders[1].Slider.RightValue = g_smallSliders[1].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[1].Slider }, g_smallSliders[1].name); g_smallSliders[1].Slider.stopRightDrag({ "DragElement": g_smallSliders[1].Slider.RightGrabby, "Event": g_smallSliders[1].Slider, "Tooltip": true }); break; case 'depth_low': g_smallSliders[2].Slider.LeftValue = g_smallSliders[2].Slider.Min; g_smallSliders[2].Slider.LeftGrabby.setX(g_smallSliders[2].Slider.getWidth() * g_smallSliders[2].Slider.setValueFunction(g_smallSliders[2].Slider.LeftValue), g_smallSliders[2].Slider.LeftValue); g_smallSliders[2].Slider.LeftTooltip.m_HtmlElementHandle.value = g_smallSliders[2].Slider.Min; updateDataViewSliderParams({ "slider": g_smallSliders[2].Slider }, g_smallSliders[2].name); g_smallSliders[2].Slider.updateLeftGrabby(g_smallSliders[2].Slider); g_smallSliders[2].Slider.RightValue = g_smallSliders[2].Slider.Max; g_smallSliders[2].Slider.RightGrabby.setX(g_smallSliders[2].Slider.getWidth() * g_smallSliders[2].Slider.setValueFunction(g_smallSliders[2].Slider.RightValue) - g_smallSliders[2].Slider.getWidth(), g_smallSliders[2].Slider.RightValue); g_smallSliders[2].Slider.RightTooltip.m_HtmlElementHandle.value = g_smallSliders[2].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[2].Slider }, g_smallSliders[2].name); g_smallSliders[2].Slider.updateRightGrabby(g_smallSliders[2].Slider); break; case 'depth_high': g_smallSliders[2].Slider.LeftValue = g_smallSliders[2].Slider.Min; g_smallSliders[2].Slider.LeftGrabby.setX(g_smallSliders[2].Slider.getWidth() * g_smallSliders[2].Slider.setValueFunction(g_smallSliders[2].Slider.LeftValue), g_smallSliders[2].Slider.LeftValue); g_smallSliders[2].Slider.LeftTooltip.m_HtmlElementHandle.value = g_smallSliders[2].Slider.Min; updateDataViewSliderParams({ "slider": g_smallSliders[2].Slider }, g_smallSliders[2].name); g_smallSliders[2].Slider.updateLeftGrabby(g_smallSliders[2].Slider); g_smallSliders[2].Slider.RightValue = g_smallSliders[2].Slider.Max; g_smallSliders[2].Slider.RightGrabby.setX(g_smallSliders[2].Slider.getWidth() * g_smallSliders[2].Slider.setValueFunction(g_smallSliders[2].Slider.RightValue) - g_smallSliders[2].Slider.getWidth(), g_smallSliders[2].Slider.RightValue); g_smallSliders[2].Slider.RightTooltip.m_HtmlElementHandle.value = g_smallSliders[2].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[2].Slider }, g_smallSliders[2].name); g_smallSliders[2].Slider.updateRightGrabby(g_smallSliders[2].Slider); break; case 'table_low': g_smallSliders[3].Slider.LeftValue = g_smallSliders[3].Slider.Min; g_smallSliders[3].Slider.LeftGrabby.setX(g_smallSliders[3].Slider.getWidth() * g_smallSliders[3].Slider.setValueFunction(g_smallSliders[3].Slider.LeftValue), g_smallSliders[3].Slider.LeftValue); g_smallSliders[3].Slider.LeftTooltip.m_HtmlElementHandle.value = g_smallSliders[3].Slider.Min; updateDataViewSliderParams({ "slider": g_smallSliders[3].Slider }, g_smallSliders[3].name); g_smallSliders[3].Slider.updateLeftGrabby(g_smallSliders[3].Slider); g_smallSliders[3].Slider.RightValue = g_smallSliders[3].Slider.Max; g_smallSliders[3].Slider.RightGrabby.setX(g_smallSliders[3].Slider.getWidth() * g_smallSliders[3].Slider.setValueFunction(g_smallSliders[3].Slider.RightValue) - g_smallSliders[3].Slider.getWidth(), g_smallSliders[3].Slider.RightValue); g_smallSliders[3].Slider.RightTooltip.m_HtmlElementHandle.value = g_smallSliders[3].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[3].Slider }, g_smallSliders[3].name); g_smallSliders[3].Slider.updateRightGrabby(g_smallSliders[3].Slider); break; case 'table_high': g_smallSliders[3].Slider.LeftValue = g_smallSliders[3].Slider.Min; g_smallSliders[3].Slider.LeftGrabby.setX(g_smallSliders[3].Slider.getWidth() * g_smallSliders[3].Slider.setValueFunction(g_smallSliders[3].Slider.LeftValue), g_smallSliders[3].Slider.LeftValue); g_smallSliders[3].Slider.LeftTooltip.m_HtmlElementHandle.value = g_smallSliders[3].Slider.Min; updateDataViewSliderParams({ "slider": g_smallSliders[3].Slider }, g_smallSliders[3].name); g_smallSliders[3].Slider.updateLeftGrabby(g_smallSliders[3].Slider); g_smallSliders[3].Slider.RightValue = g_smallSliders[3].Slider.Max; g_smallSliders[3].Slider.RightGrabby.setX(g_smallSliders[3].Slider.getWidth() * g_smallSliders[3].Slider.setValueFunction(g_smallSliders[3].Slider.RightValue) - g_smallSliders[3].Slider.getWidth(), g_smallSliders[3].Slider.RightValue); g_smallSliders[3].Slider.RightTooltip.m_HtmlElementHandle.value = g_smallSliders[3].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[3].Slider }, g_smallSliders[3].name); g_smallSliders[3].Slider.updateRightGrabby(g_smallSliders[3].Slider); break; case 'size_low': g_smallSliders[4].Slider.LeftValue = g_smallSliders[4].Slider.Min; g_smallSliders[4].Slider.LeftGrabby.setX(g_smallSliders[4].Slider.getWidth() * g_smallSliders[4].Slider.setValueFunction(g_smallSliders[4].Slider.LeftValue), g_smallSliders[4].Slider.LeftValue); g_smallSliders[4].Slider.LeftTooltip.m_HtmlElementHandle.value = g_smallSliders[4].Slider.Min; updateDataViewSliderParams({ "slider": g_smallSliders[4].Slider }, g_smallSliders[4].name); g_smallSliders[4].Slider.updateLeftGrabby(g_smallSliders[4].Slider); g_smallSliders[4].Slider.RightValue = g_smallSliders[4].Slider.Max; g_smallSliders[4].Slider.RightTooltip.m_HtmlElementHandle.value = g_smallSliders[4].Slider.Max; g_smallSliders[4].Slider.RightGrabby.setX(g_smallSliders[4].Slider.getWidth() * g_smallSliders[4].Slider.setValueFunction(g_smallSliders[4].Slider.RightValue) - g_smallSliders[4].Slider.getWidth(), g_smallSliders[4].Slider.RightValue); updateDataViewSliderParams({ "slider": g_smallSliders[4].Slider }, g_smallSliders[4].name); g_smallSliders[4].Slider.updateRightGrabby(g_smallSliders[4].Slider); break; case 'size_high': g_smallSliders[4].Slider.LeftValue = g_smallSliders[4].Slider.Min; g_smallSliders[4].Slider.LeftGrabby.setX(g_smallSliders[4].Slider.getWidth() * g_smallSliders[4].Slider.setValueFunction(g_smallSliders[4].Slider.LeftValue), g_smallSliders[4].Slider.LeftValue); g_smallSliders[4].Slider.LeftTooltip.m_HtmlElementHandle.value = g_smallSliders[4].Slider.Min; updateDataViewSliderParams({ "slider": g_smallSliders[4].Slider }, g_smallSliders[4].name); g_smallSliders[4].Slider.updateRightGrabby(g_smallSliders[4].Slider); g_smallSliders[4].Slider.RightValue = g_smallSliders[4].Slider.Max; g_smallSliders[4].Slider.RightGrabby.setX(g_smallSliders[4].Slider.getWidth() * g_smallSliders[4].Slider.setValueFunction(g_smallSliders[4].Slider.RightValue) - g_smallSliders[4].Slider.getWidth(), g_smallSliders[4].Slider.RightValue); g_smallSliders[4].Slider.RightTooltip.m_HtmlElementHandle.value = g_smallSliders[4].Slider.Max; updateDataViewSliderParams({ "slider": g_smallSliders[4].Slider }, g_smallSliders[4].name); g_smallSliders[4].Slider.updateRightGrabby(g_smallSliders[4].Slider); break; case 'fluor_low': g_smallSliders[5].Slider.LeftValue = g_smallSliders[5].Slider.Min; g_smallSliders[5].Slider.LeftGrabby.setX(g_smallSliders[5].Slider.getWidth() * g_smallSliders[5].Slider.setValueFunction(g_smallSliders[5].Slider.LeftValue), g_smallSliders[5].Slider.LeftValue); updateDataViewSliderParams({ "slider": g_smallSliders[5].Slider }, g_smallSliders[5].name); g_smallSliders[5].Slider.stopLeftDrag({ "DragElement": g_smallSliders[5].Slider.LeftGrabby, "Event": g_smallSliders[5].Slider, "Tooltip": true }); g_smallSliders[5].Slider.RightValue = g_smallSliders[5].Slider.Max; g_smallSliders[5].Slider.RightGrabby.setX(g_smallSliders[5].Slider.getWidth() * g_smallSliders[5].Slider.setValueFunction(g_smallSliders[5].Slider.RightValue) - g_smallSliders[5].Slider.getWidth(), g_smallSliders[5].Slider.RightValue); updateDataViewSliderParams({ "slider": g_smallSliders[5].Slider }, g_smallSliders[5].name); g_smallSliders[5].Slider.stopRightDrag({ "DragElement": g_smallSliders[5].Slider.RightGrabby, "Event": g_smallSliders[5].Slider, "Tooltip": true }); break; case 'fluor_high': g_smallSliders[5].Slider.LeftValue = g_smallSliders[5].Slider.Min; g_smallSliders[5].Slider.LeftGrabby.setX(g_smallSliders[5].Slider.getWidth() * g_smallSliders[5].Slider.setValueFunction(g_smallSliders[5].Slider.LeftValue), g_smallSliders[5].Slider.LeftValue); updateDataViewSliderParams({ "slider": g_smallSliders[5].Slider }, g_smallSliders[5].name); g_smallSliders[5].Slider.stopLeftDrag({ "DragElement": g_smallSliders[5].Slider.LeftGrabby, "Event": g_smallSliders[5].Slider, "Tooltip": true }); g_smallSliders[5].Slider.RightValue = g_smallSliders[5].Slider.Max; g_smallSliders[5].Slider.RightGrabby.setX(g_smallSliders[5].Slider.getWidth() * g_smallSliders[5].Slider.setValueFunction(g_smallSliders[5].Slider.RightValue) - g_smallSliders[5].Slider.getWidth(), g_smallSliders[5].Slider.RightValue); updateDataViewSliderParams({ "slider": g_smallSliders[5].Slider }, g_smallSliders[5].name); g_smallSliders[5].Slider.stopRightDrag({ "DragElement": g_smallSliders[5].Slider.RightGrabby, "Event": g_smallSliders[5].Slider, "Tooltip": true }); break; case 'shape': n = item.replace("shape_", ""); cb = $(n + '-qr_cb'); ncb = $(n + '_cb'); img = $(n + '-qr_img'); cb.checked = false; ncb.checked = false; img.src = g_imagePath + 't' + n + '_d.gif'; g_diamondData.setParam(item); break; }
    updateSliders(1); updateSliders(0); $('filters-list').innerHTML = UpdateFilters(g_diamondData);
}
function UpdateFilters(e) {
    var filters = {}, img, item, timg, results, f; img = "<a onclick=\"clearFilter([[FILTER]])\"><img class=\"ClearFilter\" src=\"" + g_imagePath + "filter_x.gif\" alt=\"Clear Filter\" /></a>"; for (item in e.params) {
        timg = img.replace("[[FILTER]]", "'" + item + "'"); switch (item) {
            case "shape_round": filters.shape_round = timg + "&nbsp;Round"; break; case "shape_princess": filters.shape_princess = timg + "&nbsp;Princess"; break; case "shape_emerald": filters.shape_emerald = timg + "&nbsp;Emerald"; break; case "shape_marquise": filters.shape_marquise = timg + "&nbsp;Marquise"; break; case "shape_heart": filters.shape_heart = timg + "&nbsp;Heart"; break; case "shape_pear": filters.shape_pear = timg + "&nbsp;Pear"; break; case "shape_radiant": filters.shape_radiant = timg + "&nbsp;Radiant"; break; case "shape_oval": filters.shape_oval = timg + "&nbsp;Oval"; break; case "shape_asscher": filters.shape_asscher = timg + "&nbsp;Asscher"; break; case "shape_cushion": filters.shape_cushion = timg + "&nbsp;Cushion"; break; case "price_low": if (Adiamor.ui.Viewport.renderMoney(e.params[item]) != "$250") {
                    timg = img.replace("[[FILTER]]", "'" + item + "'"); if (filters.price == null) { filters.price = timg + "&nbsp;Min. Price: " + Adiamor.ui.Viewport.renderMoney(e.params[item]); }
                    else { filters.price = filters.price.replace("Max. Price: ", Adiamor.ui.Viewport.renderMoney(e.params[item]) + "-"); } 
                }
                break; case "price_high": if (Adiamor.ui.Viewport.renderMoney(e.params[item]) != "$250,000") {
                    timg = img.replace("[[FILTER]]", "'" + item + "'"); if (filters.price == null) { filters.price = timg + "&nbsp;Max. Price: " + Adiamor.ui.Viewport.renderMoney(e.params[item]); }
                    else { filters.price = filters.price.replace("Min. Price: ", "") + "-" + Adiamor.ui.Viewport.renderMoney(e.params[item]); } 
                }
                break; case "carat_low": if (e.params[item] != "0.30") {
                    timg = img.replace("[[FILTER]]", "'" + item + "'"); if (filters.carat == null) { filters.carat = timg + "&nbsp;Min. Ct: " + e.params[item]; }
                    else { filters.carat = filters.carat.replace("Max. Ct: ", e.params[item] + "-") + " ct1."; } 
                }
                break; case "carat_high": if (e.params[item] != "15.0") {
                    timg = img.replace("[[FILTER]]", "'" + item + "'"); if (filters.carat == null) { filters.carat = timg + "&nbsp;Max. Ct: " + e.params[item]; }
                    else { filters.carat = filters.carat.replace("Min. Ct: ", "") + "-" + e.params[item] + " ct."; } 
                }
                break; case "color_low": if (e.params[item] != "29") {
                    if (filters.color == null) { filters.color = timg + "&nbsp;Min. Color: " + g_mappings.Color[e.params[item]]; }
                    else { filters.color = timg + "&nbsp;Color(s): " + g_mappings.Color[parseInt(e.params.color_high, 10) + 1] + "-" + g_mappings.Color[e.params[item]]; } 
                }
                break; case "color_high": if (e.params[item] != "22") {
                    if (filters.color == null) { filters.color = timg + "&nbsp;Max. Color: " + g_mappings.Color[e.params[item]]; }
                    else { filters.color = timg + "&nbsp;Color(s): " + g_mappings.Color[parseInt(e.params[item], 10) + 1] + "-" + g_mappings.Color[e.params.color_low]; } 
                }
                break; case "clarity_low": if (e.params[item] != "37") {
                    if (filters.clarity == null) { filters.clarity = timg + "&nbsp;Min. Clarity: " + g_mappings.Clar[e.params[item]]; }
                    else { filters.clarity = timg + "&nbsp;Clarity: " + g_mappings.Clar[parseInt(e.params.clarity_high, 10) + 1] + "-" + g_mappings.Clar[e.params[item]]; } 
                }
                break; case "clarity_high": if (e.params[item] != "30") {
                    if (filters.clarity == null) { filters.clarity = timg + "&nbsp;Max. Clarity: " + g_mappings.Clar[e.params[item]]; }
                    else { filters.clarity = timg + "&nbsp;Clarity: " + g_mappings.Clar[parseInt(e.params[item], 10) + 1] + "-" + g_mappings.Clar[e.params.clarity_low]; } 
                }
                break; case "polish_low": if (e.params[item] != "63" && e.params[item] != "64") {
                    if (filters.polish == null) { filters.polish = timg + "&nbsp;Min. Polish: " + g_mappings.Pol[e.params[item]]; }
                    else { filters.polish = timg + "&nbsp;Polish: " + g_mappings.Pol[parseInt(e.params.polish_high, 10) + 1] + "-" + g_mappings.Pol[e.params[item]]; } 
                }
                break; case "polish_high": if (e.params[item] != "60") {
                    if (filters.polish == null) { filters.polish = timg + "&nbsp;Max. Polish: " + g_mappings.Pol[e.params[item]]; }
                    else { filters.polish = timg + "&nbsp;Polish: " + g_mappings.Pol[parseInt(e.params[item], 10) + 1] + "-" + g_mappings.Pol[e.params.polish_low]; } 
                }
                break; case "sym_low": if (e.params[item] != "63" && e.params[item] != "64") {
                    if (filters.symmetry == null) { filters.symmetry = timg + "&nbsp;Min. Symmetry: " + g_mappings.Sym[e.params[item]]; }
                    else { filters.symmetry = timg + "&nbsp;Symmetry: " + g_mappings.Sym[parseInt(e.params.sym_high, 10) + 1] + "-" + g_mappings.Sym[e.params[item]]; } 
                }
                break; case "sym_high": if (e.params[item] != "60") {
                    if (filters.symmetry == null) { filters.symmetry = timg + "&nbsp;Max. Symmetry: " + g_mappings.Sym[e.params[item]]; }
                    else { filters.symmetry = timg + "&nbsp;Symmetry: " + g_mappings.Sym[parseInt(e.params[item], 10) + 1] + "-" + g_mappings.Sym[e.params.sym_low]; } 
                }
                break; case "fluor_low": if (e.params[item] != "46" && e.params[item] != "47") {
                    if (filters.fluor == null) { filters.fluor = timg + "&nbsp;Min. Fluor: " + g_mappings.Fluor[e.params[item]]; }
                    else { filters.fluor = timg + "&nbsp;Fluor: " + g_mappings.Fluor[parseInt(e.params.fluor_high, 10) + 1] + "-" + g_mappings.Fluor[e.params[item]]; } 
                }
                break; case "fluor_high": if (e.params[item] != "41") {
                    if (filters.fluor == null) { filters.fluor = timg + "&nbsp;Max. Fluor: " + g_mappings.Fluor[e.params[item]]; }
                    else { filters.fluor = timg + "&nbsp;Fluor: " + g_mappings.Fluor[parseInt(e.params[item], 10) + 1] + "-" + g_mappings.Fluor[e.params.fluor_low]; } 
                }
                break; default: break;
        } 
    }
    results = "<div class=\"Filter\">FILTERS: </div>"; f = false; for (item in filters) { results += "<div class=\"Filter\">" + filters[item] + "</div>"; f = true; }
    if (f) { results += "<div style=\"height: 1px; margin: 0px; padding: 0px; width: 100%; clear: both;\"></div>"; }
    else { results = "<div style=\"height: 1px; margin: 0px; padding: 0px; width: 100%; clear: both;\"></div>"; }
    return results;
}
Adiamor.data.JsonDataView.prototype.getMappedValue = function (row, col) {
    if (this.data.length == 0) { return ""; }
    else {
        if (this.data[row] != null) {
            var rowData = this.data[row], val, colMappings, mappedVal; if (rowData[col] != null) {
                val = rowData[col]; if (g_mappings != null) {
                    colMappings = g_mappings[this.Schema[col].Name]; if (colMappings != null) {
                        mappedVal = colMappings[val]; if (mappedVal != null) { val = mappedVal; }
                        else { val = this.Schema[col].Default; } 
                    }
                    return val;
                }
                else { return val; } 
            }
            else { return ""; } 
        }
        else { return ""; } 
    } 
}; Adiamor.data.JsonDataView.prototype.getMappedValueCut = function (row, col) {
    if (this.data.length == 0) { return ""; }
    else {
        if (this.data[row] != null) {
            var rowData = this.data[row], val, colMappings, mappedVal; if (rowData[col] != null) {
                val = rowData[col]; if (g_mappings != null) {
                    colMappings = g_mappings[this.Schema[col].Name + "1"]; if (colMappings != null) {
                        mappedVal = colMappings[val]; if (mappedVal != null) { val = mappedVal; }
                        else { val = this.Schema[col].Default; } 
                    }
                    return val;
                }
                else { return val; } 
            }
            else { return ""; } 
        }
        else { return ""; } 
    } 
}; Adiamor.data.JsonDataView.prototype.dispose = function () { Adiamor.data.JsonDataView.base.dispose.call(this); }; Adiamor.data.PagedJsonDataView = function () { Adiamor.data.PagedJsonDataView.baseConstructor.apply(this, arguments); this.dataCache = new Adiamor.collections.Map(-1, -1); this.requestCache = new Adiamor.collections.Map(-1, -1); this.requestQueue = []; }; Adiamor.lang.extend(Adiamor.data.PagedJsonDataView, Adiamor.data.JsonDataView); Adiamor.data.PagedJsonDataView.prototype.inCache = function (start, pageSize) {
    var firstRow = start, lastRow = start + pageSize - 1, lastKnownRow, cacheGaps, numCacheGaps; lastKnownRow = this.getRemoteRowCount() - 1; if (lastKnownRow < lastRow) { lastRow = lastKnownRow; }
    cacheGaps = this.dataCache.gaps(firstRow, lastRow); numCacheGaps = cacheGaps.length; return (numCacheGaps == 0 && lastKnownRow != -1);
}; Adiamor.data.PagedJsonDataView.prototype.get = function (callback, errorCallback, params) {
    if (typeof this.params.start != "number" || typeof this.params.page_size != "number") { return; }
    var firstRow, lastRow, cacheGaps, numCacheGaps, i, low, high, requestGaps, funcref; firstRow = this.params.start; lastRow = firstRow + this.params.page_size - 1; cacheGaps = this.dataCache.gaps(firstRow, lastRow); numCacheGaps = cacheGaps.length; if (numCacheGaps > 0) {
        for (i = 0; i < numCacheGaps; i += 1) {
            low = cacheGaps[i].low; high = cacheGaps[i].high; requestGaps = this.requestCache.gaps(low, high); if (requestGaps.length == 0) { funcref = Adiamor.lang.close(this, this.get, arguments); this.requestQueue.push(funcref); return; }
            this.requestCache.insert(low, high); Adiamor.data.PagedJsonDataView.base.get.apply(this, arguments);
        } 
    }
    else { return this.data.slice(firstRow, lastRow); } 
}; Adiamor.data.PagedJsonDataView.prototype.getComplete = function (args) {
    var xd = args.response, getCompleteEvtArgs = args.params, query = "?", data, lastRowReturned, numRowsReturned, startXi, endXi, pnlNoResults, htmString, tempMin, tempMax; if (getCompleteEvtArgs.params.shape_round != null)
    { query += "shape_round=" + getCompleteEvtArgs.params.shape_round + "&"; }
    if (getCompleteEvtArgs.params.shape_princess != null)
    { query += "shape_princess=" + getCompleteEvtArgs.params.shape_princess + "&"; }
    if (getCompleteEvtArgs.params.shape_emerald != null)
    { query += "shape_emerald=" + getCompleteEvtArgs.params.shape_emerald + "&"; }
    if (getCompleteEvtArgs.params.shape_marquise != null)
    { query += "shape_marquise=" + getCompleteEvtArgs.params.shape_marquise + "&"; }
    if (getCompleteEvtArgs.params.shape_heart != null)
    { query += "shape_heart=" + getCompleteEvtArgs.params.shape_heart + "&"; }
    if (getCompleteEvtArgs.params.shape_cushion != null)
    { query += "shape_cushion=" + getCompleteEvtArgs.params.shape_cushion + "&"; }
    if (getCompleteEvtArgs.params.shape_asscher != null)
    { query += "shape_asscher=" + getCompleteEvtArgs.params.shape_asscher + "&"; }
    if (getCompleteEvtArgs.params.shape_oval != null)
    { query += "shape_oval=" + getCompleteEvtArgs.params.shape_oval + "&"; }
    if (getCompleteEvtArgs.params.shape_radiant != null)
    { query += "shape_radiant=" + getCompleteEvtArgs.params.shape_radiant + "&"; }
    if (getCompleteEvtArgs.params.shape_pear != null)
    { query += "shape_pear=" + getCompleteEvtArgs.params.shape_pear + "&"; }
    if (getCompleteEvtArgs.params.diamond != null)
    { query += "diamond=" + getCompleteEvtArgs.params.diamond + "&"; }
    if (getCompleteEvtArgs.params.price_low != null)
    { query += "price_low=" + getCompleteEvtArgs.params.price_low + "&"; }
    if (getCompleteEvtArgs.params.price_high != null)
    { query += "price_high=" + getCompleteEvtArgs.params.price_high + "&"; }
    if (getCompleteEvtArgs.params.carat_low != null)
    { query += "carat_low=" + getCompleteEvtArgs.params.carat_low + "&"; }
    if (getCompleteEvtArgs.params.carat_high != null)
    { query += "carat_high=" + getCompleteEvtArgs.params.carat_high + "&"; }
    if (getCompleteEvtArgs.params.cut_low != null)
    { query += "cut_low=" + getCompleteEvtArgs.params.cut_low + "&"; }
    if (getCompleteEvtArgs.params.cut_high != null)
    { query += "cut_high=" + getCompleteEvtArgs.params.cut_high + "&"; }
    if (getCompleteEvtArgs.params.color_low != null)
    { query += "color_low=" + getCompleteEvtArgs.params.color_low + "&"; }
    if (getCompleteEvtArgs.params.color_high != null)
    { query += "color_high=" + getCompleteEvtArgs.params.color_high + "&"; }
    if (getCompleteEvtArgs.params.clarity_low != null)
    { query += "clarity_low=" + getCompleteEvtArgs.params.clarity_low + "&"; }
    if (getCompleteEvtArgs.params.clarity_high != null)
    { query += "clarity_high=" + getCompleteEvtArgs.params.clarity_high + "&"; }
    if (getCompleteEvtArgs.params.polish_low != null)
    { query += "polish_low=" + getCompleteEvtArgs.params.polish_low + "&"; }
    if (getCompleteEvtArgs.params.polish_high != null)
    { query += "polish_high=" + getCompleteEvtArgs.params.polish_high + "&"; }
    if (getCompleteEvtArgs.params.sym_low != null)
    { query += "sym_low=" + getCompleteEvtArgs.params.sym_low + "&"; }
    if (getCompleteEvtArgs.params.sym_high != null)
    { query += "sym_high=" + getCompleteEvtArgs.params.sym_high + "&"; }
    if (getCompleteEvtArgs.params.depth_low != null)
    { query += "depth_low=" + getCompleteEvtArgs.params.depth_low + "&"; }
    if (getCompleteEvtArgs.params.depth_high != null)
    { query += "depth_high=" + getCompleteEvtArgs.params.depth_high + "&"; }
    if (getCompleteEvtArgs.params.table_low != null)
    { query += "table_low=" + getCompleteEvtArgs.params.table_low + "&"; }
    if (getCompleteEvtArgs.params.table_high != null)
    { query += "table_high=" + getCompleteEvtArgs.params.table_high + "&"; }
    if (getCompleteEvtArgs.params.size_low != null)
    { query += "size_low=" + getCompleteEvtArgs.params.size_low + "&"; }
    if (getCompleteEvtArgs.params.size_high != null)
    { query += "size_high=" + getCompleteEvtArgs.params.size_high + "&"; }
    if (getCompleteEvtArgs.params.fluor_low != null)
    { query += "fluor_low=" + getCompleteEvtArgs.params.fluor_low + "&"; }
    if (getCompleteEvtArgs.params.fluor_high != null)
    { query += "fluor_high=" + getCompleteEvtArgs.params.fluor_high + "&"; }
    if (getCompleteEvtArgs.params.page_size != null)
    { query += "page_size=" + getCompleteEvtArgs.params.page_size + "&"; }
    document.getElementById("imgRSS").href = "createRSS.aspx" + query; document.getElementById("txtRSS").href = "createRSS.aspx" + query; document.getElementById("imgExcel").href = "createexcel.aspx" + query; document.getElementById("txtExcel").href = "createexcel.aspx" + query; document.getElementById("imgEmail").href = "diamond-search-email.aspx" + query; document.getElementById("txtEmail").href = "diamond-search-email.aspx" + query; if (null == xd) {
        if (this.errorCallback) { this.errorCallback.call(this.context); }
        return getCompleteEvtArgs;
    }
    try { xd = eval('(' + xd + ')'); data = xd.data; }
    catch (e) { xd = { 'data': [], 'rows': 0 }; data = xd.data; }
    getCompleteEvtArgs.payload = xd; this.setRemoteRowCount(xd.rows); numRowsReturned = data.length; startXi = 0; endXi = -1; if (0 < numRowsReturned) { startXi = data[0][this.fieldMap.xi]; endXi = data[data.length - 1][this.fieldMap.xi]; this.dataCache.insert(startXi, endXi); }
    else { getCompleteEvtArgs.pageSize = 0; pnlNoResults = $('no-results'); if (xd.suggestions != null) { htmString = ""; tempMin = ""; tempMax = ""; htmString = '<div style="width: 386px; height: 74px; background-image: url(http://www.adiamor.com/media/Adiamor/noresults.gif); position: absolute; top: 100px; left: 38px; padding-top: 15px; padding-right: 15px; padding-left: 8px;">'; htmString += "No results were found. Use the sliders above to broaden your search<BR>, give us a call at 1-877-627-5094 or click  <a href=\"javascript:clearSearch();\">here</a> to reset your search.</div>"; pnlNoResults.innerHTML = htmString; } }
    getCompleteEvtArgs.numRowsReturned = numRowsReturned; getCompleteEvtArgs.lastRowReturned = endXi; this.mergeData(xd.data); this.requestCache.remove(startXi, endXi); if (null != getCompleteEvtArgs.requestObject) { this.ajaxCallbackPool.release(getCompleteEvtArgs.requestObject); }
    this.OnDataReady.notify(getCompleteEvtArgs); if (null != getCompleteEvtArgs.callback) { getCompleteEvtArgs.callback.call(this, getCompleteEvtArgs); getCompleteEvtArgs = null; }
    else { return getCompleteEvtArgs; } 
}; function checkNumShapes() {
    var num = 0; if (document.getElementById("round-qr_cb").checked) { num += 1; }
    if (document.getElementById("princess-qr_cb").checked) { num += 1; }
    if (document.getElementById("emerald-qr_cb").checked) { num += 1; }
    if (document.getElementById("marquise-qr_cb").checked) { num += 1; }
    if (document.getElementById("heart-qr_cb").checked) { num += 1; }
    if (document.getElementById("pear-qr_cb").checked) { num += 1; }
    if (document.getElementById("radiant-qr_cb").checked) { num += 1; }
    if (document.getElementById("oval-qr_cb").checked) { num += 1; }
    if (document.getElementById("asscher-qr_cb").checked) { num += 1; }
    if (document.getElementById("cushion-qr_cb").checked) { num += 1; }
    return num;
}
function updateSliders(dir) {
    var src = g_mainSliders, dest = g_miniSliders, i; if (dir) { src = g_miniSliders; dest = g_mainSliders; }
    if (onlyRound()) { $('slider-label-size').style.visibility = "hidden"; }
    else { $('slider-label-size').style.visibility = "visible"; }
    if (document.getElementById("round-qr_cb").checked || document.getElementById("asscher-qr_cb").checked || document.getElementById("emerald-qr_cb").checked || document.getElementById("princess-qr_cb").checked) {
        if (checkNonRound()) { $('ntb-sliderAdiamor__uid__11').className = "slider-bg-repeat slider-element slider-cut-mini"; $('ntb-sliderAdiamor__uid__6').className = "slider-bg-repeat slider-element slider-cut"; }
        else { $('ntb-sliderAdiamor__uid__11').className = "slider-bg-repeat slider-element slider-cut-mini-both"; $('ntb-sliderAdiamor__uid__6').className = "slider-bg-repeat slider-element slider-cut-both"; }
        $('cutmarkings').src = "http://www.adiamor.com/media/Adiamor/cutmarkings.gif";
    }
    else { $('ntb-sliderAdiamor__uid__11').className = "slider-bg-repeat slider-element slider-cut-mini-noround"; $('ntb-sliderAdiamor__uid__6').className = "slider-bg-repeat slider-element slider-cut-noround"; $('cutmarkings').src = "http://www.adiamor.com/media/Adiamor/cutmarkings2.gif"; }
    for (i = 0; i < g_miniSliders.length; i += 1) { dest[i].Slider.Ticks = src[i].Slider.Ticks; dest[i].Ticks = src[i].Ticks; dest[i].Slider.Max = src[i].Slider.Max; dest[i].Slider.Min = src[i].Slider.Min; dest[i].Slider.setMinValue(src[i].Slider.getMinValue()); dest[i].Slider.setMaxValue(src[i].Slider.getMaxValue()); }
    if (dir == 0) { g_miniSlidersSync = true; } 
}
function updateDataViewSliderParams(evtArgs, name) {
    name = name.replace('-mini', ''); var minValue = evtArgs.slider.getMinValue(), maxValue = evtArgs.slider.getMaxValue(); if (evtArgs.slider.Discrete) { minValue = Math.floor(minValue); maxValue = Math.floor(maxValue); }
    else if (evtArgs.slider.TooltipEnabled) {
        if (evtArgs.slider.LeftTooltip == null) { minValue = evtArgs.slider.BottomTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); maxValue = evtArgs.slider.TopTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); }
        else { minValue = evtArgs.slider.LeftTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); maxValue = evtArgs.slider.RightTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); } 
    }
    g_diamondData.setParam(name + '_low', minValue); g_diamondData.setParam(name + '_high', maxValue); g_activeSlider = null;
}
function runSuggest(row, min, max) { var sliders = g_mainSliders; sliders[row].Slider.setMinValue(min); sliders[row].Slider.setMaxValue(max); updateSliders(0); updateSliders(1); updateDataViewSliderParams({ "slider": sliders[row].Slider }, sliders[row].name); sliders[row].Slider.OnRangeChanged.notify({ 'slider': sliders[row].Slider }); }
function clearSearch() {
    hideElement($('gridlist-overlay')); var sliders = g_mainSliders, i; for (i = 0; i < sliders.length; i += 1) { sliders[i].Slider.setMinValue(sliders[i].sliderParams.Min); sliders[i].Slider.setMaxValue(sliders[i].sliderParams.Max); updateDataViewSliderParams({ "slider": sliders[i].Slider }, sliders[i].name); }
    sliders[sliders.length - 1].Slider.OnRangeChanged.notify({ 'slider': sliders[sliders.length - 1].Slider }); sliders = g_smallSliders; for (i = 0; i < sliders.length; i += 1) {
        if (sliders[i].Slider.Discrete) { sliders[i].Slider.setMinValue(sliders[i].sliderParams.Min); sliders[i].Slider.setMaxValue(sliders[i].sliderParams.Max); }
        else { sliders[i].Slider.setMinValue(sliders[i].sliderParams.Min); sliders[i].Slider.setMaxValue(sliders[i].sliderParams.Max); }
        updateDataViewSliderParams({ "slider": sliders[i].Slider }, sliders[i].name);
    }
    sliders[sliders.length - 1].Slider.OnRangeChanged.notify({ 'slider': sliders[sliders.length - 1].Slider }); if (checkNonRound())
    { }
    else { document.getElementById("round-qr_cb").checked = true; document.getElementById("round_cb").checked = true; document.getElementById("round-qr_img").src = g_imagePath + 'round_d.gif'; document.getElementById("round_img").src = g_imagePath + 'round_d.gif'; g_diamondData.setParam('shape_round', 16); }
    updateSliders(0); updateSliders(1);
}
Adiamor.data.PagedJsonDataView.prototype.executeRequests = function () { var oldRequests = this.requestQueue, i; this.requestQueue = []; for (i = 0; i < oldRequests.length; i += 1) { oldRequests[i].call(); } }; Adiamor.data.PagedJsonDataView.prototype.flush = function () { this.requestCache.flush(); this.dataCache.flush(); this.requestQueue = []; Adiamor.data.PagedJsonDataView.base.flush.call(this); }; Adiamor.data.PagedJsonDataView.prototype.dispose = function () { this.requestCache.flush(); this.requestCache = null; this.requestQueue = null; }; Adiamor.lang.defineNs("Adiamor.ui"); Adiamor.ui.Effects = {}; Adiamor.ui.Effects.appearFromBottom = function (panel, options, duration, callback) {
    if (typeof options.endTop == "undefined")
    { options.endTop = 0; }
    if (typeof options.startTop == "undefined")
    { options.startTop = panel.Container.offsetHeight; }
    options.deltaTop = (options.endTop - options.startTop) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); var count = 1; while (duration > 0) { duration -= Adiamor.ui.Effects.ANIMATION_INTERVAL; options.startTop = options.startTop + options.deltaTop; window.setTimeout(Adiamor.lang.close(panel, panel.setSurfaceTop, [eval(options.startTop)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); count += 1; }
    window.setTimeout(Adiamor.lang.close(panel, panel.setSurfaceTop, [eval(options.endTop)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count);
}; Adiamor.ui.Effects.disappearFromTop = function (panel, options, duration, callback, callbackContext) {
    if (typeof options.endTop == "undefined") { options.endTop = panel.Container.offsetHeight; }
    if (typeof options.startTop == "undefined") { options.startTop = 0; }
    options.deltaTop = (options.endTop - options.startTop) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); var count = 1; while (duration > 0) { duration -= Adiamor.ui.Effects.ANIMATION_INTERVAL; options.startTop = options.startTop + options.deltaTop; window.setTimeout(Adiamor.lang.close(panel, panel.setSurfaceTop, [eval(options.startTop)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); count += 1; }
    window.setTimeout(Adiamor.lang.close(panel, panel.setSurfaceTop, [eval(options.endTop)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); if (callback != null) { window.setTimeout(Adiamor.lang.close(callbackContext || {}, callback, [panel]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); } 
}; Adiamor.ui.Effects.shrink = function (options, domElements, duration, callback) {
    var domElement, deltaHeight_Doctype, deltaWidth_Doctype, coords; domElement = domElements[0]; deltaHeight_Doctype = 0 - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-top-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-bottom-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-top"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-bottom"), 10); deltaWidth_Doctype = 0 - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-left-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-right-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-left"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-right"), 10); coords = Adiamor.html.getCoords(domElement); options.oldHeight = coords.height + deltaHeight_Doctype; if (options.up) { options.oldY = coords.y; }
    options.oldWidth = coords.width + deltaWidth_Doctype; if (options.left) { options.oldX = coords.x; }
    if (!(typeof (options.width) == "undefined")) { options.deltaWidth = (options.width - options.oldWidth) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); }
    else { options.width = options.oldWidth; options.deltaWidth = null; }
    if (!(typeof (options.height) == "undefined")) { options.deltaHeight = (options.height - options.oldHeight) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); }
    else { options.height = options.oldHeight; options.deltaHeight = null; }
    Adiamor.ui.Effects.resize(options, domElements, duration, callback);
}; Adiamor.ui.Effects.tutorial = function (options, domElements, duration, callback) {
    var domElement, deltaHeight_Doctype, deltaWidth_Doctype, coords; domElement = domElements[0]; deltaHeight_Doctype = 0 - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-top-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-bottom-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-top"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-bottom"), 10); deltaWidth_Doctype = 0 - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-left-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-right-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-left"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-right"), 10); coords = Adiamor.html.getCoords(domElement); options.oldHeight = coords.height + deltaHeight_Doctype; if (options.up) { options.oldY = coords.y; }
    options.oldWidth = coords.width + deltaWidth_Doctype; if (options.left) { options.oldX = coords.x; }
    if (!(typeof (options.width) == "undefined")) { options.deltaWidth = (options.width - options.oldWidth) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); }
    else { options.width = options.oldWidth; options.deltaWidth = null; }
    if (!(typeof (options.height) == "undefined")) { options.deltaHeight = (options.height - options.oldHeight) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); }
    else { options.height = options.oldHeight; options.deltaHeight = null; }
    Adiamor.ui.Effects.resize(options, domElements, duration, callback);
}; Adiamor.ui.Effects.grow = function (options, domElements, duration, callback) {
    var domElement, deltaHeight_Doctype, deltaWidth_Doctype, coords; domElement = domElements[0]; deltaHeight_Doctype = 0 - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-top-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-bottom-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-top"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-bottom"), 10); deltaWidth_Doctype = 0 - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-left-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-right-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-left"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-right"), 10); coords = Adiamor.html.getCoords(domElement); options.oldHeight = coords.height + deltaHeight_Doctype; if (options.up) { options.oldY = coords.y; }
    options.oldWidth = coords.width + deltaWidth_Doctype; if (options.left) { options.oldX = coords.x; }
    if (!(typeof (options.width) == "undefined")) { options.deltaWidth = (options.width - options.oldWidth) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); }
    else { options.width = options.oldWidth; options.deltaWidth = null; }
    if (!(typeof (options.height) == "undefined")) { options.deltaHeight = (options.height - options.oldHeight) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); }
    else { options.height = options.oldHeight; options.deltaHeight = null; }
    Adiamor.ui.Effects.resize(options, domElements, duration, callback);
}; Adiamor.ui.Effects.shrinkAndHide = function (domElement, duration, callback) { if (!Adiamor.ui.Effects.isHidden(domElement)) { Adiamor.ui.Effects.shrink({ height: 0 }, domElement, duration, function () { Adiamor.ui.Effects.hide(domElement); if (callback) { callback(); } }); } }; Adiamor.ui.Effects.growToAutomatic = function (domElement, duration, callback) {
    var options, elementHeight, elementWidth; options = {}; elementHeight = domElement.offsetHeight - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-top-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-bottom-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-top"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-bottom"), 10); elementWidth = domElement.offsetWidth - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-left-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-right-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-left"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-right"), 10); options.height = 100; Adiamor.ui.Effects.grow(options, [domElement], duration, function () { if (callback) { callback(); } });
}; Adiamor.ui.Effects.shrinkToAutomatic = function (domElement, duration, callback) {
    var options, elementHeight, elementWidth; options = {}; elementHeight = domElement.offsetHeight - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-top-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-bottom-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-top"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-bottom"), 10); elementWidth = domElement.offsetWidth - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-left-width"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "border-right-width"), 10) -
parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-left"), 10) - parseInt("0" + Adiamor.dom.getStyle(domElement, "padding-right"), 10); options.height = 0; Adiamor.ui.Effects.shrink(options, [domElement], duration, function () { domElement.style.height = ""; domElement.style.width = ""; if (callback) { callback(); } });
}; Adiamor.ui.Effects.resize = function (options, domElements, duration, callback) {
    duration -= Adiamor.ui.Effects.ANIMATION_INTERVAL; var newHeight = null, newWidth = null, newX = null, newY = null; if (duration <= 0) {
        if (options.deltaHeight != null) { newHeight = options.height; newY = options.top || null; }
        if (options.deltaWidth != null) { newWidth = options.width; newX = options.left; } 
    }
    else {
        if (options.deltaHeight != null) { newHeight = options.oldHeight + options.deltaHeight; newHeight = Math.max(newHeight, 0); options.oldHeight = newHeight; newY = (options.oldY - options.deltaHeight) || null; options.oldY = newY; }
        if (options.deltaWidth != null) { newWidth = options.oldWidth + options.deltaWidth; newWidth = Math.max(newWidth, 0); options.oldWidth = newWidth; newX = options.oldX + options.deltaWidth; options.oldX = newX; }
        window.setTimeout(Adiamor.lang.close(this, Adiamor.ui.Effects.resize, [options, domElements, duration, callback]), Adiamor.ui.Effects.ANIMATION_INTERVAL);
    }
    Adiamor.ui.Effects.executeNextPulse.push(Adiamor.lang.close({}, Adiamor.ui.Effects.resizeFunc, [domElements, newHeight, newWidth, newY, newX, duration, callback]));
}; Adiamor.ui.Effects.resizeFunc = function (domElements, newHeight, newWidth, newY, newX, duration, callback) {
    var i, domElement; for (i = 0; i < domElements.length; i += 1) {
        domElement = domElements[i]; if (newHeight != null) { domElement.style.height = Math.floor(newHeight) + "px"; }
        if (newWidth != null) { domElement.style.width = Math.floor(newWidth) + "px"; } 
    }
    if (duration <= 0) { if (callback) { window.setTimeout(callback, 0); } } 
}; Adiamor.ui.Effects.executeNextPulse = []; Adiamor.ui.Effects.pulse = function () { var p; while (p = Adiamor.ui.Effects.executeNextPulse.shift()) { p.call(); } }; Adiamor.ui.Effects.PULSE_INTERVAL = 40; Adiamor.ui.Effects.ANIMATION_INTERVAL = 25; if (Adiamor.browser.IE) { Adiamor.ui.Effects.PULSE_INTERVAL = 10; Adiamor.ui.Effects.ANIMATION_INTERVAL = 10; }
window.setInterval(Adiamor.ui.Effects.pulse, Adiamor.ui.Effects.PULSE_INTERVAL); Adiamor.ui.Effects.fade = function (element, options, duration, func, funcContext, callback, callbackContext) {
    options.deltaValue = (options.endValue - options.startValue) / (duration / Adiamor.ui.Effects.ANIMATION_INTERVAL); var count = 1; while (duration > 0) { duration -= Adiamor.ui.Effects.ANIMATION_INTERVAL; options.startValue = options.startValue + options.deltaValue; window.setTimeout(Adiamor.lang.close(funcContext, func, [element, eval(options.startValue)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); count += 1; }
    window.setTimeout(Adiamor.lang.close(funcContext, func, [element, eval(options.endValue)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); if (callback != null) { window.setTimeout(Adiamor.lang.close(callbackContext || this, callback, [element, eval(options.startValue)]), Adiamor.ui.Effects.ANIMATION_INTERVAL * count); } 
}; Adiamor.ui.Effects.hide = function (domElement) { Adiamor.html.Css.addClass(domElement, "Adiamor-ui-effects-hidden"); domElement.style.height = ""; domElement.style.width = ""; }; Adiamor.ui.Effects.isHidden = function (domElement) {
    if (Adiamor.html.Css.hasClass(domElement, "Adiamor-ui-effects-hidden"))
    { return true; }
    else { return false; } 
}; Adiamor.ui.Effects.show = function (domElement, options) {
    domElement.style.display = "none"; for (o in options) { if (options.hasOwnProperty(o)) { domElement.style[o] = options[o]; } }
    domElement.style.display = "";
}; Adiamor.ui.Effects.FADE_INTERVAL = 5; Adiamor.ui.Effects.FADE_STEP = 25; Adiamor.lang.defineNs("Adiamor.ui"); Adiamor.ui.DragDrop = function (element, allowVertDrag, allowHorizDrag) {
    this.allowVertDrag = (allowVertDrag != null ? allowVertDrag : true); this.allowHorizDrag = (allowHorizDrag != null ? allowHorizDrag : true); if (Adiamor.browser.IE) { this.surface = document.getElementById("ebadragdropsurface_"); if (this.surface == null) { this.surface = document.createElement("div"); this.surface.id = "ebadragdropsurface_"; var s = this.surface.style; s.filter = "alpha(opacity=1)"; s.backgroundColor = "white"; s.position = "absolute"; s.visibility = "hidden"; s.top = "-5000"; s.left = "-5000"; s.width = "100"; s.height = "100"; s.zIndex = "500"; document.body.appendChild(this.surface); } }
    this.object = null; if (element.getDragElement != null) { this.object = element; element = element.getDragElement(); }
    this.element = element; this.zIndex = this.element.style.zIndex; this.element.style.zIndex = 400; this.Ticks = 10; this.Discrete = false; this.OnMouseMove = new Adiamor.base.SubjectHelper(); this.OnDragStart = new Adiamor.base.SubjectHelper(); this.OnDragStop = new Adiamor.base.SubjectHelper(); this.events = [{ "type": "mouseup", "handler": this.onMouseUp }, { "type": "mousemove", "handler": this.onMouseMove}];
}; Adiamor.ui.DragDrop.prototype.startDrag = function () {
    this.originTop = parseInt(this.object.getY(), 10); this.originLeft = parseInt(this.object.getX(), 10); if (isNaN(this.originLeft)) { this.originLeft = 0; }
    if (isNaN(this.originTop)) { this.originTop = 0; }
    var coords = Adiamor.html.getCoords(this.element); this.originX = coords.x; this.originY = coords.y; this.originWidth = coords.width; this.originHeight = coords.height; if (Adiamor.browser.IE) { this.surface.style.visibility = "visible"; this.surface.style.width = document.body.clientWidth; this.surface.style.height = document.body.clientHeight; }
    Adiamor.html.attachEvents(document, this.events, this); this.OnDragStart.notify();
}; Adiamor.ui.DragDrop.prototype.onMouseMove = function (evt) {
    var coords, x, y, offset, xoffset, newLeft, newBottom; coords = Adiamor.html.getEventCoords(evt); x = coords.x; y = coords.y; if (this.allowHorizDrag) {
        offset = 0; xoffset = 0; if (x + xoffset <= this.minX) { x = this.minX + xoffset; }
        else if (x + xoffset >= this.maxX) { x = this.maxX - xoffset; }
        newLeft = (this.originLeft + x - this.originX - this.originWidth / 2); this.object.setX(newLeft);
    }
    else if (this.allowVertDrag) {
        offset = 0; if (y + offset >= this.minY) { y = this.minY; }
        else if (y <= this.maxY) { y = this.maxY; }
        newBottom = (y - this.originTop - this.originY - this.originHeight - offset); this.object.setY(newBottom);
    }
    Adiamor.html.cancelEvent(evt);
}; Adiamor.ui.DragDrop.prototype.onMouseUp = function (evtObj) {
    if (Adiamor.browser.IE) { this.surface.style.visibility = "hidden"; }
    Adiamor.html.detachEvents(document, this.events); this.element.style.zIndex = this.zIndex; this.OnDragStop.notify({ 'DragElement': this.object, 'DragManager': this, 'Event': evtObj });
}; Adiamor.ui.DragDrop.prototype.setXBounds = function (min, max) { this.minX = min; this.maxX = max; this.Step = Math.floor((this.maxX - this.minX) / this.Ticks); }; Adiamor.ui.DragDrop.prototype.setMaxX = function (val) { this.maxX = val; }; Adiamor.ui.DragDrop.prototype.setMinX = function (val) { this.minX = val; }; Adiamor.ui.DragDrop.prototype.setYBounds = function (min, max) { this.minY = min; this.maxY = max; this.Step = Math.floor((this.maxY - this.minY) / this.Ticks); }; Adiamor.ui.DragDrop.prototype.setMaxY = function (val) { this.maxY = val; }; Adiamor.ui.DragDrop.prototype.setMinY = function (val) { this.minY = val; }; Adiamor.ui.IDraggable = function Adiamor_ui_IDraggable(element) { this.DragElement = element; }; Adiamor.ui.IDraggable.prototype.getDragElement = function () { return this.DragElement; }; function createFunction(obj, func) { return function () { return func.apply(obj, arguments); }; }
Adiamor.ui.IDraggable.makeDraggable = function (obj, element) { obj.DragElement = element; obj.getDragElement = createFunction(obj, Adiamor.ui.IDraggable.prototype.getDragElement); }; Adiamor.lang.defineNs("Adiamor.ui"); Adiamor.ui.Element = function (template, templateFunctions, id) { if (arguments.length > 0) { this.initialize(template, templateFunctions, id); } }; Adiamor.lang.extend(Adiamor.ui.Element, Adiamor.base.Object); Adiamor.ui.Element.prototype.initialize = function (template, templateFunctions, id) { this.template = template; this.templateFunctions = templateFunctions; this.templateExternals = null; this.id = id; this.m_HtmlElementHandle = $(id); }; Adiamor.ui.Element.prototype.getId = function () { return this.id; }; Adiamor.ui.Element.prototype.setId = function (id) { this.id = id; }; Adiamor.ui.Element.prototype.getHeight = function () { var elem = this.getHtmlElementHandle(); return parseInt(elem.style.height || elem.offsetHeight, 10); }; Adiamor.ui.Element.prototype.setHeight = function (height) {
    if (typeof height == "number") { height = height + 'px'; }
    this.getHtmlElementHandle().style.height = height;
}; Adiamor.ui.Element.prototype.getWidth = function () { var elem = this.getHtmlElementHandle(); return parseInt(elem.style.width || elem.offsetWidth, 10); }; Adiamor.ui.Element.prototype.setWidth = function (width) {
    if (typeof width == "number") { width = width + 'px'; }
    this.getHtmlElementHandle().style.width = width;
}; Adiamor.ui.Element.prototype.getTemplate = function () { return this.template; }; Adiamor.ui.Element.prototype.setTemplate = function (template) { this.template = template; }; Adiamor.ui.Element.prototype.getTemplateFunctions = function () { return this.templateFunctions; }; Adiamor.ui.Element.prototype.setTemplateFunctions = function (templateFunctions) { this.templateFunctions = templateFunctions; }; Adiamor.ui.Element.prototype.getTemplateExternals = function () { return this.templateExternals; }; Adiamor.ui.Element.prototype.setTemplateExternals = function (templateExternals) { this.templateExternals = templateExternals; }; Adiamor.ui.Element.prototype.getHtmlElementHandle = function () {
    if (this.m_HtmlElementHandle == null) { this.m_HtmlElementHandle = document.getElementById(this.getId()); }
    return this.m_HtmlElementHandle;
}; Adiamor.ui.Element.prototype.setHtmlElementHandle = function (htmlElementHandle) { this.m_HtmlElementHandle = htmlElementHandle; }; Adiamor.ui.Element.prototype.hide = function () { var tag = this.getHtmlElementHandle(); tag.style.display = "none"; }; Adiamor.ui.Element.prototype.show = function () { var tag = this.getHtmlElementHandle(); tag.style.display = "block"; }; Adiamor.ui.Element.prototype.align = function (element) { var tag = this.getHtmlElementHandle(); tag.style.top = '-10000px'; tag.style.left = '-10000px'; tag.style.visibility = 'hidden'; tag.style.display = 'block'; }; Adiamor.ui.Element.prototype.isVisible = function () {
    var disp = this.getHtmlElementHandle().style.display; if (disp == "none" || disp == "") { return false; }
    return true;
}; Adiamor.ui.Element.prototype.toggle = function () {
    if (this.isVisible()) { this.hide(); }
    else { this.show(); } 
}; Adiamor.ui.Element.prototype.beginFloatMode = function () { var tag = this.getHtmlElementHandle(); tag.style.position = "absolute"; }; Adiamor.ui.Element.prototype.setX = function (x) { var anum = /(^\d+$)|(^\d+\.\d+$)/, tag; if (anum.test(x)) { tag = this.getHtmlElementHandle(); tag.style.left = parseInt(x, 10) + "px"; } }; Adiamor.ui.Element.prototype.getX = function () { var tag = this.getHtmlElementHandle(); return parseInt(tag.style.left, 10); }; Adiamor.ui.Element.prototype.setY = function (y) { var tag = this.getHtmlElementHandle(); tag.style.top = parseInt(y, 10) + "px"; }; Adiamor.ui.Element.prototype.getY = function () { var tag = this.getHtmlElementHandle(); return parseInt(tag.style.top, 10); }; Adiamor.ui.Element.prototype.render = function (htmlElement, templateString, inputObject, extensions, external) {
    templateString = templateString == null ? this.getTemplate() : htmlElement; inputObject = inputObject == null ? this : inputObject; htmlElement = htmlElement == null ? this.getHtmlElementHandle() : htmlElement; extensions = extensions == null ? this.getTemplateFunctions() : extensions; external = external == null ? this.getTemplateExternals() : external; var html, tag; html = Adiamor.templating.applyTemplate(templateString, inputObject, extensions, external); if (null == htmlElement) { document.body.insertAdjacentHTML("beforeEnd", html); tag = document.body.childNodes[document.body.childNodes.length - 1]; if (tag.id == "") { tag.id = this.getId(); } }
    else { htmlElement.innerHTML = html; }
    this.attachToTag();
}; Adiamor.ui.Element.prototype.attachToTag = function () { var domNode = this.getHtmlElementHandle(); if (domNode != null) { domNode.AdiamorObject = this; } }; Adiamor.ui.Element.prototype.dispose = function () { Adiamor.ui.Element.base.dispose.call(this); }; Adiamor.ui.Panel = function (contents) { this.Contents = contents || ""; this.OnMouseOver = new Adiamor.base.SubjectHelper(); this.OnMouseOut = new Adiamor.base.SubjectHelper(); }; Adiamor.lang.extend(Adiamor.ui.Panel, Adiamor.ui.Element); Adiamor.ui.Panel.prototype.attachToParent = function (container) {
    this.Container = container; if (this.Container.innerHTML != "") { this.Contents = this.Container.innerHTML; }
    this.Frame = Adiamor.html.getFirstChild(this.Container); if (this.Frame != null) { this.Frame.style.position = 'relative'; this.Surface = Adiamor.html.getFirstChild(this.Frame); }
    this.setId(container.id); this.attachEvents(); this.render();
}; Adiamor.ui.Panel.prototype.attachEvents = function () { Adiamor.html.attachEvent(this.Container, 'mouseover', this.OnMouseOver.notify, this.OnMouseOver); Adiamor.html.attachEvent(this.Container, 'mouseout', this.OnMouseOut.notify, this.OnMouseOut); }; Adiamor.ui.Panel.prototype.render = function () { if (this.Container.innerHTML == "") { this.Container.innerHTML = this.Contents; } }; Adiamor.ui.Panel.prototype.setBackgroundImage = function (bgImage, options) {
    if (bgImage.indexOf(".png" > 0)) {
        if (Adiamor.browser.IE6) { this.Container.style.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bgImage + "')"; bgImage = 'none'; }
        else { bgImage = "url('" + bgImage + "')"; } 
    }
    this.Container.style.backgroundImage = bgImage; var item; for (item in options) { if (options.hasOwnProperty(item)) { this.Container.style[item] = options[item]; } } 
}; Adiamor.ui.Panel.prototype.setSurfaceTop = function (scrollTop) { this.Surface.style.top = scrollTop + 'px'; }; Adiamor.ui.Panel.prototype.getSurfaceTop = function () { return this.Surface.style.top; }; Adiamor.lang.defineNs('Adiamor.ui'); var EBA_SELECTION_BUFFER = 15; var g_renderDelay = 50; Adiamor.ui.Viewport = function () { this.disposal = []; this.RowHeight = 27; this.uid = Adiamor.base.getUid(); this.lastScrollTop = -1; this.rows = 500; this.cacheMap = new Adiamor.collections.Map(-1, -1); this.DataSource = {}; this.element = null; this.frame = null; this.surface = null; this.RowHoverColor = "#f7fbfc"; this.OnRenderComplete = new Adiamor.base.SubjectHelper(); }; Adiamor.ui.Viewport.prototype.mapToHtml = function (element, frame, surface) { this.surface = surface; this.frame = frame; this.element = element; }; Adiamor.ui.Viewport.prototype.clear = function () { this.surface.innerHTML = ''; this.lastScrollTop = -1; this.flushCache(); }; Adiamor.ui.Viewport.prototype.setSurfaceHeight = function (height) { this.surface.style.height = height + 'px'; }; Adiamor.ui.Viewport.prototype.setScrollTopRelative = function (offset) { this.setScrollTop(this.scrollTop + offset); }; Adiamor.ui.Viewport.prototype.setScrollTopPercent = function (scrollPercent) { this.scrollTopPercent = scrollPercent; this.setScrollTop(Math.round((this.surface.offsetHeight - this.frame.clientHeight) * scrollPercent)); }; Adiamor.ui.Viewport.prototype.setScrollTop = function (scrollTop) { this.scrollTop = scrollTop; this.frame.scrollTop = scrollTop; this.render(); }; Adiamor.ui.Viewport.prototype.render = function () {
    if (this.surface.scrollTop != this.lastScrollTop) {
        var visibleRowRange = this.getRowRange(), funcRef; if (!this.rendered(visibleRowRange)) { funcRef = Adiamor.lang.close(this, this.renderReady, [visibleRowRange]); window.clearTimeout(this.lastTimeoutId); this.lastTimeoutId = window.setTimeout(funcRef, g_renderDelay); }
        else { this.hideIndicator(); } 
    } 
}; Adiamor.ui.Viewport.prototype.renderNext = function () {
    g_grid.View.FirstVisibleRow += 15; g_grid.View.LastVisibleRow += 15; if (g_diamondData.getRemoteRowCount() <= (g_grid.View.FirstVisibleRow + 15)) { $('NextButton').style.visibility = "hidden"; }
    else { $('NextButton').style.visibility = "visible"; }
    $('LastButton').style.visibility = "visible"; if (g_diamondData.getRemoteRowCount() <= g_grid.View.FirstVisibleRow) { g_grid.View.FirstVisibleRow -= 15; g_grid.View.LastVisibleRow -= 15; }
    g_grid.renderNext();
}; Adiamor.ui.Viewport.prototype.renderLast = function () {
    g_grid.View.FirstVisibleRow -= 15; g_grid.View.LastVisibleRow -= 15; if ((g_grid.View.FirstVisibleRow - 15) < 0) { $('LastButton').style.visibility = "hidden"; }
    else { $('LastButton').style.visibility = "visible"; }
    $('NextButton').style.visibility = "visible"; if (g_grid.View.FirstVisibleRow <= 0) { g_grid.View.FirstVisibleRow = 0; g_grid.View.LastVisibleRow = 14; }
    g_grid.renderLast();
}; Adiamor.ui.Viewport.prototype.renderAll = function () { g_grid.View.FirstVisibleRow = 0; g_grid.View.LastVisibleRow = g_diamondData.getRemoteRowCount(); var height = ((g_diamondData.getRemoteRowCount()) + 1) * 30 + 2; g_diamondData.setParam("start", 0); g_diamondData.setParam("page_size", 500); $('NextButton').style.visibility = "hidden"; $('LastButton').style.visibility = "hidden"; $('AllButton').style.visibility = "hidden"; g_grid.renderAll(); }; Adiamor.ui.Viewport.prototype.rendered = function (visibleRowRange) {
    if (visibleRowRange == null) { visibleRowRange = this.getRowRange(); }
    var myGaps = this.cacheMap.gaps(visibleRowRange.first, visibleRowRange.last); return Boolean(myGaps[0] == null);
}; Adiamor.ui.Viewport.prototype.getRowRange = function () { var firstVisibleRow = 0, lastVisibleRow = 0; firstVisibleRow += Math.floor(this.frame.scrollTop / this.RowHeight); lastVisibleRow += firstVisibleRow + (Math.ceil(this.frame.clientHeight / this.RowHeight) * 2); return { first: firstVisibleRow, last: lastVisibleRow }; }; function hideElement(element) { var s = element.style; s.left = "-10000px"; s.visibility = "hidden"; s.display = "none"; }
function showElement(element) { var s = element.style; s.visibility = "visible"; s.display = "block"; Adiamor.dom.setOpacity(element, 100); }
function positionElement(element, top, left) { element.style.top = top + "px"; element.style.left = left + "px"; }
function isElementVisible(element) {
    var left, disp, vis; left = parseInt(Adiamor.dom.getStyle(element, "left"), 10); disp = Adiamor.dom.getStyle(element, "display"); vis = Adiamor.dom.getStyle(element, "visibility"); if (disp == "none" || vis == "hidden" || left < -500) { return false; }
    return true;
}
Adiamor.ui.Viewport.prototype.renderReady = function (visibleRowRange) {
    var myGaps, low, high, rows; myGaps = this.cacheMap.gaps(visibleRowRange.first, visibleRowRange.last); if (myGaps[0] != null) {
        low = myGaps[0].low; high = myGaps[0].high; rows = high - low + 1; if (!this.DataSource.inCache(low, rows - 1)) {
            if ($('gridlist-indicator').style.visibility == 'visible' && this.rows == 0) { this.hideIndicator(); }
            else { this.showIndicator(); }
            this.DataSource.setParam("start", low); this.DataSource.setParam("page_size", rows); this.DataSource.get(); return false;
        }
        else { this.hideIndicator(); hideElement($('gridlist-overlay')); this.cacheMap.insert(low, high); this.renderGap(low, high); } 
    }
    return (myGaps[0] != null);
}; Adiamor.ui.Viewport.prototype.showIndicator = function () { $('gridlist-indicator').style.visibility = 'visible'; }; Adiamor.ui.Viewport.prototype.hideIndicator = function () { $('gridlist-indicator').style.visibility = 'hidden'; }; Adiamor.ui.Viewport.renderImage = function (val) { return '<div style="width: 100%; text-align: left;"><img align="left" src="http://www.adiamor.com/media/Adiamor/b' + val + '_d.gif" style="margin-top:-3px; vertical-align:middle;">&nbsp;&nbsp;' + val.toUpperCase() + '</div>'; }; Adiamor.ui.Viewport.renderImageOnly = function (val) { return '<div style="width: 100%; text-align: center;"><img align="center" src="http://www.adiamor.com/media/Adiamor/b' + val + '_d.gif" style="margin-top:-3px; vertical-align:middle;"></div>'; }; Adiamor.ui.Viewport.renderBoolean = function (val) { return '<div class="gridlist-column-boolean-value"></div>'; }; Adiamor.ui.Viewport.renderNumber = function (val, schema, type) {
    if (schema.Decimals != null) { return Adiamor.lang.formatNumber(val, schema.Decimals); }
    else { return Adiamor.lang.formatNumber(val); } 
}; Adiamor.ui.Viewport.renderButton = function (val, schema, g_type) { return '<a href="http://www.adiamor.com/Diamonds/Results/D' + val + '" class="view"><img border="0" src="../media/Adiamor/viewbutton.gif" ></a>'; }; Adiamor.ui.Viewport.renderEmpty = function (val, schema, g_type) { return '&nbsp;'; }; Adiamor.ui.Viewport.renderMoney = function (val) {
    var ca = document.cookie.split(';'), currency, i, c; for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("country") == 0) { currency = unescape(c.substring(("country=").length, c.length)); } }
    if (currency == "BP") { return '&#163;' + Adiamor.lang.formatNumber(val, 0); }
    else { return '$' + Adiamor.lang.formatNumber(val, 0); } 
}; var g_types = { "image": { "Class": "gridlist-column-image", "Formatter": Adiamor.ui.Viewport.renderImage }, "boolean": { "Class": "gridlist-column-boolean", "Formatter": Adiamor.ui.Viewport.renderBoolean }, "number": { "Class": "gridlist-column-number", "Formatter": Adiamor.ui.Viewport.renderNumber }, "money": { "Class": "gridlist-column-money", "Formatter": Adiamor.ui.Viewport.renderMoney }, "button": { "Class": "gridlist-column-button", "Formatter": Adiamor.ui.Viewport.renderButton }, "empty": { "Class": "gridlist-column-empty", "Formatter": Adiamor.ui.Viewport.renderEmpty} }; Adiamor.ui.Viewport.prototype.renderGap = function (top, bottom) {
    var lastRow, rows, sRows, h, s, schema, i, className, borderColor, backColor, tmpid, j, val, type, pd, pixelTop, o, domRow, count, item; lastRow = bottom; rows = Math.min(lastRow - top + 1, this.DataSource.data.length); sRows = []; h = 0; g_grid.SelectedRows = []; s = []; schema = this.DataSource.Schema; s.push("<table cellspacing=\"0\" border=\"0\" cellpadding=\"0\" class=\"gridlist-datablock\">"); for (i = 0; i < rows; i += 1) {
        className = "ListDataRow"; borderColor = "#eeeeee"; backColor = "#ffffff"; if (i % 2 == 0) { backColor = "#fbfbfb"; className = "ListDataRowAlt"; }
        if (this.DataSource.getMappedValue(top + i, 15) == "True") { sRows[h] = top + i; h += 1; className = "gridlist-rowselected"; }
        tmpid = parseInt((top + i), 10); s.push("<tr id=\"list_row_" + tmpid + "\" class=\"" + className + " \" onmouseover=\"RowHighlight(this, 'url(http://www.adiamor.com/media/Adiamor/row_info_background.gif)', '" + this.RowHoverColor + "', '" + backColor + "', false);\" onmouseout=\"RowDim(this, '', '" + borderColor + "', '" + backColor + "');\" row=\"" + (top + i) + "\" Adiamortype=\"row\">"); for (j = 0; j < schema.length; j += 1) {
            val = this.DataSource.getMappedValue(top + i, j); type = schema[j].Type; if (g_types[type] != null) { className = g_types[type].Class; val = g_types[type].Formatter.call(this, val, schema[j], g_types[type]); if (g_types[type].Class == "gridlist-column-money") { val = val.replace('£', '&pound;'); } }
            if (g_grid.Columns[j].Width != g_grid.Columns[j].OriginalWidth) {
                pd = ""; if (g_grid.Columns[j].Name == "Cut" && (g_grid.Columns[j].OriginalWidth - g_grid.Columns[j].Width) > 5) { val = this.DataSource.getMappedValueCut(top + i, j); }
                else if (g_grid.Columns[j].Name == "Info") { }
                if (!Adiamor.browser.SAFARI && !Adiamor.browser.MOZ) { s.push("<td class=\"gridlist-column" + j + " gridlist-columndata" + j + "\" style=\"width: " + g_grid.Columns[j].Width + ";\" width=\"" + g_grid.Columns[j].Width + "\" Adiamortype=\"cell\" row=\"" + (top + i) + "\" column=\"" + j + "\"><div class=\"gridlist-cell gridlist-column" + j + "\" style=\"width: " + (g_grid.Columns[j].Width) + ";" + pd + "\">" + val + "</div></td>"); }
                else { s.push("<td class=\"gridlist-column" + j + " gridlist-columndata" + j + "\" style=\"width: " + g_grid.Columns[j].Width + ";\" width=\"" + g_grid.Columns[j].Width + "\" Adiamortype=\"cell\" row=\"" + (top + i) + "\" column=\"" + j + "\"><div class=\"gridlist-cell gridlist-column" + j + "\" style=\"width: " + (g_grid.Columns[j].Width - 10) + ";\">" + val + "</div></td>"); } 
            }
            else { s.push("<td class=\"gridlist-column" + j + " gridlist-columndata" + j + "\" Adiamortype=\"cell\" row=\"" + (top + i) + "\" column=\"" + j + "\"><div class=\"gridlist-cell gridlist-column" + j + " " + className + "\">" + val + "</div></td>"); } 
        }
        s.push("</tr>");
    }
    s.push("</table>"); s = s.join(''); pixelTop = top * this.RowHeight; o = document.createElement("div"); o.style.position = "absolute"; o.style.top = pixelTop + 'px'; o.top = top; o.bottom = lastRow; o.rows = rows; o.setAttribute('id', 'Adiamor_grid_block_' + top + '_' + bottom); o.innerHTML = s; this.surface.appendChild(o); for (h = 0; h < sRows.length; h += 1) { delete g_grid.SelectedRows[h]; delete g_grid.SelectedRows[sRows[h]]; }
    for (h = 0; h < sRows.length; h += 1) { domRow = $("list_row_" + sRows[h]); g_grid.SelectedRows[sRows[h]] = domRow; }
    count = 0; for (item in g_grid.SelectedRows) { count += 1; }
    if (sRows.length > 0) { count = sRows.length; }
    $('numCompare').innerHTML = "(" + sRows.length + ")"; borderColor = "#eeeeee"; backColor = "#ffffff"; if (parseInt(top, 10) % 2 == 0) { backColor = "#fbfbfb"; }
    if ((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight) > parseInt(g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight, 10)) { showInfoPanel($("list_row_" + (parseInt((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight), 10) + 1))); RowHighlight($("list_row_" + (parseInt((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight), 10) + 1)), 'url(http://www.adiamor.com/media/Adiamor/row_info_background.gif)', this.RowHoverColor, backColor, false); RowDim($("list_row_" + (parseInt((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight), 10) + 1)), '', borderColor, backColor); }
    else { showInfoPanel($("list_row_" + parseInt((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight), 10))); RowHighlight($("list_row_" + parseInt((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight), 10)), 'url(http://www.adiamor.com/media/Adiamor/row_info_background.gif)', this.RowHoverColor, backColor, false); RowDim($("list_row_" + parseInt((g_grid.Scrollbar.HtmlElement.scrollTop / g_grid.RowHeight), 10)), '', borderColor, backColor); }
    clearPanel = true; this.OnRenderComplete.notify();
}; Adiamor.ui.Viewport.prototype.flushCache = function () { this.cacheMap.flush(); }; Adiamor.ui.Viewport.prototype.setDataSource = function (oDataSource) { this.DataSource = oDataSource; }; Adiamor.ui.Viewport.prototype.getDataSource = function () { return this.DataSource; }; Adiamor.lang.defineNs("Adiamor.collections"); Adiamor.lang.defineNs("Adiamor.drawing"); if (typeof (Adiamor.drawing) == "undefined") { Adiamor.drawing = function () { }; }
if (typeof (Adiamor.collections) == "undefined") { Adiamor.collections = function () { }; }
Adiamor.drawing.Point = function (x, y) { this.x = x; this.y = y; }; Adiamor.drawing.Point.prototype.toString = function () { return "(" + this.x + "," + this.y + ")"; }; Adiamor.collections.CellSet = function (owner, startRow, startColumn, endRow, endColumn) {
    this.owner = owner; if (startRow != null && startColumn != null && endRow != null && endColumn != null) { this.setRange(startRow, startColumn, endRow, endColumn); }
    else { this.setRange(0, 0, 0, 0); } 
}; Adiamor.collections.CellSet.prototype.toString = function () {
    var str = "", i, j; for (i = this._topRow; i <= this._bottomRow; i += 1) {
        str += "["; for (j = this._leftColumn; j <= this._rightColumn; j += 1) { str += "(" + i + "," + j + ")"; }
        str += "]";
    }
    return str;
}; Adiamor.collections.CellSet.prototype.setRange = function (startRow, startColumn, endRow, endColumn) { this._startRow = startRow; this._startColumn = startColumn; this._endRow = endRow; this._endColumn = endColumn; this._leftColumn = Math.min(startColumn, endColumn); this._rightColumn = Math.max(startColumn, endColumn); this._topRow = Math.min(startRow, endRow); this._bottomRow = Math.max(startRow, endRow); }; Adiamor.collections.CellSet.prototype.changeStartCell = function (startRow, startColumn) { this._startRow = startRow; this._startColumn = startColumn; this._leftColumn = Math.min(startColumn, this._endColumn); this._rightColumn = Math.max(startColumn, this._endColumn); this._topRow = Math.min(startRow, this._endRow); this._bottomRow = Math.max(startRow, this._endRow); }; Adiamor.collections.CellSet.prototype.changeEndCell = function (endRow, endColumn) { this._endRow = endRow; this._endColumn = endColumn; this._leftColumn = Math.min(endColumn, this._startColumn); this._rightColumn = Math.max(endColumn, this._startColumn); this._topRow = Math.min(endRow, this._startRow); this._bottomRow = Math.max(endRow, this._startRow); }; Adiamor.collections.CellSet.prototype.getRowCount = function () { return this._bottomRow - this._topRow + 1; }; Adiamor.collections.CellSet.prototype.getColumnCount = function () { return this._rightColumn - this._leftColumn + 1; }; Adiamor.collections.CellSet.prototype.getCoords = function () { return { 'top': new Adiamor.drawing.Point(this._leftColumn, this._topRow), 'bottom': new Adiamor.drawing.Point(this._rightColumn, this._bottomRow) }; }; Adiamor.collections.CellSet.prototype.getCellObjectByOffset = function (relRow, relColumn) { return this.owner.getCellObject(this._topRow + relRow, this._leftColumn + relColumn); }; Adiamor.ui.ActivityIndicator = function () { }; Adiamor.ui.ActivityIndicator.prototype.initialize = function () { }; Adiamor.lang.defineNs("Adiamor.ui"); Adiamor.ui.GridList = function () {
    this.Columns = []; this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'xi', 'Label': '', 'Width': 75, 'Display': false, 'Type': 'text', 'Sortable': false })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'ID', 'Label': 'ID', 'Width': 75, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Shape', 'Label': '<div id="hShape" style="padding-top: 2px">SHAPE</div>', 'Width': 90, 'Display': true, 'Type': 'image', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Carat', 'Label': '<div id="hCarat" style="padding-top: 2px">CARAT</div>', 'Width': 45, 'Display': true, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Color', 'Label': '<div id="hColor" style="padding-top: 2px">COLOR</div>', 'Width': 43, 'Display': true, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Clar', 'Label': '<div id="hClar" style="padding-top: 2px">CLARITY</div>', 'Width': 51, 'Display': true, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Cut', 'Label': '<div id="hCut" style="padding-top: 2px">CUT</div>', 'Width': 85, 'Display': true, 'Type': 'text', 'Sortable': false })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Pol', 'Label': '<div id="hPol" style="padding-top: 2px">POLISH</div>', 'Width': 29, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Sym', 'Label': '<div id="hSym" style="padding-top: 2px">SYMMETRY</div>', 'Width': 29, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Depth', 'Label': '<div id="hDepth" style="padding-top: 2px">DEPTH</div>', 'Width': 29, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Tbl', 'Label': '<div id="hTbl" style="padding-top: 2px">TABLE</div>', 'Width': 29, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Fluor', 'Label': '<div id="hFluor" style="padding-top: 2px">FLUOR</div>', 'Width': 29, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Size', 'Label': '<div id="hSize" style="padding-top: 2px">L/W</div>', 'Width': 29, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Cert', 'Label': '<div id="hCert" style="padding-top: 2px">CERT</div>', 'Width': 54, 'Display': false, 'Type': 'text', 'Sortable': false })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'SPrice', 'Label': '<div id="hSPrice" style="padding-top: 2px">PRICE</div>', 'Width': 109, 'Display': true, 'Type': 'money', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Selected', 'Label': '<a id="hSelected" onclick="compareDiamonds();" style="cursor:pointer;cursor:hand;color:#666666;">Compare</a>', 'Width': 72, 'Display': false, 'Type': 'boolean', 'Sortable': false })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Info', 'Label': '<div id="hInfo" style="padding-top: 2px">DETAILS</div>', 'Width': 174, 'Display': true, 'Type': 'empty', 'Sortable': false })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Girdle', 'Label': '<div id="hGirdle" style="padding-top: 2px">GIRDLE</div>', 'Width': 39, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Meas', 'Label': '<div id="hMeas" style="padding-top: 2px">MEAS</div>', 'Width': 64, 'Display': false, 'Type': 'text', 'Sortable': true })); this.Columns.push(new Adiamor.ui.GridListColumn({ 'Name': 'Culet', 'Label': '<div id="hCulet" style="padding-top: 2px">CULET</div>', 'Width': 39, 'Display': false, 'Type': 'text', 'Sortable': true })); this.ColumnsMap = {}; var i; for (i = 0; i < this.Columns.length; i += 1) { this.ColumnsMap[this.Columns[i].Name] = i; }
    this.RowCount = 500; this.RowHeight = 27; this.Scrollbar = null; this.SortColumn = null; this.SortDirection = null; this.Template = '<table id="myGridList" class="List" border="0" cellpadding="0" cellspacing="0" >{$Header}{$Grid}{$Footer}</table>'; this.Header = null; this.SelectedRows = {}; this.MouseOverRow = null; this.MouseOverColumn = null; this.OnScrollVertical = new Adiamor.base.SubjectHelper(); this.OnDataSourceConnected = new Adiamor.base.SubjectHelper(); this.OnMouseOver = new Adiamor.base.SubjectHelper(); this.OnMouseOut = new Adiamor.base.SubjectHelper(); this.OnSort = new Adiamor.base.SubjectHelper(); this.ViewEvents = [{ 'type': 'dblclick', 'handler': this.mouseClickHandler }, { 'type': 'mouseover', 'handler': this.mouseOverHandler }, { 'type': 'mouseout', 'handler': this.mouseOutHandler}]; this.createChildren();
}; Adiamor.lang.extend(Adiamor.ui.GridList, Adiamor.ui.Element); Adiamor.ui.GridList.prototype.createChildren = function () { this.View = new Adiamor.ui.Viewport(); this.View.mapToHtml($("ListDataElement"), $("ListDataFrame"), $("ListDataSurface")); Adiamor.html.attachEvents($("ListDataElement"), this.ViewEvents, this); this.OnDataSourceConnected.subscribe(this.View.setDataSource, this.View); this.View.setDataSource(this.DataSource); this.setupColumnClasses(); this.Header = new Adiamor.ui.GridListColumnHeader(); this.Header.Columns = this.Columns; this.Header.attachToParent($("gridlist-columnheader")); this.Header.OnClick.subscribe(this.sort, this); }; Adiamor.ui.GridList.prototype.sort = function (columnIndex) {
    if (typeof (columnIndex) == "string") { columnIndex = parseInt(columnIndex, 10); }
    if (g_grid.Columns[columnIndex] == null || g_grid.Columns[columnIndex].Sortable == false) { return; }
    var oldSortDir = this.SortDirection, oldSortCol = this.SortColumn, newSortDir = "ASC", newSortCol = columnIndex; if (g_grid.SortColumn == columnIndex) { newSortDir = (g_grid.SortDirection == "ASC" ? ("DESC") : ("ASC")); }
    g_grid.setSort(newSortCol, newSortDir, oldSortCol, oldSortDir); g_grid.OnSort.notify(g_grid.SortColumn, this.SortDirection); g_grid.render();
}; Adiamor.ui.GridList.prototype.setSort = function (sortCol, sortDir, oldSortCol, oldSortDir) {
    if (sortCol == 141) { sortCol = 14; }
    this.SortColumn = sortCol; this.SortDirection = sortDir; if (oldSortCol != null) { Adiamor.html.removeClass(Adiamor.html.getFirstChild($('gridlist-columnheader' + oldSortCol)), 'gridlist-columnheader-sort' + oldSortDir); }
    Adiamor.html.addClass(Adiamor.html.getFirstChild($('gridlist-columnheader' + sortCol)), 'gridlist-columnheader-sort' + this.SortDirection); this.DataSource.setParam("sortcol", this.Columns[sortCol].Name); this.DataSource.setParam("sortdir", sortDir);
}; Adiamor.ui.GridList.prototype.render = function () { this.DataSource.flush(); this.View.clear(); this.View.setScrollTop(0); }; Adiamor.ui.GridList.prototype.renderNext = function () { this.DataSource.flush(); this.View.clear(); this.View.setScrollTop(0); }; Adiamor.ui.GridList.prototype.renderLast = function () { this.DataSource.flush(); this.View.clear(); this.View.setScrollTop(0); }; Adiamor.ui.GridList.prototype.renderAll = function () { this.DataSource.flush(); this.View.clear(); this.View.setScrollTop(0); }; Adiamor.ui.GridList.prototype.setupColumnClasses = function () {
    var i, col; for (i = 0; i < this.Columns.length; i += 1) {
        col = this.Columns[i]; col.cssStyle = Adiamor.html.getClass('gridlist-column' + i); if (!col.Display) { col.cssStyle.display = 'none'; }
        col.cssStyle.width = col.Width + 'px'; col.OriginalWidth = col.Width;
    } 
}; function getAdiamorCookie() {
    var ca = document.cookie.split(';'), cookieValues = [], i, c; for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("adiamor") == 0 && c.indexOf("adiamor2") != 0 && c.indexOf("Adiamor2") != 0) { cookieValues = unescape(c.substring(("adiamor=").length, c.length)).split(";"); } }
    return cookieValues;
}
function createCookie(name, value, days) {
    var expires, cookieValues, destroy, found, nameEQ, i, c, date; if (days) { date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toGMTString(); }
    else { expires = ""; }
    cookieValues = getAdiamorCookie(); destroy = (value == null || value == "null" || value == ""); found = false; nameEQ = name + "="; for (i = 0; i < cookieValues.length; i += 1) { c = cookieValues[i].replace(/\s/g, ''); if (c.indexOf(nameEQ) == 0) { found = true; cookieValues[i] = name + "=" + value; if (destroy) { cookieValues.splice(i, 1); } } }
    if (!found && !destroy) { cookieValues.push(name + "=" + value); }
    document.cookie = "adiamor=" + escape(cookieValues.join(";")) + expires + "; path=/";
}
function readCookie(name) {
    var cookieValues = getAdiamorCookie(), nameEQ, i, c; nameEQ = name + "="; for (i = 0; i < cookieValues.length; i += 1) { c = cookieValues[i].replace(/\s/g, ''); if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length, c.length); } }
    return null;
}
Adiamor.ui.GridList.prototype.mouseClickHandler = function (evtObj, element) {
    var domCell = this.findCell(evtObj.srcElement), domRow, row, col, cookieValue, id, id2, count, item, title; if (domCell != null) {
        domRow = domCell.parentNode; if (domRow != null) {
            row = domCell.getAttribute("row"); col = domCell.getAttribute("column"); if (this.Columns[col].Name == "Selected") {
                if (this.SelectedRows[row] != null) {
                    cookieValue = readCookie("compare"); id = "D|" + this.DataSource.data[row][this.ColumnsMap.ID] + "-"; id2 = "T|" + this.DataSource.data[row][this.ColumnsMap.ID] + "-"; if (cookieValue != null) { cookieValue = cookieValue.replace(id, id2); createCookie("compare", cookieValue, 90); }
                    this.setRowClass(this.SelectedRows[row], row); delete this.SelectedRows[row];
                }
                else { cookieValue = readCookie("compare") || ""; id = "D|" + this.DataSource.data[row][this.ColumnsMap.ID] + "-"; id2 = "T|" + this.DataSource.data[row][this.ColumnsMap.ID] + "-"; cookieValue = cookieValue.replace(id2, id); createCookie("compare", cookieValue, 90); domRow.className = "gridlist-rowselected"; this.SelectedRows[row] = domRow; }
                count = 0; for (item in this.SelectedRows) { count += 1; }
                if (count == 0) { $('numCompare').innerHTML = ""; }
                else { $('numCompare').innerHTML = "(" + count + ")"; } 
            }
            else { title = this.DataSource.getMappedValue(row, this.ColumnsMap.Cert) + "-Certified-"; title += this.DataSource.getMappedValue(row, this.ColumnsMap.Color) + "-" + this.DataSource.getMappedValue(row, this.ColumnsMap.Clar) + "-"; title += this.DataSource.getMappedValue(row, this.ColumnsMap.Cut).replace(" ", "-") + "-Cut-"; title += this.DataSource.getMappedValue(row, this.ColumnsMap.Shape) + "-Diamond"; window.open("http://www.adiamor.com/Diamonds/" + title + "/D" + this.DataSource.data[row][this.ColumnsMap.ID], '_self'); } 
        } 
    } 
}; Adiamor.ui.GridList.prototype.setRowClass = function (rowElement, rowNumber) {
    var className = "ListDataRow"; if (rowNumber % 2 == 0) { className = "ListDataRowAlt"; }
    rowElement.className = className;
}; Adiamor.ui.GridList.prototype.mouseOverHandler = function (evtObj, element) { var domRow, domCell, newRow, newColumn; domRow = this.findRow(evtObj.srcElement); domCell = this.findCell(evtObj.srcElement); if (domCell != null && domRow != null) { newRow = domRow.getAttribute("row"); newColumn = domCell.getAttribute("column"); if (this.MouseOverRow != newRow || this.MouseOverColumn != newColumn) { this.OnMouseOver.notify({ 'row': domRow, 'cell': domCell, 'event': evtObj }); this.MouseOverRow = newRow; } } }; Adiamor.ui.GridList.prototype.mouseOutHandler = function (evtObj, element) { var domCell, toElement; domCell = this.findRow(evtObj.srcElement); toElement = this.findRow(evtObj.toElement); if ((toElement == null || toElement.nodeType == 9)) { this.OnMouseOut.notify({ 'row': domCell }); this.MouseOverRow = null; this.MouseOverColumn = null; } }; function findElement(elem, type) {
    var breakOut = 5, i; for (i = 0; i < breakOut && (elem != null && elem.getAttribute && elem.getAttribute('Adiamortype') != type); i += 1) { elem = elem.parentNode; }
    if (i == breakOut || elem == document) { elem = null; }
    return elem;
}
Adiamor.ui.GridList.prototype.findRow = function (elem) { return findElement(elem, 'row'); }; Adiamor.ui.GridList.prototype.findCell = function (elem) { return findElement(elem, 'cell'); }; Adiamor.ui.GridList.prototype.setDataSource = function (datasource) {
    this.DataSource = datasource; if (typeof this.DataSource == "object" && this.DataSource.OnRowCountChanged != null) { this.DataSource.OnRowCountChanged.subscribe(this.setRowCount, this); this.DataSource.OnDataReady.subscribe(this.View.render, this.View); }
    this.OnDataSourceConnected.notify(this.DataSource);
}; Adiamor.ui.GridList.prototype.setRowCount = function (rows) { this.RowCount = rows; this.View.rows = rows; this.View.clear(); var newHeight = Math.max(rows * this.RowHeight, this.View.frame.clientHeight + 1); this.View.setSurfaceHeight(newHeight); this.Scrollbar.setRange(newHeight); }; Adiamor.ui.GridList.prototype.setScrollbar = function (scrollbar) { this.Scrollbar = scrollbar; this.Scrollbar.OnScroll.subscribe(this.scrollVertical, this); this.OnScrollVertical.subscribe(this.Scrollbar.setScrollPercent, this.Scrollbar); }; Adiamor.ui.GridList.prototype.scrollVertical = function (percent) { var origPct = this.scrollVerticalPercent; this.scrollVerticalPercent = percent; this.View.setScrollTopPercent(percent); this.OnScrollVertical.notify(percent); }; Adiamor.ui.GridList.prototype.attachToParent = function (HtmlContainer, HtmlElement) { this.HtmlContainer = HtmlContainer; this.HtmlElement = HtmlElement || Adiamor.html.getFirstChild(this.HtmlContainer.firstChild); if (this.HtmlElement == null) { this.render(); } }; Adiamor.ui.GridList.prototype.getColumns = function () { return this.Columns; }; Adiamor.ui.GridList.prototype.dispose = function () { Adiamor.ui.GridList.base.dispose.call(this); }; Adiamor.ui.GridListColumnHeader = function () { this.Columns = null; this.Container = null; this.OnClick = new Adiamor.base.SubjectHelper(); }; Adiamor.lang.extend(Adiamor.ui.GridListColumnHeader, Adiamor.ui.Panel); Adiamor.ui.GridListColumnHeader.prototype.attachToParent = function (container) { this.Container = container; this.render(); }; Adiamor.ui.GridListColumnHeader.prototype.render = function () {
    var s = [], i, clazz; s.push("<table id=\"Adiamor-ui-gridlistcolumnheader\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>"); for (i = 0; i < this.Columns.length; i += 1) {
        clazz = ''; if (i == this.SortColumn) { clazz = 'gridlist-columnheader-sort' + this.SortDirection; }
        s.push("<td id=\"gridlist-columnheader" + i + "\" class=\"gridlist-columnheader" + i + " gridlist-column" + i + " " + clazz + "\" Adiamortype=\"header\" column=\"" + i + "\"><div class=\"gridlist-columnheader gridlist-column" + i + "\">" + this.Columns[i].Label + "</div></td>");
    }
    s.push("</tr></table>"); s = s.join(""); this.Container.innerHTML = s; Adiamor.html.attachEvent($('Adiamor-ui-gridlistcolumnheader'), 'click', this.mouseClickHandler, this);
}; Adiamor.ui.GridListColumnHeader.prototype.mouseClickHandler = function (evtObj, element) { var domCell = this.findHeader(evtObj.srcElement); if (domCell != null) { this.OnClick.notify(domCell.getAttribute("column")); } }; Adiamor.ui.GridListColumnHeader.prototype.findHeader = function (elem) { return findElement(elem, 'header'); }; Adiamor.ui.GridListColumn = function (values) { this.Name = ""; this.Label = ""; this.Width = 100; this.DataField = ""; this.Display = true; this.Type = "text"; this.Template = "{$Value}"; this.setValues(values); }; Adiamor.lang.extend(Adiamor.ui.GridListColumn, Adiamor.base.Object); Adiamor.ui.Slider = function (values) { this.uid = Adiamor.base.getUid(); this.Container = null; this.LeftStart = 0; this.RightStart = 0; this.LeftGrabby = null; this.RightGrabby = null; this.LeftOverlay = null; this.RightOverlay = null; this.Max = 100; this.Min = 0; this.Ticks = 10; this.Width = 230; this.Height = 47; this.OverlayHeight = null; this.OnRangeChanged = new Adiamor.base.SubjectHelper(); this.OnStartDrag = new Adiamor.base.SubjectHelper(); this.OnDrag = new Adiamor.base.SubjectHelper(); this.Discrete = false; this.GrabbyWidth = 15; this.GrabbyHeight = 53; this.ElementClassName = ''; this.ClassPostFix = ""; this.Coords = null; this.TooltipEnabled = false; this.LeftTooltipOffsetTop = -10; this.RightTooltipOffsetTop = -10; this.LeftTooltipOffsetLeft = 0; this.RightTooltipOffsetLeft = 0; this.Slope = 1; this.LeftTooltip = null; this.setValues(values); this.LeftValue = this.Min; this.RightValue = this.Max; if (this.OverlayHeight == null) { this.OverlayHeight = this.Height; } }; Adiamor.lang.extend(Adiamor.ui.Slider, Adiamor.ui.Element); Adiamor.ui.Slider.prototype.attachToParent = function (container) { this.Container = container; this.render(); }; function exchangeSetter(method1, method2, object1, object2, filter) {
    var srcMethod = object1[method1]; if (filter instanceof Function) { object1[method1] = function () { val = filter.apply(this, arguments); return method2.apply(object2, arguments); }; }
    else { object1[method1] = function () { return method2.apply(object2, arguments); }; } 
}
function exchangeGetter(method1, method2, object1, object2, filter) {
    var srcMethod = object1[method1]; if (filter instanceof Function) { object1[method1] = function () { var val = method2.call(object2); val = filter.call(this, val); return val; }; }
    else { object1[method1] = function () { var val = method2.call(object2); return val; }; } 
}
function highlightTooltip(evtArgs, elem, saveState, fragment) { this.style.border = "1px solid #ccc"; }
function dimTooltip(evtArgs, elem, saveState, fragment) { this.style.border = "1px solid #ccc"; }
Adiamor.ui.Slider.prototype.render = function () {
    var s, type, inputWidth, parent; s = '<div id="ntb-slider' + this.uid + '" class="slider-bg-repeat slider-element' + this.ClassPostFix + ' ' + this.ElementClassName + '" style="width:' + this.Width + 'px;height:' + this.Height + 'px;">'; type = this.ElementClassName.substring(7); inputWidth = "55"; if (type == "depth" || type == "table") { inputWidth = "41"; }
    s += ' <div id="ntb-slider-lo' + this.uid + '" class="slider-overlay' + this.ClassPostFix + '" style="float:left;width:0px;height:' + this.OverlayHeight + 'px;"></div>'; s += ' <div id="ntb-slider-lg' + this.uid + '" class="slider-grabby slider-grabbyleft' + this.ClassPostFix + '" style="float:left;width:' + this.GrabbyWidth + 'px;height:' + this.GrabbyHeight + 'px;"></div>'; s += ' <div id="ntb-slider-ro' + this.uid + '" class="slider-overlay' + this.ClassPostFix + '" style="float:right;width:0px;height:' + this.OverlayHeight + 'px;"></div>'; s += ' <div id="ntb-slider-rg' + this.uid + '" class="slider-grabby slider-grabbyright' + this.ClassPostFix + '" style="float:right;width:' + this.GrabbyWidth + 'px;height:' + this.GrabbyHeight + 'px;"></div>'; if (this.TooltipEnabled && !Adiamor.browser.SAFARI && !Adiamor.browser.MOZ) { s += ' <input tabindex="' + ti + '" type="text" id="ntb-slider-lt' + this.uid + '" style="text-align:center;border:1px solid #ccc;line-height:10px;font-size:10px;font-family:arial, sans-serif;height:10px;width:' + inputWidth + 'px;position:absolute;left:' + (this.LeftTooltipOffsetLeft) + 'px;top:' + (this.LeftTooltipOffsetTop + this.Height) + 'px;float:left;" />'; ti += 1; s += ' <input tabindex="' + ti + '" type="text" id="ntb-slider-rt' + this.uid + '" style="text-align:center;border:1px solid #ccc;line-height:10px;font-size:10px;font-family:arial, sans-serif;height:10px;width:' + inputWidth + 'px;position:absolute;left:' + (this.RightTooltipOffsetLeft + this.Width) + 'px;top:' + (this.RightTooltipOffsetTop + this.Height) + 'px;float:right;" />'; ti += 1; }
    else if (this.TooltipEnabled && !Adiamor.browser.SAFARI && Adiamor.browser.MOZ) { s += ' <input tabindex="' + ti + '" type="text" id="ntb-slider-lt' + this.uid + '" style="text-align:center;padding-bottom: 3px;border:1px solid #ccc;line-height:10px;font-size:10px;font-family:arial, sans-serif;height:10px;width:' + inputWidth + 'px;position:absolute;left:' + (this.LeftTooltipOffsetLeft) + 'px;top:' + (this.LeftTooltipOffsetTop + this.Height) + 'px;float:left;" />'; ti += 1; s += ' <input tabindex="' + ti + '" type="text" id="ntb-slider-rt' + this.uid + '" style="text-align:center;padding-bottom: 3px;border:1px solid #ccc;line-height:10px;font-size:10px;font-family:arial, sans-serif;height:10px;width:' + inputWidth + 'px;position:absolute;left:' + (this.RightTooltipOffsetLeft + this.Width) + 'px;top:' + (this.RightTooltipOffsetTop + this.Height) + 'px;float:right;" />'; ti += 1; }
    else if (this.TooltipEnabled) { s += ' <input tabindex="' + ti + '" type="text" id="ntb-slider-lt' + this.uid + '" style="text-align:center;border:1px solid #ccc;line-height:10px;font-size:10px;font-family:arial, sans-serif;height:10px;width:' + inputWidth + 'px;position:absolute;left:' + (this.LeftTooltipOffsetLeft) + 'px;top:' + (this.LeftTooltipOffsetTop + this.Height) + 'px;float:left;" />'; ti += 1; s += ' <input tabindex="' + ti + '" type="text" id="ntb-slider-rt' + this.uid + '" style="text-align:center;border:1px solid #ccc;line-height:10px;font-size:10px;font-family:arial, sans-serif;height:10px;width:' + inputWidth + 'px;position:absolute;left:' + (this.RightTooltipOffsetLeft + this.Width) + 'px;top:' + (this.RightTooltipOffsetTop + this.Height) + 'px;float:right;" />'; ti += 1; }
    s += '</div>'; this.Container.innerHTML = s; this.Element = $('ntb-slider' + this.uid); Adiamor.html.attachEvent(this.Element, "mousedown", this.handleSliderClick, this); this.setBounds(); Adiamor.html.attachEvent(this.Element, "mouseover", this.handleMouseover, this); Adiamor.html.attachEvent(this.Element, "mouseout", this.handleMouseout, this); parent = null; if (typeof (this.Element.parentElement) != "undefined") { parent = this.Element.parentElement.parentElement; }
    else { parent = this.Element.parentNode.parentNode; }
    Adiamor.html.attachEvent(parent, "mouseover", this.handleMouseoverP, this); Adiamor.html.attachEvent(parent, "mouseout", this.handleMouseoutP, this); this.LeftGrabby = new Adiamor.ui.Element(null, null, 'ntb-slider-lg' + this.uid); this.LeftGrabby.Position = 'Left'; this.RightGrabby = new Adiamor.ui.Element(null, null, 'ntb-slider-rg' + this.uid); this.RightGrabby.Position = 'Right'; this.LeftOverlay = new Adiamor.ui.Element(null, null, 'ntb-slider-lo' + this.uid); this.RightOverlay = new Adiamor.ui.Element(null, null, 'ntb-slider-ro' + this.uid); Adiamor.html.attachEvent(this.LeftOverlay.m_HtmlElementHandle, "click", this.handleLeftOverlayClick, this); Adiamor.html.attachEvent(this.RightOverlay.m_HtmlElementHandle, "click", this.handleRightOverlayClick, this); Adiamor.html.attachEvent(this.LeftGrabby.m_HtmlElementHandle, "click", function (evtArgs) { Adiamor.html.cancelEvent(evtArgs); }, this); Adiamor.html.attachEvent(this.RightGrabby.m_HtmlElementHandle, "click", function (evtArgs) { Adiamor.html.cancelEvent(evtArgs); }, this); Adiamor.ui.IDraggable.makeDraggable(this.LeftGrabby, this.LeftGrabby.m_HtmlElementHandle); Adiamor.ui.IDraggable.makeDraggable(this.RightGrabby, this.RightGrabby.m_HtmlElementHandle); this.LeftGrabbyDD = new Adiamor.ui.DragDrop(this.LeftGrabby, false, true); this.RightGrabbyDD = new Adiamor.ui.DragDrop(this.RightGrabby, false, true); this.LeftGrabbyDD.setXBounds(this.MinXCoord - this.GrabbyWidth, this.MaxXCoord + this.GrabbyWidth); this.LeftGrabbyDD.OnDragStop.subscribe(this.stopLeftDrag, this); this.RightGrabbyDD.setXBounds(this.MinXCoord + this.GrabbyWidth, this.MaxXCoord + this.GrabbyWidth); this.RightGrabbyDD.OnDragStop.subscribe(this.stopRightDrag, this); if (this.TooltipEnabled) { this.LeftTooltip = new Adiamor.ui.Element(null, null, 'ntb-slider-lt' + this.uid); this.RightTooltip = new Adiamor.ui.Element(null, null, 'ntb-slider-rt' + this.uid); Adiamor.html.attachEvent(this.LeftTooltip.m_HtmlElementHandle, "blur", this.updateLeftGrabby, this); Adiamor.html.attachEvent(this.RightTooltip.m_HtmlElementHandle, "blur", this.updateRightGrabby, this); Adiamor.html.attachEvent(this.LeftTooltip.m_HtmlElementHandle, "focus", this.focusLeftGrabby, this); Adiamor.html.attachEvent(this.RightTooltip.m_HtmlElementHandle, "focus", this.focusRightGrabby, this); Adiamor.html.attachEvent(this.LeftTooltip.m_HtmlElementHandle, "keydown", function (evtArgs) { if (evtArgs.keyCode == 13) { this.blur(); } }, this.LeftTooltip.m_HtmlElementHandle); Adiamor.html.attachEvent(this.RightTooltip.m_HtmlElementHandle, "keydown", function (evtArgs) { if (evtArgs.keyCode == 13) { this.blur(); } }, this.RightTooltip.m_HtmlElementHandle); exchangeSetter("setX", this.setLeftGrabbyXT, this.LeftGrabby, this); exchangeSetter("setX", this.setRightGrabbyXT, this.RightGrabby, this); }
    else { exchangeSetter("setX", this.setLeftGrabbyX, this.LeftGrabby, this); exchangeSetter("setX", this.setRightGrabbyX, this.RightGrabby, this); }
    this.LeftGrabby.getX = Adiamor.lang.close(this.LeftOverlay, this.LeftOverlay.getWidth); exchangeGetter("getX", this.RightOverlay.getWidth, this.RightGrabby, this.RightOverlay, function (val) { return -parseInt(val, 10); }); Adiamor.html.attachEvent(this.LeftGrabby.m_HtmlElementHandle, "mousedown", this.startDragLeft, this); Adiamor.html.attachEvent(this.RightGrabby.m_HtmlElementHandle, "mousedown", this.startDragRight, this); this.offset = 2; if (this.Discrete && this.ElementClassName.indexOf("mini") == -1) { this.offset = 5; }
    this.LeftGrabby.setX(0); this.RightGrabby.setX(0);
}; Adiamor.ui.Slider.prototype.updateLeftGrabby = function (evtObj) {
    var val = this.LeftTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); if (val != tooltip) {
        if (val.substring(0, 1) == '.') { val = "0" + val; }
        if (parseValues(this.getMaxValue()) >= parseValues(val)) { this.setMinValue(val); }
        else { this.setMinValue(this.getMaxValue()); this.setMaxValue(val); }
        this.stopLeftDrag({ "DragElement": this.LeftGrabby, "Event": evtObj, "Tooltip": true });
    }
    tooltip = null;
}; Adiamor.ui.Slider.prototype.focusLeftGrabby = function (evtObj) { var val = this.LeftTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); tooltip = val; }; Adiamor.ui.Slider.prototype.updateRightGrabby = function (evtObj) {
    var val = this.RightTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); if (val != tooltip) {
        if (val.substring(0, 1) == '.') { val = "0" + val; }
        if (parseValues(this.getMinValue()) <= parseValues(val)) { this.setMaxValue(val); }
        else { this.setMaxValue(this.getMinValue()); this.setMinValue(val); }
        this.stopRightDrag({ "DragElement": this.RightGrabby, "Event": evtObj, "Tooltip": true });
    }
    tooltip = null;
}; Adiamor.ui.Slider.prototype.focusRightGrabby = function (evtObj) { var val = this.RightTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); tooltip = val; }; Adiamor.ui.Slider.prototype.setLeftGrabbyX = function (val) {
    var step, mod, div, anum; step = Math.floor((this.getWidth()) / this.Ticks); if (isNaN(val)) { val = 0; }
    if (this.Discrete) {
        mod = (val % step); div = Math.floor(val / step); if (val > (div * step + step / 2)) { val = (div + 1) * step; }
        else if (val <= div * step + step / 2) { val = (div) * step; }
        if ((val + 6) > (this.getWidth() + this.RightGrabby.getX())) { val -= step; }
        if (val != 0) { val += 6; } 
    }
    anum = /(^\d+$)|(^\d+\.\d+$)/; if (anum.test(val)) { this.LeftOverlay.m_HtmlElementHandle.style.width = (Math.max(0, val)) + 'px'; this.RightGrabbyDD.setMinX(val + this.MinXCoord + this.GrabbyWidth * (3 / 2)); } 
}; Adiamor.ui.Slider.prototype.setLeftGrabbyXT = function (val, displayValue) {
    val = Math.round(val); this.setLeftGrabbyX(val); this.LeftTooltip.setX(Math.min(Math.max(val + this.LeftTooltipOffsetLeft, 0), this.getWidth() - 90)); this.LeftTooltip.m_HtmlElementHandle.value = this.formatTooltipValue(displayValue || Math.max(this.getValueFunction(val / this.getWidth()), this.Min)); var ca = document.cookie.split(';'), currency, i, c; for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("country") == 0) { currency = unescape(c.substring(("country=").length, c.length)); } }
    if (currency == "BP") { this.LeftTooltip.m_HtmlElementHandle.value = this.LeftTooltip.m_HtmlElementHandle.value.replace('$', '\u00A3'); } 
}; Adiamor.ui.Slider.prototype.setRightGrabbyX = function (val) {
    var step, mod, div; step = Math.floor((this.getWidth()) / this.Ticks); if (isNaN(val)) { val = 0; }
    if (this.Discrete) {
        mod = (val % step); div = Math.floor(val / step); if (val > (div * step + step / 2)) { val = (div + 1) * step; }
        else if (val <= div * step + step / 2) { val = (div) * step; }
        if ((this.LeftGrabby.getX() + 6) > this.getWidth() + val) { val += step; }
        if (val != 0) { val -= 6; } 
    }
    this.RightOverlay.setWidth(Math.max(0, -val)); this.LeftGrabbyDD.setMaxX(this.MinXCoord + this.getWidth() + val + this.offset);
}; Adiamor.ui.Slider.prototype.setRightGrabbyXT = function (val, displayValue) {
    val = Math.round(val); var width, ca, currency, i, c; width = this.getWidth(); this.setRightGrabbyX(val); this.RightTooltip.setX(Math.max(Math.min(width + val + this.RightTooltipOffsetLeft, width - 45), 60)); this.RightTooltip.m_HtmlElementHandle.value = this.formatTooltipValue(displayValue || Math.min(this.getValueFunction((width + val) / width), this.Max)); ca = document.cookie.split(';'); for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("country") == 0) { currency = unescape(c.substring(("country=").length, c.length)); } }
    if (currency == "BP") { this.RightTooltip.m_HtmlElementHandle.value = this.RightTooltip.m_HtmlElementHandle.value.replace('$', '\u00A3'); } 
}; Adiamor.ui.Slider.prototype.updateBottomGrabby = function (evtObj) {
    var val = this.BottomTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); if (tooltip != val) {
        if (val.substring(0, 1) == '.') { val = "0" + val; }
        if (parseInt(this.getMaxValue(), 10) >= parseInt(val, 10)) { this.setMinValue(val); }
        this.stopBottomDrag({ "DragElement": this.BottomGrabby, "Event": evtObj, "Tooltip": true });
    }
    tooltip = null;
}; Adiamor.ui.Slider.prototype.focusBottomGrabby = function (evtObj) { var val = this.BottomTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); tooltip = val; }; Adiamor.ui.Slider.prototype.updateTopGrabby = function (evtObj) {
    var val = this.TopTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); if (tooltip != val) {
        if (val.substring(0, 1) == '.') { val = "0" + val; }
        if (parseInt(this.getMinValue(), 10) <= parseInt(val, 10)) { this.setMaxValue(val); }
        this.stopTopDrag({ "DragElement": this.TopGrabby, "Event": evtObj, "Tooltip": true });
    }
    tooltip = null;
}; Adiamor.ui.Slider.prototype.focusTopGrabby = function (evtObj) { var val = this.TopTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''); tooltip = val; }; Adiamor.ui.Slider.prototype.setBottomGrabbyY = function (val) { var anum = /(^\d+$)|(^\d+\.\d+$)/; if (anum.test(val)) { this.BottomOverlay.m_HtmlElementHandle.style.height = (Math.max(0, val)) + 'px'; this.TopGrabbyDD.setMinY(this.MaxYCoord + val - this.GrabbyHeight - 5); } }; Adiamor.ui.Slider.prototype.setBottomGrabbyYT = function (val, displayValue) {
    val = Math.round(val); var height = this.getHeight(), ca, currency, i, c; this.setBottomGrabbyY(Math.min(val, (this.getHeight() + 2))); this.BottomTooltip.setY(Math.min(val + this.BottomTooltipOffsetTop, (this.getHeight() + 2 + this.BottomTooltipOffsetTop))); this.BottomTooltip.m_HtmlElementHandle.value = this.formatTooltipValue(displayValue || Math.max(this.getSmallValueFunction((val - (this.GrabbyHeight * 3) + 4) / (height - (this.GrabbyHeight * 3) + 4)), this.Min)); ca = document.cookie.split(';'); for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("country") == 0) { currency = unescape(c.substring(("country=").length, c.length)); } }
    if (currency == "BP") { this.BottomTooltip.m_HtmlElementHandle.value = this.BottomTooltip.m_HtmlElementHandle.value.replace('$', '\u00A3'); } 
}; Adiamor.ui.Slider.prototype.setTopGrabbyY = function (val) { this.TopOverlay.setHeight(Math.max(0, val)); val = Math.max(val, this.GrabbyHeight * 1.5); this.BottomGrabbyDD.setMaxY(this.MaxYCoord + val + this.GrabbyHeight / 2 + this.offset); }; Adiamor.ui.Slider.prototype.setTopGrabbyYT = function (val, displayValue) {
    val = Math.round(val); var height, ca, currency, i, c; height = this.getHeight(); this.setTopGrabbyY(val); this.TopTooltip.setY(Math.max(val + this.TopTooltipOffsetTop, -5)); if (this.Discrete == false) { this.TopTooltip.m_HtmlElementHandle.value = this.formatTooltipValue(displayValue || Math.min(this.getSmallValueFunction((val - (this.GrabbyHeight * 2)) / (height - (this.GrabbyHeight * 3) + 1)), this.Max)); }
    else { this.TopTooltip.m_HtmlElementHandle.value = this.formatTooltipValue(displayValue || Math.min(this.getSmallValueFunction((height + val + (this.GrabbyHeight) + 1) / height) + this.Min, this.Max)); }
    ca = document.cookie.split(';'); for (i = 0; i < ca.length; i += 1) { c = ca[i].replace(/\s/g, ''); if (c.indexOf("country") == 0) { currency = unescape(c.substring(("country=").length, c.length)); } }
    if (currency == "BP") { this.TopTooltip.m_HtmlElementHandle.value = this.TopTooltip.m_HtmlElementHandle.value.replace('$', '\u00A3'); } 
}; Adiamor.ui.Slider.prototype.formatTooltipValue = function (val) { return val; }; Adiamor.ui.Slider.prototype.setBounds = function () { var type = this.ElementClassName.substring(7); this.Coords = Adiamor.html.getCoords(this.Element); this.MinXCoord = this.Coords.x; this.MaxXCoord = this.MinXCoord + this.getWidth(); }; Adiamor.ui.Slider.prototype.startDragLeft = function (evt) { this.OnStartDrag.notify(this, this.LeftGrabbyDD); this.LeftGrabbyDD.startDrag(); Adiamor.html.cancelEvent(evt); }; Adiamor.ui.Slider.prototype.startDragRight = function (evt) { this.OnStartDrag.notify(this, this.RightGrabbyDD); this.RightGrabbyDD.startDrag(); Adiamor.html.cancelEvent(evt); }; Adiamor.ui.Slider.prototype.stopLeftDrag = function (evtArgs) {
    var val = this.LeftGrabby.getX(), compare; compare = this.Min; if (compare > this.Max) { compare = this.Max; }
    if (evtArgs.Tooltip !== true) { this.LeftValue = Math.max(this.getValueFunction(val / this.getWidth()), compare); }
    this.stopDrag(evtArgs);
}; Adiamor.ui.Slider.prototype.stopRightDrag = function (evtArgs) {
    var val = this.RightGrabby.getX(), width = this.getWidth(), compare = this.Max; if (compare < this.Min) { compare = this.Min; }
    if (evtArgs.Tooltip !== true) { this.RightValue = Math.min(this.getValueFunction((width + val) / width), compare); }
    this.stopDrag(evtArgs);
}; Adiamor.ui.Slider.prototype.startDragBottom = function (evt) { this.OnStartDrag.notify(this, this.BottomGrabbyDD); this.BottomGrabbyDD.startDrag(); Adiamor.html.cancelEvent(evt); }; Adiamor.ui.Slider.prototype.startDragTop = function (evt) { this.OnStartDrag.notify(this, this.TopGrabbyDD); this.TopGrabbyDD.startDrag(); Adiamor.html.cancelEvent(evt); }; Adiamor.ui.Slider.prototype.stopBottomDrag = function (evtArgs) {
    var val = Math.abs(this.BottomGrabby.getY()), compare; compare = this.Min; if (compare > this.Max) { compare = this.Max; }
    if (evtArgs.Tooltip !== true) { this.BottomValue = Math.max(this.getSmallValueFunction(val / this.getHeight()), compare); }
    this.stopDrag(evtArgs);
}; Adiamor.ui.Slider.prototype.stopTopDrag = function (evtArgs) {
    var val = Math.abs(this.TopGrabby.getY()), height = this.getHeight(), compare = this.Max; if (compare < this.Min) { compare = this.Min; }
    if (evtArgs.Tooltip !== true) { this.TopValue = Math.min(this.getSmallValueFunction(((height + val + (this.GrabbyHeight)) / height) - 1), compare); }
    this.stopDrag(evtArgs);
}; Adiamor.ui.Slider.prototype.stopDrag = function (evtArgs) {
    var type, evt, Grabby, step, y, mod, div, offset, leftoffset, rightoffset, x; type = this.ElementClassName.substring(7); evt = evtArgs.Event; Grabby = evtArgs.DragElement; offset = 5; g_diamondData.setParam('diamond', null); step = Math.floor((this.getWidth()) / this.Ticks); x = Grabby.getX(); if (this.Discrete) {
        mod = (x % step); div = Math.floor(x / step); if (x > (div * step + step / 2)) { x = (div + 1) * step; }
        else if (x <= div * step + step / 2) { x = (div) * step; }
        leftoffset = 0; rightoffset = 0; offset = 0; if ((this.LeftGrabby.getX() + 6) > (this.getWidth() + this.RightGrabby.getX())) {
            if (x < 0) { x += step; rightoffset = (this.Min > this.Max ? -1 : 1); }
            else { x -= step; leftoffset = (this.Min > this.Max ? 1 : -1); } 
        }
        if (typeof (this.LeftValue) == "undefined") { this.LeftValue = this.Min; }
        if (typeof (this.RightValue) == "undefined") { this.RightValue = this.Max; }
        this.LeftValue = Math.round(this.LeftValue) + leftoffset; this.RightValue = Math.round(this.RightValue) + rightoffset; Grabby.setX(x);
    }
    this.OnRangeChanged.notify({ 'slider': this }); Adiamor.html.cancelEvent(evt);
}; Adiamor.ui.Slider.prototype.getMinValue = function () {
    var type = this.ElementClassName.substring(7), minVal; if (this.LeftValue != null) { return this.LeftValue; }
    else {
        minVal = this.LeftGrabby.getX() / this.getWidth(); if (minVal == 0 && this.Discrete) { minVal = -0.01; }
        minVal = this.getValueFunction(minVal); return minVal;
    } 
}; Adiamor.ui.Slider.prototype.setMinValue = function (minValue) { var type = this.ElementClassName.substring(7); this.LeftValue = minValue; this.LeftGrabby.setX(this.getWidth() * this.setValueFunction(minValue), this.LeftValue); }; Adiamor.ui.Slider.prototype.getMaxValue = function () {
    var type = this.ElementClassName.substring(7), maxVal, width; if (this.RightValue != null) { return this.RightValue; }
    else {
        width = this.getWidth(); maxVal = ((width + this.RightGrabby.getX()) / width); if (maxVal == 1 && this.Discrete) { maxVal = 1.01; }
        maxVal = this.getValueFunction(maxVal); return maxVal;
    } 
}; Adiamor.ui.Slider.prototype.setMaxValue = function (maxValue) { var type = this.ElementClassName.substring(7), width; this.RightValue = maxValue; width = this.getWidth(); this.RightGrabby.setX(width * this.setValueFunction(maxValue) - width, this.RightValue); }; Adiamor.ui.Slider.prototype.handleLeftOverlayClick = function (evtArgs) { var coords = Adiamor.html.getEventCoords(evtArgs); this.LeftGrabby.setX((coords.x - this.MinXCoord)); this.stopLeftDrag({ "DragElement": this.LeftGrabby, "Event": evtArgs }); }; Adiamor.ui.Slider.prototype.handleRightOverlayClick = function (evtArgs) { var coords = Adiamor.html.getEventCoords(evtArgs); this.RightGrabby.setX((coords.x - this.MaxXCoord)); this.stopRightDrag({ "DragElement": this.RightGrabby, "Event": evtArgs }); }; Adiamor.ui.Slider.prototype.handleTopOverlayClick = function (evtArgs) { var coords = Adiamor.html.getEventCoords(evtArgs); this.TopGrabby.setY((coords.y - this.MaxYCoord)); this.stopTopDrag({ "DragElement": this.TopGrabby, "Event": evtArgs }); }; Adiamor.ui.Slider.prototype.handleBottomOverlayClick = function (evtArgs) { var coords = Adiamor.html.getEventCoords(evtArgs); this.BottomGrabby.setY((coords.y - this.MaxYCoord)); this.stopBottomDrag({ "DragElement": this.BottomGrabby, "Event": evtArgs }); }; Adiamor.ui.Slider.prototype.handleSliderClick = function (evtArgs, elem) {
    if (evtArgs.srcElement.getAttribute("type") == "text") { return true; }
    var coords, type, click, rightX, leftX, width; coords = Adiamor.html.getEventCoords(evtArgs); type = this.ElementClassName.substring(7); click = coords.x - this.MinXCoord; rightX = this.RightGrabby.getX(); leftX = this.LeftGrabby.getX(); width = this.getWidth(); if (click - leftX < (width - click - Math.abs(rightX))) { this.handleLeftOverlayClick(evtArgs); } else { this.handleRightOverlayClick(evtArgs); } 
}; Adiamor.ui.Slider.prototype.handleMouseover = function (evtArgs, elem) { Adiamor.html.addClass(this.LeftGrabby.m_HtmlElementHandle, 'slider-grabbyleft' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.RightGrabby.m_HtmlElementHandle, 'slider-grabbyright' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.LeftOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.RightOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); }; Adiamor.ui.Slider.prototype.handleMouseout = function (evtArgs, elem) { Adiamor.html.removeClass(this.LeftGrabby.m_HtmlElementHandle, 'slider-grabbyleft' + this.ClassPostFix + '-o'); Adiamor.html.removeClass(this.RightGrabby.m_HtmlElementHandle, 'slider-grabbyright' + this.ClassPostFix + '-o'); Adiamor.html.removeClass(this.LeftOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); Adiamor.html.removeClass(this.RightOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.LeftOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + ''); Adiamor.html.addClass(this.RightOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + ''); }; Adiamor.ui.Slider.prototype.handleMouseoverP = function (evtArgs, elem) {
    Adiamor.html.addClass(elem, 'ActiveSlider'); Adiamor.html.addClass(this.Container, 'slider-container' + this.ClassPostFix + '-on'); try { var imgName = this.Container.id; imgName = imgName.replace("slider-container-", ""); imgName = imgName.replace("-mini", ""); $("slider-" + imgName + "-info").style.visibility = "visible"; }
    catch (ex) { }
    Adiamor.html.addClass(this.LeftGrabby.m_HtmlElementHandle, 'slider-grabbyleft' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.RightGrabby.m_HtmlElementHandle, 'slider-grabbyright' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.LeftOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.RightOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o');
}; Adiamor.ui.Slider.prototype.handleMouseoutP = function (evtArgs, elem) {
    var eloop = null, found, imgName, sRecord, i; if (evtArgs.toElement != null) {
        if (typeof (this.Element.parentElement) != "undefined") { eloop = evtArgs.toElement.parentElement; }
        else { eloop = evtArgs.toElement.parentNode; } 
    }
    found = (evtArgs.toElement == elem); while (eloop != null && !found) {
        if (eloop == elem) { found = true; }
        if (typeof (this.Element.parentElement) != "undefined") { eloop = eloop.parentElement; }
        else { eloop = eloop.parentNode; } 
    }
    if (!found) {
        try { imgName = this.Container.id; imgName = imgName.replace("slider-container-", ""); imgName = imgName.replace("-mini", ""); $("slider-" + imgName + "-info").style.visibility = "hidden"; }
        catch (ex) { }
        Adiamor.html.removeClass(elem, 'ActiveSlider'); Adiamor.html.removeClass(this.Container, 'slider-container' + this.ClassPostFix + '-on'); Adiamor.html.removeClass(this.LeftGrabby.m_HtmlElementHandle, 'slider-grabbyleft' + this.ClassPostFix + '-o'); Adiamor.html.removeClass(this.RightGrabby.m_HtmlElementHandle, 'slider-grabbyright' + this.ClassPostFix + '-o'); Adiamor.html.removeClass(this.LeftOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); Adiamor.html.removeClass(this.RightOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + '-o'); Adiamor.html.addClass(this.LeftOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + ''); Adiamor.html.addClass(this.RightOverlay.m_HtmlElementHandle, 'slider-overlay' + this.ClassPostFix + ''); sRecord = null; for (i = 0; i < g_miniSliders.length; i += 1) { if (g_miniSliders[i].name == this.Container.id.replace("slider-container-", "")) { sRecord = g_mainSliders[i]; } }
        if (sRecord == null) { for (i = 0; i < g_smallSliders.length; i += 1) { if (g_smallSliders[i].name == this.Container.id.replace("slider-container-", "")) { sRecord = g_smallSliders[i]; } } }
        hideSliderInfo(sRecord);
    } 
}; Adiamor.ui.Slider.prototype.getWidth = function () { return (this.Width - 2 * this.GrabbyWidth); }; Adiamor.ui.Slider.prototype.getHeight = function () { return (this.Height - 2 * this.GrabbyHeight); }; Adiamor.ui.Slider.prototype.getValueFunction = function (val) { return ((this.Max - this.Min) * val + this.Min); }; Adiamor.ui.Slider.prototype.setValueFunction = function (val) { return (val - this.Min) / (this.Max - this.Min); }; Adiamor.ui.Slider.prototype.getSmallValueFunction = function (val) { return ((this.Min - this.Max) * val + this.Max); }; Adiamor.ui.Slider.prototype.setSmallValueFunction = function (val) {
    var offset = 0; if (this.Discrete) { offset = 1; }
    return ((val - offset) - this.Max) / (this.Min - this.Max);
}; Adiamor.ui.Slider.expGetValueFunction = function (x) { var val = (this.Min + this.Slope * (Math.exp(x * Math.log((this.Max - this.Min) / this.Slope + 1)) - 1)); return val; }; Adiamor.ui.Slider.expSetValueFunction = function (y) { var val = (Math.log((y - this.Min) / this.Slope + 1) / (Math.log((this.Max - this.Min) / this.Slope + 1))); return val; }; function connect(method1, method2, object1, object2, filter) {
    var srcMethod = object1[method1]; if (filter instanceof Function) { object1[method1] = function (val) { srcMethod.apply(object1, arguments); val = filter.call(this, val); method2.call(object2, val); }; }
    else { object1[method1] = function (val) { srcMethod.apply(object1, arguments); method2.call(object2, val); }; } 
}
Adiamor.lang.defineNs("Adiamor.ui"); Adiamor.ui.Scrollbar = function () { this.uid = Adiamor.base.getUid(); this.OnScroll = new Adiamor.base.SubjectHelper(); }; Adiamor.ui.Scrollbar.prototype.render = function () { }; Adiamor.ui.Scrollbar.prototype.attachToParent = function (HtmlContainer, HtmlElement, HtmlSurface) {
    this.HtmlContainer = HtmlContainer; this.HtmlElement = HtmlElement || Adiamor.html.getFirstChild(this.HtmlContainer); if (this.HtmlElement == null) { this.render(); }
    else { this.HtmlElement.style.overflow = "auto"; }
    this.HtmlSurface = HtmlSurface || Adiamor.html.getFirstChild(this.HtmlElement); this.HtmlSurface.style.width = 1; Adiamor.html.attachEvent(this.HtmlElement, "scroll", this.scrollByUser, this);
}; Adiamor.ui.Scrollbar.prototype.scrollByUser = function () { this.OnScroll.notify(this.getScrollPercent()); }; Adiamor.ui.Scrollbar.prototype.getScrollPercent = function () { }; Adiamor.ui.Scrollbar.prototype.setRange = function (size) { }; Adiamor.ui.Scrollbar.prototype.getWidth = function () { return 17; }; Adiamor.ui.Scrollbar.prototype.getHeight = function () { return 17; }; Adiamor.ui.VerticalScrollbar = function () { Adiamor.ui.VerticalScrollbar.baseConstructor.call(this); }; Adiamor.lang.extend(Adiamor.ui.VerticalScrollbar, Adiamor.ui.Scrollbar); Adiamor.ui.VerticalScrollbar.prototype.setScrollPercent = function (percent) { this.HtmlElement.scrollTop = (this.HtmlSurface.clientHeight - this.HtmlElement.clientHeight) * percent; return false; }; Adiamor.ui.VerticalScrollbar.prototype.getScrollPercent = function () { return (this.HtmlElement.scrollTop / (this.HtmlSurface.clientHeight - this.HtmlElement.clientHeight)); }; Adiamor.ui.VerticalScrollbar.prototype.setRange = function (size) { this.HtmlSurface.style.height = size + 'px'; }; Adiamor.lang.defineNs('Adiamor.collections'); Adiamor.collections.isHashEmpty = function (hash) {
    var empty = true, item; for (item in hash) { if (hash[item] != null && hash[item] != '') { empty = false; break; } }
    return empty;
}; Adiamor.collections.hashLength = function (hash) {
    var count = 0, item; for (item in hash) { if (hash.hasOwnProperty(item)) { count += 1; } }
    return count;
}; Adiamor.collections.serialize = function (hash) {
    var s = "", item, value, type; for (item in hash) { if (hash.hasOwnProperty(item)) { value = hash[item]; type = typeof (value); if (type == "string" || type == "number") { s += "'" + item + "':'" + value + "',"; } } }
    s = s.substring(0, s.length - 1); return "{" + s + "}";
}; Adiamor.collections.Map = function () { this.head = null; this.tail = null; this.debug = []; }; Adiamor.collections.Map.prototype.insert = function (low, high) {
    low = Number(low); high = Number(high); if (high < low) { return; }
    this.debug.push("insert(" + low + "," + high + ")"); var newNode = new Adiamor.collections.MapNode(low, high), n; if (this.head == null) { this.debug.push("empty cache, adding first node"); this.head = newNode; this.tail = newNode; }
    else {
        n = this.head; while (n != null && low > n.high + 1) { n = n.next; }
        if (n == null) { this.debug.push("appending node to end"); this.tail.next = newNode; newNode.prev = this.tail; this.tail = newNode; }
        else {
            this.debug.push("inserting new node before " + n.toString()); if (n.prev != null) { newNode.prev = n.prev; n.prev.next = newNode; }
            newNode.next = n; n.prev = newNode; while (newNode.mergeNext()) { }
            if (newNode.prev == null) { this.head = newNode; }
            if (newNode.next == null) { this.tail = newNode; } 
        } 
    } 
}; Adiamor.collections.Map.prototype.remove = function (low, high) {
    low = Number(low); high = Number(high); this.debug.push("insert(" + low + "," + high + ")"); if (this.head == null) { }
    else {
        if (high < this.head.low || low > this.tail.high) { return; }
        var start = this.head, end, temp, origLow, origHigh; while (start != null && low > start.high) { start = start.next; }
        if (start == null) { this.debug.push("the range was not found"); }
        else {
            end = start; temp = null; while (end != null && high > end.high) {
                if ((end.next != null && high < end.next.low) || end.next == null) { break; }
                temp = end.next; if (end != start) { this.removeNode(end); }
                end = temp;
            }
            if (start != end) {
                if (high >= end.high) { this.removeNode(end); }
                if (low <= start.low) { this.removeNode(start); } 
            }
            else if (start.low >= low && start.high <= high) { this.removeNode(start); return; }
            else if (low > start.low && high < start.high) { origLow = start.low; origHigh = start.high; this.removeNode(start); this.insert(origLow, low - 1); this.insert(high + 1, origHigh); return; }
            if (end != null && high < end.high) { end.low = high + 1; }
            if (start != null && low > start.low) { start.high = low - 1; } 
        } 
    } 
}; Adiamor.collections.Map.prototype.gaps = function (low, high) {
    if (high < 0 || low < 0 || high < low) { return []; }
    var g, n, minLow; g = []; n = this.head; if (n == null || n.low > high || this.tail.high < low) { g.push(new Adiamor.collections.Range(low, high)); return g; }
    minLow = 0; while (n != null && n.high < low)
    { minLow = n.high + 1; n = n.next; }
    if (n != null) {
        do {
            if (g.length == 0)
            { if (low < n.low) { g.push(new Adiamor.collections.Range(Math.max(low, minLow), Math.min(n.low - 1, high))); } }
            if (high > n.high) {
                if (n.next == null || n.next.low > high)
                { g.push(new Adiamor.collections.Range(n.high + 1, high)); }
                else { g.push(new Adiamor.collections.Range(n.high + 1, n.next.low - 1)); } 
            }
            n = n.next;
        } while (n != null && n.high < high);
    }
    else { g.push(new Adiamor.collections.Range(this.tail.high + 1, high)); }
    return g;
}; Adiamor.collections.Map.prototype.ranges = function (low, high) {
    var g, n, minLow; g = []; n = this.head; if (n == null || n.low > high || this.tail.high < low) { return g; }
    while (n != null && n.high < low)
    { minLow = n.high + 1; n = n.next; }
    if (n != null) { do { g.push(new Adiamor.collections.Range(n.low, n.high)); n = n.next; } while (n != null && n.high < high); }
    return g;
}; Adiamor.collections.Map.prototype.removeNode = function (node) {
    if (node.prev != null) { node.prev.next = node.next; }
    else { this.head = node.next; }
    if (node.next != null) { node.next.prev = node.prev; }
    else { this.tail = node.prev; }
    node = null;
}; Adiamor.collections.Map.prototype.flush = function () {
    var node = this.head, next; while (Boolean(node)) { next = node.next; delete (node); node = next; }
    this.head = null; this.tail = null;
}; Adiamor.collections.Map.prototype.toString = function () {
    var n = this.head, s = []; while (n != null) { s.push(n.toString()); n = n.next; }
    return s.join(",") + '';
}; Adiamor.collections.MapNode = function (low, high) { this.low = low; this.high = high; this.next = null; this.prev = null; }; Adiamor.collections.MapNode.prototype.isIn = function (val) { return ((val >= this.low) && (val <= this.high)); }; Adiamor.collections.MapNode.prototype.mergeNext = function () {
    var next = this.next, nextNext; if (next != null && next.low <= this.high + 1) {
        this.high = Math.max(this.high, next.high); this.low = Math.min(this.low, next.low); nextNext = next.next; this.next = nextNext; if (nextNext != null) { nextNext.prev = this; }
        next.clear(); return true;
    }
    else { return false; } 
}; Adiamor.collections.MapNode.prototype.clear = function () { this.next = null; this.prev = null; }; Adiamor.collections.MapNode.prototype.toString = function () { return "[" + this.low + "," + this.high + "]"; }; Adiamor.collections.Range = function (low, high) { this.low = low; this.high = high; }; Adiamor.collections.Range.prototype.isIn = function (val) { return ((val >= this.low) && (val <= this.high)); }; var imgs = [], index, i; for (i = 0; i < g_checkboxes.length; i += 1) { index = imgs.length; imgs[index] = new Image(); imgs[index].src = g_imagePath + g_checkboxes[i].name + "_d.gif"; }
index = imgs.length; imgs[index] = new Image(); imgs[index].src = g_imagePath + "leftslider_big_over.gif"; index = imgs.length; imgs[index] = new Image(); imgs[index].src = g_imagePath + "leftslider_small_over.gif"; index = imgs.length; imgs[index] = new Image(); imgs[index].src = g_imagePath + "leftslider_mini_over.gif"; var g_sliderExtensionHeightOrig = 50; var g_sliderExtensionHeightFinal = 325; var g_pageTransitionTime = 500; var g_detailUrl = ""; var g_rowInfoPanel; var g_rowComparePanel; var g_rowCompareContents; var g_rowComparePanelTimeout = null; var g_colChooserPanelTimeout = null; var g_resultsPanel; var g_extendedSliders; var g_state = []; var g_currentState = 0; var g_colChooserPanel; var g_colChooserContents; var g_colChooserButton; var g_queryBuilderPanel; var g_queryResultsPanel; var g_queryMask; var g_resultsFound = false; function sliderTutorial(item) { item.Slider.LeftOverlay.m_HtmlElementHandle.style.width = ((item.Slider.Width / 2) - (item.Slider.Width / 20)) + 'px'; item.Slider.RightOverlay.m_HtmlElementHandle.style.width = ((item.Slider.Width / 2) - (item.Slider.Width / 20)) + 'px'; Adiamor.ui.Effects.tutorial({ width: 0 }, [item.Slider.LeftOverlay.m_HtmlElementHandle], 300, null); Adiamor.ui.Effects.tutorial({ width: 0 }, [item.Slider.RightOverlay.m_HtmlElementHandle], 300, null); }
function restoreSliders(sliders, min, max) {
    var found = false, minVal, maxVal, i; for (i = 0; i < sliders.length; i += 1) {
        minVal = readCookie(min + i); if (minVal != null && !(isNaN(parseInt(minVal, 10)))) { sliders[i].Slider.setMinValue(minVal); found = true; }
        else if (sliders[i].Slider.ClassPostFix == "-small") {
            if (sliders[i].Slider.Discrete) { minVal = sliders[i].Slider.Min; minVal += 1; sliders[i].Slider.setMinValue(minVal); }
            else { minVal = sliders[i].Slider.Min; sliders[i].Slider.setMinValue(minVal); } 
        }
        maxVal = readCookie(max + i); if (maxVal != null && !(isNaN(parseInt(maxVal, 10)))) { sliders[i].Slider.setMaxValue(maxVal); found = true; }
        else if (sliders[i].Slider.ClassPostFix == "-small") {
            if (sliders[i].Slider.Discrete) { maxVal = sliders[i].Slider.Max; sliders[i].Slider.setMaxValue(maxVal); }
            else { maxVal = sliders[i].Slider.Max; sliders[i].Slider.setMaxValue(maxVal); } 
        }
        updateDataViewSliderParams({ "slider": sliders[i].Slider }, sliders[i].name);
    }
    return found;
}
function saveEngagementLimit() { createCookie("mamin:1", document.getElementById("mincarat").innerText, 1); createCookie("mamax:1", document.getElementById("maxcarat").innerText, 1); for (i = 0; i < g_checkboxes.length; i += 1) { if (g_checkboxes[i].Checkbox.checked) { createCookie("shape:" + g_checkboxes[i].name, "checked", 1); } else { createCookie("shape:" + g_checkboxes[i].name, null, 1); } } }
function restoreCheckboxes() {
    var found = false, round_cb = null, i, g_cb, n, cookie, cb, img, ncb, nimg; for (i = 0; i < g_checkboxes.length; i += 1) {
        g_cb = g_checkboxes[i]; n = g_cb.name; cookie = readCookie("shape:" + n); cb = g_cb.Checkbox; img = g_cb.Image; ncb = g_cb.CheckboxQr; nimg = g_cb.ImageQr; if (cookie == "checked") { cb.checked = true; ncb.checked = true; img.src = g_imagePath + n + '_d.gif'; nimg.src = g_imagePath + n + '_d.gif'; g_diamondData.setParam('shape_' + n, g_inverseMappings.Shape[n]); found = true; }
        else { cb.checked = false; ncb.checked = false; img.src = g_imagePath + 't' + n + '_d.gif'; nimg.src = g_imagePath + 't' + n + '_d.gif'; g_diamondData.setParam('shape_' + n); if (n == "round") { round_cb = g_cb; } } 
    }
    if (!found) { round_cb.Checkbox.checked = true; round_cb.CheckboxQr.checked = true; round_cb.Image.src = g_imagePath + 'round_d.gif'; round_cb.ImageQr.src = g_imagePath + 'round_d.gif'; g_diamondData.setParam('shape_round', g_inverseMappings.Shape.round); }
    if (onlyRound()) { $('slider-label-size').style.visibility = "hidden"; }
    else { $('slider-label-size').style.visibility = "visible"; } 
}
function saveState() {
    createCookie("sortcolumn", g_grid.SortColumn, 1); createCookie("sortdirection", g_grid.SortDirection, 1); var firstVisibleRow = 0, lastVisibleRow, cb, i; firstVisibleRow += Math.floor(g_grid.View.frame.scrollTop / g_grid.View.RowHeight); lastVisibleRow = 0; lastVisibleRow += Math.ceil(g_grid.View.frame.clientHeight / g_grid.View.RowHeight) + firstVisibleRow; createCookie("startRow", firstVisibleRow, 1); createCookie("endRow", lastVisibleRow, 1); Adiamor.lang.forEach(g_grid.Columns, function (item) { cb = $(item.Name.toLowerCase() + '_cb'); if (cb != null) { if (cb.checked) { createCookie("column:" + item.Name, "visible", 1); } else { createCookie("column:" + item.Name, "invisible", 1); } } }); if (g_miniSliders.Slider == null)
        Adiamor.lang.forEach(g_miniSliders, setupMainSlider); for (i = 0; i < g_miniSliders.length; i += 1) {
        if (g_miniSliders[i].Slider.TooltipEnabled) { createCookie("mamin:" + i, g_miniSliders[i].Slider.LeftTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''), 1); createCookie("mamax:" + i, g_miniSliders[i].Slider.RightTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''), 1); }
        else { createCookie("mamin:" + i, g_miniSliders[i].Slider.getMinValue(), 1); createCookie("mamax:" + i, g_miniSliders[i].Slider.getMaxValue(), 1); } 
    }
    if (g_smallSliders.Slider == null)
        Adiamor.lang.forEach(g_smallSliders, setupMainSlider); for (i = 0; i < g_smallSliders.length; i += 1) {
        if (g_smallSliders[i].Slider.TooltipEnabled) { createCookie("smmin:" + i, g_smallSliders[i].Slider.LeftTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''), 1); createCookie("smmax:" + i, g_smallSliders[i].Slider.RightTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''), 1); }
        else { createCookie("smmin:" + i, parseInt(g_smallSliders[i].Slider.getMinValue(), 10), 1); createCookie("smmax:" + i, parseInt(g_smallSliders[i].Slider.getMaxValue(), 10), 1); } 
    }
    for (i = 0; i < g_checkboxes.length; i += 1) { if (g_checkboxes[i].Checkbox.checked) { createCookie("shape:" + g_checkboxes[i].name, "checked", 1); } else { createCookie("shape:" + g_checkboxes[i].name, null, 1); } } 
}
function setState(obj) {
    Adiamor.lang.forEach(g_miniSliders, function (item, index) { item.Slider.setMinValue(obj[item.name.replace('-mini', '')].left); item.Slider.setMaxValue(obj[item.name.replace('-mini', '')].right); updateDataViewSliderParams({ "slider": item.Slider }, item.name); }); Adiamor.lang.forEach(g_mainSliders, function (item, index) { item.Slider.setMinValue(obj[item.name].left); item.Slider.setMaxValue(obj[item.name].right); updateDataViewSliderParams({ "slider": item.Slider }, item.name); }); Adiamor.lang.forEach(g_smallSliders, function (item, index) { item.Slider.setMinValue(obj[item.name].left); item.Slider.setMaxValue(obj[item.name].right); updateDataViewSliderParams({ "slider": item.Slider }, item.name); }); Adiamor.lang.forEach(g_checkboxes, function (item, index) {
        var n = item.name, cb = item.Checkbox, img = item.Image, ncb = item.CheckboxQr, nimg = item.ImageQr; if (obj[n].checked) { cb.checked = true; ncb.checked = true; img.src = g_imagePath + n + '_d.gif'; nimg.src = g_imagePath + n + '_d.gif'; g_diamondData.setParam('shape_' + n, g_inverseMappings.Shape[n]); }
        else { cb.checked = false; ncb.checked = false; img.src = g_imagePath + 't' + n + '_d.gif'; nimg.src = g_imagePath + 't' + n + '_d.gif'; g_diamondData.setParam('shape_' + n); } 
    });
}
function showSliderInfo(evtObj, element) { Adiamor.html.align(this.Callout.Container, this.info, Adiamor.at | Adiamor.al, 0, 0, 0, this.info.offsetWidth); this.Callout.Container.style.zIndex = 10000; }
function hideSliderInfo(element) { element.Callout.Container.style.left = -5000 + 'px'; }
function setupSliderCallout(item) { var n = item.name; if ($('slider-' + n + '-callout')) { item.Callout = new Adiamor.ui.Panel(); item.Callout.attachToParent($('slider-' + n + '-callout')); item.Callout.setWidth(500); item.Callout.setHeight("auto"); item.info = $('slider-' + n + '-info'); Adiamor.html.attachEvent(item.info, 'mouseover', Adiamor.lang.close(item, showSliderInfo)); } }
function setupBasicSlider(item) { var n = item.name; if (item.Slider == null) { item.Slider = new Adiamor.ui.Slider(item.sliderParams); item.Name = n; item.Slider.ElementClassName = "slider-" + n; item.Slider.attachToParent($("slider-container-" + n)); item.Slider.OnStartDrag.subscribe(Adiamor.lang.close({}, function (slider, grabby) { g_activeSlider = grabby; })); } }
function smallSliderChanged(evtArgs) { updateDataViewSliderParams(evtArgs, this.Name); g_grid.render(); }
function setupSmallSlider(item) { setupBasicSlider(item); setupSliderCallout(item); item.Slider.OnRangeChanged.subscribe(Adiamor.lang.close(item, smallSliderChanged)); }
function hideMask() { g_queryMask.style.display = 'none'; }
function createStateObject() {
    var obj = {}, sliders = g_mainSliders; if (parseInt(g_queryBuilderPanel.style.left, 10) < 0) { sliders = g_miniSliders; }
    Adiamor.lang.forEach(sliders, function (item, index) {
        if (item.Slider.TooltipEnabled) { obj[item.name.replace('-mini', '')] = { "left": item.Slider.LeftTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, ''), "right": item.Slider.RightTooltip.m_HtmlElementHandle.value.replace(/[^0-9|\.]/gi, '') }; }
        else { obj[item.name.replace('-mini', '')] = { "left": item.Slider.getMinValue(), "right": item.Slider.getMaxValue() }; } 
    }); Adiamor.lang.forEach(g_smallSliders, function (item, index) { obj[item.name] = { "right": item.Slider.getMaxValue(), "left": item.Slider.getMinValue() }; }); Adiamor.lang.forEach(g_checkboxes, function (item, index) { obj[item.name] = { "checked": item.Checkbox.checked }; }); return obj;
}
function showQueryResults(saveState, fragment) {
    hideElement(g_queryBuilderPanel); g_queryResultsPanel.style.left = '-2000px'; showElement(g_queryResultsPanel); g_queryMask.style.width = Math.max(g_queryResultsPanel.offsetWidth, $("myGridList").offsetWidth + 30) + 'px'; g_queryMask.style.height = g_queryResultsPanel.offsetHeight + 'px'; positionElement(g_queryResultsPanel, 0, 0); if (g_smallSliders[0].Slider == null) { Adiamor.lang.forEach(g_smallSliders, setupSmallSlider); }
    var found = restoreSliders(g_smallSliders, "smmin:", "smmax:") || found, sliders, i; if (Adiamor.browser.MOZ || Adiamor.browser.IE) {
        if (saveState == null || saveState == true) { g_state.push(createStateObject()); }
        else if (saveState == false) { setState(g_state[fragment]); g_grid.render(); } 
    }
    Adiamor.ui.Effects.fade(g_queryMask, { startValue: 100, endValue: 0 }, g_pageTransitionTime, Adiamor.dom.setOpacity, Adiamor.dom, hideMask); g_grid.render(); sliders = g_mainSliders; for (i = 0; i < g_mainSliders.length; i += 1) { sliders[i] = g_mainSliders[i]; sliders[i].Slider = g_mainSliders[i].Slider; }
    if (document.getElementById("round-qr_cb").checked || document.getElementById("asscher-qr_cb").checked || document.getElementById("emerald-qr_cb").checked || document.getElementById("princess-qr_cb").checked) {
        sliders[2].Ticks = 5; sliders[2].Slider.Ticks = 5; sliders[2].Slider.Max = 5; sliders[2].sliderParams.Max = 5; if (sliders[2].Slider.getMaxValue() == 4) { sliders[2].Slider.setMaxValue(5); }
        if (checkNonRound()) { }
        else { }
        if (parseInt(g_diamondData.params.cut_high, 10) == 4) { g_diamondData.setParam('cut_high', 5); } 
    }
    else {
        sliders[2].Ticks = 4; sliders[2].Slider.Ticks = 4; sliders[2].Slider.Max = 4; sliders[2].sliderParams.Max = 4; if (sliders[2].Slider.getMaxValue() == 5) { sliders[2].Slider.setMaxValue(4); }
        if (sliders[2].Slider.getMinValue() == 4) { sliders[2].Slider.setMinValue(3); }
        if (parseInt(g_diamondData.params.cut_high, 10) == 5) {
            if (parseInt(g_diamondData.params.cut_low, 10) == 4 || parseInt(g_diamondData.params.cut_low, 10) == 5) { g_diamondData.setParam('cut_low', 3); }
            g_diamondData.setParam('cut_high', 4);
        } 
    }
    if (saveState != false) { updateSliders(0); } 
}
function updateResultsPanel() {
    g_resultsFound = true; $('results-pending').style.display = 'none'; var numResults = Adiamor.lang.formatNumber(g_diamondData.getRemoteRowCount(), 0), msg; if (numResults == 0) { msg = $('gridlist-overlay'); showElement(msg); Adiamor.html.align(msg, g_grid.View.element, Adiamor.aw | Adiamor.ah | Adiamor.at | Adiamor.al); }
    if (g_diamondData.params.compare == null) { $('results-recordcount').innerHTML = "(" + numResults + ")"; $('results-found').innerHTML = numResults + " Results Found"; $('results-found').style.display = 'block'; } 
}
function showResultsPending() { if (!g_resultsFound) { $('results-pending').style.display = "block"; $('results-found').style.display = 'none'; window.setTimeout(updateResultsPanel, 3000); } }
function showResultsPanel(slider) {
    g_resultsPanel.Container.style.display = 'block'; if (parseInt(g_resultsPanel.getSurfaceTop(), 10) == 0) { Adiamor.ui.Effects.disappearFromTop(g_resultsPanel, {}, 50, Adiamor.lang.close({}, showResultsPanel, [slider])); }
    else { showResultsPending(); g_resultsPanel.setSurfaceTop(29); g_resultsPanel.show(); Adiamor.html.align(g_resultsPanel.Container, slider.Container, Adiamor.at | Adiamor.al, 0, 0, -g_resultsPanel.Container.offsetHeight, 0); Adiamor.ui.Effects.appearFromBottom(g_resultsPanel, {}, 300); } 
}
function miniSliderChanged(evtArgs) { updateSliders(1); updateDataViewSliderParams(evtArgs, this.Name); g_grid.render(); }
function getDataViewRecordCount() { g_diamondData.setParam("start", 0); g_diamondData.setParam("page_size", 1); g_diamondData.flush(); g_diamondData.get(); }
function mainSliderChanged(evtArgs) { g_resultsFound = false; showResultsPanel(this.Slider); updateDataViewSliderParams(evtArgs, this.Name); getDataViewRecordCount(); }
function setupMiniSlider(item, index) { setupBasicSlider(item); setupSliderCallout(item); item.Slider.OnRangeChanged.subscribe(Adiamor.lang.close(item, miniSliderChanged)); }
function restoreState() {
    var found = false, checked, cb, sortCol, sortDir, i, position; saveEngagementLimit(); if (g_miniSliders[0].Slider == null) { Adiamor.lang.forEach(g_miniSliders, setupMiniSlider); }
    found = restoreSliders(g_miniSliders, "mamin:", "mamax:") || found; found = restoreSliders(g_mainSliders, "mamin:", "mamax:") || found; restoreCheckboxes(); Adiamor.lang.forEach(g_grid.Columns, function (item) { checked = readCookie("column:" + item.Name); cb = $(item.Name.toLowerCase() + '_cb'); if (cb != null) { if (checked == "visible") { item.cssStyle.display = ''; cb.checked = true; } else { item.cssStyle.display = 'none'; cb.checked = false; } } }); sortCol = readCookie("sortcolumn") || 14; sortDir = readCookie("sortdirection") || "ASC"; for (i = 0; i < $('sortList').length; i += 1) { if ($('sortList').options[i].value == sortCol) { $('sortList').selectedIndex = i; } }
    g_grid.setSort(sortCol, sortDir); showQueryResults(null, null, true); showColumns(); position = (readCookie("startRow") * g_grid.View.RowHeight); setTimeout("scrollMove(" + position + ")", 1400); if (!found) { Adiamor.lang.forEach(g_miniSliders, sliderTutorial); } 
}
function hideSliders() { g_resultsPanel.Container.style.display = 'none'; Adiamor.ui.Effects.shrink({ height: g_sliderExtensionHeightOrig }, [g_extendedSliders, Adiamor.html.getFirstChild(g_extendedSliders)], 50); $('slider-extension-show').style.display = 'block'; $('slider-extension-hide').style.display = 'none'; }
function showSliders() { Adiamor.ui.Effects.shrink({ height: g_sliderExtensionHeightFinal }, [g_extendedSliders, Adiamor.html.getFirstChild(g_extendedSliders)], 100); $('slider-extension-show').style.display = 'none'; $('slider-extension-hide').style.display = 'block'; }
function fadeSlidersIn() { Adiamor.ui.Effects.fade($('query-results-filter'), { startValue: 0, endValue: 100 }, 500, Adiamor.dom.setOpacity, Adiamor.dom, null); Adiamor.html.detachEvent($('query-collapse'), 'click', expandSliders); Adiamor.html.attachEvent($('query-collapse'), 'click', collapseSliders); }
function fadeSlidersOut() { Adiamor.ui.Effects.shrink({ height: 0 }, [$('query-results-filter')], 50); Adiamor.html.detachEvent($('query-collapse'), 'click', collapseSliders); Adiamor.html.attachEvent($('query-collapse'), 'click', expandSliders); }
function collapseSliders(evtArgs, elem, saveState, fragment) { Adiamor.ui.Effects.fade($('query-results-filter'), { startValue: 100, endValue: 0 }, 500, Adiamor.dom.setOpacity, Adiamor.dom, fadeSlidersOut); }
function expandSliders(evtArgs, elem, saveState, fragment) { Adiamor.ui.Effects.shrink({ height: 245 }, [$('query-results-filter')], 50, fadeSlidersIn); }
function showQueryBuilder(saveState, fragment) {
    if (Adiamor.browser.MOZ || Adiamor.browser.IE) {
        if (saveState == null || saveState == true) { Adiamor.browser.History.instance.add('querybuilder.html#' + (g_state.length)); g_state.push(createStateObject()); }
        else if (saveState == false) { setState(g_state[fragment]); getDataViewRecordCount(); } 
    }
    hideElement(g_queryResultsPanel); g_queryBuilderPanel.style.left = '-2000px'; showElement(g_queryBuilderPanel); g_queryMask.style.width = (g_queryBuilderPanel.offsetWidth + 100) + 'px'; g_queryMask.style.height = g_queryBuilderPanel.offsetHeight + 'px'; positionElement(g_queryBuilderPanel, 0, 0); Adiamor.html.align(g_queryMask, g_queryBuilderPanel, Adiamor.al | Adiamor.at | Adiamor.ah, 0, 30); showElement(g_queryBuilderPanel); Adiamor.ui.Effects.fade(g_queryMask, { startValue: 100, endValue: 0 }, g_pageTransitionTime, Adiamor.dom.setOpacity, Adiamor.dom, hideMask); if (saveState != false) { updateSliders(1); } 
}
function hideQueryBuilder(evtArgs, evtElem, saveState, fragment) { g_queryMask.style.display = 'block'; Adiamor.html.align(g_queryMask, g_queryBuilderPanel, Adiamor.al | Adiamor.at | Adiamor.aw | Adiamor.ah, 0, 30); Adiamor.ui.Effects.fade(g_queryMask, { startValue: 0, endValue: 100 }, g_pageTransitionTime, Adiamor.dom.setOpacity, Adiamor.dom, Adiamor.lang.close(this, showQueryResults, [saveState, fragment])); }
function hideColChooserPanel() { hideElement(g_colChooserPanel.Container); hideElement(g_colChooserContents); }
function hideQueryResults(evtArgs, elem, saveState, fragment) { hideColChooserPanel(); g_queryMask.style.display = 'block'; Adiamor.html.align(g_queryMask, g_queryResultsPanel, Adiamor.aw | Adiamor.ah, 0, 30); Adiamor.ui.Effects.fade(g_queryMask, { startValue: 0, endValue: 100 }, g_pageTransitionTime, Adiamor.dom.setOpacity, Adiamor.dom, Adiamor.lang.close(this, showQueryBuilder, [saveState, fragment])); }
function restoreBackButtonState(url, fragment) {
    if (g_state[fragment] != null) {
        if (parseInt(g_queryBuilderPanel.style.left, 10) < 0) {
            if (url == "querybuilder.html") { hideQueryResults(null, null, false, fragment); }
            else { setState(g_state[fragment]); } 
        }
        else {
            if (url == "queryresults.html") { hideQueryBuilder(null, null, false, fragment); }
            else { setState(g_state[fragment]); } 
        } 
    } 
}
function displayOptionalSlider(evtArgs, elem, saveState, fragment) {
    var mask = $("slider-mask-" + this.id.substring(6)), label = $("label-" + this.id.substring(6)); if (mask.style.display == "none" || mask.style.display == "") {
        $('slider-mask-polish').style.display = "none"; $('slider-mask-symmetry').style.display = "none"; $('slider-mask-depth').style.display = "none"; $('slider-mask-table').style.display = "none"; $('slider-mask-size').style.display = "none"; $('slider-mask-fluor').style.display = "none"; if (this.id.substring(6) == "size") { label.src = "http://www.adiamor.com/media/Adiamor/lwlabel_on.gif"; }
        else { label.src = "http://www.adiamor.com/media/Adiamor/" + this.id.substring(6) + "label_on.gif"; }
        mask.style.display = "block";
    }
    else {
        mask.style.display = "none"; if (this.id.substring(6) == "size") { label.src = "http://www.adiamor.com/media/Adiamor/lwlabel.gif"; }
        else { label.src = "http://www.adiamor.com/media/Adiamor/" + this.id.substring(6) + "label.gif"; } 
    } 
}
function clickDiamond(evtObj) {
    var id = evtObj.srcElement.id, n = this.name, cb = this.Checkbox, img = this.Image, ncb = this.CheckboxQr, nimg = this.ImageQr, sliders, i; g_smallSliders[2].Slider.setMinValue(45); g_smallSliders[2].Slider.setMaxValue(86); g_smallSliders[3].Slider.setMinValue(49); g_smallSliders[3].Slider.setMaxValue(89); g_smallSliders[4].Slider.setMinValue(0.50); g_smallSliders[4].Slider.setMaxValue(2.75); g_diamondData.setParam('depth_low', 45); g_diamondData.setParam('depth_high', 86); g_diamondData.setParam('table_low', 49); g_diamondData.setParam('table_high', 89); g_diamondData.setParam('size_low', 0.75); g_diamondData.setParam('size_high', 2.75); if (id.indexOf("-qr") > 0) { cb = this.CheckboxQr; img = this.ImageQr; ncb = this.Checkbox; nimg = this.Image; }
    if (cb.checked) {
        if (id.indexOf("_cb") < 0) { cb.checked = false; }
        ncb.checked = false; img.src = g_imagePath + 't' + n + '_d.gif'; nimg.src = g_imagePath + 't' + n + '_d.gif'; if (checkNumShapes() > 0) { g_diamondData.setParam('shape_' + n); } 
    }
    else {
        if (checkNumShapes() == 0) { g_diamondData.setParam('shape_asscher'); g_diamondData.setParam('shape_cushion'); g_diamondData.setParam('shape_emerald'); g_diamondData.setParam('shape_heart'); g_diamondData.setParam('shape_marquise'); g_diamondData.setParam('shape_oval'); g_diamondData.setParam('shape_pear'); g_diamondData.setParam('shape_princess'); g_diamondData.setParam('shape_radiant'); g_diamondData.setParam('shape_round'); }
        if (id.indexOf("_cb") < 0) { cb.checked = true; }
        ncb.checked = true; img.src = g_imagePath + n + '_d.gif'; nimg.src = g_imagePath + n + '_d.gif'; g_diamondData.setParam('shape_' + n, g_inverseMappings.Shape[n]);
    }
    g_diamondData.setParam('diamond', '1'); if (id.indexOf("-qr") > 0) { sliders = g_miniSliders; for (i = 0; i < g_miniSliders.length; i += 1) { sliders[i] = g_miniSliders[i]; sliders[i].Slider = g_miniSliders[i].Slider; } }
    else { sliders = g_mainSliders; for (i = 0; i < g_mainSliders.length; i += 1) { sliders[i] = g_mainSliders[i]; sliders[i].Slider = g_mainSliders[i].Slider; } }
    if (firstClick == false && n != "round") {
        firstClick = true; document.getElementById("round-qr_cb").checked = false; document.getElementById("round_cb").checked = false; document.getElementById("round-qr_img").src = g_imagePath + 'tround_d.gif'; document.getElementById("round_img").src = g_imagePath + 'tround_d.gif'; g_diamondData.setParam('shape_round'); sliders[2].Ticks = 4; sliders[2].Slider.Ticks = 4; sliders[2].Slider.Max = 4; sliders[2].sliderParams.Max = 4; if (sliders[2].Slider.getMaxValue() == 5 || sliders[2].Slider.getMaxValue() == "5") { sliders[2].Slider.setMaxValue(4); }
        if (sliders[2].Slider.getMinValue() == 4 || sliders[2].Slider.getMinValue() == "4") { sliders[2].Slider.setMinValue(3); }
        if ($('ntb-sliderAdiamor__uid__11') != null) { $('ntb-sliderAdiamor__uid__11').className = "slider-bg-repeat slider-element slider-cut-mini-noround"; }
        if ($('ntb-sliderAdiamor__uid__6') != null) { $('ntb-sliderAdiamor__uid__6').className = "slider-bg-repeat slider-element slider-cut-noround"; }
        if ($('cutmarkings') != null) { $('cutmarkings').src = "http://www.adiamor.com/media/Adiamor/cutmarkings2.gif"; }
        if (parseInt(g_diamondData.params.cut_high, 10) == 5) {
            if (parseInt(g_diamondData.params.cut_low, 10) == 4 || parseInt(g_diamondData.params.cut_low, 10) == 5) { g_diamondData.setParam('cut_low', 3); }
            g_diamondData.setParam('cut_high', 4);
        } 
    }
    else {
        firstClick = true; if (n == "round") {
            if (ncb.checked) {
                sliders[2].Ticks = 5; sliders[2].Slider.Ticks = 5; sliders[2].Slider.Max = 5; sliders[2].sliderParams.Max = 5; if (sliders[2].Slider.getMaxValue() == 4 || sliders[2].Slider.getMaxValue() == "4") { sliders[2].Slider.setMaxValue(5); }
                if (parseInt(g_diamondData.params.cut_high, 10) == 4) { g_diamondData.setParam('cut_high', 5); } 
            }
            else {
                sliders[2].Ticks = 4; sliders[2].Slider.Ticks = 4; sliders[2].Slider.Max = 4; sliders[2].sliderParams.Max = 4; if (sliders[2].Slider.getMaxValue() == 5 || sliders[2].Slider.getMaxValue() == "5") { sliders[2].Slider.setMaxValue(4); }
                if (sliders[2].Slider.getMinValue() == 4 || sliders[2].Slider.getMinValue() == "4") { sliders[2].Slider.setMinValue(3); }
                if (parseInt(g_diamondData.params.cut_high, 10) == 5) {
                    if (parseInt(g_diamondData.params.cut_low, 10) == 4 || parseInt(g_diamondData.params.cut_low, 10) == 5) { g_diamondData.setParam('cut_low', 3); }
                    g_diamondData.setParam('cut_high', 4);
                } 
            } 
        } 
    }
    updateSliders(1); updateSliders(0); g_diamondData.flush();
}
function clickDiamondQb(evtObj) { g_resultsFound = false; showResultsPending(); clickDiamond.call(this, evtObj); getDataViewRecordCount(); }
function clickDiamondQr(evtObj) { clickDiamond.call(this, evtObj); g_grid.render(); }
function setupCheckbox(item) {
    var n = item.name; item.Panel = $('checkbox-' + n); item.PanelQr = $('checkbox-' + n + '-qr'); item.Image = $(n + '_img'); item.ImageQr = $(n + '-qr_img'); item.Checkbox = $(n + '_cb'); item.CheckboxQr = $(n + '-qr_cb'); if (item.Checkbox.checked) { item.Image.src = g_imagePath + n + '_d.gif'; item.ImageQr.src = g_imagePath + n + '_d.gif'; g_diamondData.setParam('shape_' + n, g_inverseMappings.Shape[n]); }
    Adiamor.html.attachEvent(item.Panel, 'mousedown', Adiamor.lang.close(item, clickDiamondQb)); Adiamor.html.attachEvent(item.PanelQr, 'mousedown', Adiamor.lang.close(item, clickDiamondQr));
}
function setupMainSlider(item) { setupBasicSlider(item); setupSliderCallout(item); item.Slider.OnRangeChanged.subscribe(Adiamor.lang.close(item, mainSliderChanged)); }
function setSliderLimits(getCompleteEventArgs) {
    var data = getCompleteEventArgs.payload.limits, n, s, newMin, newMax, i; if (data == null || tooltip != null) { return; }
    for (i = 0; i < g_mainSliders.length; i += 1) {
        mainSlider = g_mainSliders[i].Slider; miniSlider = g_miniSliders[i].Slider; n = g_mainSliders[i].name; if (data[n] != null) {
            newMin = Math.max(mainSlider.getMinValue(), data[n].min); newMax = Math.min(mainSlider.getMaxValue(), data[n].max); mainSlider.Max = data[n].max; mainSlider.Min = data[n].min; if (miniSlider != null) { miniSlider.Max = data[n].max; miniSlider.Min = data[n].min; }
            mainSlider.setMinValue(newMin); mainSlider.setMaxValue(newMax); if (miniSlider != null) { miniSlider.setMinValue(newMin); miniSlider.setMaxValue(newMax); } 
        } 
    }
    for (i = 0; i < g_smallSliders.length; i += 1) { s = g_smallSliders[i].Slider; n = g_smallSliders[i].name; if (data[n] != null) { newMin = Math.max(s.getMinValue(), data[n].min); newMax = Math.min(s.getMaxValue(), data[n].max); s.Max = data[n].max; s.Min = data[n].min; s.setMinValue(newMin); s.setMaxValue(newMax); } } 
}
function showInfoPanel(row) {
    var dRow = parseInt(row.getAttribute('row'), 10), cols, s, title, i, cb, show, val, topOffset, arrow_offset, horizontal_offset; cols = [{ "label": "Item Number:", "column": "ID" }, { "label": "<img src=\"http://www.adiamor.com/media/Adiamor/cert.gif\" alt=\"\" style=\"margin: 0px 4px -2px 0px; \" />", "column": "Cert" }, { "label": "Shape", "column": "Shape" }, { "label": "Culet", "column": "Culet" }, { "label": "Depth", "column": "Depth" }, { "label": "Table", "column": "Tbl" }, { "label": "Polish", "column": "Pol" }, { "label": "Symmetry", "column": "Sym" }, { "label": "Fluorescence", "column": "Fluor" }, { "label": "Measurements", "column": "Meas" }, { "label": "L/W Ratio", "column": "Size" }, { "label": "Girdle", "column": "Girdle" }, { "label": "Price", "column": "SPrice" }, { "label": "ID", "column": "ID" }, { "label": "Selected", "column": "Selected" }, { "label": "ID", "column": "ID"}]; s = []; s.push('<br><div style="height: 450px">'); title = g_grid.DataSource.getMappedValue(dRow, g_grid.ColumnsMap.Cert) + "-Certified-"; title += g_grid.DataSource.getMappedValue(dRow, g_grid.ColumnsMap.Color) + "-" + g_grid.DataSource.getMappedValue(dRow, g_grid.ColumnsMap.Clar) + "-"; title += g_grid.DataSource.getMappedValue(dRow, g_grid.ColumnsMap.Cut).replace(" ", "-") + "-Cut-"; title += g_grid.DataSource.getMappedValue(dRow, g_grid.ColumnsMap.Shape) + "-Diamond"; for (i = 0; i < cols.length; i += 1) {
        cb = $(cols[i].column.toLowerCase() + '_cb'); show = true; if (cb != null) { if (cb.checked) { show = false; } }
        val = g_diamondData.getMappedValue(dRow, g_grid.ColumnsMap[cols[i].column]); if (cols[i].column == "Pol" || cols[i].column == "Sym") { val = val.replace(/EX/g, "Excellent"); val = val.replace(/ID/g, "Ideal"); val = val.replace(/G/g, "Good"); val = val.replace(/VG/g, "Very G"); val = val.replace(/F/g, "Fair"); }
        else if (cols[i].column == "Fluor") { val = val.replace(/VS/g, "Very Strong"); val = val.replace(/SB/g, "Strong"); val = val.replace(/MB/g, "Medium"); val = val.replace(/N/g, "None"); val = val.replace(/F/g, "Faint"); }
        if (show && val != null && val != "") {
            if (i == 0) { s.push('<a class="Header" href="http://www.adiamor.com/Diamonds/' + title + '/D' + val + '">D-' + val + '</a>'); }
            else if (i == 1) { s.push('<div class="Value" style="padding-bottom: 10px;">' + cols[i].label + 'Certified by ' + val + '</div>'); }
            else if (i == 10) {
                var shape = g_diamondData.getMappedValue(dRow, g_grid.ColumnsMap[cols[2].column]); if (shape.toLowerCase() == "round") { }
                else { s.push('<div class="Value"><strong>' + cols[i].label + ':</strong> ' + val + '</div>'); } 
            }
            else if (i == 12) { s.push('<div class="Price"><strong>' + cols[i].label + ':</strong> ' + formatMoney0_detail(val) + '</div>'); }
            else if (i == 13) { s.push('<div class="Button"><a href="http://www.adiamor.com/Diamonds/' + title + '/D' + val + '"><img src="http://www.adiamor.com/media/Adiamor/Moredetails.gif" onmouseover=\'this.src="http://www.adiamor.com/media/Adiamor/Moredetails_over.gif"\' onmouseout="this.src=\'http://www.adiamor.com/media/Adiamor/Moredetails.gif\'" alt="View More Details" /></a></div>'); }
            else if (i == 14) {
                if (g_grid.SelectedRows[row.id.replace("list_row_", "")] != null) { s.push('<div class="Button"><img src="http://www.adiamor.com/media/Adiamor/removefromcompare.gif" onclick="CompareClick(' + dRow + ',this)" alt="Add to Compare" style="cursor:pointer;cursor:hand;" /></div>'); }
                else { s.push('<div class="Button"><img src="http://www.adiamor.com/media/Adiamor/Addtocompare.gif" onclick="CompareClick(' + dRow + ',this)" onmouseover=\'this.src="http://www.adiamor.com/media/Adiamor/Addtocompare_over.gif"\' onmouseout="this.src=\'http://www.adiamor.com/media/Adiamor/Addtocompare.gif\'" alt="Add to Compare" style="cursor:pointer;cursor:hand;" /></div>'); } 
            }
            else if (i == 15) {
                if (sessionBRF == "true") { s.push('<div class="Button"><a href="http://www.adiamor.com/addBuildDiamond.aspx?addDiamond=1&ID=' + val + '"><img src="http://www.adiamor.com/media/Adiamor/addtoring.gif" alt="Add to Ring" style="cursor:pointer;cursor:hand;" /></a></div>'); }
                else if (sessionPendant == "start") { s.push('<div class="Button"><a href="http://www.adiamor.com/addBuildDiamond.aspx?addDiamondPendant=1&ID=' + val + '"><img src="http://www.adiamor.com/images/buttons/btnAddtoPendantDS.gif" alt="Add to Pendant" style="cursor:pointer;cursor:hand;" /></a></div>'); }
                else { s.push('<div class="Button" style="position: relative;">'); s.push('    <img onclick="AddtoMenu(true);" src="http://www.adiamor.com/media/Adiamor/selectdiamondDS.gif" alt="Select This Diamond" style="cursor:pointer;" />'); s.push('    <ul class="DetailsDropDown3" id="CartControl" style="top: -57px; width: 154px;">'); s.push('     <li id="CartControlBYRLI"><a id="CartControlBYRA" href="http://www.adiamor.com/addBuildDiamond.aspx?addDiamond=1&ID=' + val + '" style="font-size: 11px;">With a ring</a>'); s.push('     <li id="CartControlRingLI"><a id="CartControlRingA" href="http://www.adiamor.com/addBuildDiamond.aspx?addDiamondSolo=1&ID=' + val + '" style="font-size: 11px;">Without a ring</a>'); s.push('     <li id="CartControlPendantLI"><a id="CartControlPendantA" href="http://www.adiamor.com/addBuildDiamond.aspx?addDiamondPendant=1&ID=' + val + '" style="font-size: 11px;">With a pendant</a>'); s.push('    </ul>'); s.push('</div>'); } 
            }
            else if (i == 11) {
                var shape = g_diamondData.getMappedValue(dRow, g_grid.ColumnsMap[cols[2].column]); if (shape.toLowerCase() == "round") { s.push('<div class="Value" style="height: 32px;"><strong>' + cols[i].label + ':</strong> ' + val + '</div>'); s.push('<div class="Value">&nbsp;</div>'); }
                else { s.push('<div class="Value" style="height: 32px;"><strong>' + cols[i].label + ':</strong> ' + val + '</div>'); } 
            }
            else { s.push('<div class="Value"><strong>' + cols[i].label + ':</strong> ' + val + '</div>'); } 
        }
        else { if (i == 3) { s.push('<div class="Value"><strong>' + cols[i].label + ':</strong> None</div>'); } } 
    }
    s.push('</div>'); Adiamor.lang.forEach(g_grid.Columns, function (item) { }); hideColChooserPanel(); $("panel-rowdetail-contents").innerHTML = s.join(''); topOffset = 0; arrow_offset = (dRow * g_grid.RowHeight) + 26; horizontal_offset = 185; if (Adiamor.browser.MOZ) { topOffset -= $("ListDataFrame").scrollTop; horizontal_offset = 186; }
    Adiamor.html.align(g_rowInfoPanel.Container, document.getElementById('myGridList'), Adiamor.at | Adiamor.al, 0, 0, 24, g_grid.Header.Container.clientWidth - horizontal_offset); Adiamor.html.align(g_rowInfoPanelArrow.Container, document.getElementById('myGridList'), Adiamor.at | Adiamor.al, 0, 0, arrow_offset, g_grid.Header.Container.clientWidth - horizontal_offset);
}
function catcher(event) {
    var targ; if (!e) { var e = window.event; }
    if (e.target) { targ = e.target; }
    else if (e.srcElement) { targ = e.srcElement; }
    if (targ.nodeType == 3) { targ = targ.parentNode; } 
}
document.onmousedown = catcher; function CompareClick(row, el) {
    var domRow = $('list_row_' + row), tmp1 = "", cookieValue, id, id2, count, item; if (g_grid.SelectedRows[row] != null) {
        cookieValue = readCookie("compare"); id = "D|" + g_grid.DataSource.data[row][g_grid.ColumnsMap.ID] + "-"; id2 = "T|" + g_grid.DataSource.data[row][g_grid.ColumnsMap.ID] + "-"; if (cookieValue != null) { cookieValue = cookieValue.replace(id, ""); cookieValue = cookieValue.replace(id2, ""); createCookie("compare", cookieValue, 90); }
        g_grid.setRowClass(g_grid.SelectedRows[row], row); delete g_grid.SelectedRows[row]; el.src = "http://www.adiamor.com/media/Adiamor/Addtocompare.gif";
    }
    else { cookieValue = readCookie("compare") || ""; id = "D|" + g_grid.DataSource.data[row][g_grid.ColumnsMap.ID] + "-"; id2 = "T|" + g_grid.DataSource.data[row][g_grid.ColumnsMap.ID] + "-"; cookieValue = cookieValue.replace(id2, id); createCookie("compare", cookieValue, 90); domRow.className = "gridlist-rowselected"; g_grid.SelectedRows[row] = domRow; el.src = "http://www.adiamor.com/media/Adiamor/removefromcompare.gif"; }
    count = 0; for (item in g_grid.SelectedRows) { count += 1; }
    $('numCompare').innerHTML = "(" + count + ")"; if (g_diamondData.params.compare != null) { compareDiamonds(); } 
}
function hideComparePanel() { hideElement(g_rowComparePanel.Container); hideElement(g_rowCompareContents); }
function hideInfoPanel(evtObj, elem, clear) { clearPanel = true; window.setTimeout("hideInfoPanelNow(null, null, true)", 1000); }
function hideInfoPanelNow(evtObj, elem, clear) {
    if (clearPanel) {
        if (clear) { window.clearTimeout(g_rowComparePanelTimeout); g_rowComparePanelTimeout = null; hideComparePanel(); }
        else { g_rowComparePanelTimeout = window.setTimeout(hideComparePanel, 200); } 
    }
    else
        window.setTimeout("hideInfoPanelNow(null, null, true)", 500);
}
function rowMouseOverHandler(evtArgs) { showInfoPanel(evtArgs.row); }
function preventHide(evtArgs) { clearPanel = false; }
function hideComparePanelHandler(evtObj, elem) { var comparePanel = findElement(evtObj.toElement, 'panel-rowcompare'); if (comparePanel == null) { hideComparePanel(); } }
function querySt(ji) { var hu, gy, i; hu = window.location.search.substring(1); gy = hu.split("&"); for (i = 0; i < gy.length; i += 1) { ft = gy[i].split("="); if (ft[0] == ji) { return ft[1]; } } }
function abortDrag(evtArgs) { if (evtArgs.fromElement == null && g_activeSlider != null) { g_activeSlider.onMouseUp(); } }
function showColChooserPanel() { showElement(g_colChooserPanel.Container); showElement(g_colChooserContents); Adiamor.html.align(g_colChooserPanel.Container, g_colChooserButton, Adiamor.at | Adiamor.al, 0, 0, g_colChooserButton.offsetHeight); Adiamor.html.align(g_colChooserContents, g_colChooserButton, Adiamor.at | Adiamor.al, 0, 0, g_colChooserButton.offsetHeight); }
function toggleColChooserPanel() {
    if (isElementVisible(g_colChooserContents)) { hideColChooserPanel(); }
    else { showColChooserPanel(); } 
}
function init() {
    if (typeof (sIFR) == "function") { }
    if (Adiamor.browser.IE && !Adiamor.browser.IE6 && !Adiamor.browser.IE7 && !Adiamor.browser.IE8) { window.location = "../diamondsearch.aspx"; }
    else if (Adiamor.browser.OPERA) { window.location = "../diamondsearch.aspx"; }
    Adiamor.html.attachEvent(window, "unload", saveState); var rightTooltipOffset = 40, scrollbar; if (!Adiamor.browser.IE) { rightTooltipOffset = 40; }
    g_mainSliders = [{ name: 'price', calloutOffset: 120, sliderParams: { "Height": 60, "OverlayHeight": 47, "TooltipEnabled": true, "Min": 250, "Max": 250000, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -30, "RightTooltipOffsetLeft": -27 + rightTooltipOffset, "LeftTooltipOffsetTop": -11, "RightTooltipOffsetTop": -11, "Slope": 120} }, { name: 'carat', calloutOffset: 56, sliderParams: { "Height": 60, "OverlayHeight": 47, "TooltipEnabled": true, "Min": 0.30, "Max": 15, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -20, "RightTooltipOffsetLeft": -27 + rightTooltipOffset, "LeftTooltipOffsetTop": -11, "RightTooltipOffsetTop": -11, "Slope": 0.05} }, { name: 'cut', calloutOffset: 4, sliderParams: { "Min": 0, "Max": 5, "Discrete": true, "Ticks": 5} }, { name: 'color', calloutOffset: -38, sliderParams: { "Min": 29, "Max": 22, "Discrete": true, "Ticks": 7} }, { name: 'clarity', calloutOffset: -76, sliderParams: { "Min": 37, "Max": 30, "Discrete": true, "Ticks": 7}}]; if (Adiamor.browser.SAFARI) { g_smallSliders = [{ name: 'polish', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'sym', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'depth', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 45, "Max": 86, "TooltipEnabled": true, "formatTooltipValue": formatNumber1, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'table', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 49, "Max": 89, "TooltipEnabled": true, "formatTooltipValue": formatDouble, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'size', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 0.50, "Max": 2.75, "TooltipEnabled": true, "formatTooltipValue": formatNumber2, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'fluor', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 46, "Max": 41, "Discrete": true, "Ticks": 5, "ClassPostFix": "-small"}}]; g_miniSliders = [{ name: 'price-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 250, "Max": 250000, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 100, "ClassPostFix": "-mini"} }, { name: 'carat-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 0.30, "Max": 15.01, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 0.1, "ClassPostFix": "-mini"} }, { name: 'cut-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 5, "GrabbyHeight": 15, "Min": 0, "Max": 5, "ClassPostFix": "-mini"} }, { name: 'color-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 15, "Min": 29, "Max": 22, "ClassPostFix": "-mini"} }, { name: 'clarity-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 15, "Min": 37, "Max": 30, "ClassPostFix": "-mini"}}]; }
    else if (!Adiamor.browser.IE6) { g_smallSliders = [{ name: 'polish', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'sym', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'depth', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 45, "Max": 86, "TooltipEnabled": true, "formatTooltipValue": formatNumber1, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'table', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 49, "Max": 89, "TooltipEnabled": true, "formatTooltipValue": formatDouble, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'size', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 0.50, "Max": 2.75, "TooltipEnabled": true, "formatTooltipValue": formatNumber2, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'fluor', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 46, "Max": 41, "Discrete": true, "Ticks": 5, "ClassPostFix": "-small"}}]; g_miniSliders = [{ name: 'price-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 250, "Max": 250000, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 100, "ClassPostFix": "-mini"} }, { name: 'carat-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 0.30, "Max": 15.01, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 0.1, "ClassPostFix": "-mini"} }, { name: 'cut-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 5, "GrabbyHeight": 15, "Min": 0, "Max": 5, "ClassPostFix": "-mini"} }, { name: 'color-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 15, "Min": 29, "Max": 22, "ClassPostFix": "-mini"} }, { name: 'clarity-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 15, "Min": 37, "Max": 30, "ClassPostFix": "-mini"}}]; }
    else { g_smallSliders = [{ name: 'polish', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'sym', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'depth', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 45, "Max": 86, "TooltipEnabled": true, "formatTooltipValue": formatNumber1, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'table', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 49, "Max": 89, "TooltipEnabled": true, "formatTooltipValue": formatDouble, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'size', calloutOffset: 20, sliderParams: { "Height": 15, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 0.50, "Max": 2.75, "TooltipEnabled": true, "formatTooltipValue": formatNumber2, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 3, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 3, "ClassPostFix": "-small"} }, { name: 'fluor', calloutOffset: 20, sliderParams: { "Height": 36, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 46, "Max": 41, "Discrete": true, "Ticks": 5, "ClassPostFix": "-small"}}]; g_miniSliders = [{ name: 'price-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 250, "Max": 250000, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 100, "ClassPostFix": "-mini"} }, { name: 'carat-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 200, "OverlayHeight": 13, "GrabbyWidth": 7, "GrabbyHeight": 15, "Min": 0.30, "Max": 15.01, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 0.1, "ClassPostFix": "-mini"} }, { name: 'cut-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 5, "GrabbyHeight": 15, "Min": 0, "Max": 5, "ClassPostFix": "-mini"} }, { name: 'color-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 15, "Min": 29, "Max": 22, "ClassPostFix": "-mini"} }, { name: 'clarity-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 200, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 15, "Min": 37, "Max": 30, "ClassPostFix": "-mini"}}]; }
    Adiamor.html.attachEvent(document, 'mouseover', abortDrag); g_extendedSliders = $('slider-extension-container'); if (Adiamor.browser.IE7) { g_extendedSliders.style.height = g_sliderExtensionHeightFinal + 'px'; Adiamor.html.getFirstChild(g_extendedSliders).style.height = g_sliderExtensionHeightFinal + 'px'; $('slider-extension-show').style.display = 'none'; $('slider-extension-hide').style.display = 'block'; }
    g_queryMask = $('query-mask'); g_queryBuilderPanel = $('query-builder'); g_queryResultsPanel = $('query-results'); Adiamor.dom.setOpacity(g_queryMask, 0); Adiamor.html.align(g_queryMask, g_queryBuilderPanel, Adiamor.al | Adiamor.at); g_queryMask.style.display = 'none'; g_resultsPanel = new Adiamor.ui.Panel(); g_resultsPanel.attachToParent($("slider-results-container")); g_grid = new Adiamor.ui.GridList(); g_grid.RowCount = 500; g_grid.RowHeight = 27; scrollbar = new Adiamor.ui.VerticalScrollbar(); scrollbar.attachToParent($("VerticalScrollbarContainer")); scrollbar.setRange(10000); g_grid.setScrollbar(scrollbar); g_diamondData = new Adiamor.data.PagedJsonDataView(); if (window.location.href.indexOf("col=Canada") >= 0 || window.location.href.indexOf("canadian-diamonds") >= 0 || window.location.href.indexOf("Canadian-Diamonds") >= 0 || window.location.href.indexOf("Diamonds/Search/Canadian") >= 0) { CanadaInit(); }
    g_diamondData.initialize({ 'GetHandler': g_getHandlerUrl }); g_diamondData.OnRowCountChanged.subscribe(updateResultsPanel, g_resultsPanel); g_diamondData.OnDataReady.subscribe(setSliderLimits); g_grid.setDataSource(g_diamondData); g_grid.OnMouseOver.subscribe(rowMouseOverHandler); g_grid.OnMouseOut.subscribe(hideInfoPanel); g_grid.attachToParent(null, $("myGridList")); Adiamor.lang.forEach(g_mainSliders, setupMainSlider); Adiamor.lang.forEach(g_checkboxes, setupCheckbox); if (Adiamor.browser.IE7) { hideSliders(); }
    g_rowInfoPanel = new Adiamor.ui.Panel(); g_rowInfoPanel.attachToParent($('panel-rowdetail')); g_rowInfoPanel.setBackgroundImage(g_imagePath + 'row_info_callout.png'); g_rowInfoPanel.setWidth(189); g_rowInfoPanel.setHeight(460); g_rowInfoPanelArrow = new Adiamor.ui.Panel(); g_rowInfoPanelArrow.attachToParent($('panel-rowdetail-arrow')); g_rowInfoPanelArrow.setBackgroundImage(g_imagePath + 'row_info_callout-arrow.png'); g_rowInfoPanelArrow.setWidth(1); g_rowInfoPanelArrow.setHeight(27); g_rowComparePanel = new Adiamor.ui.Panel(); g_rowComparePanel.attachToParent($('panel-rowcompare')); g_rowComparePanel.setBackgroundImage(g_imagePath + 'row-compare-callout.png'); g_rowComparePanel.setWidth(154); g_rowComparePanel.setHeight(169); g_rowCompareContents = $('panel-rowcompare-contents'); Adiamor.html.attachEvent(g_rowCompareContents, 'mouseover', function () { window.clearTimeout(g_rowComparePanelTimeout); }); Adiamor.html.attachEvent(g_rowCompareContents, 'mouseout', hideComparePanelHandler); g_colChooserPanel = new Adiamor.ui.Panel(); g_colChooserPanel.attachToParent($('panel-columnchooser')); g_colChooserPanel.setBackgroundImage(g_imagePath + 'chooserback_new.png'); g_colChooserContents = $('panel-columnchooser-contents'); g_colChooserButton = $('columnchooser-button'); Adiamor.html.attachEvent(g_colChooserButton, 'mousedown', toggleColChooserPanel); Adiamor.html.attachEvent($('slider-extension-show'), 'click', showSliders); Adiamor.html.attachEvent($('slider-extension-hide'), 'click', hideSliders); Adiamor.html.attachEvent($('show-results-button'), 'click', hideQueryBuilder); Adiamor.html.attachEvent($('show-results-button-small'), 'click', hideQueryBuilder); Adiamor.html.attachEvent($('show-query-button1'), 'click', hideQueryResults); Adiamor.html.attachEvent($('show-query-button2'), 'click', hideQueryResults); Adiamor.html.attachEvent($('query-collapse'), 'click', collapseSliders); Adiamor.browser.History.instance = new Adiamor.browser.History(); Adiamor.browser.History.instance.OnChange.subscribe(restoreBackButtonState); restoreState(); window.onresize = function (event) {
        var pURL = unescape(window.location.pathname); if (Adiamor.browser.IE) {
            if (getDocHeight() == Adiamor.browser.DocumentHeight)
            { }
            else { } 
        }
        else { window.location.replace(pURL); } 
    }; document.onmousedown = closeMenus;
}
function CanadaInit() { g_getHandlerUrl = 'http://www.adiamor.com/CanadaSearch.aspx'; $('info').innerHTML = "CANADIAN DIAMOND SEARCH"; }
function affinityinit() {
    var rightTooltipOffset = 40, scrollbar; if (!Adiamor.browser.IE) { rightTooltipOffset = 40; }
    g_mainSliders = [{ name: 'price', calloutOffset: 120, sliderParams: { "Height": 60, "OverlayHeight": 47, "TooltipEnabled": true, "Min": 250, "Max": 250000, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -30, "RightTooltipOffsetLeft": -27 + rightTooltipOffset, "LeftTooltipOffsetTop": -11, "RightTooltipOffsetTop": -11, "Slope": 120} }, { name: 'carat', calloutOffset: 56, sliderParams: { "Height": 60, "OverlayHeight": 47, "TooltipEnabled": true, "Min": 0.30, "Max": 15, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -20, "RightTooltipOffsetLeft": -27 + rightTooltipOffset, "LeftTooltipOffsetTop": -11, "RightTooltipOffsetTop": -11, "Slope": 0.05} }, { name: 'cut', calloutOffset: 4, sliderParams: { "Min": 0, "Max": 5, "Discrete": true, "Ticks": 5} }, { name: 'color', calloutOffset: -38, sliderParams: { "Min": 29, "Max": 22, "Discrete": true, "Ticks": 7} }, { name: 'clarity', calloutOffset: -76, sliderParams: { "Min": 37, "Max": 30, "Discrete": true, "Ticks": 7}}]; if (!Adiamor.browser.IE6) { g_smallSliders = [{ name: 'polish', calloutOffset: 120, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'sym', calloutOffset: 120, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'depth', calloutOffset: 45, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 45, "Max": 86, "TooltipEnabled": true, "formatTooltipValue": formatNumber1, "BottomTooltipOffsetTop": 10, "BottomTooltipOffsetLeft": 40, "TopTooltipOffsetTop": -20, "TopTooltipOffsetLeft": 40, "ClassPostFix": "-small"} }, { name: 'table', calloutOffset: 85, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 49, "Max": 89, "TooltipEnabled": true, "formatTooltipValue": formatDouble, "BottomTooltipOffsetTop": 10, "BottomTooltipOffsetLeft": 40, "TopTooltipOffsetTop": -20, "TopTooltipOffsetLeft": 40, "ClassPostFix": "-small"} }, { name: 'size', calloutOffset: 75, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 0.50, "Max": 2.75, "TooltipEnabled": true, "formatTooltipValue": formatNumber2, "BottomTooltipOffsetTop": 10, "BottomTooltipOffsetLeft": 40, "TopTooltipOffsetTop": -20, "TopTooltipOffsetLeft": 40, "ClassPostFix": "-small"} }, { name: 'fluor', calloutOffset: 5, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 46, "Max": 41, "Discrete": true, "Ticks": 5, "ClassPostFix": "-small"}}]; g_miniSliders = [{ name: 'price-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 18, "Min": 250, "Max": 250000, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 100, "ClassPostFix": "-mini"} }, { name: 'carat-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 18, "Min": 0.30, "Max": 15, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 0.1, "ClassPostFix": "-mini"} }, { name: 'cut-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 5, "GrabbyHeight": 18, "Min": 0, "Max": 5, "ClassPostFix": "-mini"} }, { name: 'color-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 18, "Min": 29, "Max": 22, "ClassPostFix": "-mini"} }, { name: 'clarity-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 18, "Min": 37, "Max": 30, "ClassPostFix": "-mini"}}]; }
    else { g_smallSliders = [{ name: 'polish', calloutOffset: 120, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'sym', calloutOffset: 120, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 63, "Max": 60, "Discrete": true, "Ticks": 3, "ClassPostFix": "-small"} }, { name: 'depth', calloutOffset: 45, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 45, "Max": 86, "TooltipEnabled": true, "formatTooltipValue": formatNumber1, "BottomTooltipOffsetTop": 15, "BottomTooltipOffsetLeft": 40, "TopTooltipOffsetTop": -20, "TopTooltipOffsetLeft": 40, "ClassPostFix": "-small"} }, { name: 'table', calloutOffset: 85, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 49, "Max": 89, "TooltipEnabled": true, "formatTooltipValue": formatDouble, "BottomTooltipOffsetTop": 15, "BottomTooltipOffsetLeft": 40, "TopTooltipOffsetTop": -20, "TopTooltipOffsetLeft": 40, "ClassPostFix": "-small"} }, { name: 'size', calloutOffset: 75, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 0.50, "Max": 2.75, "TooltipEnabled": true, "formatTooltipValue": formatNumber2, "BottomTooltipOffsetTop": 15, "BottomTooltipOffsetLeft": 40, "TopTooltipOffsetTop": -20, "TopTooltipOffsetLeft": 40, "ClassPostFix": "-small"} }, { name: 'fluor', calloutOffset: 5, sliderParams: { "Height": 31, "Width": 240, "GrabbyWidth": 74, "GrabbyHeight": 9, "Min": 46, "Max": 41, "Discrete": true, "Ticks": 5, "ClassPostFix": "-small"}}]; g_miniSliders = [{ name: 'price-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 18, "Min": 250, "Max": 250000, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatMoney0, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 100, "ClassPostFix": "-mini"} }, { name: 'carat-mini', calloutOffset: 20, sliderParams: { "Height": 18, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "GrabbyHeight": 18, "Min": 0.30, "Max": 15, "TooltipEnabled": true, "getValueFunction": Adiamor.ui.Slider.expGetValueFunction, "setValueFunction": Adiamor.ui.Slider.expSetValueFunction, "formatTooltipValue": formatCarat, "LeftTooltipOffsetLeft": -35, "LeftTooltipOffsetTop": 1, "RightTooltipOffsetLeft": -25 + rightTooltipOffset, "RightTooltipOffsetTop": 1, "Slope": 0.1, "ClassPostFix": "-mini"} }, { name: 'cut-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 5, "GrabbyHeight": 18, "Min": 0, "Max": 5, "ClassPostFix": "-mini"} }, { name: 'color-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 18, "Min": 29, "Max": 22, "ClassPostFix": "-mini"} }, { name: 'clarity-mini', calloutOffset: 20, sliderParams: { "Height": 31, "Width": 427, "OverlayHeight": 24, "GrabbyWidth": 7, "Discrete": true, "Ticks": 7, "GrabbyHeight": 18, "Min": 37, "Max": 30, "ClassPostFix": "-mini"}}]; }
    Adiamor.html.attachEvent(document, 'mouseover', abortDrag); g_extendedSliders = $('slider-extension-container'); if (Adiamor.browser.IE7) { g_extendedSliders.style.height = g_sliderExtensionHeightFinal + 'px'; Adiamor.html.getFirstChild(g_extendedSliders).style.height = g_sliderExtensionHeightFinal + 'px'; $('slider-extension-show').style.display = 'none'; $('slider-extension-hide').style.display = 'block'; }
    g_queryMask = $('query-mask'); g_queryBuilderPanel = $('query-builder'); g_queryResultsPanel = $('query-results'); Adiamor.dom.setOpacity(g_queryMask, 0); Adiamor.html.align(g_queryMask, g_queryBuilderPanel, Adiamor.al | Adiamor.at); g_queryMask.style.display = 'none'; g_resultsPanel = new Adiamor.ui.Panel(); g_resultsPanel.attachToParent($("slider-results-container")); g_grid = new Adiamor.ui.GridList(); g_grid.RowCount = 500; g_grid.RowHeight = 27; scrollbar = new Adiamor.ui.VerticalScrollbar(); scrollbar.attachToParent($("VerticalScrollbarContainer")); scrollbar.setRange(10000); g_grid.setScrollbar(scrollbar); g_diamondData = new Adiamor.data.PagedJsonDataView(); g_diamondData.initialize({ 'GetHandler': g_getHandlerUrl }); g_diamondData.OnRowCountChanged.subscribe(updateResultsPanel, g_resultsPanel); g_diamondData.OnDataReady.subscribe(setSliderLimits); g_grid.setDataSource(g_diamondData); g_grid.OnMouseOver.subscribe(rowMouseOverHandler); g_grid.attachToParent(null, $("myGridList")); Adiamor.lang.forEach(g_mainSliders, setupMainSlider); Adiamor.lang.forEach(g_checkboxes, setupCheckbox); if (Adiamor.browser.IE7) { hideSliders(); }
    g_rowInfoPanel = new Adiamor.ui.Panel(); g_rowInfoPanel.attachToParent($('panel-rowdetail')); g_rowInfoPanel.setBackgroundImage(g_imagePath + 'row_info_callout.png'); g_rowInfoPanel.setWidth(193); g_rowInfoPanel.setHeight(458); g_rowInfoPanelArrow = new Adiamor.ui.Panel(); g_rowInfoPanelArrow.attachToParent($('panel-rowdetail-arrow')); g_rowInfoPanelArrow.setBackgroundImage(g_imagePath + 'row_info_callout-arrow.png'); g_rowInfoPanelArrow.setWidth(1); g_rowInfoPanelArrow.setHeight(29); g_rowComparePanel = new Adiamor.ui.Panel(); g_rowComparePanel.attachToParent($('panel-rowcompare')); g_rowComparePanel.setBackgroundImage(g_imagePath + 'row-compare-callout.png'); g_rowComparePanel.setWidth(154); g_rowComparePanel.setHeight(169); g_rowCompareContents = $('panel-rowcompare-contents'); Adiamor.html.attachEvent(g_rowCompareContents, 'mouseover', function () { window.clearTimeout(g_rowComparePanelTimeout); }); Adiamor.html.attachEvent(g_rowCompareContents, 'mouseout', hideComparePanelHandler); g_colChooserPanel = new Adiamor.ui.Panel(); g_colChooserPanel.attachToParent($('panel-columnchooser')); g_colChooserPanel.setBackgroundImage(g_imagePath + 'chooserback_new.png'); g_colChooserContents = $('panel-columnchooser-contents'); g_colChooserButton = $('columnchooser-button'); Adiamor.html.attachEvent(g_colChooserButton, 'mousedown', toggleColChooserPanel); Adiamor.html.attachEvent($('slider-extension-show'), 'click', showSliders); Adiamor.html.attachEvent($('slider-extension-hide'), 'click', hideSliders); Adiamor.html.attachEvent($('show-results-button'), 'click', hideQueryBuilder); Adiamor.html.attachEvent($('show-results-button-small'), 'click', hideQueryBuilder); Adiamor.html.attachEvent($('show-query-button1'), 'click', hideQueryResults); Adiamor.html.attachEvent($('show-query-button2'), 'click', hideQueryResults); Adiamor.html.attachEvent($('query-collapse'), 'click', collapseSliders); Adiamor.browser.History.instance = new Adiamor.browser.History(); Adiamor.browser.History.instance.OnChange.subscribe(restoreBackButtonState); restoreState();
}
function scrollMove(position) { g_grid.Scrollbar.HtmlElement.scrollTop = position; }
function searchDiamonds() { $('resultsTab').style.backgroundColor = "#ffffff"; $('compareTab').style.backgroundColor = "#eeeeee"; g_diamondData.setParam("compare"); g_grid.render(); }
function compareDiamonds() {
    var selectedDiamonds = g_grid.SelectedRows, idList = "", cookieValue = readCookie("compare"), count, item2, item, rowIndex, Id, items, i; idList = cookieValue; if (cookieValue != null) { cookieValue = cookieValue.split("-"); }
    if (idList == "0" || idList == null) { idList = ""; }
    count = 0; for (item2 in selectedDiamonds) { if (selectedDiamonds.hasOwnProperty(item2)) { count += 1; } }
    if (count > 1) {
        for (item in selectedDiamonds) { if (selectedDiamonds.hasOwnProperty(item)) { rowIndex = item; Id = g_diamondData.getMappedValue(rowIndex, g_grid.ColumnsMap.ID); if (idList.indexOf(Id) == -1) { idList = idList + "D|" + Id + "-"; } } }
        items = idList.split("-"); idList = ""; for (i = 0; i < items.length; i += 1) {
            if (items[i].indexOf("D") == -1 && items[i].indexOf("R") == -1 && items[i].indexOf("E") == -1 && items[i].indexOf("P") == -1 && items[i].indexOf("B") == -1 && items[i].indexOf("T") == -1) { items[i] = "D|" + items[i]; }
            if (items[i] != "") { if (i != items.length - 1) { idList += items[i] + "-"; } } 
        }
        createCookie("compare", idList, 90); $('resultsTab').style.backgroundColor = "#eeeeee"; $('compareTab').style.backgroundColor = "#ffffff"; idList = idList.replace(/-/g, ","); idList = idList.replace(/D/g, ""); idList = idList.replace(/T/g, ""); idList = idList.replace(/|/g, ""); g_diamondData.setParam("compare", idList); g_grid.render();
    }
    else { alert("Please select at least two items to compare."); } 
}
function showComparePanel(row) {
    var dRow = parseInt(row.getAttribute('row'), 10), topOffset = -g_rowComparePanel.Container.offsetHeight / 2 - 83; if (Adiamor.browser.MOZ) { topOffset -= $("ListDataFrame").scrollTop; }
    showElement(g_rowComparePanel.Container); showElement(g_rowCompareContents); Adiamor.html.align(g_rowComparePanel.Container, row, Adiamor.at | Adiamor.al, 0, 0, topOffset, -g_rowComparePanel.Container.offsetWidth + 10); Adiamor.html.align(g_rowCompareContents, row, Adiamor.at | Adiamor.al, 0, 0, topOffset, -g_rowComparePanel.Container.offsetWidth + 10);
}
function showColumns() {
    var vc = 0, cb; Adiamor.lang.forEach(g_grid.Columns, function (item) {
        cb = $(item.Name.toLowerCase() + '_cb'); if (cb != null) { if (cb.checked) { vc += 1; } }
        else if (item.Display) { vc += 1; } 
    }); Adiamor.lang.forEach(g_grid.Columns, function (item) {
        var cb = $(item.Name.toLowerCase() + '_cb'), width; if (cb != null) { if (cb.checked) { item.cssStyle.display = ''; } else { item.cssStyle.display = 'none'; } }
        if (item.Display || cb != null) { width = GetColumnWidth(item, vc); if (width != null) { item.cssStyle.width = width + 'px'; item.Width = width; } } 
    }); hideColChooserPanel(); g_grid.render();
}
function handleColChooserButtonMouseOut(evtObj, evtElem, clear) {
    if (clear) { window.clearTimeout(g_colChooserPanelTimeout); g_colChooserPanelTimeout = null; hideColChooserPanel(); }
    else { g_colChooserPanelTimeout = window.setTimeout(hideColChooserPanel, 20); } 
}
function hideColChooserPanelHandler(evtObj) { var colChooserPanel = findElement(evtObj.toElement, 'panel-columnchooser'); if (colChooserPanel == null) { hideColChooserPanel(); } }
function AddtoMenu(show) {
    if (show && document.getElementById('CartControl') != null) {
        show = (document.getElementById('CartControl').style.display.toLowerCase() == "" || document.getElementById('CartControl').style.display.toLowerCase() == "none"); if (show) { document.getElementById('CartControl').style.display = "block"; }
        else { document.getElementById('CartControl').style.display = "none"; } 
    }
    else { document.getElementById('CartControl').style.display = "none"; } 
}
function closeMenus(ev) {
    try {
        var targ
        if (!e) var e = window.event
        if (e.target) targ = e.target
        else if (e.srcElement) targ = e.srcElement
        if (targ.nodeType == 3)
            targ = targ.parentNode
        if (targ.id.indexOf("CartControl") == -1) { AddtoMenu(false) } 
    }
    catch (ex) { } 
}
function ib_OnOver(imgName) {
    if (document.getElementById(imgName + "ToolTip") != null) { document.getElementById(imgName + "ToolTip").style.display = "inline"; }
    if (document.getElementById(imgName + "ToolTipArrow") != null) { document.getElementById(imgName + "ToolTipArrow").style.display = "block"; } 
}
function ib_OnOut(imgName) {
    if (document.getElementById(imgName + "ToolTip") != null) { document.getElementById(imgName + "ToolTip").style.display = "none"; }
    if (document.getElementById(imgName + "ToolTipArrow") != null) { document.getElementById(imgName + "ToolTipArrow").style.display = "none"; } 
}
function load() {
    if (document.getElementById('init') != null) { Adiamor.browser.DocumentHeight = getDocHeight(); init(); }
    else if (document.getElementById('affinityinit') != null) { affinityinit(); }
    else { window.setTimeout(load, 25); }
    var cDiv = $('currency'); if (cDiv != null) { cDiv.style.display = "none"; } 
}
load();
