/* >> AJAX URL Manager jQuery 1.2.6 Version: rel-1-0-0 */
	AjaxURLManager = {
		mode: 'static',
		URL: {},
		sessionData: null,
		baseURL: '/backend/',
		baseURLStatic: '../static/',
		setBaseURL: function(url){
			this.baseURL = url;
		},
		setBaseURLStatic: function(url){
			this.baseURLStatic = url;
		},
		setMode: function(mode){
			this.mode = APP_MODE = mode;
		},
		registerKey: function(key, attrs, staticFile, allwaysStatic){
			this.URL[key] = {'attrs': attrs, 'staticFile': staticFile, 'allwaysStatic': allwaysStatic};
		},
		getUrlWithKey: function(key, attrs){
			if (this.URL[key]){
				var data = this.URL[key];
				if (data.attrs || attrs){
					if (data.attrs) attrs = $.extend(data.attrs, attrs);
					var realAttrs = {};
					for (var k in attrs){
						if (attrs[k] != null) realAttrs[k] = attrs[k];
					}
					if (this.sessionData) realAttrs = $.extend(realAttrs, this.sessionData);
					attrs = '?' + $.param(realAttrs);
				}else{
					if (this.sessionData){
						var attrs = $.extend(data.attrs, this.sessionData);
						attrs = '?' + $.param(this.sessionData);
					}
				}
				if (this.mode == 'static' && data.staticFile || data.allwaysStatic && data.staticFile){
					return [this.baseURLStatic,data.staticFile,attrs].join('');
				}
				return [this.baseURL,key,attrs].join('');
			}
			return null;
		}
	}
	AjaxURLManager.setMode('live');
	AjaxURLManager.registerKey('search', null, null, false);
/* << */


// >> i18n
	$.lang('searchPhraseProposalTitle', {
		'de': 'Unsere Vorschl&auml;ge f&uuml;r Sie...',
		'en': 'Our proposals for you...'
	});
	$.lang('productProposalTitle', {
		'de': 'Unsere Produktvorschläge...',
		'en': 'Our product proposals...'
	});
	$.lang('searchFacetPanelItemBack', {
		'de': '&#8595; Alle anzeigen',
		'en': '&#8595; Show all'
	});
	$.lang('searchSelectFacetPanelItemBack', {
		'de': 'Alle anzeigen',
		'en': 'Show all'
	});
	$.lang('searchInfoPrompt1', {
		'de': 'Seite',
		'en': 'Page'
	});
	$.lang('searchInfoPrompt2', {
		'de': 'von',
		'en': 'of'
	});
// <<
	
