﻿/*
    Behaviours for the Browse Page 
*/

var arrAttributeTypes = new Array();

arrAttributeTypes[0] = "item_category";
arrAttributeTypes[1] = "artist_maker_author";
arrAttributeTypes[2] = "origin";
arrAttributeTypes[3] = "stylistic_period";
arrAttributeTypes[4] = "material_or_medium";
arrAttributeTypes[5] = "date";
arrAttributeTypes[6] = "item_type";
arrAttributeTypes[7] = "item";
arrAttributeTypes[8] = "subject_matter_or_theme";
arrAttributeTypes[9] = "design";
arrAttributeTypes[10] = "function_movement";
arrAttributeTypes[11] = "size";

var update_everything = true;

var clearAll_item_category = searchstring;
var clearAll_artist_maker_author = searchstring;
var clearAll_origin = searchstring;
var clearAll_stylistic_period = searchstring;
var clearAll_material_or_medium = searchstring;
var clearAll_date = searchstring;
var clearAll_item_type = searchstring;
var clearAll_item = searchstring;
var clearAll_subject_matter_or_theme = searchstring;
var clearAll_design = searchstring;
var clearAll_function_movement = searchstring;
var clearAll_size = searchstring;

var saved_interest = false;

var reload_prices = true;
var reload_locations = true;
var reload_sales = true;

var low_value = 0;
var high_value = 0;

var b_lfsearch = true;
var b_noresults = false;
var str_alternate = '';
var b_gold = false;
var sr_JS;


