var jsAspSol = {
	language: 'de',
	catalogShopId: 221,
	loaderCount: 0,

	searchFormId: 'search',
	clientEngine: (navigator.appName == "Microsoft Internet Explorer") ? 'trident' : 'compatible',
	lastSearchedTxt: '',
	params: [],
	lang: [],
	txtTimer: false,
	txtIntelli: '',
	ugrIntelli: '',
	txtFaIntelli: '',
	txtOaIntelli: '',

	checkOnParams: function() {
		jsAspSol.params.grp = '';
		jsAspSol.params.ugr = '';
		jsAspSol.params.frm = '';
		jsAspSol.params.mss = '';
		jsAspSol.params.tgs = '';
		jsAspSol.params.txt = '';
		jsAspSol.params.fatxt = '';
		jsAspSol.params.oatxt = '';
		var params = location.search.substring(1, location.search.length).split('&');
		for(var i = 0; i < params.length; i++) {
			var vars = params[i].split('=');
			if(vars[0] == 'grp' || vars[0] == 'ugr' || vars[0] == 'frm' || vars[0] == 'mss' || vars[0] == 'tgs' || vars[0] == 'txt' || vars[0] == 'fatxt' || vars[0] == 'oatxt') {
				jsAspSol.params[vars[0]] = vars[1];
			}
		}
/*
		if(jsAspSol.params.txt !== '') {
			jsAspSol.switchProductSearch('intellisearch');
			$('txt').value = jsAspSol.params.txt;
			jsAspSol.txtIntelli = jsAspSol.params.txt;
			jsAspSol.params.txt = '';
			jsAspSol.ugrIntelli = jsAspSol.params.ugr;
			jsAspSol.params.ugr = '';
			if(jsAspSol.ugrIntelli !== '') {
				jsAspSol.callIntelli(jsAspSol.ugrIntelli, jsAspSol.txtIntelli);
			} else {
				jsAspSol.productSearch('txt');
			}
		} else */
		if(jsAspSol.params.fatxt !== '') {
			jsAspSol.switchProductSearch('fa-intellisearch');
			jsAspSol.txtFaIntelli = jsAspSol.params.fatxt;
			jsAspSol.params.fatxt = '';
			$('fatxt').value = jsAspSol.txtFaIntelli;
			jsAspSol.productSearch('fa-txt');
		} else if(jsAspSol.params.oatxt !== '') {
			jsAspSol.switchProductSearch('oa-intellisearch');
			jsAspSol.txtOaIntelli = jsAspSol.params.oatxt;
			jsAspSol.params.oatxt = '';
			$('oatxt').value = jsAspSol.txtOaIntelli;
			jsAspSol.productSearch('oa-txt');
		} else if(jsAspSol.params.grp !== '' || (jsAspSol.params.ugr !== '' && jsAspSol.params.txt === '')) {
			jsAspSol.switchProductSearch('tagsearch');
		} else if(jsAspSol.params.txt === '') {
			$('ugrTitle').style.display = 'none';
			$('ugr').style.display = 'none';
			$('frmTitle').style.display = 'none';
			$('frm').style.display = 'none';
			$('mssTitle').style.display = 'none';
			$('mss').style.display = 'none';
			$('tgsTitle').style.display = 'none';
			$('tgs').style.display = 'none';
			$('fnd').style.display = 'none';
			jsAspSol.productSearch('grp', true, true);
			jsAspSol.switchProductSearch('tagsearch', false);
		}
	},
	highlightTag: function(group, id, sqlId) {
		var mainA = $('a_' + group + id);
		var mainI = $('hidden_' + group + id);
		if(mainA.className == '') {
			mainA.className = 'tagSelected';
			mainI.value = sqlId;
		} else {
			mainA.className = '';
			mainI.value = '';
		}
	},
	setFixedAttribute: function(obj, Event, FncString) {
		if(jsAspSol.clientEngine == 'trident') { 
			switch(Event) {
				case 'onchange':
					obj.onchange = function() { eval(FncString) };
					break;
				case 'onclick':
					obj.onclick = function() { eval(FncString) };
					break;
				case 'onmouseover':
					obj.onmouseover = function() { eval(FncString) };
					break;
				case 'onmouseout':
					obj.onmouseout = function() { eval(FncString) };
					break;
			}
		} else {
			obj.setAttribute(Event, FncString);
		}
	},
	ajaxLoader: function(status) {
		if(status == 'start') {
			jsAspSol.loaderCount++;
 			$(document.body).startWaiting('bodyWaiting');
		} else {
			jsAspSol.loaderCount--;
			if(jsAspSol.loaderCount == 0) $(document.body).stopWaiting();
		}
	},
	switchProductSearch: function(sr, startSearch) {
		if(startSearch == null || startSearch == undefined) var startSearch = true;
		var actSr = $(sr);
		switch(sr) {
			case 'intellisearch':
				var actBut = $('isBut'),
					inActSr1 = $('fa-intellisearch'),
					inActSr2 = $('tagsearch'),
					inActSr3 = $('oa-intellisearch'),
					inActBut1 = $('tsBut'),
					inActBut2 = $('faBut');
					inActBut3 = $('oaBut');
				break;
			case 'fa-intellisearch':
				var actBut = $('faBut'),
					inActSr1 = $('intellisearch'),
					inActSr2 = $('tagsearch'),
					inActSr3 = $('oa-intellisearch'),
					inActBut1 = $('isBut'),
					inActBut2 = $('tsBut');
					inActBut3 = $('oaBut');
				break;
			case 'oa-intellisearch':
				var actBut = $('oaBut'),
					inActSr1 = $('fa-intellisearch'),
					inActSr2 = $('tagsearch'),
					inActSr3 = $('intellisearch'),
					inActBut1 = $('isBut'),
					inActBut2 = $('tsBut');
					inActBut3 = $('faBut');
				break;
			case 'tagsearch':
				var actBut = $('tsBut'),
					inActSr1 = $('intellisearch'),
					inActSr2 = $('fa-intellisearch'),
					inActSr3 = $('oa-intellisearch'),
					inActBut1 = $('isBut'),
					inActBut2 = $('faBut');
					inActBut3 = $('oaBut');
				break;
		}
		actSr.style.display = '';
		actBut.className = 'active';
		inActSr1.style.display = 'none';
		inActSr2.style.display = 'none';
		inActSr3.style.display = 'none';
		inActBut1.className = '';
		inActBut2.className = '';
		inActBut3.className = '';
		$('txt').value = '';
		$('fatxt').value = '';
		$('oatxt').value = '';
		$('fnd').innerHTML = '';
		$('fndTitle').style.display = 'none';
		$('fndNotTitle').style.display = 'none';
		$('fndShortTitle').style.display = 'none';
		$('fndGroupTitle').style.display = 'none';
		$('tag-res-count').innerHTML = '';
		$('intelli-res-count').innerHTML = '';
		$('fa-intelli-res-count').innerHTML = '';
		$('oa-intelli-res-count').innerHTML = '';
		if(sr == 'tagsearch' && startSearch) jsAspSol.productSearch('grp');
	},
	textTimeout: function(strValue) {
		if(jsAspSol.txtTimer) clearTimeout(jsAspSol.txtTimer);
		jsAspSol.txtTimer = window.setTimeout("jsAspSol.productSearch('execTxt');", 850);
	},
	didYouMean: function(container_id, productId) {
		new Ajax.Request('/didYouMean.cfm', {
		    method:'get',
			parameters: {pId: productId},
			onLoading: jsAspSol.ajaxLoader('start'),
		    onSuccess: function(transport) {
				jsAspSol.ajaxLoader('stop');
				var rec = transport.responseText.evalJSON(true), con = $(container_id), conProd = $('col-middle');
				if(rec.recordcount > 0) {
					conProd.appendChild(constructor({
						_type: "div",
						className: "highslide-html-content dym-popup",
						id: "dym-" + container_id,
						_addNewElements: [{
							_type: "h2",
							innerHTML: rec.data.name[0] + ' (' + rec.data.art_nr[0] + ')'
						},{
							_type: "div",
							className: "specs",
							_addNewElements: [{
								_type: "table",
								cellSpacing: 0,
								_addNewElements: [{
									_type: "tbody",
									_addNewElements: [{
										_type: "tr",
										_statement: (rec.data.art_nr[0] != ''),
										_addNewElements: [{
											_type: "th",
											innerHTML: requestMLT("Artikelnummer")
										},{
											_type: "td",
											innerHTML: rec.data.art_nr[0]
										}]
									},{
										_type: "tr",
										_statement: (rec.data.formen[0] != ''),
										_addNewElements: [{
											_type: "th",
											innerHTML: requestMLT("Form")
										},{
											_type: "td",
											innerHTML: rec.data.formen[0]
										}]
									},{
										_type: "tr",
										_statement: (rec.data.mass[0] != ''),
										_addNewElements: [{
											_type: "th",
											innerHTML: requestMLT("Mass")
										},{
											_type: "td",
											innerHTML: rec.data.mass[0]
										}]
									},{
										_type: "tr",
										_statement: (rec.data.gewicht[0] != ''),
										_addNewElements: [{
											_type: "th",
											innerHTML: requestMLT("Gewicht")
										},{
											_type: "td",
											innerHTML: rec.data.gewicht[0]
										}]
									},{
										_type: "tr",
										_statement: (rec.data.tags[0] != ''),
										_addNewElements: [{
											_type: "td",
											colspan: 2,
											_addNewElements: [{
												_type: "div",
												className: "specTags",
												_addNewElements: [{
													_type: "div",
													className: "specTagsTitle",
													innerHTML: requestMLT("Tags")
												},{
													_type: "ul",
													innerHTML: rec.data.tags[0]
												}]
											}]
										}]
									},{
										_type: "tr",
										_statement: (rec.data.preis[0] != ''),
										_addNewElements: [{
											_type: "th",
											innerHTML: requestMLT("Preis")
										},{
											_type: "td",
											innerHTML: rec.data.preis[0]
										}]
									}]
								}]
							},{
								_type: "div",
								className: "detailOptions",
								_addNewElements: [{
									_type: "a",
									title: requestMLT("Produkt dem Merkzettel hinzuf&uuml;gen"),
									href: "javascript:;",
									onclick: "jsAspSol.addTo('mz', " + rec.data.id[0] +");",
									className: "butMz",
									innerHTML: requestMLT("Artikel merken")
								},{
									_type: "a",
									title: requestMLT("Produkt dem Warenkorb hinzuf&uuml;gen"),
									href: "javascript:;",
									onclick: "jsAspSol.addTo('wk', " + rec.data.id[0] +");",
									className: "butWk",
									innerHTML: requestMLT("Artikel bestellen")
								},{
									_type: "a",
									_statement: (rec.data.preis[0] != '' && rec.data.preis[0] != 0),
									title: requestMLT("Detailseite als PDF runterladen (mit Preisangaben)"),
									href: "get_pdf.cfm?art_id=" + rec.data.id[0] + "&pricing=true",
									className: "butPdf",
									innerHTML: requestMLT("Download PDF")
								},{
									_type: "a",
									title: ((rec.data.preis[0] != '' && rec.data.preis[0] != 0) ? requestMLT("Detailseite als PDF runterladen (ohne Preisangaben)") : requestMLT("Detailseite als PDF runterladen")),
									href: "get_pdf.cfm?art_id=" + rec.data.id[0],
									className: "butPdf",
									innerHTML: ((rec.data.preis[0] != '' && rec.data.preis[0] != 0) ? requestMLT("Download PDF (ohne Preise)") : requestMLT("Download PDF"))
								}]
							}]
						},{
							_type: "div",
							className: "detailImage",
							_statement: (rec.data.tn_image[0] != ''),
							_addNewElements: [{
								_type: "a",
								className: "highslide",
								onclick: "return hs.expand(this, {caption: '" + rec.data.name[0] + "'})",
								href: rec.data.big_image[0],
								_addNewElements: [{
									_type: "img",
									src: rec.data.big_image[0],
									alt: rec.data.name[0]
								}]
							}]
						}]
					}));
					con.appendChild(constructor({
						_type: "div",
						className: 'did-you-mean',
						_addNewElements: [{
							_type: "span",
							className: 'dym-title',
							innerHTML: requestMLT('Meinten Sie')
						},{
							_type: "a",
							href: 'javascript:;',
							onclick: "return hs.htmlExpand(this, {contentId: 'dym-" + container_id + "', wrapperClassName: 'highslide-white', outlineType: 'rounded-white', outlineWhileAnimating: true});",
							innerHTML: rec.data.title[0]
						}]
					}));
				}
		    },
		    onFailure: function(){ jsAspSol.ajaxLoader('stop'); /* alert('Can not load recommandation, please try again later.'); */ }
		  });
	},
	productSearch: function(method, singleMode, firstTime) {
		if(singleMode == null || singleMode == undefined) var singleMode = false;
		if(firstTime == null || firstTime == undefined) var firstTime = false;
		switch(method) {
			case 'grp':
				var grpSel = $('grp');
				if(!firstTime) grpSel.innerHTML = '';

				new Ajax.Request('/json.cfm', {
				    method:'get',
					parameters: {method: 'getGrp'},
					onLoading: jsAspSol.ajaxLoader('start'),
				    onSuccess: function(transport){
						var grp = transport.responseText.evalJSON(true);
						jsAspSol.ajaxLoader('stop');
						for(var i=0; i < grp.recordcount; i++) {
							grpSel.appendChild(constructor({
								_type: "option",
								value: grp.data.id[i],
								innerHTML: grp.data.name[i]
							}));
						}
						if(jsAspSol.params.grp !== '') {
							forSearchGroup:
							for(var i = 0; i < grpSel.options.length; i++) {
								if(grpSel.options[i].value == jsAspSol.params.grp) {
									grpSel.selectedIndex = i;
									break forSearchGroup;
								}
							}
							jsAspSol.params.grp = '';
						}
						if(!singleMode) jsAspSol.productSearch('ugr');
				    },
				    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not load groups, please try again later.'); }
				  });
				break;
			case 'ugr':
				var ugrSel = $('ugr');
				ugrSel.innerHTML = '';
				ugrSel.style.display = '';

				$('ugrTitle').style.display = '';
				$('fnd').innerHTML = '';
				$('fndTitle').style.display = 'none';
				$('fndNotTitle').style.display = 'none';
				$('fndShortTitle').style.display = 'none';
				$('fndGroupTitle').style.display = 'none';

				$('frm').innerHTML = '';
				$('frm').style.display = 'none';
				$('frmTitle').style.display = 'none';

				$('mss').innerHTML = '';
				$('mss').style.display = 'none';
				$('mssTitle').style.display = 'none';

				$('tgs').innerHTML = '';
				$('tgs').style.display = 'none';
				$('tgsTitle').style.display = 'none';

				if($('grp').options[0].value == '') $('grp').options[0] = null;

				new Ajax.Request('/json.cfm', {
				    method:'get',
					parameters: {method: 'getUgr', grp: $('grp').value},
					onLoading: jsAspSol.ajaxLoader('start'),
				    onSuccess: function(transport){
						jsAspSol.ajaxLoader('stop');
						var ugr = transport.responseText.evalJSON(true);
						if(ugr.recordcount > 1) {
							ugrSel.appendChild(constructor({
								_type: "option",
								value: "",
								innerHTML: requestMLT('Bitte w&auml;hlen Sie eine Untergruppe')
							}));
						}
						for(var i=0; i < ugr.recordcount; i++) {
							ugrSel.appendChild(constructor({
								_type: "option",
								value: ugr.data.id[i],
								innerHTML: ugr.data.name[i]
							}));
						}
						if(jsAspSol.params.ugr !== '') {
							forSearchGroup:
							for(var i = 0; i < ugrSel.options.length; i++) {
								if(ugrSel.options[i].value == jsAspSol.params.ugr) {
									ugrSel.selectedIndex = i;
									break forSearchGroup;
								}
							}
							jsAspSol.params.grp = '';
						}
						if(!singleMode && ugr.recordcount == 1) jsAspSol.productSearch('all');
				    },
				    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not load subGroups, please try again later.'); }
				  });
				break;
			case 'all':
				if($('ugr').options[0].value == '') $('ugr').options[0] = null;

				$('fnd').innerHTML = '';
				$('fndTitle').style.display = 'none';
				$('fndNotTitle').style.display = 'none';
				$('fndShortTitle').style.display = 'none';
				$('fndGroupTitle').style.display = 'none';

				var frmDiv = $('frm');
				var frmTitle = $('frmTitle');
				frmDiv.innerHTML = '';
				frmDiv.style.display = 'none';
				frmTitle.style.display = 'none';

				var mssDiv = $('mss');
				var mssTitle = $('mssTitle');
				mssDiv.innerHTML = '';
				mssDiv.style.display = 'none';
				mssTitle.style.display = 'none';

				var tgsDiv = $('tgs');
				var tgsTitle = $('tgsTitle');
				tgsDiv.innerHTML = '';
				tgsDiv.style.display = 'none';
				tgsTitle.style.display = 'none';

				new Ajax.Request('/json.cfm', {
				    method:'get',
					parameters: {method: 'getFrm', ugr: $('ugr').value},
					onLoading: jsAspSol.ajaxLoader('start'),
				    onSuccess: function(transport){
						jsAspSol.ajaxLoader('stop');
						var frm = transport.responseText.evalJSON(true);
						if(frm.recordcount > 0) {
							frmDiv.style.display = '';
							frmTitle.style.display = '';
							var thisClass = '', thisValue = '';
							for(var i=0; i < frm.recordcount; i++) {
								if(jsAspSol.params.frm !== '') {
									var frms = jsAspSol.params.frm.split(',');
									forSearchFrm:
									for(var ii = 0; ii < frms.length; ii++) {
										if(frms[ii] == frm.data.id[i]) {
											thisClass = 'tagSelected';
											thisValue = frm.data.id[i];
											break forSearchFrm;
										}
									}
								}
								frmDiv.appendChild(constructor({
									_type: "li",
									_addNewElements: [{
										_type: "a",
										href: "javascript:;",
										onclick: "jsAspSol.highlightTag('frm', '" + i + "', '" + frm.data.id[i] + "'); jsAspSol.productSearch('fnd'); this.blur();",
										id: "a_frm" + i,
										className: thisClass,
										_addNewElements: [{
											_type: "span",
											innerHTML: frm.data.name[i]
										},{
											_type: "input",
											type: "hidden",
											id: "hidden_frm" + i,
											name: "frm",
											value: thisValue
										}]
									}]
								}));
							}
							jsAspSol.params.frm = '';
						}
				    },
				    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not load forms, please try again later.'); }
				});
				new Ajax.Request('/json.cfm', {
				    method:'get',
					parameters: {method: 'getMss', ugr: $('ugr').value},
					onLoading: jsAspSol.ajaxLoader('start'),
				    onSuccess: function(transport){
						jsAspSol.ajaxLoader('stop');
						var mss = transport.responseText.evalJSON(true);
						if(mss.recordcount > 0) {
							mssDiv.style.display = '';
							mssTitle.style.display = '';
							for(var i=0; i < mss.recordcount; i++) {
								var thisClass = '', thisValue = '';
								if(jsAspSol.params.mss !== '') {
									var msss = jsAspSol.params.mss.split(',');
									forSearchMss:
									for(var ii = 0; ii < msss.length; ii++) {
										if(msss[ii] == mss.data.id[i]) {
											thisClass = 'tagSelected';
											thisValue = mss.data.id[i];
											break forSearchMss;
										}
									}
								}
								mssDiv.appendChild(constructor({
									_type: "li",
									_addNewElements: [{
										_type: "a",
										href: "javascript:;",
										onclick: "jsAspSol.highlightTag('mss', '" + i + "', '" + mss.data.id[i] + "'); jsAspSol.productSearch('fnd'); this.blur();",
										id: "a_mss" + i,
										className: thisClass,
										_addNewElements: [{
											_type: "span",
											innerHTML: mss.data.name[i]
										},{
											_type: "input",
											type: "hidden",
											id: "hidden_mss" + i,
											name: "mss",
											value: thisValue
										}]
									}]
								}));
							}
							jsAspSol.params.mss = '';
						}
				    },
				    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not load measures, please try again later.'); }
				});
				new Ajax.Request('/json.cfm', {
				    method:'get',
					parameters: {method: 'getTgs', ugr: $('ugr').value},
					onLoading: jsAspSol.ajaxLoader('start'),
				    onSuccess: function(transport){
						jsAspSol.ajaxLoader('stop');
						var tgs = transport.responseText.evalJSON(true);
						if(tgs.recordcount > 0) {
							tgsDiv.style.display = '';
							tgsTitle.style.display = '';
							for(var i=0; i < tgs.recordcount; i++) {
								var thisClass = '', thisValue = '';
								if(jsAspSol.params.tgs !== '') {
									var tgss = jsAspSol.params.tgs.split(',');
									forSearchTgs:
									for(var ii = 0; ii < tgss.length; ii++) {
										if(tgss[ii] == tgs.data.id[i]) {
											thisClass = 'tagSelected';
											thisValue = tgs.data.id[i];
											break forSearchTgs;
										}
									}
								}
								tgsDiv.appendChild(constructor({
									_type: "li",
									_addNewElements: [{
										_type: "a",
										href: "javascript:;",
										onclick: "jsAspSol.highlightTag('tgs', '" + i + "', '" + tgs.data.id[i] + "'); jsAspSol.productSearch('fnd'); this.blur();",
										id: "a_tgs" + i,
										className: thisClass,
										_addNewElements: [{
											_type: "span",
											innerHTML: tgs.data.name[i]
										},{
											_type: "input",
											type: "hidden",
											id: "hidden_tgs" + i,
											name: "tgs",
											value: thisValue
										}]
									}]
								}));
							}
							jsAspSol.params.tgs = '';
						}
						jsAspSol.productSearch('fnd');
				    },
				    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not load tags, please try again later.'); }
				});
				break;
			case 'fnd':
				var grpSet = (jsAspSol.params.grp !== '') ? jsAspSol.params.grp : $('grp').value,
					ugrSet = (jsAspSol.params.ugr !== '') ? jsAspSol.params.ugr : $('ugr').value,
					frmSet = (jsAspSol.params.frm !== '') ? jsAspSol.params.frm : tools.makeCSList('frm'),
					mssSet = (jsAspSol.params.mss !== '') ? jsAspSol.params.mss : tools.makeCSList('mss'),
					tgsSet = (jsAspSol.params.tgs !== '') ? jsAspSol.params.tgs : tools.makeCSList('tgs'),
					newHrefAppend = '';

				if(grpSet !== '') newHrefAppend += "&grp=" + grpSet;
				if(ugrSet !== '') newHrefAppend += "&ugr=" + ugrSet;
				if(frmSet !== '') newHrefAppend += "&frm=" + frmSet;
				if(mssSet !== '') newHrefAppend += "&mss=" + mssSet;
				if(tgsSet !== '') newHrefAppend += "&tgs=" + tgsSet;
				new Ajax.Request('/json.cfm', {
				    method:'get',
					parameters: {method: 'getRes', grp: grpSet, ugr: ugrSet, frm: frmSet, mss: mssSet, tgs: tgsSet},
					onLoading: jsAspSol.ajaxLoader('start'),
				    onSuccess: function(transport) { jsAspSol.writeResults(transport, newHrefAppend); },
				    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not load forms, please try again later.') }
				});
				break;
			case 'txt':
				jsAspSol.txtIntelli = escape($('txt').value);
				jsAspSol.textTimeout();
				break;
			case 'execTxt':
				$('fnd').innerHTML = '';
				$('fndTitle').style.display = 'none';
				$('fndShortTitle').style.display = '';
				$('fndGroupTitle').style.display = 'none';
				if(jsAspSol.txtIntelli.length >= 3) {
					$('fndShortTitle').style.display = 'none';
					new Ajax.Request('/json.cfm', {
					    method:'get',
						parameters: {method: 'getTxtGrp', txt: jsAspSol.txtIntelli},
						onLoading: jsAspSol.ajaxLoader('start'),
					    onSuccess: function(transport) { jsAspSol.writeGroups(transport); },
					    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not get Results, please try again later.') }
					});
				}
				break;
			case 'execFaTxt':
				jsAspSol.txtFaIntelli = escape($('fatxt').value);
				$('fnd').innerHTML = '';
				$('fndTitle').style.display = 'none';
				$('fndShortTitle').style.display = '';
				$('fndGroupTitle').style.display = 'none';
				if(jsAspSol.txtFaIntelli.length >= 3) {
					$('fndShortTitle').style.display = 'none';
					new Ajax.Request('/json.cfm', {
					    method:'get',
						parameters: {method: 'getFaTxt', txt: jsAspSol.txtFaIntelli},
						onLoading: jsAspSol.ajaxLoader('start'),
					    onSuccess: function(transport) { jsAspSol.writeResults(transport, '&fatxt=' + jsAspSol.txtFaIntelli, 'fa-intelli'); },
					    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not get Results, please try again later.') }
					});
				}
				break;
			case 'execOaTxt':
				jsAspSol.txtOaIntelli = escape($('oatxt').value);
				$('fnd').innerHTML = '';
				$('fndTitle').style.display = 'none';
				$('fndShortTitle').style.display = '';
				$('fndGroupTitle').style.display = 'none';
				if(jsAspSol.txtOaIntelli.length >= 3) {
					$('fndShortTitle').style.display = 'none';
					new Ajax.Request('/json.cfm', {
					    method:'get',
						parameters: {method: 'getOaTxt', txt: jsAspSol.txtOaIntelli},
						onLoading: jsAspSol.ajaxLoader('start'),
					    onSuccess: function(transport) { jsAspSol.writeResults(transport, '&oatxt=' + jsAspSol.txtOaIntelli, 'oa-intelli'); },
					    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not get Results, please try again later.') }
					});
				}
				break;
		}
	},
	writeResults: function(transport, newHrefAppend, srType) {
		if(srType == null) srType = 'tag';
		var fnd = transport.responseText.evalJSON(true);
		var fndDiv = $('fnd');
		var fndTitle = $('fndTitle');
		var fndNotTitle = $('fndNotTitle');
		var fndShortTitle = $('fndShortTitle');
		var fndGroupTitle = $('fndGroupTitle');
		jsAspSol.ajaxLoader('stop');
		fndDiv.innerHTML = '';
		if(fnd.recordcount > 0) {
			if(srType == 'tag') {
				$('tag-res-count').innerHTML = ' (' + fnd.recordcount + ')';
			} else if(srType == 'fa-intelli') {
				$('fa-intelli-res-count').innerHTML = ' (' + fnd.recordcount + ')';
			} else if(srType == 'oa-intelli') {
				$('oa-intelli-res-count').innerHTML = ' (' + fnd.recordcount + ')';
			} else {
				$('intelli-res-count').innerHTML = ' (' + fnd.recordcount + ')';
			}
			fndDiv.style.display = '';
			fndTitle.style.display = '';
			fndNotTitle.style.display = 'none';
			fndShortTitle.style.display = 'none';
			fndGroupTitle.style.display = 'none';
			for(var i=0, tags=''; i < fnd.recordcount; i++) {
				tags = '';
				if(fnd.data.tags[i] !== '') {
					tags += fnd.data.tags[i];
				}
				if(fnd.data.formen[i] !== '') {
					if(tags !== '') tags += ', ';
					tags += (requestMLT('Form') + ': ' + fnd.data.formen[i]);
				}
				if(fnd.data.mass[i] !== '') {
					if(tags !== '') tags += ', ';
					tags += (requestMLT('Mass') + ': ' + fnd.data.mass[i]);
				}
				fndDiv.appendChild(constructor({
					_type: 'div',
					className: 'srProd',
					id: 'res_' + i,
					_addNewElements: [{
						_type: 'a',
						className: 'srProdTitle',
						href: "index.cfm?id=" + jsAspSol.catalogShopId + "&pid=" + fnd.data.id[i] + newHrefAppend,
						_addNewElements: [{
							_type: 'h3',
							innerHTML: fnd.data.name[i] + ' (' + fnd.data.art_nr[i] + ')'
						}]
					},{
						_type: 'a',
						className: 'srProdImage',
						href: (fnd.data.image_over[i] !== '') ? fnd.data.image_over[i] : "index.cfm?id=" + jsAspSol.catalogShopId + "&pid=" + fnd.data.id[i] + newHrefAppend,
						onclick: (fnd.data.image_over[i] !== '') ? ("return hs.expand(this, {caption: '" + fnd.data.name[i] + ' (' + fnd.data.art_nr[i] + ')' + "'})") : 'void(0);',
						//onmouseover: (fnd.data.image_over[i] !== '') ? "overlib('<div class=\"imagePopup\"><img src=\"" + fnd.data.image_over[i] + "\" alt=\"" + fnd.data.name[i] + "\"></div>',FULLHTML)" : 'void(0);',
						//onmouseout: (fnd.data.image_over[i] !== '') ? "nd();" : 'void(0);',
						_addNewElements: [{
							_type: 'img',
							src: fnd.data.image[i],
							alt: fnd.data.name[i],
							height: 50,
							id: "img_" + fnd.data.id[i]
						}]
					},{
						_type: 'a',
						className: 'srProdDesc',
						href: "index.cfm?id=" + jsAspSol.catalogShopId + "&pid=" + fnd.data.id[i] + newHrefAppend,
						_addNewElements: [{
							_type: 'span',
							className: 'srProdTags',
							innerHTML: tags
						},{
							_type: 'span',
							_statement: client.viewPrices,
							className: 'srProdPrice',
							innerHTML: fnd.data.preis[i]
						}]
					},{
						_type: 'div',
						className: 'srProdOptions',
						_addNewElements: [{
							_type: 'a',
							className: 'srProdDetail',
							id: 'prodDetail_' + fnd.data.id[i],
							href: "index.cfm?id=" + jsAspSol.catalogShopId + "&pid=" + fnd.data.id[i] + newHrefAppend,
							title: requestMLT('Zur Detailansicht des Produkts', 'prodDetail_' + fnd.data.id[i]),
							_addNewElements: [{
								_type: 'img',
								src: 'style/images/detail.gif'
							}]
						},{
							_type: 'a',
							className: 'srProdCart',
							href: 'javascript:;',
							onclick: "jsAspSol.addTo('wk', " + fnd.data.id[i] + ");",
							id: 'prodCart_' + fnd.data.id[i],
							title: requestMLT('Produkt dem Warenkorb hinzuf&uuml;gen', 'prodCart_' + fnd.data.id[i]),
							_addNewElements: [{
								_type: 'img',
								src: 'style/images/wk_add.gif'
							}]
						},{
							_type: 'a',
							_statement: ((client.id > 0) ? true : false),
							className: 'srProdList',
							href: 'javascript:;',
							onclick: "jsAspSol.addTo('mz', " + fnd.data.id[i] + ");",
							id: 'prodList_' + fnd.data.id[i],
							title: requestMLT('Produkt dem Merkzettel hinzuf&uuml;gen', 'prodList_' + fnd.data.id[i]),
							_addNewElements: [{
								_type: 'img',
								src: 'style/images/ml_add.gif'
							}]
						}]
					}]
				}));
				//jsAspSol.didYouMean('res_' + i, fnd.data.id[i]);
			}
		} else {
			fndDiv.style.display = 'none';
			fndTitle.style.display = 'none';
			fndNotTitle.style.display = '';
			if(srType == 'tag') {
				$('tag-res-count').innerHTML = ' (0)';
			} else if(srType == 'fa-intelli') {
				$('fa-intelli-res-count').innerHTML = ' (0)';
			} else {
				$('intelli-res-count').innerHTML = ' (0)';
			}
		}

		if(srType == 'intelli') {
			fndDiv.appendChild(constructor({
				_type: 'div',
				className: 'backToGroups',
				_addNewElements: [{
					_type: 'a',
					innerHTML: '&laquo; ' + requestMLT('Zur&uuml;ck zu den gefundenen Gruppen'),
					href: 'javascript:;',
					onclick: "jsAspSol.productSearch('execTxt');"
				}]
			}));
		}
	},
	writeGroups: function(transport) {
		var fnd = transport.responseText.evalJSON(true);
		var fndDiv = $('fnd');
		var fndTitle = $('fndTitle');
		var fndNotTitle = $('fndNotTitle');
		var fndShortTitle = $('fndShortTitle');
		var fndGroupTitle = $('fndGroupTitle');
		jsAspSol.ajaxLoader('stop');
		fndDiv.innerHTML = '';
		if(fnd.recordcount > 0) {
			$('intelli-res-count').innerHTML = ' (' + fnd.recordcount + ')';
			fndDiv.style.display = '';
			fndTitle.style.display = 'none';
			fndNotTitle.style.display = 'none';
			fndShortTitle.style.display = 'none';
			fndGroupTitle.style.display = '';
			fndDiv.appendChild(constructor({
				_type: 'ul',
				id: 'srProdGroups'
			}));
			srGroups = $('srProdGroups');

			for(var i=0; i < fnd.recordcount; i++) {
				srGroups.appendChild(constructor({
					_type: 'li',
					_addNewElements: [{
						_type: 'a',
						innerHTML: '&raquo; ' + fnd.data.name[i],
						href: 'javascript:;',
						onclick: "jsAspSol.callIntelli(" + fnd.data.id[i] + ", '" + jsAspSol.txtIntelli + "');"
					}]
				}));
			}
		} else {
			$('intelli-res-count').innerHTML = ' (0)';
			fndDiv.style.display = '';
			fndTitle.style.display = 'none';
			fndNotTitle.style.display = '';
			fndShortTitle.style.display = 'none';
			fndGroupTitle.style.display = 'none';
		}
	},
	callIntelli: function(ugrId, txt) {
		$('fnd').innerHTML = '';
		$('fndTitle').style.display = 'none';
		$('fndShortTitle').style.display = 'none';
		$('fndGroupTitle').style.display = 'none';
		jsAspSol.ugrIntelli = ugrId;
		if(jsAspSol.txtIntelli.length >= 3) {
			$('fndShortTitle').style.display = 'none';
			new Ajax.Request('/json.cfm', {
			    method:'get',
				parameters: {method: 'getTxt', txt: txt, ugr: jsAspSol.ugrIntelli},
				onLoading: jsAspSol.ajaxLoader('start'),
			    onSuccess: function(transport) { jsAspSol.writeResults(transport, '&txt=' + jsAspSol.txtIntelli + '&ugr=' + jsAspSol.ugrIntelli, 'intelli'); },
			    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not get Results, please try again later.') }
			});
		}
	},
	addTo: function(list, id) {
		if(list == null) var list = 'mz';
		var proceed = true;
		if(list == 'wk') {
			var amount = prompt(requestMLT('Geben Sie bitte die gewuenschte Anzahl an'), '1');
			if(amount != '' && amount != null) {
				if(parseInt(amount) != amount) {
					alert(requestMLT('Sie m&uuml;ssen eine Ganzzahl eingeben!'));
					proceed = false;
				}
			} else {
				proceed = false;
			}
		} else {
			var amount = 1;
		}
		if(proceed) {
			new Ajax.Request('/list.cfm', {
			    method:'get',
				parameters: {t: list, d: 'add', i: id, a: amount},
				onLoading: jsAspSol.ajaxLoader('start'),
			    onSuccess: function(transport) { jsAspSol.writeList(list, transport); },
			    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not save or load list, please try again later.') }
			});
		}
	},
	deleteFrom: function(list, id) {
		if(list == null) var list = 'mz';
		new Ajax.Request('/list.cfm', {
		    method:'get',
			parameters: {t: list, d: 'del', i: id},
			onLoading: jsAspSol.ajaxLoader('start'),
		    onSuccess: function(transport) { jsAspSol.writeList(list, transport); },
		    onFailure: function(){ jsAspSol.ajaxLoader('stop'); alert('Can not delete from list or load list, please try again later.') }
		});
	},
	writeList: function(list, transport) {
		var listUl = $(list + 'Ul');
		var listTitle = $(list + 'Title');

		var listContent = transport.responseText.evalJSON(true);
		listUl.innerHTML = '';
		if(listContent.recordcount > 0) {
			$(list).style.display = '';
			for(var i = 0; i < listContent.recordcount; i++) {
				listUl.appendChild(constructor({
					_type: "li",
					_addNewElements: [{
						_type: "div",
						className: "listRow",
						_addNewElements: [{
							_type: "a",
							href: "index.cfm?id=" + jsAspSol.catalogShopId + "&pid=" + listContent.data.id[i],
							id: "a_" + list + i,
							innerHTML: listContent.data.art_nr[i],
							className: "prodNr"
						}]
					},{
						_type: "div",
						className: (list == 'mz') ? "listRow mzdots" : "listRow",
						_addNewElements: [{
							_type: "input",
							_statement: (list == 'mz'),
							name: "mzitems",
							type: "checkbox",
							value: listContent.data.id[i],
							checked: false
						},{
							_type: "a",
							href: "index.cfm?id=" + jsAspSol.catalogShopId + "&pid=" + listContent.data.id[i],
							id: "a_" + list + i,
							innerHTML: listContent.data.name[i],
							className: "prodName"
						},{
							_type: "a",
							href: "javascript:;",
							onclick: "jsAspSol.deleteFrom('" + list + "', " + listContent.data.id[i] + ");",
							id: "a_" + list + i,
							className: "listDelete",
							_addNewElements: [{
								_type: "img",
								src: "style/images/" + list + "-delete.gif"
							}]
						}]
					}]
				}));
			}
			if(listContent.data.totalpreis[0] !== '' && client.viewPrices) {
				listUl.appendChild(constructor({
					_type: "li",
					_addNewElements: [{
						_type: "div",
						className: "totalPrice",
						innerHTML: "Total: " + listContent.data.totalpreis[0]
					}]
				}));
			}
			new Effect.Highlight(listUl, {startcolor: '#ffff99', endcolor: '#ffffff', duration: 1.3});
			jsAspSol.ajaxLoader('stop');
		} else {
			$(list).style.display = 'none';
			jsAspSol.ajaxLoader('stop');
		}
	}
}