// >> Solr-Search embedding kit Version: rel-1-1-1
	if (typeof(window.llsolr) === 'undefined'){
		window.llsolr = {};
	}

	llsolr.SolrSearchEmbeddingKit = $.extend(
		$.clone(LLObject),
		{
			create: function(opts){
				var o = LLObject.create.call(this);
				o.keyCnt = 0;
				o.proposalItems = {
					'current': 0,
					'items': null
				};
				o.addOns = [];
				o.searchPhraseProposals = null;
				o.SolrFacetAddOn = null;
				o.SolrFacetSelectboxFacetTeaserAddOn = null;
				o.SolrStaticFacetSelectboxFacetTeaserAddOn = null;
				o.defaults = {
					standardParams: {
						'q': '',
						'start': 0,
						'rows': 0,
						'indent': 'on',
						'qt': 'dismax',
						'spellcheck': false,
						'wt': 'json',
						'spellcheck.extendedResults': true,
						'spellcheck.collate': true,
						'facet': true,
						'facet.mincount': 1,
						'keyCnt': o.keyCnt,
						'facet.field': [],
						'facet.query': []
					},
					searchPhraseParams: {
						'facet.limit': 100,
						'facet.prefix': ''
					},
					searchPhraseFacets: ['textpropose'],
					persistentStaticParams: [], // added on each request
					detailSearchResultCount: 10,
					detailSearchParams: {
						'hl': 'false',
						'hl.fl': 'textpropose',
						'facet.sort': 'count'
					},
					detailSearchFacets: [],
					searchDetailTarget: [],
					searchDetailUrl: '/',
					detailSearchAjaxHandler: 'search',
					searchPhraseOuterTarget: [],
					autocomplete: false,
					pagerFrameWidth: 10,
					pagerTopTarget: $('#llsolr-pager1'),
					pagerBottomTarget: $('#llsolr-pager2'),
					searchResultTarget: $('#llsolr-detailSearchResult'),
					facetPanelsTarget: $('#llsolr-facetPanels'),
					positionAbsolute: false,
					relativeTargetPosition: null,
					onBeforeSearchResult: null,
					onSearchResult: null,
					searchTransmitter: null,
					searchPhraseProposalItem: llsolr.SolrSearchPhraseProposalsItem,
					showSearchPhraseProposalCount: false,
					productProposalItem: llsolr.SolrProductProposalsItem,
					staticSearchPhrasePrefix: ''
				};
				if (opts && Utils.isObject(opts)){
					$.extend(o.defaults, opts);
				}
				o.currentFacets = {};
				o.data = null;
				o.phrase = '';
				o.originalTarget = null;
				return o;
			},
			sequence: (function(){
				var seq = 0;
				return {
					next: function(){
						return (seq += 1);
					}
				};
			}()),
			prepareSearchElement: function(){
				var spp, searchTargets = this.defaultParams('searchPhraseOuterTarget'), searchTargets, self = this,
				posAbsolute = this.defaultParams('positionAbsolute'),
				autocomplete = this.defaultParams('autocomplete');
				if ($('#llsolr-searchPhraseProposals', searchTargets).length === 0){
					spp = this.makeSearchPhraseProposalPaneLayout().hide();
					if (posAbsolute){
						spp.addClass('llsolr-searchPhraseProposals-posAbs');
						$('body').append(spp);
					}else{
						searchTargets.each(function(i){
							var form, field, button;
							form = $(this).find('form');
							field = $(this).find('input[type=text]');
							button = $(this).find('.button input');
							button.bind('click.autocomplete', function(e){
								self.handleKeyPress(e)
							});
							self.originalTarget = field;
							form.bind('submit.autocomplete', function(e){
								e.preventDefault();
								e.stopPropagation();
								if (!autocomplete){
									window.location.href = self.defaultParams('searchDetailUrl') +
									Utils.getUrlParamsFromJson({'phrase': self.preprocessPhrase($.trim(field.val()))});
								}else{
									self.handleKeyPress(e);
								}
							}).css({
								position: 'relative',
								zIndex: 1000 + (self.sequence.next() * 1)
							});
							$(this).find('llsolr-searchPhraseProposals-root').css({
								zIndex: 1000000 + (self.sequence.next() * 1)
							});
							if (autocomplete){
								field.attr({
									autocomplete: 'off'
								});
								$(this).bind('keydown.autocomplete', function(e){
									self.handleKeyPress(e);
								});
								(function(currentTarget, searchTargets){
									field.bind('keyup.autocomplete', function(e){
										var spp, searchTarget, phrase;
										self.keyCnt +=1;
										for (i = 0; i < searchTargets.length; i+=1){
											searchTarget = searchTargets[i];
											if (searchTarget !== currentTarget.get(0)){
												$(searchTarget).find('input[type=text]').val(currentTarget.find('input[type=text]').val());
											}
										}
										if (e.keyCode === 8 || e.keyCode > 45 || e.keyCode === 0){
											field = $(this);
											// check if autocomplete shell is not in search target then append to the search target.
											if (!currentTarget.find('.llsolr-searchPhraseProposals-root').length){
												currentTarget.append($('body').find('.llsolr-searchPhraseProposals-root'));
											}
											if (field.val().charCodeAt(field.val().length - 1) !== 32){
												phrase = self.preprocessPhrase(field.val());
												self.handleSearchPhraseProposals(phrase);
											}
										}
										currentTarget.find('.llsolr-searchPhraseProposals-root').css({
											zIndex: 1000000 + (self.sequence.next() * 1)
										});
									});
								}($(this), searchTargets));
							}
							field.parent().css({
							}).append(spp);
						});
					}
					this.searchPhraseProposals = spp;
				}
			},
			preprocessPhrase: function(phrase){
				return phrase.replace(/\-/g, ' ');
			},
			defaultParams: function(name, param, value){
				var p;
				if (arguments.length){
					if (name && param && typeof(value) === 'undefined'){
						p = this.defaults[name];
						if (Utils.isObject(p)){
							return this.defaults[name][param];
						}
						return this.defaults[name];
					}else if (name && !param && value){
						return (this.defaults[name] = value);
					}else if (name && param && typeof(value) !== 'undefined'){
						p = this.defaults[name];
						if (Utils.isObject(p)){
							return (this.defaults[name][param] = value);
						}
						return (this.defaults[name] = value);
					}
					return this.defaults[name];
				}else{
					return this.defaults;
				}
			},
			addOn: function(addOnObj){
				var i, isAlreadyAdded = false;
				if (Utils.isObject(addOnObj)){
					for (i = 0; i < this.addOns.length; i+=1){
						if (this.addOns === addOnObj){
							isAlreadyAdded = true;
							break;
						}
					}
					if (!isAlreadyAdded){
						this.addOns.push(addOnObj);
						addOnObj.parent = this;
						return addOnObj;
					}
				}
				return null;
			},
			makeSearchPhraseProposalPaneLayout: function(){
				var lay = $(
					'<div class="viewport llsolr-searchPhraseProposals-root" style="z-index: 10000000">' +
						'<div id="llsolr-searchPhraseProposals" class="llsolr-searchPhraseProposals">' +
							'<div id="llsolr-searchPhraseProposalsPane">' +
								'<div class="title"></div>' +
								'<div id="llsolr-searchPhraseProposalsScrollPane"></div>' +
							'</div>' +
						'</div>' +
					'</div>'
				);
				return lay;
			},
			makeProductProposalPaneLayout: function(){
				var lay, idx = '', srTarId = this.defaults.searchDetailTarget.attr('id');
				try {
					if (srTarId.lastIndexOf('_') > -1){
						idx = srTarId.substring(srTarId.lastIndexOf('_'), srTarId.length);
					}
					lay = $(
						'<div id="llsolr-productSearchProposals' + idx + '" class="llsolr-productSearchProposals">' +
							'<div id="llsolr-productSearchProposalsPane' + idx + '" class="llsolr-productSearchProposalsPane">' +
								'<div class="title">' +
									'<div class="viewport">' +
										'<div class="searchInfo"></div>' +
									'</div>' +
									'<div class="titleInner"></div>' +
								'</div>' +
								'<div id="llsolr-productSearchProposalsScrollPane' + idx + '" class="llsolr-productSearchProposalsScrollPane"></div>' +
							'</div>' +
						'</div>'
					);
				}catch(e){
					if (window.console && window.console.error){
						console.error('Exception: SolrSearchEmbeddingKit.makeProductProposalPaneLayout', e);
					}
				}
				return lay;
			},
			makeSearchSummaryLayout: function(){
				var d = this.data, numFound, start, rows, overall, current;
				numFound = d.response.numFound;
				start = d.responseHeader.params.start;
				rows = d.responseHeader.params.rows;
				current = start / rows + 1;
				overall = numFound % rows > 0 ? Math.floor(numFound / rows) + 1 : numFound / rows;
				return $(
					'<div class="outer">' +
						'<span class="prompt">' + $.lang('searchInfoPrompt1') + '</span>' +
						'<span class="current">' + current + '</span>' +
						'<span class="prompt">' + $.lang('searchInfoPrompt2') + '</span>' +
						'<span class="overall">' + overall + '</span>' +
					'</div>'
				);
			},
			buildFacetQueryParams: function(params, facetQueryKeys){
				var k, realParams = [], facetDates = this.data.facet_counts.facet_dates,
				facetDatesKeys = [];
				if (typeof(facetDates) !== 'undefined'){
					for (k in facetDates){
						facetDatesKeys.push(k);
					}
				}
				for (k in params){
					if ($.inArray(k, facetDatesKeys) > -1){
						realParams.push([k,':',params[k]].join(''));
					}else if ($.inArray(k.substring(0, k.lastIndexOf(':')), facetQueryKeys) > -1){
						var key = k.substring(0, k.lastIndexOf(':'));
						realParams.push([key,':',params[k].substring(params[k].lastIndexOf(':')+1, params[k].length)].join(''));
					}else{
						realParams.push([k,':"',params[k],'"'].join(''));
					}
				}
				return {
					fq: realParams
				};
			},
			getQueryParams: function(type, phrase, addParams){
				var stdParams = this.defaultParams('standardParams'),
				searchPhraseParamExt = this.defaultParams('searchPhraseParams'),
				searchPhraseFacets = this.defaultParams('searchPhraseFacets'),
				detailSearchParamExt = this.defaultParams('detailSearchParams'),
				detailSearchFacets = this.defaultParams('detailSearchFacets'),
				staticSearchPhrasePrefix = this.defaultParams('staticSearchPhrasePrefix'),
				persistentStaticParams = this.defaultParams('persistentStaticParams'),
				coreParams, facetFields, q;
				stdParams.keyCnt = this.keyCnt;
				if (addParams && typeof addParams === 'object'){
					if (addParams.start || addParams.start == 0){
						stdParams = $.extend(stdParams, {'start': addParams.start});
						delete addParams.start;
					}
					addParams = Utils.getUrlParamsFromJson(addParams);
					addParams = '&' + addParams.substring(1, addParams.length);
				}else{
					addParams = '';
				}
				coreParams = null;
				facetFields = null;
				if (type == 'searchProposals'){
					facetFields = searchPhraseFacets;
					q = $.trim(phrase).split(' ');
					if (q[0] !== '' && q[0] !== ' '){
						if (q.length === 1){
							searchPhraseParamExt['facet.prefix'] = q[0].toLowerCase();
							searchPhraseParamExt['q.alt'] = '*:*';
						}else{
							if (q.length > 1 && q[q.length -1] !== ' '){
								stdParams.q = q.slice(0, q.length -1).join(' ');
								searchPhraseParamExt['facet.prefix'] = q[q.length -1].toLowerCase();
							}
						}
						coreParams = $.extend(stdParams, searchPhraseParamExt);
					}
				}else if (type == 'productProposals'){
					facetFields = detailSearchFacets;
					stdParams.rows = this.defaultParams('detailSearchResultCount');
					if (Math.abs(decodeURIComponent(phrase)) === 0){
						phrase = '';
					}
					stdParams.q = staticSearchPhrasePrefix ? staticSearchPhrasePrefix + ' ' + phrase : phrase;
					coreParams = $.extend(stdParams, detailSearchParamExt);
				}
				if (coreParams){
					coreParams = Utils.getUrlParamsFromJson(coreParams);
					// extend core params cgi string with facet fields.
					$(facetFields).each(function(i){
						coreParams += '&facet.field=' + this;
					});
					coreParams += addParams;
					if (persistentStaticParams.length){
						$(persistentStaticParams).each(function(i){
							coreParams += '&' + this;
						});
					}
					return coreParams;
				}
				return null;
			},
			facetParamsAsJson: function(facet){
				var i, fqs = this.defaultParams('standardParams', 'fq'), fq, realFqs = [];
				if (Utils.isObject(facet)){
					this.currentFacets = $.extend(this.currentFacets, facet);
				}else if (typeof facet === 'string' && this.currentFacets){
					delete this.currentFacets[facet];
					if (fqs){
						for (i = 0; i < fqs.length; i+=1){
							fq = fqs[i].split(':')[0];
							if (fq != facet){
								realFqs.push(fqs[i]);
							}
						}
					}
					this.defaultParams('standardParams', 'fq', realFqs);
				}
				if (this.SolrFacetAddOn){
					this.SolrFacetAddOn.currentFacets = this.currentFacets;
				}
				if (this.SolrFacetSelectboxFacetTeaserAddOn){
					this.SolrFacetSelectboxFacetTeaserAddOn.currentFacets = this.currentFacets;
				}
				if (this.SolrStaticFacetSelectboxFacetTeaserAddOn){
					this.SolrStaticFacetSelectboxFacetTeaserAddOn.currentFacets = this.currentFacets;
				}
				return this.currentFacets;
			},
			getFilterQuery: function(){
				var d = this.data, respHeader = d.responseHeader;
				if (respHeader.params && respHeader.params.fq){
					if (respHeader.params.fq){
						return respHeader.params.fq;
					}
				}
				return null;
			},
			getFacetQueryKeys: function(){
				var facetQuery = this.defaultParams('standardParams', 'facet.query'), i,
				keys = [], key;
				for (i = 0; i < facetQuery.length; i++){
					key = facetQuery[i].split(':')[0];
					if ($.inArray(key, keys) === -1){
						keys.push(key);
					}
				}
				return keys;
			},
			requestData: function(url, callback){
				var searchTransmitter = this.defaults.searchTransmitter;
				if (searchTransmitter && Utils.isObject(searchTransmitter)){
					if (!searchTransmitter.parent){
						searchTransmitter.parent = this;
					}
					searchTransmitter.requestData(url, callback);
				}else{
					$.getJSON(url, callback);
				}
			},
			initItemsAndShow: function(items){
				var item;
				for (i = 0; i < items.length; i+=1){
					item = this.defaults.productProposalItem.create();
					item.id = i;
					item.parent = this;
					item.data = items[i];
					item.make();
					this.proposalItems.items.push(item);
				}
			},
			handleSearchPhraseProposals: function(phrase){
				var params = this.getQueryParams('searchProposals', phrase), opts = this.defaults,
				url, self, proposals, proposal, i, count, item, searchTextSnippet,
				spp = this.searchPhraseProposals, handleRequestData;
				spp.removeAttr('style');
				if (params){
					params = Utils.getUrlParamsAsJson(params);
					delete params['facet.query'];
					params.q = phrase.substring(0, phrase.lastIndexOf(' ') > -1 ? phrase.lastIndexOf(' ') : phrase.length);
					params['facet.field'] = ['textpropose'];
					params.rows = 0;
					params['facet.sort'] = 'count';
					params.autocomplete = true;
					url = AjaxURLManager.getUrlWithKey(opts.detailSearchAjaxHandler) + 
						decodeURIComponent(Utils.getUrlParamsFromJson(params));
					this.proposalItems.current = 0;
					this.proposalItems.items = [];
					this.proposalItems.items.push(opts.searchPhraseOuterTarget.find('input[type=text]'));
					self = this;
					handleRequestData = function(data, textStatus){
						var ItemClass = self.defaults.searchPhraseProposalItem;
						if (self.keyCnt == (data.responseHeader.params.keyCnt * 1)){
							self.data = data;
							spp.find('.title').html($.lang('searchPhraseProposalTitle'));
							$('#llsolr-searchPhraseProposalsScrollPane').empty();
							if (data.facet_counts.facet_fields.textpropose.length > 0){
								proposals = data.facet_counts.facet_fields.textpropose;
								searchTextSnippet = '';
								if (phrase.search(' ') > -1){
									searchTextSnippet = phrase.substring(0, phrase.lastIndexOf(' ')) + ' ';
								}
								for (i = 0; i < proposals.length; i+=1){
									if (i % 2 == 1){continue;}
									proposal = searchTextSnippet + proposals[i];
									count = null;
									if (self.defaultParams('showSearchPhraseProposalCount')){
										count = proposals[i+1];
									}
									item = ItemClass.create(proposal, count, self.phrase);
									item.id = i / 2;
									item.parent = self;
									item.make();
									self.proposalItems.items.push(item);
								}
								spp.show('fast');
							}else{
								spp.hide('fast');
								self.proposalItems.current = 0;
								self.proposalItems.items = [];
							}
						}
					};
					this.requestData(url, handleRequestData);
				}else{
					spp.hide('fast');
					$('#llsolr-searchPhraseProposalsScrollPane').empty();
				}
			},
			handleProductProposals: function(phrase, params){
				var opts = this.defaults, url, self = this, facetParams, realParams, isFacetQueryKey, 
				facetQueryKeys = this.getFacetQueryKeys(), start, rows, numFound, pObj, k, i, key,
				handleRequestData, beforeSearchCallback = this.defaults.onBeforeSearchResult, idx = '', 
				srTarId;
				if (this.defaults.searchDetailTarget.length){
					srTarId = this.defaults.searchDetailTarget.attr('id');
					try{
						if (srTarId.lastIndexOf('_') > -1){
							idx = srTarId.substring(srTarId.lastIndexOf('_'), srTarId.length);
						}
						if (phrase || phrase === ''){
							this.phrase = phrase;
							if (beforeSearchCallback && Utils.isFunction(beforeSearchCallback)){
								beforeSearchCallback.call(this);
							}
							if (! params){
								facetParams = this.facetParamsAsJson();
								realParams = {'fq': []};
								for (k in facetParams){
									isFacetQueryKey = false;
									for (i = 0; i < facetQueryKeys.length; i++){
										key = facetQueryKeys[i];
										if (k.search(key) !== -1){
											isFacetQueryKey = true;
											break;
										}
									}
									if (isFacetQueryKey){
										realParams.fq.push(k);
									}else{
										realParams.fq.push([k,':"',facetParams[k],'"'].join(''));
									}
								}
								params = this.getQueryParams('productProposals', encodeURIComponent(phrase), realParams);
							}
							if (params){
								url = AjaxURLManager.getUrlWithKey(opts.detailSearchAjaxHandler) + params;
								url = decodeURIComponent(url);
								this.proposalItems.current = 0;
								this.proposalItems.items = [$('#productSearchFieldImage').find(':input')];
								handleRequestData = function(data, textStatus){
									var cb = self.defaults.onSearchResult, i, pagerCallback, pagerData, currentPage, docs;
									self.data = data;
									if (cb && Utils.isFunction(cb)){
										cb.call(self);
									}
									for (i = 0; i < self.addOns.length; i+=1){
										self.addOns[i].update();
									}
									$('#llsolr-productSearchProposals' + idx).find('.titleInner').html($.lang('productProposalTitle'));
									$('#llsolr-productSearchProposals' + idx).find('.title .searchInfo').html(self.makeSearchSummaryLayout());
									$('#llsolr-productSearchProposalsScrollPane' + idx).empty();
									if (data.response.docs.length){
										docs = data.response.docs;
										self.initItemsAndShow(docs);
									}
									pagerCallback = function(page){
										var p, facetQueryKeys = self.getFacetQueryKeys(), facetParams, realParams, params;
										p = page;
										facetParams = self.facetParamsAsJson();
										realParams = self.buildFacetQueryParams(facetParams, facetQueryKeys);
										realParams = $.extend(realParams, {'start': (p-1) * data.responseHeader.params.rows});
										params = self.getQueryParams('productProposals', phrase, realParams);
										self.handleProductProposals(phrase, params);
									};
									pagerData = {
										frameWidth: self.defaults.pagerFrameWidth,
										callback: pagerCallback
									};
									if (opts.pagerTopTarget){
										Pager1 = PagerElement.create($.extend({target: opts.pagerTopTarget}, pagerData));
									}
									pagerData.target = opts.pagerBottomTarget;
									if (opts.pagerBottomTarget){
										Pager2 = PagerElement.create($.extend({target: opts.pagerTopTarget}, pagerData));
									}
									start = data.response.start;
									rows = data.responseHeader.params.rows;
									numFound = data.response.numFound;
									currentPage = start / rows + 1;
									pObj = {
										pager:{
											currentPage: currentPage,
											overall: numFound,
											offset: rows
										}
									};
									if (opts.pagerTopTarget){Pager1.update(pObj);}
									if (opts.pagerBottomTarget){Pager2.update(pObj);}
								};
								this.requestData(url, handleRequestData);
							}else{
								$('#llsolr-productSearchProposalsScrollPane' + idx).empty();
							}
						}
					}catch(e){
						if (window.console && window.console.error){
							console.error('Exception: SolrSearchEmbeddingKit.handleProductProposals', e);
						}
					}
				}else{
					if (phrase || phrase === ''){
						this.phrase = phrase;
						if (beforeSearchCallback && Utils.isFunction(beforeSearchCallback)){
							beforeSearchCallback.call(this);
						}
						if (! params){
							facetParams = this.facetParamsAsJson();
							realParams = {'fq': []};
							for (k in facetParams){
								isFacetQueryKey = false;
								for (i = 0; i < facetQueryKeys.length; i++){
									key = facetQueryKeys[i];
									if (k.search(key) !== -1){
										isFacetQueryKey = true;
										break;
									}
								}
								if (isFacetQueryKey){
									realParams.fq.push(k);
								}else{
									realParams.fq.push([k,':"',facetParams[k],'"'].join(''));
								}
							}
							params = this.getQueryParams('productProposals', encodeURIComponent(phrase), realParams);
						}
						if (params){
							url = AjaxURLManager.getUrlWithKey(opts.detailSearchAjaxHandler) + params;
							url = decodeURIComponent(url);
							this.proposalItems.current = 0;
							this.proposalItems.items = [$('#productSearchFieldImage').find(':input')];
							handleRequestData = function(data, textStatus){
								var cb = self.defaults.onSearchResult, i, pagerCallback, pagerData, currentPage, docs;
								self.data = data;
								if (cb && Utils.isFunction(cb)){
									cb.call(self);
								}
								for (i = 0; i < self.addOns.length; i+=1){
									self.addOns[i].update();
								}
								$('#llsolr-productSearchProposals' + idx).find('.titleInner').html($.lang('productProposalTitle'));
								$('#llsolr-productSearchProposals' + idx).find('.title .searchInfo').html(self.makeSearchSummaryLayout());
								$('#llsolr-productSearchProposalsScrollPane' + idx).empty();
								if (data.response.docs.length){
									docs = data.response.docs;
									self.initItemsAndShow(docs);
								}
								pagerCallback = function(page){
									var p, facetQueryKeys = self.getFacetQueryKeys(), facetParams, realParams, params;
									p = page;
									facetParams = self.facetParamsAsJson();
									realParams = self.buildFacetQueryParams(facetParams, facetQueryKeys);
									realParams = $.extend(realParams, {'start': (p-1) * data.responseHeader.params.rows});
									params = self.getQueryParams('productProposals', phrase, realParams);
									self.handleProductProposals(phrase, params);
								};
								pagerData = {
									frameWidth: self.defaults.pagerFrameWidth,
									callback: pagerCallback
								};
								if (opts.pagerTopTarget){
									Pager1 = PagerElement.create($.extend({target: opts.pagerTopTarget}, pagerData));
								}
								pagerData.target = opts.pagerBottomTarget;
								if (opts.pagerBottomTarget){
									Pager2 = PagerElement.create($.extend({target: opts.pagerTopTarget}, pagerData));
								}
								start = data.response.start;
								rows = data.responseHeader.params.rows;
								numFound = data.response.numFound;
								currentPage = start / rows + 1;
								pObj = {
									pager:{
										currentPage: currentPage,
										overall: numFound,
										offset: rows
									}
								};
								if (opts.pagerTopTarget){Pager1.update(pObj);}
								if (opts.pagerBottomTarget){Pager2.update(pObj);}
							};
							this.requestData(url, handleRequestData);
						}else{
							$('#llsolr-productSearchProposalsScrollPane' + idx).empty();
						}
					}
				}
				return phrase;
			},
			removeProposalsHoverEffect: function(){
				$(this.proposalItems.items).each(function(i){
					if (i > 0){
						this.jqElm.removeClass('searchProposalItemHover');
					}
				});
			},
			completePhrase: function(){
				var opts = this.defaults, field = opts.searchPhraseOuterTarget.find('input[type=text]'),
				proposal = this.proposalItems.items[this.proposalItems.current];
				field.val(proposal.proposal);
			},
			completePhraseAndSetFocusToInput: function(proposal){
				var opts = this.defaults, field = opts.searchPhraseOuterTarget.find('input[type=text]'), currentPhrase,
				spp = this.searchPhraseProposals;
				if (proposal){
					field.val(proposal);
					field.focus();
				}else{
					currentPhrase = $.trim(field.val());
					proposal = this.proposalItems.items[this.proposalItems.current];
					if (typeof proposal !== 'undefined'){
						field.val(proposal.proposal);
					}
				}
				this.proposalItems.current = 0;
				spp.hide('fast');
			},
			fire: function(){
				var opts = this.defaults, field = opts.searchPhraseOuterTarget.find('input[type=text]'), sessId = '';
				if (Utils.getXist4cSessionId()){
					sessId = Utils.getXist4cSessionId({
							returnWithPrefix: true
					});
				}
				window.location.href = [
					opts.searchDetailUrl,
					sessId,
					Utils.getUrlParamsFromJson({'phrase': this.preprocessPhrase($.trim(field.val()))})].join('');
			},
			handleKeyPress: function(e){
				e.stopPropagation();
				var pItems = this.proposalItems, current, spp = this.searchPhraseProposals;
				if (e.keyCode === 13 || e.type === 'click'){ // if return key
					//this.completePhraseAndSetFocusToInput();
					spp.hide('fast');
					this.fire();
				}else if (e.keyCode === 38 || e.keyCode === 40){ // if up or down cursor key
					this.removeProposalsHoverEffect();
					if (e.keyCode === 38){
						if (pItems.current > 0){
							current = pItems.current -= 1;
						}else{
							current = pItems.items.length -1;
							pItems.current = current;
						}
					}else{
						if (pItems.current < pItems.items.length -1){
							current = pItems.current +=1;
						}else{
							current = 0;
							pItems.current = current;
						}
					}
					if (current > 0){
						pItems.items[current].jqElm.addClass('searchProposalItemHover');
					}else{
						pItems.items[0].focus();
					}
					this.completePhrase();
				}else if(e.keyCode === 27){ // if escape key
					spp.hide('fast');
				}
			},
			make: function(){
				this.prepareSearchElement();
			},
			makeDetail: function(){
				var phrase = null, params = Utils.getUrlParamsAsJson(), validParams = [], i, j, k, facets, facetQuerys, tmp,
				queryParams = Utils.getUrlParamsAsJson(this.getQueryParams('productProposals', '')), facet, realParams = {},
				isValid, target = this.defaultParams('searchDetailTarget');
				try {
					if (target.length){
						if (params && typeof(params.phrase) !== 'undefined'){
							phrase = decodeURIComponent(params.phrase);
							if (this.defaults.searchPhraseOuterTarget.length){
								this.defaults.searchPhraseOuterTarget.find('input[type=text]').css({
									backgroundImage: 'none'
								}).val(phrase);
							}
						}else{
							phrase = '';
						}
						if (params && params.searchTrigger){
							facets = queryParams['facet.field'];
							facetQuerys = queryParams['facet.query'];
							facetDates = queryParams['facet.date'];
							for (i = 0; i < facets.length; i++){
								facet = facets[i];
								if ($.inArray(facet, validParams) === -1){
									validParams.push(facet);
								}
							}
							for (j = 0; j < facetQuerys.length; j++){
								facet = decodeURIComponent(facetQuerys[i]).split(':')[0];
								if ($.inArray(facet, validParams) === -1){
									validParams.push(facet);
								}
							}
							for (k in params){
								isValid = false;
								for (i = 0; i < validParams.length; i++){
									if (k.search(validParams[i]) > -1){
										isValid = true;
										break;
									}
								}
								if (isValid){
									if (typeof(realParams[k]) === 'undefined'){
										realParams[k] = params[k];
									}else{
										if (realParams[k] && Utils.isArray(realParams[k])){
											realParams[k].push(params[k]);
										}else if (realParams[k] && !Utils.isArray(realParams[k])){
											tmp = realParams[k];
											realParams[k] = [tmp];
											realParams[k].push(params[k]);
										}
									}
								}
							}
							this.facetParamsAsJson(realParams);
						}
						target.append(this.makeProductProposalPaneLayout());
						this.handleProductProposals(phrase);
					}
				}catch(e){
					if (window.console && window.console.error){
						console.error('Exception: SolrSearchEmbeddingKit.makeDetail', e);
					}
				}
			}
		}
	);

	llsolr.SolrSearchPhraseProposalsItem = $.extend(
		$.clone(LLObject),
		{
			create: function(proposal, count, phrase){
				var o = LLObject.create.call(this);
				o.id = null;
				o.parent = null;
				o.proposal = proposal;
				o.jqElm = null;
				o.count = count;
				o.phrase = phrase;
				return o;
			},
			changeProposalFirstLetterCase: function(){
				var fl = this.proposal.substring(0, 1);
				var rest = this.proposal.substring(1, this.proposal.length);
				if (isNaN(fl)){
					fl = fl.toUpperCase();
				}
				return fl + rest;
			},
			makeItemLayout: function(){
				var lay = $(
					'<div class="proposalItem searchProposalItem">' +
						'<div class="viewport"><div class="count"></div></div>' +
						'<div class="proposal"></div>' +
					'</div>'
				), count;
				lay.find('.proposal').text(this.changeProposalFirstLetterCase());
				if (this.count){
					lay.find('.count').text('(' + this.count + ')')
				}
				lay.hover(
					function(){
						$(this).addClass('searchProposalItemHover');
					},
					function(){
						$(this).removeClass('searchProposalItemHover');
					}
				);
				var self = this;
				lay.bind('click', function(e){
					self.parent.proposalItems.current = self.id;
					self.parent.completePhraseAndSetFocusToInput(self.proposal);
					self.parent.fire();
				});
				return lay;
			},
			make: function(){
				var item = this.makeItemLayout();
				this.jqElm = item;
				$('#llsolr-searchPhraseProposalsScrollPane').append(item);
			}
		}
	);
	
	llsolr.SolrProductProposalsItem = $.extend(
		$.clone(LLObject),
		{
			create: function(){
				var o = LLObject.create.call(this);
				o.id = null;
				o.parent = null;
				o.data = null;
				o.jqElm = null;
				o.descAttrs = [
					'art_beschreibung_s_tg'
				];
				return o;
			},
			getDescription: function(){
				var str = '', realText, self = this;
				$(this.descAttrs).each(function(i){
					if (typeof self.data[this] !== 'undefined'){
						realText = self.data[this];
						if (realText.indexOf('_') == 0 || realText.indexOf('_') == 7){
							realText = realText.substring(realText.indexOf('_') + 1, realText.length);
						}
						str += realText + ', ';
					}
				});
				if (str.length > 0){
					return str.substring(0, str.length -2);
				}
				return str;
			},
			makeItemLayout: function(){
				var img = '', d = this.data, lay;
				if (this.data.img_src){
					iattrs = {
						src: d.img_src,
						width: d.img_width,
						height: d.img_height,
						border: 0
					};
					img = $('<img/>').attr(iattrs);
				}
				lay = $(
					'<div class="proposalItem productProposalItem">' +
						'<div class="proposal">' +
							'<div class="image"></div>' +
							'<div class="textOuter">' +
								'<h1 class="headline">' + d.art_bezeichnung_s_tg + '</h1>' +
								'<p class="desc">' + this.getDescription() + '</p>' +
							'</div>' +
							'<div class="floatTerm"></div>' +
						'</div>' +
					'</div>'
				);
				lay.find('.image').append(img);
				lay.hover(
					function(){
						$(this).addClass('productProposalItemHover');
					},
					function(){
						$(this).removeClass('productProposalItemHover');
					}
				);
				lay.bind('click', function(){
					var sessId = '', href = d.link, params = Utils.getUrlParamsAsJson(d.link);
					if (params){
						href = d.link.substring(0, d.link.indexOf('?'));
					}
					if (Utils.getXist4cSessionId()){
						sessId = Utils.getXist4cSessionId({
							returnWithPrefix: true
						});
					}
					window.location.href = href + sessId + (Utils.getUrlParamsFromJson(params) || '');
				});
				return lay;
			},
			make: function(){
				var item = this.makeItemLayout(), idx = '', srTarId = this.parent.defaults.searchDetailTarget.attr('id');
				if (srTarId && srTarId.lastIndexOf('_') > -1){
					idx = srTarId.substring(srTarId.lastIndexOf('_'), srTarId.length);
				}
				this.jqElm = item;
				$('#llsolr-productSearchProposalsScrollPane' + idx).append(item);
			}
		}
	);


	llsolr.SolrAddOn = $.extend(
		$.clone(LLObject),
		{
			create: function(opts){
				var o = LLObject.create.call(this);
				o.parent = null;
				o.domel = null;
				o.defaults = {
					target: null,
					usedPanelClass: llsolr.SolrProductFacetPanel,
					usedItemClass: llsolr.SolrProductFacetPanelItem,
					usedBackItemClass: llsolr.SolrProductFacetPanelBackItem
				};
				if(Utils.isObject(opts)){
					$.extend(o.defaults, opts);
				}
				return o;
			}
		}
	);

	llsolr.SolrFacetAddOn = $.extend(
		$.clone(llsolr.SolrAddOn),
		{
			create: function(opts){
				var o;
				if (!opts){
					opts = {};
				}
				if (!opts.priceBuckets){
					opts.priceBuckets = true;
				}
				if (!opts.priceBucketsCurrency){
					opts.priceBucketsCurrency = 'EUR';
				}
				o = llsolr.SolrAddOn.create.call(this, opts);
				o.currentFacets = null;
				o.cnt = 0;
				o.iCnt = 0;
				o.facets = [];
				o.facetQueryPartsRegister = {};
				if(Utils.isObject(opts)){
					$.extend(o.defaults, opts);
				}
				$.lang('solrFacetAddOn_upto', {
					de: 'Bis ',
					en: 'Up to '
				});
				$.lang('solrFacetAddOn_over', {
					de: 'Über ',
					en: 'Over '
				});
				return o;
			},
			parseFacetQueryExpressionByType: function(type, expr, count){
				var exprGrp = [], exprParts, rexOR = /\sOR\s/, rexAND = /\sAND\s/, rexTO = /\sTO\s/, mode = 0, i,
				curr = this.defaults.priceBucketsCurrency;
				if (rexOR.test(expr)){
					mode = 1;
					exprGrp = expr.split(rexOR);
				}else if (rexAND.test(expr)){
					mode = 2;
					exprGrp = expr.split(rexAND);
				}else{
					exprGrp.push(expr);
				}
				for (i = 0; i < exprGrp.length; i+=1){
					expr = exprGrp[i];
					exprParts = expr.substring(1, expr.length -1).split(rexTO);
					if (type == 'priceBuckets'){
						return {
							from: (parseFloat(exprParts[0]).toFixed(2) + '').replace(/\./, ','),
							to: (parseFloat(exprParts[1]).toFixed(2) + '').replace(/\./, ','),
							currency: curr,
							rawExpr: expr,
							count: count
						};
					}
				}
				return null;
			},
			registerFacetQueryPartsByType: function(type, key, name){
				var fq = this.parent.data.facet_counts.facet_queries, k,
				fqr, expr, count;
				fqr = this.facetQueryPartsRegister = {};
				for (k in fq){
					count = fq[k];
					if (!fqr[type]){
						fqr[type] = {
							key: key,
							name: name,
							items: []
						};
					}
					if (k.search(key) > -1){
						expr = this.parseFacetQueryExpressionByType(type, k.split(':')[1], count);
						if (expr){
							fqr[type].items.push(expr);
						}
					}
				}
			},
			getFacetQueryPartsKeyList: function(){
				var k, list = [], parts = this.facetQueryPartsRegister;
				for (k in parts){
					list.push(parts[k].key);
				}
				return list;
			},
			searchFacetKeys: function(data){
				var i, searchFacets = 
				(data.responseHeader && data.responseHeader.params.fq) ? data.responseHeader.params.fq : [],
				searchFacet = [];
				if (searchFacets){
					if (typeof searchFacets !== 'string'){
						for (i = 0; i < searchFacets.length; i+=1){
							searchFacet.push(searchFacets[i].split(':')[0]);
						}
					}else{
						searchFacet.push(searchFacets.split(':')[0]);
					}
				}
				return searchFacet;
			},
			clearFacets: function(){
				this.facets = [];
			},
			add: function(key, pTitle, linkedPanels, useClass){
				var opts = this.defaults, d = this.parent.data, panel, target = opts.target,
				count, item, i, facet, searchFacets = this.searchFacetKeys(d),
				facets = d.facet_counts.facet_fields || null,
				panelClass = opts.usedPanelClass,
				itemClass = opts.usedItemClass,
				backItemClass = opts.usedBackItemClass;
				if (Utils.isObject(useClass)){
					if (useClass.usedPanelClass){
						panelClass = useClass.usedPanelClass;
					}
					if (useClass.usedItemClass){
						itemClass = useClass.usedItemClass;
					}
					if (useClass.usedBackItemClass){
						backItemClass = useClass.usedBackItemClass;
					}
				}
				this.domel = target;
				if (facets){
					facet = facets[key];
					panel = panelClass.create();
					panel.target = target;
					panel.parent = this;
					panel.id = this.cnt;
					panel.domId = 'facetPanel_' + this.cnt;
					panel.title = pTitle;
					panel.realTitle = key;
					panel.key = key;
					panel.linkedPanels = linkedPanels || [];
					if ($.inArray(key, searchFacets) > -1){
						item = backItemClass.create();
						item.id = -1;
						item.parent = panel;
						item.phrase = this.parent.phrase;
						item.domId = 'facetPanelItem_' + this.cnt + '-1';
						item.title = $.lang('searchFacetPanelItemBack');
						item.count = count;
						item.attributeName = key;
						panel.items.push(item);
					}
					for (i = 0; i < facet.length; i+=1){
						if (i % 2 == 1){
							this.iCnt++;
							continue;
						}
						title = realTitle = facet[i];
						if (realTitle.indexOf('_') == 0 || realTitle.indexOf('_') == 7){
							title = realTitle.substring(realTitle.indexOf('_') + 1, realTitle.length);
						}
						count = facet[i+1];
						item = itemClass.create();
						item.id = this.iCnt;
						item.parent = panel;
						item.phrase = this.parent.phrase;
						item.domId = 'facetPanelItem_' + this.iCnt;
						item.title = title;
						item.realTitle = realTitle;
						item.count = count;
						item.attributeName = key;
						if (panel.items.length && panel.items[panel.items.length - 1].instanceOf(backItemClass)){
							panel.selectedItems = [item];
						}else{
							panel.selectedItems = [];
						}
						panel.items.push(item);
					}
					this.cnt++;
					this.facets.push(panel);
				}
			},
			/* todo: >>> */
			addMulti: function(key, pTitle, linkedPanels){
				var opts = this.defaults, d = this.parent.data, panel, target = opts.target,
				count, item, i, facets, facet, searchFacets = this.searchFacetKeys(d);
				facets = d.facet_counts.facet_fields || null;
				if (facets){
					facet = facets[key];
					panel = llsolr.SolrProductFacetPanel.create();
					panel.target = target;
					panel.parent = this;
					panel.id = this.cnt;
					panel.domId = 'facetPanel_' + this.cnt;
					panel.title = pTitle;
					panel.realTitle = key;
					panel.key = key;
					panel.linkedPanels = linkedPanels || [];
					if ($.inArray(key, searchFacets) > -1){
						;
					}
					for (i = 0; i < facet.length; i+=1){
						if (i % 2 === 1){
							this.iCnt++;
							continue;
						}
						title = realTitle = facet[i];
						if (realTitle.indexOf('_') == 0 || realTitle.indexOf('_') == 7){
							title = realTitle.substring(realTitle.indexOf('_') + 1, realTitle.length);
						}
						count = facet[i+1];
						item = llsolr.SolrProductFacetPanelItem.create();
						item.id = this.iCnt;
						item.parent = panel;
						item.phrase = this.parent.phrase;
						item.domId = 'facetPanelItem_' + this.iCnt;
						item.title = title;
						item.realTitle = realTitle;
						item.count = count;
						item.attributeName = key;
						if (panel.items.length && panel.items[panel.items.length - 1].instanceOf(llsolr.SolrProductFacetPanelBackItem)){
							panel.selectedItems = [item];
						}else{
							panel.selectedItems = [];
						}
						panel.items.push(item);
					}
					this.cnt++;
					this.facets.push(panel);
				}
			},
			addDates: function(key, pTitle, linkedPanels, useClass){
				var opts = this.defaults, d = this.parent.data, panel, k, target = opts.target,
				count, item, facet, searchFacets = this.searchFacetKeys(d),
				facets = d.facet_counts.facet_dates || null,
				panelClass = opts.usedPanelClass,
				itemClass = opts.usedItemClass,
				backItemClass = opts.usedBackItemClass;
				if (Utils.isObject(useClass)){
					if (useClass.usedPanelClass){
						panelClass = useClass.usedPanelClass;
					}
					if (useClass.usedItemClass){
						itemClass = useClass.usedItemClass;
					}else{
						itemClass = llsolr.SolrProductFacetPanelDateItem;
					}
					if (useClass.usedBackItemClass){
						backItemClass = useClass.usedBackItemClass;
					}
				}
				this.domel = target;
				if (facets){
					facet = facets[key];
					panel = panelClass.create();
					panel.target = target;
					panel.parent = this;
					panel.id = this.cnt;
					panel.domId = 'facetPanel_' + this.cnt;
					panel.title = pTitle;
					panel.realTitle = key;
					panel.key = key;
					panel.linkedPanels = linkedPanels || [];
					if ($.inArray(key, searchFacets) > -1){
						item = backItemClass.create();
						item.id = -1;
						item.parent = panel;
						item.phrase = this.parent.phrase;
						item.domId = 'facetPanelItem_' + this.cnt + '-1';
						item.title = $.lang('searchFacetPanelItemBack');
						item.count = -1;
						item.attributeName = key;
						panel.items.push(item);
					}
					for (k in facet){
						if (!isNaN(parseInt(k, 10)) && facet[k] > 0){
							title = realTitle = k;
							if (realTitle.indexOf('_') == 0 || realTitle.indexOf('_') == 7){
								title = realTitle.substring(realTitle.indexOf('_') + 1, realTitle.length);
							}
							title = realTitle.split('-')[0];
							this.iCnt++;
							count = facet[k];
							item = itemClass.create();
							item.id = this.iCnt;
							item.parent = panel;
							item.phrase = this.parent.phrase;
							item.domId = 'facetPanelItem_' + this.iCnt;
							item.title = title;
							item.realTitle = realTitle;
							item.count = count;
							item.attributeName = key;
							if (panel.items.length && panel.items[panel.items.length - 1].instanceOf(backItemClass)){
								panel.selectedItems = [item];
							}else{
								panel.selectedItems = [];
							}
							panel.items.push(item);
						}
					}
					this.cnt++;
					this.facets.push(panel);
				}
			},
			handleFacetQuery: function(){
				var opts = this.defaults, panel, target = opts.target,
				i, facet, count, fromVal, toVal, item, 
				priceBuckets = this.facetQueryPartsRegister.priceBuckets, phrase = this.parent.phrase,
				currFacet, fq, noLinkedPanelsHandling;
				if (opts.priceBuckets && priceBuckets){
					this.cnt++;
					panel = llsolr.SolrProductFacetPanel.create();
					panel.target = target;
					panel.parent = this;
					panel.id = this.cnt;
					panel.domId = 'facetPanel_' + this.cnt;
					panel.title = priceBuckets.name;
					fq = this.parent.getFilterQuery();
					if (fq){
						if (Utils.isArray(fq)){
							for (i = 0; i < fq.length; i+=1){
								if (fq[i].search(priceBuckets.key) > -1){
									currFacet = fq[i];
								}
							}
						}else{
							if (fq.search(priceBuckets.key) > -1){
								currFacet = fq;
							}
						}
					}else{
						currFacet = null;
					}
					if (!currFacet){
						for (i = 0; i < priceBuckets.items.length; i++){
							facet = priceBuckets.items[i];
							if (facet.count){
								if (facet.from == 'NaN'){
									toVal = $.lang('solrFacetAddOn_upto') + facet.to;
									fromVal = '';
								}else if (facet.to == 'NaN'){
									fromVal = $.lang('solrFacetAddOn_over') + facet.from;
									toVal = '';
								}else{
									fromVal = facet.from + ' - ';
									toVal = facet.to;
								}
								count = facet.count;
								this.iCnt++;
								item = llsolr.SolrProductFacetPanelPriceBucketItem.create();
								item.id = this.iCnt;
								item.parent = panel;
								item.phrase = phrase;
								item.domId = 'facetPanelItem_' + this.iCnt;
								item.title = [fromVal,toVal,' ',facet.currency].join('');
								item.realTitle = priceBuckets.key + ':' + facet.rawExpr;
								item.count = count;
								item.attributeName = priceBuckets.key + ':' + facet.rawExpr;
								panel.items.push(item);
							}
						}
					}else{
						item = llsolr.SolrProductFacetPanelBackItem.create();
						item.id = -1;
						item.parent = panel;
						item.phrase = phrase;
						item.domId = 'facetPanelItem_' + this.cnt + '-1';
						item.title = $.lang('searchFacetPanelItemBack');
						item.count = count;
						item.attributeName = currFacet;
						item.key = priceBuckets.key;
						panel.items.push(item);
						this.iCnt++;
						item = llsolr.SolrProductFacetPanelCustomerPriceBucketItem.create();
						item.id = this.iCnt;
						item.parent = panel;
						item.phrase = phrase;
						item.domId = 'facetPanelItem_' + this.iCnt;
						facet = this.parseFacetQueryExpressionByType('priceBuckets', currFacet.split(':')[1], '1');
						if (facet){
							item.realTitle = priceBuckets.key + ':' + facet.rawExpr;
							item.key = priceBuckets.key;
							item.facetData = facet;
							item.attributeName = priceBuckets.key + ':' + facet.rawExpr;
							panel.items.push(item);
						}
					}
					panel.make(noLinkedPanelsHandling = true);
				}
			},
			update: function(phrase){
				var i, target = this.defaults.target;
				this.parent.SolrFacetAddOn = this;
				target.empty();
				for (i = 0; i < this.facets.length; i+=1){
					this.facets[i].make();
				}
				this.handleFacetQuery();
			}
		}
	);

	llsolr.SolrProductFacetPanel = $.extend(
		$.clone(LLObject),
		{
			create: function(){
				var o = LLObject.create.call(this);
				o.target = null;
				o.parent = null;
				o.id = null;
				o.domId = null;
				o.domel = null;
				o.title = null;
				o.realTitle = null;
				o.items = [];
				o.selectedItems = [];
				o.linkedPanels = [];
				o.key = null;
				return o;
			},
			makePanelLayout: function(){
				var lay = $(
					'<div id="' + this.domId + '" class="llsolr-facetPanel"></div>'
				);
				return lay;
			},
			makeTitleLayout: function(){
				return $(
					'<div class="facetPanelTitle">' +
						'<span>' + this.title + '</span>' +
					'</div>'
				);
			},
			appendPanelItems: function(panel){
				$(this.items).each(function(i){
					var domel;
					domel = this.make();
					panel.append(domel);
					this.domel = domel;
				});
			},
			make: function(noLinkedPanelsHandling){
				var panel = this.makePanelLayout(), i, panels = this.parent.facets, p;
				panel.append(this.makeTitleLayout());
				this.appendPanelItems(panel);
				for (i = 0; i < panels.length; i+=1){
					p = panels[i];
					if (!noLinkedPanelsHandling){
						if (p !== this && $.inArray(this.realTitle, p.linkedPanels) > -1 && !p.selectedItems.length){
							panel.hide();
							break;
						}else{
							panel.show();
						}
					}
				}
				this.target.append(panel);
				this.domel = panel;
			}
		}
	);
	
	llsolr.SolrProductFacetPanelItem = $.extend(
		$.clone(LLObject),
		{
			create: function(){
				var o = LLObject.create.call(this);
				o.id = null;
				o.panel = null;
				o.parent = null;
				o.phrase = null;
				o.domId = null;
				o.domel = null;
				o.title = null;
				o.realTitle = null;
				o.count = null;
				o.attributeName = null;
				o.key = null;
				return o;
			},
			prepareSingleYearDateQueryString: function(dateStr){
				var startTime = '00:00:00Z', endTime = '23:59:59Z', op = '" TO "',
				date = dateStr.split('T')[0], year = date.split('-')[0], lastMonth = '-12-31';
				return ['["',date,'T',startTime,op,year,lastMonth,'T',endTime,'"]'].join('');
			},
			buildFacetQueryParams: function(params, facetQueryKeys){
				return this.parent.parent.parent.buildFacetQueryParams(params, facetQueryKeys);
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams,
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<a href="#" id="' + this.domId + '" class="facetItem">' +
						'<span class="viewport">' +
							'<span class="count">(' + this.count + ')</span>' +
						'</span>' +
						'<span class="title">' + this.title + '</span>' +
					'</a>'
				);
				lay.bind('click', function(e){
					e.preventDefault();
					e.stopPropagation();
					facetParams = {};
					facetParams[self.attributeName] = self.realTitle;
					facetParams = topParent.facetParamsAsJson(facetParams);
					realParams = self.buildFacetQueryParams(facetParams, facetQueryKeys);
					realParams.start = 0;
					realParams = topParent.getQueryParams('productProposals', self.phrase, realParams);
					topParent.handleProductProposals(self.phrase, realParams);
				});
				return lay;
			},
			make: function(){
				var item = this.makeItemLayout();
				return item;
			}
		}
	);
	
	llsolr.SolrProductFacetPanelPriceBucketItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelItem),
		{
			create: function(){
				var o = llsolr.SolrProductFacetPanelItem.create.call(this);
				return o;
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams,
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<a href="#" id="' + this.domId + '" class="facetItem">' +
						'<span class="viewport">' +
							'<span class="count">(' + this.count + ')</span>' +
						'</span>' +
						'<span class="title">' + this.title + '</span>' +
					'</a>'
				);
				lay.bind('click', function(e){
					e.preventDefault();
					e.stopPropagation();
					facetParams = {};
					facetParams = topParent.facetParamsAsJson(self.attributeName);
					realParams = self.buildFacetQueryParams(facetParams, facetQueryKeys);
					facetParams[self.attributeName] = self.attributeName;
					topParent.facetParamsAsJson(facetParams);
					realParams.fq.push(self.attributeName);
					realParams.start = 0;
					realParams = topParent.getQueryParams('productProposals', self.phrase, realParams);
					topParent.handleProductProposals(self.phrase, realParams);
				});
				return lay;
			}
		}
	);

	llsolr.SolrProductFacetPanelCustomerPriceBucketItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelItem),
		{
			create: function(opts){
				var o = llsolr.SolrProductFacetPanelItem.create.call(this);
				o.key = null;
				o.facetData = null;
				return o;
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams, from, to;
				from = isNaN(this.facetData.from.replace(',', '.')) ? '' : this.facetData.from;
				to = isNaN(this.facetData.to.replace(',', '.')) ? '' : this.facetData.to;
				lay = $(
					'<div class="llsolr-customerPriceBucketItem" id="' + this.domId + '">' +
						'<table cellpadding="0" cellspacing="0" border="0">' +
							'<tr>' +
								'<td class="field">' +
									'<input type="text" name="from" value="' + from + '"/>' +
								'</td>' +
								'<th class="currency">&nbsp;-&nbsp;</th>' +
								'<td class="field">' +
									'<input type="text" name="to" value="' + to + '"/>' +
								'</td>' +
								'<th class="currency">' + this.facetData.currency + '</th>' +
								'<td class="button">' +
									'<input type="image" src="/xist4c/px/spc.gif"/>' +
								'</td>' +
							'</tr>' +
						'</table>' +
					'</div>'
				);
				lay.find('.button').bind('click', function(e){
					var custPriceItem = $(this).parents('.llsolr-customerPriceBucketItem'), fromVal, toVal, expr, k;
					e.preventDefault();
					e.stopPropagation();
					facetParams = {};
					fromVal = custPriceItem.find('input[name=from]').val().replace(',', '.');
					toVal = custPriceItem.find('input[name=to]').val().replace(',', '.');
					fromVal = !isNaN(parseInt(fromVal, 10)) ? fromVal : '*';
					toVal = !isNaN(parseInt(toVal, 10)) ? toVal : '*';
					expr = ['[',fromVal,' TO ',toVal,']'].join('');
					facetParams = topParent.facetParamsAsJson(facetParams);
					realParams = {'fq': []};
					for (k in facetParams){
						if (k.search(self.key) === -1){
							realParams.fq.push([k,':"',facetParams[k],'"'].join(''));
						}
					}
					realParams.fq.push(self.key + ':' + expr);
					realParams = topParent.getQueryParams('productProposals', self.phrase, realParams);
					topParent.handleProductProposals(self.phrase, realParams);
				});
				return lay;
			}
		}
	);

	llsolr.SolrProductFacetPanelDateItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelPriceBucketItem),
		{
			create: function(){
				var o = llsolr.SolrProductFacetPanelPriceBucketItem.create.call(this);
				return o;
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams,
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<a href="#" id="' + this.domId + '" class="facetItem">' +
						'<span class="viewport">' +
							'<span class="count">(' + this.count + ')</span>' +
						'</span>' +
						'<span class="title">' + this.title + '</span>' +
					'</a>'
				);
				lay.bind('click', function(e){
					e.preventDefault();
					e.stopPropagation();
					facetParams = topParent.facetParamsAsJson(self.attributeName);
					realParams = self.buildFacetQueryParams(facetParams, facetQueryKeys);
					facetParams[self.attributeName] = self.prepareSingleYearDateQueryString(self.realTitle);
					topParent.facetParamsAsJson(facetParams);
					realParams.fq.push([self.attributeName,':',self.prepareSingleYearDateQueryString(self.realTitle)].join(''));
					realParams.start = 0;
					realParams = topParent.getQueryParams('productProposals', self.phrase, realParams);
					topParent.handleProductProposals(self.phrase, realParams);
				});
				return lay;
			}
		}
	);

	llsolr.SolrProductFacetPanelBackItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelItem),
		{
			create: function(){
				var o = llsolr.SolrProductFacetPanelItem.create.call(this);
				o.key = null;
				return o;
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams,
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<a href="#" id="' + this.domId + '" class="facetItem facetBackItem">' +
						'<span class="title">' + this.title + '</span>' +
					'</a>'
				);
				lay.bind('click', function(e){
					var panel = self.parent, panels = self.parent.parent.facets, i, p;
					e.preventDefault();
					e.stopPropagation();
					facetParams = topParent.facetParamsAsJson(self.attributeName);
					for (i = 0; i < panels.length; i+=1){
						p = panels[i];
						if ($.inArray(p.realTitle, panel.linkedPanels) > -1 && p.selectedItems.length){
							facetParams = topParent.facetParamsAsJson(p.selectedItems[0].attributeName);
						}
					}
					realParams = self.buildFacetQueryParams(facetParams, facetQueryKeys);
					realParams.start = 0;
					realParams = topParent.getQueryParams('productProposals', self.phrase, realParams);
					topParent.handleProductProposals(self.phrase, realParams);
				});
				return lay;
			}
		}
	);

	llsolr.SolrSelectboxFacetTeaserAddOn = $.extend(
		$.clone(llsolr.SolrFacetAddOn),
		{
			create: function(opts, noLayout){
				var o, lay;
				if (opts){
					if (!opts.usedPanelClass){
						opts.usedPanelClass = llsolr.SolrProductSelectFacetAttribute;
					}
					if (!opts.usedItemClass){
						opts.usedItemClass = llsolr.SolrProductSelectFacetAttributeItem;
					}
					if (!opts.usedBackItemClass){
						opts.usedBackItemClass = null;
					}
				}
				o = llsolr.SolrFacetAddOn.create.call(this, opts);
				if (!noLayout){
					lay = o.makeOuterLayout();
					o.defaults.target.append(lay);
					o.defaults.target = lay.find('.sftao_des4');
				}
				return o;
			},
			makeOuterLayout: function(){
				var lay = $(
					'<div class="llsolr-selectboxfacetTeaserAddOn">' +
						'<div class="sftao_des1">' +
							'<div class="sftao_des2">' +
								'<div class="sftao_des3">' +
									'<div class="sftao_des4">' +
									'</div>' +
								'</div>' +
							'</div>' +
						'</div>' +
					'</div>'
				);
				return lay;
			},
			add: function(key, pTitle, linkedAttributes, classOpts){
				var opts = this.defaults, d = this.parent.data, attribute, target = opts.target, searchFacet = [],
				searchFacets = (d.responseHeader && d.responseHeader.params.fq) ? d.responseHeader.params.fq : [],
				count, item, i, facets, facet,
				panelClass = opts.usedPanelClass,
				itemClass = opts.usedItemClass;
				if (Utils.isObject(classOpts)){
					if (classOpts.usedPanelClass){
						panelClass = classOpts.usedPanelClass;
					}
					if (classOpts.usedItemClass){
						itemClass = classOpts.usedItemClass;
					}
				}
				if (searchFacets){
					if (typeof searchFacets !== 'string'){
						for (i = 0; i < searchFacets.length; i+=1){
							searchFacet.push(searchFacets[i].split(':')[0]);
						}
					}else{
						searchFacet.push(searchFacets.split(':')[0]);
					}
				}
				facets = d.facet_counts.facet_fields || null;
				if (facets){
					facet = facets[key];
					attribute = panelClass.create();
					attribute.target = target;
					attribute.parent = this;
					attribute.id = this.cnt;
					attribute.domId = 'facetSelectAttribute_' + this.cnt;
					attribute.title = pTitle;
					attribute.realTitle = key;
					attribute.key = key;
					attribute.attributeName = key;
					attribute.linkedAttributes = linkedAttributes || [];
					for (i = 0; i < facet.length; i+=1){
						if (i % 2 === 1){
							this.iCnt++;
							continue;
						}
						title = realTitle = facet[i];
						if (realTitle.indexOf('_') == 0 || realTitle.indexOf('_') == 7){
							title = realTitle.substring(realTitle.indexOf('_') + 1, realTitle.length);
						}
						count = facet[i+1];
						item = itemClass.create();
						item.id = this.iCnt;
						item.parent = attribute;
						item.phrase = this.parent.phrase;
						item.domId = 'facetAttributeItem_' + this.iCnt;
						item.title = title;
						item.realTitle = realTitle;
						item.count = count;
						item.attributeName = key;
						attribute.selectedItems = [];
						attribute.items.push(item);
					}
					this.cnt++;
					this.facets.push(attribute);
				}
			},
			handleFacetQuery: function(){
				var opts = this.defaults, attribute, target = opts.target,
				i, facet, count, fromVal, toVal, item, 
				priceBuckets = this.facetQueryPartsRegister.priceBuckets, phrase = this.parent.phrase,
				currFacet, fq;
				if (opts.priceBuckets && priceBuckets){
					this.cnt++;
					attribute = llsolr.SolrProductSelectFacetAttribute.create();
					attribute.target = target;
					attribute.parent = this;
					attribute.id = this.cnt;
					attribute.domId = 'facetSelectAttribute_' + this.cnt;
					attribute.title = priceBuckets.name;
					attribute.attributeName = priceBuckets.key;
					fq = this.parent.getFilterQuery();
					if (fq){
						if (Utils.isArray(fq)){
							for (i = 0; i < fq.length; i+=1){
								if (fq[i].search(priceBuckets.key) > -1){
									currFacet = fq[i];
								}
							}
						}else{
							if (fq.search(priceBuckets.key) > -1){
								currFacet = fq;
							}
						}
					}else{
						currFacet = null;
					}
					for (i = 0; i < priceBuckets.items.length; i++){
						facet = priceBuckets.items[i];
						if (facet.count){
							if (facet.from == 'NaN'){
								toVal = $.lang('solrFacetAddOn_upto') + facet.to;
								fromVal = '';
							}else if (facet.to == 'NaN'){
								fromVal = $.lang('solrFacetAddOn_over') + facet.from;
								toVal = '';
							}else{
								fromVal = facet.from + ' - ';
								toVal = facet.to;
							}
							count = facet.count;
							this.iCnt++;
							item = llsolr.SolrProductSelectFacetAttributePriceBucketItem.create();
							item.id = this.iCnt;
							item.parent = attribute;
							item.phrase = phrase;
							item.domId = 'facetAttributeItem_' + this.iCnt;
							item.title = [fromVal,toVal,' ',facet.currency].join('');
							item.realTitle = priceBuckets.key + ':' + facet.rawExpr;
							item.count = count;
							item.attributeName = priceBuckets.key + ':' + facet.rawExpr;
							attribute.items.push(item);
						}
					}
					attribute.make(noLinkedAttributesHandling = true);
				}
			},
			update: function(phrase){
				var i, target = this.defaults.target;
				this.parent.SolrFacetSelectboxFacetTeaserAddOn = this;
				target.empty();
				for (i = 0; i < this.facets.length; i+=1){
					facetPanel = this.facets[i];
					facetPanel.make();
				}
				this.handleFacetQuery();
			}
		}
	);

	llsolr.SolrProductSelectFacetAttribute = $.extend(
		$.clone(llsolr.SolrProductFacetPanel),
		{
			create: function(){
				var o = llsolr.SolrProductFacetPanel.create.call(this);
				delete o.linkedPanels;
				return o;
			},
			makePanelLayout: function(){
				var self = this, lay = $(
					'<div id="' + this.domId + '" class="llsolr-facetSelectAttribute">' +
						'<select name="' + this.attributeName + '"></select>' +
					'</div>'
				),
				facetQueryKeys = this.parent.getFacetQueryPartsKeyList();
				lay.find('select').bind('change', function(e){
					var i, item, panels = self.parent.facets, p, topParent = self.parent.parent, facetParams, realParams, k;
					e.preventDefault();
					e.stopPropagation();
					for (i = 0; i < self.items.length; i++){
						item = self.items[i];
						if (item.realTitle == $(this).val()){
							self.selectedItems = [item];
							break;
						}
					}
					if ($(this).val() !== '-1'){
						facetParams = {};
						realParams = {'fq': []};
						if (self.selectedItems[0].instanceOf(llsolr.SolrProductSelectFacetAttributePriceBucketItem)){
							facetParams = topParent.facetParamsAsJson(self.selectedItems[0].attributeName);
							for (k in facetParams){
								if ($.inArray(k, facetQueryKeys) === -1){
									realParams.fq.push([k,':"',facetParams[k],'"'].join(''));
								}else{
									realParams.fq.push(k);
								}
							}
							facetParams[self.selectedItems[0].attributeName] = self.selectedItems[0].attributeName;
							topParent.facetParamsAsJson(facetParams);
							realParams.fq.push(self.selectedItems[0].attributeName);
						}else{
							facetParams[self.selectedItems[0].attributeName] = self.selectedItems[0].realTitle;
							facetParams = topParent.facetParamsAsJson(facetParams);
							for (k in facetParams){
								if ($.inArray(k.split(':')[0], facetQueryKeys) === -1){
									realParams.fq.push([k,':"',facetParams[k],'"'].join(''));
								}else{
									realParams.fq.push(k);
								}
							}
						}
					}else{
						facetParams = topParent.facetParamsAsJson(self.selectedItems[0].attributeName);
						for (i = 0; i < panels.length; i+=1){
							p = panels[i];
							if ($.inArray(p.attributeName, self.linkedAttributes) > -1 && p.selectedItems.length){
								facetParams = topParent.facetParamsAsJson(p.selectedItems[0].parent.attributeName);
							}
						}
						realParams = {'fq': []};
						for (k in facetParams){
							if ($.inArray(k.split(':')[0], facetQueryKeys) === -1){
								realParams.fq.push([k,':"',facetParams[k],'"'].join(''));
							}else{
								realParams.fq.push(k);
							}
						}
					}
					realParams = topParent.getQueryParams('productProposals', self.selectedItems[0].phrase, realParams);
					topParent.handleProductProposals(self.selectedItems[0].phrase, realParams);
				});
				return lay;
			},
			makeTitleLayout: function(){
				return $(
					'<div class="llsolr-facetSelectAttributePrompt">' +
						'<span>' + this.title + '</span>' +
					'</div>'
				);
			},
			appendPanelItems: function(panel){
				var self = this, backItem = llsolr.SolrProductSelectFacetAttributeBackItem.create(), topParent = this.parent.parent,
				params = topParent.facetParamsAsJson();
				backItem.id = -1;
				backItem.parent = this;
				backItem.phrase = this.parent.parent.phrase;
				backItem.domId = 'facetPanelItem_00_-1';
				backItem.title = $.lang('searchSelectFacetPanelItemBack');
				this.items.unshift(backItem);
				$(this.items).each(function(i){
					var k, domel;
					domel = this.make();
					panel.find('select').append(domel);
					this.domel = domel;
					for (k in params){
						if (k == this.attributeName && (params[k] == this.title || params[k] == this.attributeName)){
							backItem.attributeName = this.attributeName;
							domel.attr({
								selected: true
							});
							self.selectedItems = [this];
						}
					}
				});
			},
			make: function(noLinkedPanelsHandling){
				var panel = this.makePanelLayout(), i, panels = this.parent.facets, p;
				panel.prepend(this.makeTitleLayout());
				this.appendPanelItems(panel);
				for (i = 0; i < panels.length; i+=1){
					p = panels[i];
					if (!noLinkedPanelsHandling){
						if (p !== this && $.inArray(this.realTitle, p.linkedAttributes) > -1 && !p.selectedItems.length){
							panel.hide();
							break;
						}else{
							panel.show();
						}
					}
				}
				this.target.append(panel);
				this.domel = panel;
			}
		}
	);
	
	llsolr.SolrProductSelectFacetAttributeItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelItem),
		{
			create: function(opts){
				return llsolr.SolrProductFacetPanelItem.create.call(this, opts);
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams, k,
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<option class="llsolr-selectFacetItem" value="' + this.realTitle + '">' +
						this.title + ' (' + this.count + ')' +
					'</option>'
				);
				return lay;
			}
		}
	);
	
	llsolr.SolrProductSelectFacetAttributePriceBucketItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelPriceBucketItem),
		{
			create: function(opts){
				var o = llsolr.SolrProductFacetPanelPriceBucketItem.create.call(this, opts);
				return o;
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams, k;
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<option class="llsolr-selectFacetItem" value="' + this.attributeName + '">' +
							this.title + ' (' + this.count + ')' +
					'</a>'
				);
				return lay;
			}
		}
	);
	
	llsolr.SolrProductSelectFacetAttributeBackItem = $.extend(
		$.clone(llsolr.SolrProductFacetPanelBackItem),
		{
			create: function(opts){
				var o = llsolr.SolrProductFacetPanelBackItem.create.call(this, opts);
				return o;
			},
			makeItemLayout: function(){
				var lay, topParent = this.parent.parent.parent, self = this, facetParams, realParams, k,
				facetQueryKeys = this.parent.parent.getFacetQueryPartsKeyList();
				lay = $(
					'<option class="llsolr-selectFacetItem llsolr-selectFacetBackItem" value="-1">' +
						this.title +
					'</option>'
				);
				return lay;
			}
		}
	);


	llsolr.SolrStaticSelectboxFacetTeaserAddOn = $.extend(
		$.clone(llsolr.SolrSelectboxFacetTeaserAddOn),
		{
			create: function(opts){
				var o = llsolr.SolrSelectboxFacetTeaserAddOn.create.call(this, opts, true),
				lay = o.makeOuterLayout();
				if (o.defaults.target.length){
					o.defaults.target.append(lay);
					o.defaults.target = lay.find('.sftao_attributes');
				}
				if (o.defaults.autoInit){
					Utils.busyWait(
						function(intervalObj){
							if (o.parent){
								return true;
							}
							return false;
						},
						200,
						100,
						function(intervalObj){
							o.init();
						}
					);
				}
				return o;
			},
			init: function(){
				var params;
				if (this.defaults.target && this.defaults.target.length){
					params = Utils.getUrlParamsAsJson(this.parent.getQueryParams('productProposals', ''));
					delete params.q;
					params['q.alt'] = '*:*';
					this.parent.handleProductProposals('', Utils.getUrlParamsFromJson(params));
				}
			},
			makeOuterLayout: function(){
				var self = this, lay = $(
					'<div class="llsolr-selectboxfacetTeaserAddOn llsolr-staticSelectboxfacetTeaserAddOn">' +
						'<div class="sftao_des1">' +
							'<div class="sftao_des2">' +
								'<div class="sftao_des3">' +
									'<div class="sftao_des4">' +
										'<div class="sftao_attributes"></div>' +
										'<div class="viewport">' +
											'<div class="sftao_button"></div>' +
										'</div>' +
									'</div>' +
								'</div>' +
							'</div>' +
						'</div>' +
					'</div>'
				);
				lay.find('.sftao_button').bind('click', function(e){
					var params = self.parent.facetParamsAsJson(), i, facet, searchDetailUrl = self.parent.defaults.searchDetailUrl,
					sessId = '';
					if (Utils.getXist4cSessionId()){
						sessId = Utils.getXist4cSessionId({
							returnWithPrefix: true
						});
					}
					params.searchTrigger = 's3ft'; // static facet filter
					window.location.href = searchDetailUrl + sessId + Utils.getUrlParamsFromJson(params);
				});
				return lay;
			},
			handleFacetQuery: function(){
				var opts = this.defaults, d = opts.data, attribute, k, target = opts.target, item,
				i, facet, count, fromVal, toVal,
				priceBuckets = this.facetQueryPartsRegister.priceBuckets, phrase = this.parent.phrase,
				currFacet, fq, noLinkedAttributeHandling;
				if (opts.priceBuckets && priceBuckets){
					this.cnt++;
					attribute = llsolr.SolrProductSelectFacetAttribute.create();
					attribute.target = target;
					attribute.parent = this;
					attribute.id = this.cnt;
					attribute.domId = 'facetSelectAttribute_' + this.cnt;
					attribute.title = priceBuckets.name;
					attribute.attributeName = priceBuckets.key;
					fq = this.parent.getFilterQuery();
					if (fq){
						if (Utils.isArray(fq)){
							for (i = 0; i < fq.length; i+=1){
								if (fq[i].search(priceBuckets.key) > -1){
									currFacet = fq[i];
								}
							}
						}else{
							if (fq.search(priceBuckets.key) > -1){
								currFacet = fq;
							}
						}
					}else{
						currFacet = null;
					}
					for (i = 0; i < priceBuckets.items.length; i++){
						facet = priceBuckets.items[i];
						if (facet.count){
							if (facet.from == 'NaN'){
								toVal = $.lang('solrFacetAddOn_upto') + facet.to;
								fromVal = '';
							}else if (facet.to == 'NaN'){
								fromVal = $.lang('solrFacetAddOn_over') + facet.from;
								toVal = '';
							}else{
								fromVal = facet.from + ' - ';
								toVal = facet.to;
							}
							count = facet.count;
							this.iCnt++;
							item = llsolr.SolrProductSelectFacetAttributePriceBucketItem.create();
							item.id = this.iCnt;
							item.parent = attribute;
							item.phrase = phrase;
							item.domId = 'facetAttributeItem_' + this.iCnt;
							item.title = [fromVal,toVal,' ',facet.currency].join('');
							item.realTitle = priceBuckets.key + ':' + facet.rawExpr;
							item.count = count;
							item.attributeName = priceBuckets.key + ':' + facet.rawExpr;
							attribute.items.push(item);
						}
					}
					attribute.make(noLinkedAttributesHandling = true);
					this.facets.push(attribute);
				}
			}
		}
	);
	
	// >> Pager element
		PagerElement = $.extend(
			$.clone(LLObject),
			{
				create: function(opts){
					var o = LLObject.create.call(this);
					o.opts = opts || null;
					o.currentPage = 1;
					o.overall = null;
					o.offset = null;
					return o;
				},
				getPages: function(){
					var ov, off;
					ov = this.overall;
					off = this.offset;
					return ov % off > 0 ? Math.ceil(ov / off) : ov / off;
				},
				makeArrowNaviLayout: function(){
					var opts = this.opts, firstBind, lastBind, divFirstClass, divPrevClass, divLastClass, divNextClass,
					self = this, firstCol, previousCol, lastCol, nextCol, cb = opts.callback, 
					tpl = $(
						'<td class="pagerArrowOuter">' +
							'<div></div>' +
						'</td>'
					);
					firstBind = false;
					lastBind = false;
					if (this.currentPage > 1){
						divFirstClass = 'firstPage';
						divPrevClass = 'previousPage';
						firstBind = true;
						if (this.currentPage < this.getPages()){
							divLastClass = 'lastPage';
							divNextClass = 'nextPage';
							lastBind = true;
						}else{
							divLastClass = 'lastPagePass';
							divNextClass = 'nextPagePass';
						}
					}else{
						divFirstClass = 'firstPagePass';
						divPrevClass = 'previousPagePass';
						if (this.currentPage < this.getPages()){
							divLastClass = 'lastPage';
							divNextClass = 'nextPage';
							lastBind = true;
						}else{
							divLastClass = 'lastPagePass';
							divNextClass = 'nextPagePass';
						}
					}
					firstCol = tpl.clone();
					firstCol.find('div').addClass(divFirstClass).hover(
						function(e){if (self.currentPage > 1){$(this).addClass('firstPageOver');}},
						function(e){$(this).removeClass('firstPageOver');}
					);
					previousCol = tpl.clone();
					previousCol.find('div').addClass(divPrevClass).hover(
						function(e){if (self.currentPage > 1){$(this).addClass('previousPageOver');}},
						function(e){$(this).removeClass('previousPageOver');}
					);
					lastCol = tpl.clone();
					lastCol.find('div').addClass(divLastClass).hover(
						function(e){if (self.currentPage < self.getPages()){$(this).addClass('lastPageOver');}},
						function(e){$(this).removeClass('lastPageOver');}
					);
					nextCol = tpl.clone();
					nextCol.find('div').addClass(divNextClass).hover(
						function(e){if (self.currentPage < self.getPages()){$(this).addClass('nextPageOver');}},
						function(e){$(this).removeClass('nextPageOver');}
					);
					if (cb && Utils.isFunction(cb)){
						if (firstBind){
							firstCol.find('div').bind('click', function(e){
								cb.call(self, 1);
							});
							previousCol.find('div').bind('click', function(e){
								cb.call(self, self.currentPage - 1);
							});
						}
						if (lastBind){
							lastCol.find('div').bind('click', function(e){
								cb.call(self, self.getPages());
							});
							nextCol.find('div').bind('click', function(e){
								cb.call(self, self.currentPage + 1);
							});
						}
					}
					return {
						first: firstCol.add(previousCol),
						last: nextCol.add(lastCol)
					};
				},
				makePageLayout: function(page, here){
					var lay = $('<td class="pageOuter"><div class="page"><span>' + page + '</span></div></td>'),
					cb = this.opts.callback, self = this;
					if (here){
						lay.find('.page').addClass('pageHere');
					}else{
						if (cb && Utils.isFunction(cb)){
							lay.find('div').bind('click', function(e){
								cb.call(self, page);
							});
						}
						lay.find('.page').hover(
							function(e){$(this).addClass('pageOver');},
							function(e){$(this).removeClass('pageOver');}
						);
					}
					return lay;
				},
				makePagerLayout: function(){
					var opts = this.opts,
					pOuter = $('<table cellpadding="0" cellspacing="0" class="jsonTablePager"><tr></tr></table>'),
					pages = this.getPages(),
					currPage = this.currentPage, start, end, row, i;
					halfFrameWidth = opts.frameWidth / 2;
					if (currPage - halfFrameWidth > 0){
						start = currPage - halfFrameWidth;
						end = start + opts.frameWidth;
					}else{
						start = 1;
						end = start + opts.frameWidth;
						if (end > pages){
							end = pages + 1;
						}
					}
					
					if (currPage + halfFrameWidth > pages){
						start = start - (halfFrameWidth - (pages - currPage)) +1;
						end = start + opts.frameWidth + 1;
						if (start <= 0){
							start = 1;
						}
					}
					row = pOuter.find('tr');
					row.append(this.makeArrowNaviLayout().first);
					for (i = start; i < end; ++i){
						if (i > pages){
							break;
						}
						if (i == currPage){
							row.append(this.makePageLayout(i, true));
						}else{
							row.append(this.makePageLayout(i, false));
						}
					}
					row.append(this.makeArrowNaviLayout().last);
					return pOuter;
				},
				update: function(data){
					var target = this.opts.target;
					this.currentPage = data.pager.currentPage;
					this.overall = data.pager.overall;
					this.offset = data.pager.offset;
					target.empty().append(this.makePagerLayout());
				}
			}
		);
	// <<
// <<