// Set JS cookie
function setCookie(c_name,value,expiredays){
    var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 

// Get JS cookie
function getCookie(c_name){
    if (document.cookie.length>0)
      {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
        { 
        c_start=c_start + c_name.length+1; 
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
        } 
      }
    return "";
}


// Replaces all instances of the given substring.
String.prototype.replaceAll = function( 
    strTarget, // The substring you want to replace
    strSubString // The string you want to replace in.
    ){
    var strText = this;
    var intIndexOfMatch = strText.indexOf( strTarget );
 

    // Keep looping while an instance of the target string
    // still exists in the string.
    while (intIndexOfMatch != -1){
    // Relace out the current instance.
    strText = strText.replace( strTarget, strSubString )
 

    // Get the index of any next matching substring.
    intIndexOfMatch = strText.indexOf( strTarget );
    }
 

    // Return the updated string with ALL the target strings
    // replaced out with the new substring.
    return( strText );
}

Site.Pages.Browse = Class.create
(
    Site.Page,
    {
        initialize: function($super, data, options)
        {
            $super();
            
            this.sales_anchor_showing = false;
            this.sort_anchor_showing = false;
            this.number_anchor_showing = false;
            this.location_anchor_showing = false;
            
            this.setOptions
            (
                options,
                {
                    gridImageLargeBaseUrl: "/images/photos_lots_medium/",
                    gridImageSmallBaseUrl: "/images/photos_lots_xsmall/",
                    listImageBaseUrl: "/images/photos_lots_small/"
                }
            );
            
            this.addObservers("richCheckboxOnClick", "btDisplayListOnClick", 
                              "btDisplayGridOnClick", //"breadcrumbOnClick",
                              "clearAll_item_category_OnClick", "clearAll_artist_maker_author_OnClick",
                              "clearAll_origin_OnClick", "clearAll_stylistic_period_OnClick",
                              "clearAll_material_or_medium_OnClick", "clearAll_date_OnClick",
                              "clearAll_item_type_OnClick", "clearAll_item_OnClick",
                              "clearAll_subject_matter_or_theme_OnClick", "clearAll_design_OnClick",
                              "clearAll_function_movement_OnClick", "clearAll_size_OnClick",
                              "previousPage_OnClick", "nextPage_OnClick", "paging_OnClick",
                              "hideAllOptions", "dropdownOnClick", "reset_price_filter");
            
            this.addBlocks("sendRequestOnComplete", "priceRangeOnChange", "placeBidTooltipBeforeShow", "tracklotTooltipBeforeShow");

            this.templateGridItem = new Template
                                     (
                                          Site.Pages.Browse.TEMPLATES.GRID_ITEM.interpolatep
                                          (
                                              {
                                                  largeBaseUrl: this.options.gridImageLargeBaseUrl,
                                                  smallBaseUrl: this.options.gridImageSmallBaseUrl    
                                              }                                          
                                          )
                                     );
            
            this.templateListItem =  new Template
                                     (
                                          Site.Pages.Browse.TEMPLATES.LIST_ITEM.interpolatep
                                          (
                                              {
                                                  baseUrl: this.options.listImageBaseUrl
                                              }
                                          )
                                     );
            
            
        },
    
        placeBidTooltipBeforeShow: function(trigger)
        {
            var params = trigger.href.toQueryParams();
            
            //alert(params.objectid);
            //alert(params.saleid);
            
            if (params)
            {
                //alert(params.objectid);
                if(params.objectid.length == 0){
                    //$('absentee-bid').hide();
                    $('bt-leave-absentee-bid').hide();
                    $('bt-leave-absentee-bid-div').show();
                    $('p_AbsenteeBidMessage').innerHTML = 'Online absentee bidding for this sale has closed. Please contact the <a href="/features/guides/buying/bid-departments.aspx">Bid Department</a> for assistance.';
                } else {
                    //if(params.saleid.length == 0){
                    //    document.location = securerootpath + "/LotFinder/AbsenteeBidding/Absentee_Bid.aspx?action=absenteebid&ObjectID=" + params.objectid;
                    //}
                    //$('absentee-bid').show();
                    $('bt-leave-absentee-bid').show();
                    $('bt-leave-absentee-bid-div').hide();
                    $('bt-leave-absentee-bid').href = securerootpath + "/LotFinder/AbsenteeBidding/Absentee_Bid.aspx?action=absenteebid&ObjectID=" + params.objectid;
                    //alert($('bt-leave-absentee-bid').href);
                }
                if(params.saleid.length == 0){
                    //$('bid-live').hide();
                    $('bt-bid-live').hide();
                    $('bt-bid-live-div').show();
                    if(params.closeddate.length == 0){
                        $('bt-bid-live-div').innerHTML = "<span>Bid Live</span>"
                    } else {
                        $('bt-bid-live-div').innerHTML = "<span>Bid Live <span>Register by " + params.closeddate.replace("|||", " ") + "</span></span>";
                    }
                    $('p_LiveBidMessage').innerHTML = 'Online registration for this sale has closed. Please contact the <a href="/features/guides/buying/bid-departments.aspx">Bid Department</a> for assistance.';
                } else {
                    //if(params.objectid.length == 0){
                    //    document.location = securerootpath + "/LiveBidding/SaleRegistration.aspx?SaleID=" + params.saleid;
                    //}
                    //$('bid-live').show();
                    $('bt-bid-live').show();
                    $('bt-bid-live-div').hide();
                    $('bt-bid-live').href = securerootpath + "/LiveBidding/SaleRegistration.aspx?SaleID=" + params.saleid;
                    if(params.closeddate.length == 0){
                        $('bt-bid-live').innerHTML = "<span>Bid Live <span></span></span>";
                    }
                    else{
                        $('bt-bid-live').innerHTML = "<span>Bid Live <span>Register by " + params.closeddate.replace("|||", " ") + "</span></span>";
                    }                    
                    //alert($('bt-bid-live').href);
                }
            }    
        },
        
        tracklotTooltipBeforeShow: function(trigger)
        {
            var params = trigger.href.toQueryParams();
            
            //alert(params.objectid);
            //alert(params.saleid);
            
            var track_objectid = params.objectid
            
            if($('tracklot_' + track_objectid).innerHTML == 'Tracked Lot'){
                document.location = "/MyChristies/my_tracked_lots_bids.aspx";
            }  
        },
        
        domOnLoad: function($super, event)
        {
            $super(event);

                
            this.formRefine = $('refine');
            this.mode = client_view;               

            //this.listTooltipsElement = $('list-items-tooltips');
            this.grid = $('grid-items');
            this.list = $('list-items');
            
            // setup rich select controls

            
            // show everything that requires JavaScript (would be invisible if JS is disabled)
            $('clear-all-item_category').show();
            $('clear-all-artist_maker_author').show();
            $('clear-all-origin').show();
            $('clear-all-stylistic_period').show();
            $('clear-all-material_or_medium').show();
            $('clear-all-date').show();
            $('clear-all-item_type').show();
            $('clear-all-item').show();
            $('clear-all-subject_matter_or_theme').show();
            $('clear-all-design').show();
            $('clear-all-function_movement').show();
            $('clear-all-size').show();
            
            
            //moved 0313
            addEvent($('clear-all-item_category'), "click", this.observers.clearAll_item_category_OnClick);
            addEvent($('clear-all-artist_maker_author'), "click", this.observers.clearAll_artist_maker_author_OnClick);
            addEvent($('clear-all-origin'), "click", this.observers.clearAll_origin_OnClick);
            addEvent($('clear-all-stylistic_period'), "click", this.observers.clearAll_stylistic_period_OnClick);
            addEvent($('clear-all-material_or_medium'), "click", this.observers.clearAll_material_or_medium_OnClick);
            addEvent($('clear-all-date'), "click", this.observers.clearAll_date_OnClick);
            addEvent($('clear-all-item_type'), "click", this.observers.clearAll_item_type_OnClick);
            addEvent($('clear-all-item'), "click", this.observers.clearAll_item_OnClick);
            addEvent($('clear-all-subject_matter_or_theme'), "click", this.observers.clearAll_subject_matter_or_theme_OnClick);
            addEvent($('clear-all-design'), "click", this.observers.clearAll_design_OnClick);
            addEvent($('clear-all-function_movement'), "click", this.observers.clearAll_function_movement_OnClick);
            addEvent($('clear-all-size'), "click", this.observers.clearAll_size_OnClick);
            
            // hide everything supplanted by JavaScript event handlers 
            /*
            $('bt-apply-results').hide();
            $('bt-apply-filter-by').hide();
            
            $('apply-item_category').hide();
            $('apply-artist_maker_author').hide();
            $('apply-origin').hide();
            $('apply-stylistic_period').hide();
            $('apply-material_or_medium').hide();
            $('apply-date').hide();
            $('apply-item_type').hide();
            $('apply-item').hide();
            $('apply-subject_matter_or_theme').hide();
            $('apply-design').hide();
            $('apply-function_movement').hide();
            $('apply-size').hide();
            */
            
            //this.setupRichCheckboxLists();
            
            this.setupRefineInput();
            //this.setupBreadcrumbs();

            
            if($('bt-display-list')){
                addEvent($('bt-display-list'), 'click', this.observers.btDisplayListOnClick);
            }
            if($('bt-display-grid')){
                addEvent($('bt-display-grid'), 'click', this.observers.btDisplayGridOnClick);
            }
            if($('set-currency')){
                addEvent($('set-currency'), 'click', this.observers.reset_price_filter);
            }            
           
            this.interestsTooltip = new Site.Widgets.Tooltip
            (
                $('tooltip-save-to-my-interests'),
                $('trigger-save-to-my-interests'), 
                {
                    anchor: "left"
                }
            );
            
            //this.listTooltipsController = new Site.Controllers.ListTooltips(this.list);            
            
            //$('list-items').show();
             if(client_view == 'grid'){                    
                $('list-items').hide();
                $('grid-items').show();
            }
            else{
                $('grid-items').hide();
                $('list-items').show();
            }
            
            
            this.setupRolloverController();
            this.collapsePanelController = new Site.Controllers.CollapsePanel($('criteria'));
            
            if($('location-anchor')){ addEvent($('location-anchor'), "click", this.observers.dropdownOnClick); }
            if($('sales-anchor')){ addEvent($('sales-anchor'), "click", this.observers.dropdownOnClick); }
            if($('sort-anchor')){ addEvent($('sort-anchor'), "click", this.observers.dropdownOnClick); }
            if($('number-anchor')){ addEvent($('number-anchor'), "click", this.observers.dropdownOnClick); }
            
            $('refine-panel-artist').show();
            
        },
        
        windowOnLoad: function($super, event)
        {
            $super(event);
            
             /*
            if(b_gold == true){
                client_view = 'grid';
            }
            */

            if($('criteria-price-range')){
                $('criteria-price-range').show();

                this.priceRangeControl = new Site.Widgets.PriceRange
                                     (
                                         $('price-range-1'),
                                         {
                                             startBounds: [0, 0],
                                             onChange: this.blocks.priceRangeOnChange
                                         }
                                     );
            }
            
            if($('tooltip-sale-times') && $('link-sale-times')){
                this.tooltipSaleTimes = new Site.Widgets.Tooltip($('tooltip-sale-times'), $('link-sale-times'));
            }  
            if($('tooltip-viewing-times') && $('link-viewing-times')){
                this.tooltipViewingTimes = new Site.Widgets.Tooltip($('tooltip-viewing-times'), $('link-viewing-times'));
            }              
            if($('tooltip-sale-viewing-times') && $('link-sale-viewing-times')){
                this.tooltipViewingTimes = new Site.Widgets.Tooltip($('tooltip-sale-viewing-times'), $('link-sale-viewing-times'), {offsetY: 10, showOnClick: true});
            } 
            if($('tooltip-contact-info') && $('link-contact-info')){
                this.tooltipContactInfo = new Site.Widgets.Tooltip($('tooltip-contact-info'), $('link-contact-info'));
            }  
              if($('tooltip-add-to-calendar') && $('link-add-to-calendar')){
                this.tooltipContactInfo = new Site.Widgets.Tooltip($('tooltip-add-to-calendar'), $('link-add-to-calendar'), {offsetY: 10, showOnClick: true});
            } 
            if($('tooltip-save-interest') && $('bt-save-to-my-interests')){
                this.tooltipSaveInterest = new Site.Widgets.Tooltip($('tooltip-save-interest'), $('bt-save-to-my-interests'), {showOnClick: true});
            }     
            //searchstring = document.location.hash;
            this.sendRequest();
        },
        
        setHash: function(new_hash){
            document.location.hash = new_hash;
        },
        
        destroy: function($super)
        {
            $super();
            
            //this.destroyRichCheckboxLists();
            if($('bt-display-list')){
                removeEvent($('bt-display-list'), 'click', this.observers.btDisplayListOnClick);
            }
            if($('bt-display-grid')){
                removeEvent($('bt-display-grid'), 'click', this.observers.btDisplayGridOnClick);
            }            
            
            // ADDED: 08 Feb 2008
            this.destroyRolloverController();
            
            this.release(this.interestsTooltip, this.refineArtistInput);
            
            if($('criteria-price-range')){
                this.release(this.priceRangeControl);
            }
            
            if($('tooltip-sale-times') && $('link-sale-times')){
                this.release(this.tooltipSaleTimes);
            }  
            if($('tooltip-viewing-times') && $('link-viewing-times')){
                this.release(this.tooltipViewingTimes);
            } 
            if($('tooltip-contact-info') && $('link-contact-info')){
                this.release(this.tooltipContactInfo);
            }
            if($('tooltip-save-interest') && $('bt-save-to-my-interests')){
                this.release(this.tooltipSaveInterest);
            }
        },       
        
        destroyRolloverController: function()
        {
            // CHANGED: Added "hold element" to prevent rollovers from closing when place bid tooltip is moused over (08 Feb 2008)
            this.rolloverController.destroy();       
            
            // setup place bid tooltip on place bid buttons
            this.placeBidTooltipController.destroy();
            
            // setup track lot tooltip on track lot buttons
            this.tracklotTooltipController.destroy();
        },
        
        setupRolloverController: function()
        {
            this.rolloverController = new Site.Controllers.Rollover(this.grid, 'li.grid-trigger', 'div.rollover', { holdElement: $('tooltip-place-bid') }, { holdElement: $('tooltip-track-lot') } );   
            
            // setup place bid tooltip on place bid buttons
            this.placeBidTooltipController = new Site.Controllers.Tooltips($('results').select("a.bt-bid"), { showOnClick: true, width: 450, beforeShow: this.blocks.placeBidTooltipBeforeShow } );
            
            // setup track lot tooltip on track lot buttons
            this.tracklotTooltipController = new Site.Controllers.Tooltips($('results').select("a.bt-track"), { showOnClick: true, beforeShow: this.blocks.tracklotTooltipBeforeShow } );
        },

        
        /* ADDED 0313 */
        reset_price_filter: function(event)
        {   
            var e1Value = this.getQueryStringValue("e1")
            if(e1Value.length > 0){
                searchstring = searchstring.replace("&e1=" + e1Value, "").replace("e1=" + e1Value, "").replace("&e1=", "").replace("e1=", "")
            }
            var e2Value = this.getQueryStringValue("e2")
            if(e2Value.length > 0){
                searchstring = searchstring.replace("&e2=" + e2Value, "").replace("e2=" + e2Value, "").replace("&e2=", "").replace("e2=", "")
            }
            
            searchstring = searchstring.replace("&e1=", "").replace("e1=", "").replace("&e2=", "").replace("e2=", "")
            
            var sAction = this.getQueryStringValue("action");
            
            if(searchstring.indexOf("action=") != -1){
                searchstring = searchstring.replace("action=" + sAction, "action=clearestimate")
            }
            else{
                searchstring = "action=clearestimate&" + searchstring;
            }
            
            searchstring = searchstring.replace("searchids", "selectedids"); 
            
            reload_prices = true;           
            
            //alert(searchstring);            
            
            this.sendRequest();
            Event.stop(event);
        },
            
        setupRichCheckboxLists: function()
        {             
             for(x = 0; x < 12; x++){
                 //alert(arrAttributeTypes[x]);
                 //this.richAttributeTypeCheckboxes = $('list-' + arrAttributeTypes[x]).select("a.rich-checkbox").collect
                 this.richAttributeTypeCheckboxes = $('list-' + arrAttributeTypes[x]).select("a.rich").collect //changed from a.rich-checkbox 0313
                (
                    function(input)
                    {
                        addEvent(input, "click", this.observers.richCheckboxOnClick);
                    },
                    this
                );
             }
            
            
        },
        
        setupPreviousNext: function()
        {
            addEvent($('previous_page'), "click", this.observers.previousPage_OnClick);
            addEvent($('next_page'), "click", this.observers.nextPage_OnClick);
            addEvent($('previous_page2'), "click", this.observers.previousPage_OnClick);
            addEvent($('next_page2'), "click", this.observers.nextPage_OnClick);
        },
        
        setupPaging: function()
        {           
             this.PagingLinks = $('paginglist').select("a").collect
            (
                function(input)
                {
                    addEvent(input, "click", this.observers.paging_OnClick);
                },
                this
            );
        },
        
        setupRefineInput: function()
        {
            // setup the Artist refine list entry
            
            this.refineArtistInput = new Site.Widgets.RefineInput($('refine-artist'), $('list-artist_maker_author'));
            this.refineArtistInput.updateList();
        },
        
        previousPage_OnClick: function(event)
        {
            //alert(Event.element(event).id);
            update_everything = false;
            searchstring = $(Event.element(event)).getAttribute('rel');
            
            reload_prices = false; 
            
            this.sendRequest();
            Event.stop(event);
        },
        
        nextPage_OnClick: function(event)
        {
            //alert(Event.element(event).id);
            update_everything = false;
            searchstring = $(Event.element(event)).getAttribute('rel');
            
            reload_prices = false; 
            
            this.sendRequest();
            Event.stop(event);
        },
        
        paging_OnClick: function(event)
        {
            update_everything = false;
            searchstring = $(Event.element(event)).getAttribute('rel');
            
            reload_prices = false; 
            
            //alert(searchstring);
            this.sendRequest();
            Event.stop(event);
            /*
            if(Event.element(event).id == ""){
                    if(Event.element(event).parentNode.id == ""){
                            //alert($(Event.element(event).parentNode.parentNode.id).getAttribute('rel'));
                            searchstring = $(Event.element(event).parentNode.parentNode.id).getAttribute('rel');
                    } else {
                            //alert($(Event.element(event).parentNode.id).getAttribute('rel'));
                            searchstring = $(Event.element(event).parentNode.id).getAttribute('rel');
                    }
            } else {
                    //alert($(Event.element(event).id).getAttribute('rel'));
                    searchstring = $(Event.element(event).id).getAttribute('rel');
            }
           
            this.sendRequest();
            Event.stop(event);
            */
        },
        
        clearAll_item_category_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_item_category;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_artist_maker_author_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_artist_maker_author;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_origin_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_origin;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_stylistic_period_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_stylistic_period;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_material_or_medium_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_material_or_medium;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_date_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_date;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_item_type_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_item_type;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_item_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_item;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_subject_matter_or_theme_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_subject_matter_or_theme;
            Event.stop(event);
        },
        
        clearAll_design_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_design;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_function_movement_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_function_movement;
            this.sendRequest();
            Event.stop(event);
        },
        
        clearAll_size_OnClick: function(event)
        {
            saved_interest = false;
            //alert(Event.element(event).id);
            //this.listArtist.uncheckAll();
            searchstring = clearAll_size;
            this.sendRequest();
            Event.stop(event);
        },

        richCheckboxOnClick: function(event)
        {
            saved_interest = false;
            if(Event.element(event).id == ""){
                    if(Event.element(event).parentNode.id == ""){
                            //alert($(Event.element(event).parentNode.parentNode.id).getAttribute('rel'));
                            searchstring = $(Event.element(event).parentNode.parentNode.id).getAttribute('rel');
                    } else {
                            //alert($(Event.element(event).parentNode.id).getAttribute('rel'));
                            searchstring = $(Event.element(event).parentNode.id).getAttribute('rel');
                    }
            } else {
                    //alert($(Event.element(event).id).getAttribute('rel'));
                    searchstring = $(Event.element(event).id).getAttribute('rel');
            }            
           
            this.sendRequest();
            Event.stop(event);
        },
        
        btDisplayListOnClick: function(event)
        {
            var element = Event.element(event)
            Event.stop(event);
            
            if (element.blur)
                element.blur();
                
            setCookie('client_view_pref','list',365);
            
            client_view = 'list';
                        
            this.listMode();

        },

        btDisplayGridOnClick: function(event)
        {
            var element = Event.element(event)
            Event.stop(event);

            if (element.blur)
                element.blur();
                
            setCookie('client_view_pref','grid',365);
            
            client_view = 'grid';
            
            this.gridMode();
        },
        
        listMode: function()
        {
            if(this.rolloverController)this.rolloverController.hideRollovers();
            
            this.mode = 'list';
            
            if($('bt-display-list')){         
                $('bt-display-list').addClassName("active");
            }
            if($('bt-display-grid')){
                $('bt-display-grid').removeClassName("active");
            }
            
            $('grid-items').hide();
            $('list-items').show();
            $('list-items-container').show();
        },
        
        gridMode: function()
        {
            this.mode = 'grid';
            
            if($('bt-display-list')){
                $('bt-display-list').removeClassName("active");
            }
            if($('bt-display-grid')){
                $('bt-display-grid').addClassName("active");
            }
            
            $('grid-items').show();
            $('list-items-container').hide();
        },
        
        priceRangeOnChange: function(values)
        {
            //alert(values);
            var strValues = values.toString()
            var arrValues = strValues.split(",");
            var e1 = Math.round(arrValues[0]);
            var e2 = Math.round(arrValues[1]);
            
            //alert(e1);
            //alert(e2);
            
            //alert(searchstring);
            
            var e1Value = this.getQueryStringValue("e1")
            if(e1Value.length > 0){
                searchstring = searchstring.replace("&e1=" + e1Value, "").replace("e1=" + e1Value, "").replace("&e1=", "").replace("e1=", "")
            }
            var e2Value = this.getQueryStringValue("e2")
            if(e2Value.length > 0){
                searchstring = searchstring.replace("&e2=" + e2Value, "").replace("e2=" + e2Value, "").replace("&e2=", "").replace("e2=", "")
            }
            
            searchstring = searchstring.replace("&e1=", "").replace("e1=", "").replace("&e2=", "").replace("e2=", "")
            
            if(searchstring.length > 0){
                searchstring = searchstring + "&";
            }
            searchstring = searchstring + "e1=" + e1 + "&e2=" + e2;
            
            var sAction = this.getQueryStringValue("action");
            
            if(searchstring.indexOf("action=") != -1){
                searchstring = searchstring.replace("action=" + sAction, "action=refineestimate")
            }
            else{
                searchstring = "action=refineestimate&" + searchstring;
            }
            
            searchstring = searchstring.replace("searchids", "selectedids")
            
            //alert(searchstring)
            
            reload_prices = false;             
            
            this.sendRequest();
        },
        
        getQueryStringValue: function(variable){ 
            var strValue = ""
            var arrvars = searchstring.split("&"); 
            for (i = 0; i < arrvars.length; i++){ 
                var pair = arrvars[i].split("="); 
                if (pair[0] == variable){ 
                    strValue = pair[1]; 
                } 
            } 
            return strValue;
        },

// ---- sendRequest =========================================================== >
        
        sendRequest: function()
        {            
            //added so we can bookmark search results
            if(searchstring){
                if(searchstring.length > 0){
                    this.setHash(searchstring);
                    //alert(url_to_webservice);
                }
            }   
            
            //alert(searchstring); 
            
            //alert('js noresults = ' + b_noresults);
            if(b_noresults){
                if(str_alternate.length > 0){
                    //This code is not used. WHC (6/17/2009)
                    //var noresults_redirect = "no_results.aspx?" + searchstring;
                    //noresults_redirect = noresults_redirect + "&alternate=" + str_alternate;
                    //document.location = noresults_redirect;
                }
                $('grid-items').hide();
                $('list-items').hide();
                $('list-items-container').hide();
                $('results-spinner').hide();
                $('results-controls').hide();
                $('no-results-search').style.display = 'block';
            }
            else{
                /*
                if(b_gold == true){
                    this.gridMode();
                }
                */
                if(client_view == 'grid'){
                    this.gridMode();
                }
                else{
                    this.listMode();
                }
                if(searchstring){
                    if(searchstring.length > 0){
                        this.data = null;
                        
                        $('no-results-search').style.display = 'none';
                        
                        if (update_everything)
                        {
                            if (this.mode == 'grid')
                                $('grid-items').style.display = 'none';
                            else
                                $('list-items').style.display = 'none';

                            $('results-spinner').style.display = 'block';
                        }
                        
                        //alert("Before LF Search And Create JS arrays")
                        
                        this.request = null;
                        
                        //alert(searchstring)
                        
                        if(b_lfsearch == true){
                                this.request = new Ajax.Request
                            (
                                //"/js/sample_data/browse_tyler.js?t=" + (new Date()).getTime(),
                                //"browse_erik2.js?t=" + (new Date()).getTime(),
                                "lf_search.aspx?" + searchstring + "&t=" + (new Date()).getTime(),
                                //"sample_tt.js?t=" + (new Date()).getTime(),
                                {
                                    method: "get",
                                    //requestHeaders: {Accept: 'application/json'},
                                    onComplete: this.blocks.sendRequestOnComplete
                                }
                            );

                            this.request = null;  
                        }
                        else{
                            this.getSearchResults();
                        }
                    }
                }  
            }           
        },
        
        getSearchResults: function()
        {
            //alert(sr_JS);
            this.data = sr_JS.evalJSON();
            b_lfsearch = true;
            this.updateElements();
            
            scroll(0,0);
        },
        
        sendRequestOnComplete: function(transport)
        {
            //alert("After LF Search And Create JS arrays")
            if(b_lfsearch == true){
                //alert(transport.responseText);
                this.data = transport.responseText.evalJSON();
            }
            else{
                //alert(sr_JS);
                this.data = sr_JS.evalJSON();
                b_lfsearch = true;
            }
            this.updateElements();
            
            scroll(0,0);
        },
        
        updateElements: function()
        {            
            //alert("HERE3_1")
            if (this.data)
            {
                //alert("HERE3_2")
                this.updateItems();
                
                if (update_everything)
                {
                    // clear the refine artist input
                    this.refineArtistInput.clear();
                    
                    //this.priceRangeControl.setValues(0, 1); 
                    
                    //---this.priceRangeControl.setBounds2(this.data.priceRange[0], this.data.priceRange[1]);   
                    //---this.priceRangeControl.setValues2(0, 1);
                    
                    //alert(reload_prices);
                    
                    if($('criteria-price-range')){
                        if(reload_prices){
                            low_value = this.data.priceRange[0];
                            high_value = this.data.priceRange[1];
                            //alert(low_value);
                            //alert(high_value);
                            this.priceRangeControl.setBounds(this.data.priceRange[0], this.data.priceRange[1]);
                            this.priceRangeControl.setValues2(0, 1);
                        }
                        else{
                            this.priceRangeControl.setBounds(low_value, high_value);
                        }
                    }                    
                    
                    // now update the criteria lists to reflect new quantities
                    //this.updateCategoryList("category");
                    
                    for(x = 0; x < 12; x++){
                        this.updateNonCatList(arrAttributeTypes[x]);
                     }

                    clearAll_item_category = searchstring;
                    clearAll_artist_maker_author = searchstring;
                    clearAll_origin = searchstring;
                    clearAll_stylistic_period = searchstring;
                    clearAll_material_or_medium = searchstring;
                    clearAll_date = searchstring;
                    clearAll_item_type = searchstring;
                    clearAll_item = searchstring;
                    clearAll_subject_matter_or_theme = searchstring;
                    clearAll_design = searchstring;
                    clearAll_function_movement = searchstring;
                    clearAll_size = searchstring;       
                     
                     if(this.data.clearall_item_category){
                        if(this.data.clearall_item_category.length > 0){
                               clearAll_item_category = this.data.clearall_item_category.replaceAll("||:||", "'");
                        }
                     }       
                     
                     if(this.data.clearall_artist_maker_author){
                        if(this.data.clearall_artist_maker_author.length > 0){
                               clearAll_artist_maker_author = this.data.clearall_artist_maker_author.replaceAll("||:||", "'");
                        }
                     }      
                     
                     if(this.data.clearall_origin){
                        if(this.data.clearall_origin.length > 0){
                               clearAll_origin = this.data.clearall_origin.replaceAll("||:||", "'");
                        }
                     }      
                     
                     if(this.data.clearall_stylistic_period){
                        if(this.data.clearall_stylistic_period.length > 0){
                               clearAll_stylistic_period = this.data.clearall_stylistic_period.replaceAll("||:||", "'");
                        }
                     }      
                     
                     if(this.data.clearall_material_or_medium){
                        if(this.data.clearall_material_or_medium.length > 0){
                               clearAll_material_or_medium = this.data.clearall_material_or_medium.replaceAll("||:||", "'");
                        }
                     }      
                     
                     if(this.data.clearall_date){
                        if(this.data.clearall_date.length > 0){
                               clearAll_date = this.data.clearall_date.replaceAll("||:||", "'");
                        }
                     }      
                     
                     if(this.data.clearall_item_type){
                        if(this.data.clearall_item_type.length > 0){
                               clearAll_item_type = this.data.clearall_item_type.replaceAll("||:||", "'");
                        }
                     }     
                     
                     if(this.data.clearall_item){
                        if(this.data.clearall_item.length > 0){
                               clearAll_item = this.data.clearall_item.replaceAll("||:||", "'");
                        }
                     }     
                     
                     if(this.data.clearall_subject_matter_or_theme){
                        if(this.data.clearall_subject_matter_or_theme.length > 0){
                               clearAll_subject_matter_or_theme = this.data.clearall_subject_matter_or_theme.replaceAll("||:||", "'");
                        }
                     }    
                     
                     if(this.data.clearall_design){
                        if(this.data.clearall_design.length > 0){
                               clearAll_design = this.data.clearall_design.replaceAll("||:||", "'");
                        }
                     }    
                     
                     if(this.data.clearall_size){
                        if(this.data.clearall_size.length > 0){
                               clearAll_size = this.data.clearall_size.replaceAll("||:||", "'");
                        }
                     }   
                     
                     if(this.data.clearall_function_movement){
                        if(this.data.clearall_function_movement.length > 0){
                               clearAll_function_movement = this.data.clearall_function_movement.replaceAll("||:||", "'");
                        }
                     }                     
                    
                    if(reload_sales){
                        if($('sales-anchor')) { this.buildDropdown('sales'); }
                    } 
                    if(reload_locations){
                        if($('location-anchor')) { this.buildDropdown('location'); }
                    }                     
                    if($('sort-anchor')) { this.buildDropdown('sort'); }
                    if($('number-anchor')) { this.buildDropdown('number'); }     
                    
                    this.setupRichCheckboxLists();         
                }                
            }
            
            this.setupPreviousNext();
            this.setupPaging();

            $('results-spinner').style.display = 'none';
            
            if (update_everything && b_noresults == false)
            {
                if (this.mode == 'grid')
                {
                    $('grid-items').style.display = 'block';
                } else {
                    $('list-items').style.display = 'block';
                }
            }
            
            reload_prices = true; 
        },
        
        updateNonCatList: function(key)
        {
            //alert(key);
            
            var data = this.data[key]; //the attribute
            var list = $("list-" + key); //the ul for this attribute
            var dataElement = $("data-" + key); //the container div of this ul for this attribute
            
            list.innerHTML = '';
            
            if(data.length == 0){
                $("criteria-" + key).hide();
            }
            else{
                $("criteria-" + key).show();
                data.each
                (
                    
                    /*
                    function(item)
                    {
                        var new_li = document.createElement("li");
                        new_li.innerHTML = '<a id="'+key+'-'+item.id+'" rel="'+item.url+'" class="rich-checkbox'+item.on+'" href="#"><span>'+ item.name +' <span>('+item.qty+')</span></span>';
                        list.appendChild(new_li);
                        new_li = null;
                        
                    },
                    this
                    */
                    

                    function(item)
                    {   
                        
                        
                        var new_li = document.createElement("li");
                        //commented out the following line for fixing of Task 82 (checkbox hyperlink fix) 9/8:kt
                        //Element.addClassName(new_li, "browse_checkbox"+item.on);
                        // original code, replaced by the one with Omniture tracking below.
                        // new_li.innerHTML = '<a id="'+key+'-'+item.id+'" rel="'+item.url+'" class="rich" href="#"><span class="att_name">'+ item.name +' <span>('+item.qty+')</span></span></a>';
                        
                        // ====== START: Omniture COA Interface Tracking PhaseIII PartII: TaskID 65 by ktang 7/28/08 ======
                            var oAttributename = item.name
                            var oKey = key
                            //remove underscore from oKey and remove apostrophe from oKey and oAttributename 
                            //(it was causing javascript error when composing the onclick)
                            oAttributename = oAttributename.replaceAll("'", "").replaceAll("||:||", "")
                            oKey = oKey.replaceAll("_", " ")
                            oKey = oKey.replaceAll("'", "")
                           
                            //orig commented out to fix for Task 82: kt 
                            //new_li.innerHTML = '<a id="'+key+'-'+item.id+'" rel="'+item.url+'" class="rich" href="#" onClick="var s=s_gi(\'christiesprod\');s.linkTrackVars=\'prop30,eVar21,eVar12,events\';s.linkTrackEvents=\'event60\';s.prop30=\'' + oKey + '\';s.eVar21=\'' + oKey + '\';s.eVar12=\'' + oAttributename + '\';s.events=\'event60\';s.tl(this,\'o\',\'COA Interface Tracking\');"><span class="att_name">'+ item.name +' <span>('+item.qty+')</span></span></a>';
                            
                            //added the following for fixing of Task 82 (checkbox hyperlink fix-- calls the new css class created in sites.pages.searchresults_new.css)  9/8:kt
                            if (item.on.length > 0){
                           
                                new_li.innerHTML = '<a id="'+key+'-'+item.id+'" rel="'+item.url+'" class="rich" href="#" onClick="var s=s_gi(\'christiesprod\');s.linkTrackVars=\'prop30,eVar21,eVar12,events\';s.linkTrackEvents=\'event60\';s.prop30=\'' + oKey + '\';s.eVar21=\'' + oKey + '\';s.eVar12=\'' + oAttributename + '\';s.events=\'event60\';s.tl(this,\'o\',\'COA Interface Tracking\');"><div class="sr_checkbox_checked">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="att_name">'+ item.name +' <span>('+item.qty+')</span></span></div></a>';
                            }
                            else{
                          
                                new_li.innerHTML = '<a id="'+key+'-'+item.id+'" rel="'+item.url+'" class="rich" href="#" onClick="var s=s_gi(\'christiesprod\');s.linkTrackVars=\'prop30,eVar21,eVar12,events\';s.linkTrackEvents=\'event60\';s.prop30=\'' + oKey + '\';s.eVar21=\'' + oKey + '\';s.eVar12=\'' + oAttributename + '\';s.events=\'event60\';s.tl(this,\'o\',\'COA Interface Tracking\');"><div class="sr_checkbox">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="att_name">'+ item.name +' <span>('+item.qty+')</span></span></div></a>';
                            }
                        // ====== END: Omniture COA Interface Tracking PhaseIII PartII: TaskID 65 by ktang 7/28/08 ======
                        
                        list.appendChild(new_li);
                        new_li = null;
                        
                    },
                    this
                    
                );

            }          
            
        },
            
        updateItems: function()
        {
            //alert("HERE4")
            
            var data = this.data["items"];
            
            if (data)
            {
                /*if (data.length == 1){
                    if(searchstring.indexOf("action=search") != -1){
                        var objectid = this.data.items[0].id;
                        document.location = "lot_details.aspx?intObjectId=" + objectid;
                        Event.stop(event);
                    }
                }*/
                if (data.length)
                {
                    var gridHTML = '';
                    var listHTML = '';
                    //var listTooltipsHTML = '';
                    
                    data.each
                    (
                        function(item, index)
                        {
                            // set the className property 
                            item.className = index % 2 == 0 ? "alternate" : "";
                            
                            gridHTML += this.templateGridItem.evaluatep(item).replaceAll("||:||", "'");
                            listHTML += this.templateListItem.evaluatep(item).replaceAll("||:||", "'");
                            //listTooltipsHTML += this.templateListItemTooltip.evaluatep(item);
                        },
                        this
                    );
                    
                    this.grid.update(gridHTML);
                    this.list.update(listHTML);
                    //this.listTooltipsElement.update(listTooltipsHTML);
                    
                    //this.release(this.listTooltipsController);
                    //this.listTooltipsController = new Site.Controllers.ListTooltips(this.list);
                }
                else{
                    var noresults_redirect = "no_results.aspx?" + searchstring;
                    //alert(this.data.alternate);
                    if(this.data.alternate){                        
                        noresults_redirect = noresults_redirect + "&alternate=" + this.data.alternate;
                    }
                    
                    $('grid-items').hide();
                    $('list-items').hide();
                    $('results-spinner').hide();
                    $('results-controls').hide();
                    $('no-results-search').style.display = 'block';
                        
                    //document.location = noresults_redirect;
                }
            }
            
            $('prev_next_buttons').innerHTML = this.data.previousnext;
            $('prev_next_buttons2').innerHTML = this.data.previousnext2;
            $('paginglist').innerHTML = this.data.pagenumbers;
            $('results-range').innerHTML = this.data.resultsrange;

            if (update_everything){
                
                /*
                if (this.data.numberResults == 1)
                {
                    $('lots-items').addClassName("singular");
                }
                else
                {
                    $('lots-items').removeClassName("singular");
                }
                */
                
                $('number-results').innerHTML = this.data.numberResults;
                 
                if ($('breadcrumbs'))
                    $('breadcrumbs').update(this.data.breadcrumbs.replaceAll("||:||", "'"));
                    
                if(this.data.interest_name.length > 0){
                    document.forms["tooltip_saveinterest"].elements["interest_name"].value = this.data.interest_name;
                }
                    

                if(this.data.saveinterest.length == 0){
                    $('save-to-my-interests').hide();
                }
                else{
                    $('save-to-my-interests').show();
                    $('save-to-my-interests').innerHTML = this.data.saveinterest.replaceAll("||:||", "'");
                    
                    if(saved_interest == true){
                        $('save-to-my-interests').innerHTML = $('save-to-my-interests').innerHTML.replace("Save to my interests", "Saved interest")
                    }
                    
                    this.interestsTooltip = new Site.Widgets.Tooltip
                    (
                        $('tooltip-save-to-my-interests'),
                        $('trigger-save-to-my-interests'), 
                        {
                            anchor: "left"
                        }
                    );
                    
                    if($('tooltip-save-interest') && $('bt-save-to-my-interests')){
                        this.tooltipSaveInterest = new Site.Widgets.Tooltip($('tooltip-save-interest'), $('bt-save-to-my-interests'), {showOnClick: true});
                    }
                    
                }
                    
                    
                
                //this.destroyBreadcrumbs();
                //this.setupBreadcrumbs();
            }           
                           
            this.destroyRolloverController();
            this.setupRolloverController();
        },
        
        
        hideAllOptions: function(){
            //alert('test')
            if($('location-anchor')) { $('location-anchor-ul').hide(); }
            if($('sales-anchor')) { $('sales-anchor-ul').hide(); }
            if($('number-anchor')) { $('number-anchor-ul').hide(); }
            if($('sort-anchor')) { $('sort-anchor-ul').hide(); }
            this.sales_anchor_showing = false;
            this.sort_anchor_showing = false;
            this.number_anchor_showing = false;
            this.location_anchor_showing = false;
        },
        
        
       buildDropdown: function(key)
        {
            var data = this.data[key]; //the attribute
            var list = $(key+"-anchor-ul"); //the ul for this attribute
            list.innerHTML = '';
            //alert('test');
            
            data.each
            (
                function(item)
                {
                    var new_li = document.createElement("li");
                    
                    if(item.sel == 'Y'){
                        activeElement = $(new_li);
                        new_li.addClassName("selected");
                        var the_span = $(key+'-anchor').select('span[title="selected_copy"]');
                        the_span[0].innerHTML = item.text.replaceAll("||:||", "'");
                        the_span = null;
                    }
                    
                    var li_width = "205"
                    
                    if(key == 'sales'){
                        li_width = "290"
                    }
                    
                    new_li.innerHTML = '<a href="#" style="width:'+li_width+'px;text-transform:capitalize;" onclick="page.selectDD(this.rel); event.returnValue = false; return false;" rel="'+item.value+'">'+item.text+'</a>';
                    list.appendChild(new_li);
                    new_li = null;
                    
                },
                this
            );
            
        },        
        
        selectDD: function(the_url){        
            this.hideAllOptions();
            searchstring = the_url;
            
            //alert(searchstring);
            
            var numresultsperpage = this.getQueryStringValue("num")
            
            //alert(numresultsperpage);
            
            // -- Karen - you should be able to put your omniture code here using the variable I set above to track the number of results per page ----------------
           
            this.sendRequest();
            
            var s=s_gi('christiesprod');
            s.linkTrackVars='eVar40,events';
            s.linkTrackEvents='event58';
            s.eVar40= numresultsperpage + ' results';
            s.events='event58';
            s.tl(true,'o','Number Results Filter Change');
           
            
        },
        
        
        dropdownOnClick: function(event){
            
            if(Event.element(event).id == ""){
                    var clicked_anchor = Event.element(event).parentNode.id;
            } else {
                    var clicked_anchor = Event.element(event).id;
            }
            
            if(clicked_anchor == 'location-anchor')
            {
                if(this.location_anchor_showing){ this.hideAllOptions(); } else { this.hideAllOptions(); $(clicked_anchor+'-ul').show(); this.location_anchor_showing = true; }
            }
            if(clicked_anchor == 'sales-anchor')
            {
                if(this.sales_anchor_showing){ this.hideAllOptions(); } else { this.hideAllOptions(); $(clicked_anchor+'-ul').show(); this.sales_anchor_showing = true; }
            }
            if(clicked_anchor == 'sort-anchor')
            {
                if(this.sort_anchor_showing){ this.hideAllOptions(); } else { this.hideAllOptions(); $(clicked_anchor+'-ul').show(); this.sort_anchor_showing = true; }
            }
            if(clicked_anchor == 'number-anchor')
            {
                if(this.number_anchor_showing){ this.hideAllOptions(); } else { this.hideAllOptions(); $(clicked_anchor+'-ul').show(); this.number_anchor_showing = true; }
            }   
            
        },
        
        setupBreadcrumbs: function(event)
        {
            $('breadcrumbs').select("a").each
            (
                function(link)
                {
                    addEvent(link, "click", this.observers.breadcrumbOnClick);
                },
                this
            );
        },

        destroyBreadcrumbs: function(event)
        {
            $('breadcrumbs').select("a").each
            (
                function(link)
                {
                    removeEvent(link, "click", this.observers.breadcrumbOnClick);
                },
                this
            );
        },
        
        breadcrumbOnClick: function(event)
        {
            var element = Event.element(event);
            
            // would need to extract the href from the element to find the category ID and sub-categories to load
            // not sure how this is currently structured, but it seems there is a top-level category, sub-level category, and filter categories.
             
            this.sendRequest();
            
            Event.stop(event);
        },
            
        destroyRichCheckboxLists: function()
        {
            removeEvent($('clear-all-artist'), "click", this.observers.clearAllArtistOnClick);
            removeEvent($('clear-all-date'), "click", this.observers.clearAllDateOnClick);
            removeEvent($('clear-all-function'), "click", this.observers.clearAllFunctionOnClick);
            removeEvent($('clear-all-material'), "click", this.observers.clearAllMaterialOnClick);
            
            

            this.release(this.listMaterial, this.listFunction, this.listDate, this.listArtist);
        }
    }
);

Object.extend
(
    Site.Pages.Browse,
    {        
        TEMPLATES:
        {
            GRID_ITEM: '<li id="grid-trigger-#{id}" class="grid-trigger">'
                     + '<div class="cell"><div class="mid"><div><img id="grid-image-#{id}" src="#{image2}" alt="" class="grid-image" /></div></div></div>' 
                     + '<div id="grid-rollover-#{id}" class="rollover" style="display: none;">'
    				 + '<p class="sale-info">LOT <strong>#{lotNumber}</strong>, SALE <a href="searchresults.aspx?intSaleID=#{saleid}">#{saleNumber}</a>, #{location}</p>'
    				 + '<div class="info"><div class="cell"><div class="mid"><div><a href="lot_details.aspx?from=#{from}&intObjectID=#{id}&sid=#{sid}"><img src="#{image}" height="30" alt="" class="grid-small-image" /></a></div></div></div><br />'
					 + '<div class="clearer"></div>' 
    				 //+ '<a href="lot_details.aspx?from=#{from}&intObjectID=#{id}&sid=#{sid}" class="description">#{description}</a><br />'
    				 + '<a href="lot_details.aspx?from=#{from}&intObjectID=#{id}&sid=#{sid}" class="description">#{line1}</a><br />'
    				 //+ '<span class="artist"><a href="searchresults.aspx?action=search&entry=#{artistlink}&artist=#{artistlink}">#{artist}</a></span>'
    				 //+ '<span class="artist"><a href="searchresults.aspx?action=search&searchids=#{artistlink}">#{artist}</a></span>'
    				 + '<i>#{line2}</i>'
    				 + '</div>'
    				 + '<p class="price">'
    				 + '<span class="amount">#{priceLow}#{priceHigh} #{currency}</span><br />'
    				 + '<span class="amount-usd">#{priceLowUser}#{priceHighUser} <a href="#" class="currency">#{userCurrency}</a></span>'
    				 + '</p>'
    				 + '<ul class="lot-links">'
    				 + '<li>#{trackLotLink2}</li>'
    				 + '<li>#{placeBidLink}</li>'
    				 + '</ul>'
    				 + '</div>'
    				 + '</li>',
    				   
					 
			LIST_ITEM:'<li class="#{className}">'
			        + '<div class="list_image">'
					+ '<a href="lot_details.aspx?from=#{from}&intObjectID=#{id}&sid=#{sid}">'
					+ '<img id="list-image-#{id}" src="#{image}" alt="" />&nbsp;'
					+ '</a>'
					+ '</div>'
					+ '<div class="list_sale_info">'
					+ '<div class="sale">Lot <strong>#{lotNumber}</strong>, Sale <a href="searchresults.aspx?intSaleID=#{saleid}">#{saleNumber}</a>, #{location}</div>'
					//+ '<a href="lot_details.aspx?from=#{from}&intObjectID=#{id}&sid=#{sid}" class="list_lot_desc">#{description}</a>'
					+ '<a href="lot_details.aspx?from=#{from}&intObjectID=#{id}&sid=#{sid}" class="list_lot_desc">#{line1}</a>'
					//+ '<a href="searchresults.aspx?action=search&entry=#{artistlink}&artist=#{artistlink}" class="artist">#{artist}</a>'
					//+ '<a href="searchresults.aspx?action=search&searchids=#{artistlink}" class="artist">#{artist}</a>'
					+ '<i>#{line2}</i>'
					+ '</div>'
					+ '<div class="list_estimate_bid">'
					+ '<div class="estimate">#{priceType}</div>'
					+ '#{priceLow}#{priceHigh} #{currency}<br /><span class="currency">#{priceLowUser}#{priceHighUser} #{userCurrency}</span>'
					+ '#{myBid}'
					+ '<table><tr>'
					+ '<td>#{trackLotLink}</td>'	  
					+ '<td>#{placeBidLink}</td>'                  
					+ '</tr></table>'
					+ '</div>'
					+ '<div class="clearer"></div>'
					+ '</li>'
    				 
    				 
    				 /*,
			
			// CHANGED: 08 Feb 2008
			LIST_ITEM_TOOLTIP: '<div id="list-item-tooltip-#{id}" class="tooltip-list tooltip" style="display: none;">'
			                 + '<div class="cap-tp"><div>&nbsp;</div></div><div class="clearer"></div>'
			                 + '<div class="body"><img src="#{baseUrl}#{image}" width="218" height="218" alt="" /></div>'
			                 + '<div class="clearer"></div>'
			                 + '<div class="cap-bt"></div>'
			                 + '</div>'*/
					         
        }
    }
);