 	/////////////////////////////////////// FORM ELMNTS ////////////////////////////////////////////////////
	var sliderDia;
	var sliderLen;
	var sliderPun;
	var sliderPri;
	var buttonPreS;
	var buttonPreM;
	var buttonPreL;
	var buttonPreXL;
	var buttonPreXXL;
	var dropDownComp;
	var dropDownTipps;
	var dropDownArtists;
	var dropDownMaterial;
	var hoverClass;
	var tooltipClass;
	var extOpSwitch;
	var checkAV;
	var checkHD;
	
	var button7A;
	var button5A;
	var button5B;
	var button2B;
	
	var resultBox;
	var compareBox;
	var imgSlider;
	
	/////////////////////////////////////// VALUES //////////////////////////////////////////////////////////
	var debug = false;
	
	var sliderDiaStd = 0;
	var sliderLenStd = 0;
	var sliderPunStd = 0;
	var sliderPriStd = 15;
	var dropDownCompanyStd = '';
	var dropDownTippsStd = '';
	var dropDownArtistsStd = '';
	var dropDownMaterialStd = '';
	var checkAVStd = false;
	var checkHDStd = false;
	var txtPriceRFrom = '';
	var txtPriceRUntil = '';
	
	var chVal = 'startup';
	var oldRequestString = '';
	
	var bigger;
	
	var compareStick;
	var executingRequest = false;
	
	var numberAll = 0;
	var numberPerPage = 0;
	var numberThisPage = 0;
	
	var waitBGhandles = Array();

	/////////////////////////////////////// CALLBACKS  //////////////////////////////////////////////////////
	function ajaxCB(xml) {
		debugOutput('gettingRequest',true);
		if (!xml) return;

		//------------ number sticks   --------------------------------
		var tmp = xml.getElementsByTagName('numberAll')[0];
		numberAll = (tmp ? tmp.firstChild.nodeValue : 0);
		
		tmp = xml.getElementsByTagName('entriesPerPage')[0];
		numberPerPage = (tmp ? tmp.firstChild.nodeValue : 0);

		debugOutput(numberAll + ' gesamt');
		
		//------------ sticks response -------------------------------
		clearResult();
		var sticks = xml.getElementsByTagName('stfArt');
		if (sticks.length > 0) {
			$tho('stfNotFound').style.display = 'none';
			numberThisPage = sticks.length;
			debugOutput(sticks.length + ' returns');
			
			if (compareStick && (chVal == 'artist' || chVal == 'compare')) resultBox.appendChild(returnCaption(capSimSticks)); 
			else if (compareStick) resultBox.appendChild(returnCaption(capSimSticks2)); 
			
			for (var i = 0; i < sticks.length; i++) {
				var stick = toAssoc(sticks[i].childNodes);
				var tmpBox = createStickEntry(stick,(80 - i),true);
				resultBox.appendChild(tmpBox);
			}
			
			var clear = document.createElement('br');
			clear.className = 'clear';
			resultBox.appendChild(clear);
			
			debugOutput('requestFinished');
			showArmy(true);
		} else {
			numberThisPage = 0;
			debugOutput('NOT FOUND!',true);
			$tho('stfNotFound').style.display = 'block';
			showArmy(true,notFoundArmy);
		}
		
		aktPageNav();
		showDisclaimer(true);
		showSmartNav(true);
		showWaitBG(false);
		executingRequest = false;
	}
	function ajaxCall() {
		var params = createRequestParms();
		if (oldRequestString == params) return;
		oldRequestString = params;
		
		try { 
			if (chVal != 'startup') pageTracker._trackPageview("/ajaxCallWoodpicker" );
		} catch(e) {}
		
		if (executingRequest) {
			debugOutput('ALREADY EXECUTING REQUEST!',true);
			return;
		}
		executingRequest = true;
		imgSlider.closeWindow();
		//imgSlider.clearImages();
		
		showWaitBG(true);
		debugOutput('startingRequest',true);
		debugOutput(params);
		var ajaxRequest = new CAJAX(ajaxCB,true,pathAJAX + params)
		ajaxRequest.send();
		
		if (chVal == 'artist' || chVal == 'compare') {
			showArmy(false);
			showDisclaimer(false);
			showSmartNav(false);
			clearResult();
		}

		if (chVal == 'preset7A' || chVal == 'preset5A' || chVal == 'preset5B' || chVal == 'preset2B') {
			var cat = chVal.substr(chVal.length-2,2);
			$tho('stfCatWarning').innerHTML =  catWarning.replace('%name%',presets[cat]['name']).replace('%cat%',cat);
			$tho('stfCatWarning').style.display = 'block';
		} else {
			$tho('stfCatWarning').style.display = 'none';
		}
	}
	
	function cbDiaSliderCurrent() {
		$tho('stfProbsDiaVal').innerHTML = Math.round((sliderDia.getValuePercent())*100) + '%';
	}
	function cbLenSliderCurrent() {
		$tho('stfProbsLenVal').innerHTML = Math.round((sliderLen.getValuePercent())*100) + '%';
	}
	function cbPunSliderCurrent() {
		$tho('stfProbsPunVal').innerHTML = Math.round((sliderPun.getValuePercent())*100) + '%';
	}
	function cbPriSliderCurrent() {
		$tho('stfProbsPriVal').innerHTML = Math.round((sliderPri.getValuePercent())*100) + '%';
	}
	
	function cbDiaSliderUP() {
		chVal = 'dia';
		currentPage = 0;
		workDia = Math.round((sliderDia.getValuePercent())*100);
		ajaxCall();
	}
	function cbLenSliderUP() {
		chVal = 'len';
		currentPage = 0;
		workLen = Math.round((sliderLen.getValuePercent())*100);
		ajaxCall();
	}
	function cbPunSliderUP() {
		chVal = 'pun';
		currentPage = 0;
		workPun = Math.round((sliderPun.getValuePercent())*100);
		ajaxCall();
	}
	function cbPriSliderUP() {
		chVal = 'pri';
		currentPage = 0;
		workPri = Math.round((sliderPri.getValuePercent())*100);
		ajaxCall();
	}
	
	function cbPresetS() {
		chVal = 'presets';
		selectPreset('S');
	}
	function cbPresetM() {
		chVal = 'presetm';
		selectPreset('M');
	}
	function cbPresetL() {
		chVal = 'presetl';
		selectPreset('L');
	}
	function cbPresetXL() {
		chVal = 'presetxl';
		selectPreset('XL');
	}
	function cbPresetXXL() {
		chVal = 'presetxxl';
		selectPreset('XXL');
	}
	function cbDropDownComp() {
		//dropDownArtists.reset();
		//compareStick = '';
		//clearCompare();
	
		chVal = 'comp';
		currentPage = 0;
		workCompany = dropDownComp.getValue();
		ajaxCall();
	}
	function cbDropDownArtists() { 
		var tmp = dropDownArtists.getValue();
		var id;
		for (var i = 0; i < artists.length; i++) {
			if (artists[i].name == tmp) { id = i; break; }
		}
		compareMode(artists[id]);
		ajaxCall();
	}
	function cbDropDownTipps() {
		//dropDownArtists.reset();
		//workTipps = '';
		//clearCompare();
	
		chVal = 'tipps';
		currentPage = 0;
		workTipps = dropDownTipps.getValue();
		ajaxCall();
	}
	function cbDropDownMaterial() {
		chVal = 'mat';
		currentPage = 0;
		workMaterial = dropDownMaterial.getValue();
		ajaxCall();
	}
	function cbCheckHD() {
		workHD = checkHD.getValue();
		currentPage = 0;
		ajaxCall();
	}
	function cbCheckAV() {
		workAV = checkAV.getValue();
		currentPage = 0;
		ajaxCall();
	}
	
	function cbButton7A() {
		chVal = 'preset7A';
		selectPreset('7A');
	}
	function cbButton5A() {
		chVal = 'preset5A';
		selectPreset('5A');
	}
	function cbButton5B() {
		chVal = 'preset5B';
		selectPreset('5B');
	}
	function cbButton2B() {
		chVal = 'preset2B';
		selectPreset('2B');
	}
	
	/////////////////////////////////////// INITIATION /////////////////////////////////////////////////////
	function init() {
		resultBox = $tho('stfResult');
		compareBox = $tho('stfCompare');
		if (!resultBox && !compareBox) {
			$tho('error').style.display = 'block';
			return;
		}
		sliderDia = new CSlider('stfProbsDia',new Array(10,10));
		sliderDia.setOverflowMode(true);
		sliderDia.setSlidewayWidth(38);
		sliderDia.setScrollerWidth(38);
		sliderDia.setSlidewayHeight(113);
		sliderDia.setScrollerHeight(117);
		sliderDia.setSlideDirection('VERT');
		sliderDia.setStepLocking(false);
		sliderDia.setSlidewayBG(guiPicPrefix + '/stfSlideway_bg.png');
		sliderDia.setScrollerBG(guiPicPrefix + '/stfSlider_bg' + iePostfix + '.png');
		sliderDia.setMouseCurrentCallback(cbDiaSliderCurrent);
		sliderDia.setMouseUpCallback(cbDiaSliderUP);
		sliderDia.setActivePercent(workDia/100);
		
		sliderLen = new CSlider('stfProbsLen',new Array(10,10));
		sliderLen.setOverflowMode(true);
		sliderLen.setSlidewayWidth(38);
		sliderLen.setScrollerWidth(38);
		sliderLen.setSlidewayHeight(113);
		sliderLen.setScrollerHeight(117);
		sliderLen.setSlideDirection('VERT');
		sliderLen.setStepLocking(false);
		sliderLen.setSlidewayBG(guiPicPrefix + '/stfSlideway_bg.png');
		sliderLen.setScrollerBG(guiPicPrefix + '/stfSlider_bg' + iePostfix + '.png');
		sliderLen.setMouseCurrentCallback(cbLenSliderCurrent);
		sliderLen.setMouseUpCallback(cbLenSliderUP);
		sliderLen.setActivePercent(workLen/100);
		
		sliderPun = new CSlider('stfProbsPun',new Array(10,10));
		sliderPun.setOverflowMode(true);
		sliderPun.setSlidewayWidth(38);
		sliderPun.setScrollerWidth(38);
		sliderPun.setSlidewayHeight(113);
		sliderPun.setScrollerHeight(117);
		sliderPun.setSlideDirection('VERT');
		sliderPun.setStepLocking(false);
		sliderPun.setMouseCurrentCallback(cbPunSliderCurrent);
		sliderPun.setMouseUpCallback(cbPunSliderUP);
		sliderPun.setSlidewayBG(guiPicPrefix + '/stfSlideway_bg.png');
		sliderPun.setScrollerBG(guiPicPrefix + '/stfSlider_bg' + iePostfix + '.png');
		sliderPun.setActivePercent(workPun/100);
		
		sliderPri = new CSlider('stfProbsPri',new Array(10,10));
		sliderPri.setOverflowMode(true);
		sliderPri.setSlidewayWidth(38);
		sliderPri.setScrollerWidth(38);
		sliderPri.setSlidewayHeight(113);
		sliderPri.setScrollerHeight(117);
		sliderPri.setSlideDirection('VERT');
		sliderPri.setStepLocking(false);
		sliderPri.setMouseCurrentCallback(cbPriSliderCurrent);
		sliderPri.setMouseUpCallback(cbPriSliderUP);
		sliderPri.setSlidewayBG(guiPicPrefix + '/stfSlideway_bg.png');
		sliderPri.setScrollerBG(guiPicPrefix + '/stfSlider_bg' + iePostfix + '.png');
		sliderPri.setActivePercent(workPri/100);
		
		bigger = new showBigger();
		imgSlider = new imgSlider(imgSlider_ttMax);
		context = new CContext('contextMenu');
		
		buttonPreS = new CButton('stfPresetsS',true);
		buttonPreS.setCallback(cbPresetS);
		buttonPreS.setDimensions(42,18);
		buttonPreS.setBG(guiPicPrefix + '/stfPresetsS.png',guiPicPrefix + '/stfPresetsS_act.png');
		
		buttonPreM = new CButton('stfPresetsM',true);
		buttonPreM.setCallback(cbPresetM);
		buttonPreM.setDimensions(42,18);
		buttonPreM.setBG(guiPicPrefix + '/stfPresetsM.png',guiPicPrefix + '/stfPresetsM_act.png');
		
		buttonPreL = new CButton('stfPresetsL',true);
		buttonPreL.setCallback(cbPresetL);
		buttonPreL.setDimensions(42,18);
		buttonPreL.setBG(guiPicPrefix + '/stfPresetsL.png',guiPicPrefix + '/stfPresetsL_act.png');
		
		buttonPreXL = new CButton('stfPresetsXL',true);
		buttonPreXL.setCallback(cbPresetXL);
		buttonPreXL.setDimensions(42,18);
		buttonPreXL.setBG(guiPicPrefix + '/stfPresetsXL.png',guiPicPrefix + '/stfPresetsXL_act.png');
		
		buttonPreXXL = new CButton('stfPresetsXXL',true);
		buttonPreXXL.setCallback(cbPresetXXL);
		buttonPreXXL.setDimensions(42,19);
		buttonPreXXL.setBG(guiPicPrefix + '/stfPresetsXXL.png',guiPicPrefix + '/stfPresetsXXL_act.png');

		dropDownComp = new CDropdown();
		dropDownComp.setParentId('stfComp');
		dropDownComp.setStd('<br><br><br>' + guiAllComps);
		dropDownComp.setCallback(cbDropDownComp);
		dropDownComp.setStyleClasses('compDropDownSel','compDropDown');
		dropDownComp.setBGs('#E7E7E7','#F0F0F0', '#AAAAAA');
		
		dropDownComp.addItem('777','<div>' + guiReset + '</div>','','',true);
		for (var i = 0; i < companies.length; i++) {
			var pres = (companies[i].pic ? '<img src="'+ companies[i].pic +'">' : companies[i].name);
			var anz = (i < 5 ? '<div>' + pres + '</div>' : companies[i].name);
			dropDownComp.addItem(companies[i].name,'<div>' + companies[i].name + '</div>',pres,'');
		}
		dropDownComp.renderMe();
		dropDownComp.setActive(workCompany);

		dropDownMaterial = new CDropdown();
		dropDownMaterial.setParentId('stfExtOpMaterial');
		dropDownMaterial.setStd('');
		dropDownMaterial.setCallback(cbDropDownMaterial);
		dropDownMaterial.setStyleClasses('materialDropDownSel','materialDropDown');
		dropDownMaterial.setBGs('#E7E7E7','#F0F0F0', '#AAAAAA');

		dropDownMaterial.addItem('777','<div>' + guiResetMat + '</div>','','',true);
		for (var i = 0; i < material.length; i++) {
			dropDownMaterial.addItem(material[i],'<div>' + material[i] + '</div>','<div>' + material[i] + '</div>','');
		}
		dropDownMaterial.renderMe();
		dropDownMaterial.setActive(workMaterial);
		
		
		dropDownArtists = new CDropdown();
		dropDownArtists.setParentId('stfArtist');
		dropDownArtists.setStd('');
		dropDownArtists.setCallback(cbDropDownArtists);
		dropDownArtists.setStyleClasses('artistsDropDownSel','artistsDropDown');
		dropDownArtists.setBGs('#E7E7E7','#F0F0F0', '#AAAAAA');
		
		//dropDownArtists.addItem('777','<div><<nc_lp_ncx_stickfinder_gui_reset>></div>','','',true);
		for (var i = 0; i < artists.length; i++) {
			var pres = (artists[i].pic ? '<img src="'+ artists[i].pic +'">' : artists[i].name);
			dropDownArtists.addItem(artists[i].name,'<div>' + artists[i].name + '</div>',pres,'');
		}
		dropDownArtists.renderMe();
		dropDownArtists.setActive(workArtists);
		
		
		dropDownTipps = new CDropdown();
		dropDownTipps.setParentId('stfTipps');
		dropDownTipps.setStd('');
		dropDownTipps.setCallback(cbDropDownTipps);
		dropDownTipps.setStyleClasses('tippsDropDownSel','tippsDropDown');
		//dropDownTipps.setBGs('#F0F0F0','#F0F0F0', '#AAAAAA');
		
		dropDownTipps.addItem('777','<div style="text-align:center;width:100%;"><div style="background-color:#ffffff;width:92px;text-align:center;border:1px solid #888888;font-size:10px;"><img src="' + guiPicPrefix + '/tippsReset.gif"><br>' + guiReset + '</div></div>','','',true);
		dropDownTipps.addItem('','<div class="tippsCaption"><div style="margin: 0; width: 100%; background-color:#888888;color:#ffffff;text-align:center;font-size:10px;"><b> ' + guiTippsWood + '</b></div></div>','','',false);
		dropDownTipps.addItem('','<div class="tippsCaption"><div style="margin: 0; width: 100%; background-color:#888888;color:#ffffff;text-align:center;font-size:10px;"><b> ' + guiTippsNylon + '</b></div></div>','','',false);
		for (var i = 0; i < tipps.length; i++) {
			var pres = '<img src="' + guiPicPrefix + '/tip_'+ tipps[i].name +'.jpg" style="border:1px solid #888888;">';
			dropDownTipps.addItem(tipps[i].name,'<div>' + pres + '</div>',pres,'');
		}
		dropDownTipps.renderMe();
		dropDownTipps.setActive(workTipps);

		checkHD = new CCheckbox('stfExtOpCheckHD',cbCheckHD);
		checkHD.setBoxes(42,guiPicPrefix + '/menuCheckbox.gif',guiPicPrefix + '/menuCheckboxAct.gif');
		checkHD.setValue(workHD);
		checkHD.setDimensions(15,15);
		
		checkAV = new CCheckbox('stfExtOpCheckAV',cbCheckAV);
		checkAV.setBoxes(42,guiPicPrefix + '/menuCheckbox.gif',guiPicPrefix + '/menuCheckboxAct.gif');
		checkAV.setValue(workAV);
		checkAV.setDimensions(15,15);
		
		
		hoverClass = new CHover();
		hoverClass.addImg('qmArtist',guiPicPrefix + '/qm' + iePostfix + '.png',guiPicPrefix + '/qmAct' + iePostfix + '.png');
		hoverClass.addImg('qmProps',guiPicPrefix + '/qm' + iePostfix + '.png',guiPicPrefix + '/qmAct' + iePostfix + '.png');
		hoverClass.addImg('qmCrit',guiPicPrefix + '/qm' + iePostfix + '.png',guiPicPrefix + '/qmAct' + iePostfix + '.png');
		hoverClass.addImg('qmTipps',guiPicPrefix + '/qm' + iePostfix + '.png',guiPicPrefix + '/qmAct' + iePostfix + '.png');
		
		tooltipClass = new CTooltip();
		tooltipClass.setCSSClass('tooltip');
		tooltipClass.addText('qmArtist',guiTTartist,true,true);
		tooltipClass.addText('qmProps',guiTTprops,true,true);
		tooltipClass.addText('qmCrit',guiTTcrit,true,true);
		tooltipClass.addText('qmTipps',guiTTtipps,true,true);
		
		tooltipClass.addText('stfProbsTTLen',guiTTlen,true,true);
		tooltipClass.addText('stfProbsTTDia',guiTTdia,true,true);
		tooltipClass.addText('stfProbsTTPun',guiTTpun,true,true);
		tooltipClass.addText('stfProbsTTPri',guiTTpri,true,true);
		
		tooltipClass.hideTT();
		
		extOpSwitch = new CCheckbox('stfExtOpSwitch',panel,'',null);
		extOpSwitch.setBoxes('',guiPicPrefix + '/extOpSwitchOpen.png',guiPicPrefix + '/extOpSwitchClose.png');
		extOpSwitch.setDimensions(530,14);
		
		// -------------------------------------------- cats -----------------------------------------------
		button7A = new CButton('stfCats7A',true);
		button7A.setCallback(cbButton7A);
		button7A.setDimensions(42,13);
		button7A.setBG(guiPicPrefix + '/stf_cat7A.png',guiPicPrefix + '/stf_cat7A_act.png');
		
		button5A = new CButton('stfCats5A',true);
		button5A.setCallback(cbButton5A);
		button5A.setDimensions(42,13);
		button5A.setBG(guiPicPrefix + '/stf_cat5A.png',guiPicPrefix + '/stf_cat5A_act.png');
		
		button5B = new CButton('stfCats5B',true);
		button5B.setCallback(cbButton5B);
		button5B.setDimensions(42,13);
		button5B.setBG(guiPicPrefix + '/stf_cat5B.png',guiPicPrefix + '/stf_cat5B_act.png');
		
		button2B = new CButton('stfCats2B',true);
		button2B.setCallback(cbButton2B);
		button2B.setDimensions(42,13);
		button2B.setBG(guiPicPrefix + '/stf_cat2B.png',guiPicPrefix + '/stf_cat2B_act.png');
		
		// -------------------------------------------- preselectedStick -----------------------------------------------
		if (preselectedStick) {
			compareMode(preselectedStick);
			ajaxCall();
		} else {
			selectPreset('M');
		}
	}
	
	/////////////////////////////////////// TOOLS /////////////////////////////////////////////////////
	
	function compareMode(param) {
		clearCompare();
		currentPage = 0;
	
		if (param.name != undefined && param.name != '') 
			compareBox.appendChild(returnCaption(capCompareStickArtist.replace('%artist%',param.name)));
		else
			compareBox.appendChild(returnCaption(capCompareStick));
		
		compareBox.appendChild(createStickEntry(param,82,false));
		if (param.name != undefined && param.name != '') {
			dropDownArtists.setActive(param.name);
		
			chVal = 'artist';
			compareStick = param.stfArtArtNr;
			workArtists = param.name;
		
			$tho('stfArtistCapName').innerHTML = param.name;
			$tho('stfArtistCapRef').innerHTML = param.ref;
			
			var aBox = document.createElement('div');
			aBox.className = 'aBox';
			aBoxImg = document.createElement('img');
			aBoxImg.src = param.picBig;
			aBox.appendChild(aBoxImg);
			
			aBox.innerHTML = aBox.innerHTML + '<br><br>' + param.name.toUpperCase();
			aBox.innerHTML = aBox.innerHTML + '<br><span>' + param.ref + '</span>';
			
			compareBox.appendChild(aBox);
		} else {
			chVal = 'compare';
			compareStick = param.stfArtArtNr;
			workArtists = '';
			
			$tho('stfArtistCapName').innerHTML = '';
			$tho('stfArtistCapRef').innerHTML = '';
			dropDownArtists.setActive('');
		}
	
		sliderDia.setActivePercent(param.stfArtWebDia/100);
		sliderLen.setActivePercent(param.stfArtWebLen/100);
		sliderPun.setActivePercent(param.stfArtWebPun/100);
		sliderPri.setActivePercent(sliderPriStd/100);
		
		workDia = param.stfArtWebDia;
		workLen = param.stfArtWebLen;
		workPun = param.stfArtWebPun;
		workPri = sliderPriStd;
		
		//dropDownComp.reset();
		//dropDownTipps.reset();
		//workCompany = '';
		//workTipps = '';
	}
	function renderBubbleEvent(e) {
		renderBubble();
	}
	var oldProv = '';
	function renderBubble(txtParam,xCoord,yCoord) {
		if (proverbs.length == 0 && txtParam == undefined) return;
	
		var outerB = $tho('bubble');
		outerB.style.display = 'block';
		outerB.onclick = renderBubbleEvent;
		
		var b = $tho('bubble1');
		var text;
		if (txtParam) {
			text = txtParam;
		} else {
			var counter = 0;
			while ((text = proverbs[parseInt(Math.random()*proverbs.length)]) == '' && text != oldProv && counter++ < 10000);
		}
		oldProv = text;
		
		if (text.length > 0) {
			b.innerHTML = text;
		} else {
			outerB.style.display = 'none';
		}


		var x;
		var y;
		if (xCoord != undefined && yCoord != undefined) {
			x = xCoord;
			y = yCoord;
		} else {
			y = 0;
			x = parseInt(Math.random() * (520+1));
			var max = 0;
			var min = 10;
			if (x <= 130) {
				max = (1.4*x)+141;
			} else if (x > 130 && x <= 140) {
				max = 325;
			} else if (x > 140 && x <= 520) {
				max = (-0.68*x)+423;
			}
			y = min + parseInt(Math.random() * (max+1-min));
			y = 325 - y - outerB.offsetHeight + 10;
			x = x - 25;
		}
		//b.innerHTML = b.innerHTML + ' ' + (outerB.offsetHeight == 0 ? 110 : outerB.offsetHeight) + ' ';
		//b.innerHTML = b.innerHTML + ' ' + x + '_' + y;
		
		outerB.style.top = y + 'px';
		outerB.style.left = x + 'px';
	}

	function showArmy(vis,txt,x,y) {
		$tho('stfStickArmy').style.display = (vis ? 'block' : 'none');
		renderBubble(txt,x,y);
	}
	function showDisclaimer(val) {
		$tho('stfDisclaimer').style.display = (val ? 'block' : 'none');
	}
	function showSmartNav(val) {
		$tho('stfSmartNav').style.display = (val ? 'block' : 'none');
	}
	
	function returnContextMenu(art) {
		var retVal = '';
		retVal += '<a href="basket_add.html?ar=' + art.stfArtArtNr + '">' + guiKTXbasket + '</a>';
		retVal += '<a href="wishlist.html?artnr=' + art.stfArtArtNr + '">' + guiKTXwish + '</a>';
		retVal += '<a href="' + art.stfArtURL + '">' + guiKTXpp + '</a>';
		return retVal;
	}
	function returnCaption(val) {
		var cap = document.createElement('div');
		cap.className = 'stfBigCaption';
		cap.innerHTML = val + ":";
		return cap;
	}
	
	function refPageSelection(val) {
		return function (e) {
			pageSelection(e,val);
		}
	}
	function pageSelection(e,val) {
		//e.preventDefault();
		chVal = 'page';
		currentPage = val;
		ajaxCall();
	}
	function aktExtOp() {
		chVal = 'extOp';
		currentPage = 0;
	
		//workHD = checkHD.getValue();
		//workAV = checkAV.getValue();
		
		workPriceRFrom = parseFloat($tho('priceRFrom').value.replace(",","."));
		workPriceRUntil = parseFloat($tho('priceRUntil').value.replace(",","."));
		
		ajaxCall();		
	}
	function showWaitBG(show,timeOut) {
		if (show) {
			if ($tho('stfExtOpContent').offsetHeight > 30) {
				$tho('stfWaitBG').style.height = '267px';
			} else {
				$tho('stfWaitBG').style.height = '220px';
			}
			if (timeOut) {
				document.getElementById('stfWaitImg').style.display = 'block';
				document.getElementById('stfWaitBG').style.display = 'block';
			} else {
				waitBGhandles[waitBGhandles.length] = window.setTimeout("showWaitBG(true,true)",1);
			}
		} else {
			document.getElementById('stfWaitImg').style.display = 'none';
			document.getElementById('stfWaitBG').style.display = 'none';
			for (var i = 0; i < waitBGhandles.length; i++) {
				window.clearTimeout(waitBGhandles[i]);
			}
		}
	}

	function aktPageNav() {
		if (numberThisPage > 0) {
			$tho('stfPaging1').style.display = 'block';
			$tho('stfPaging2').style.display = 'block';
			var pageBox1 = $tho('stfPagingPage1');
			var pageBox2 = $tho('stfPagingPage2');
			while (pageBox2.firstChild) pageBox2.removeChild(pageBox2.firstChild);
			while (pageBox1.firstChild) pageBox1.removeChild(pageBox1.firstChild);

			var maxPage = Math.ceil(numberAll / numberPerPage);
			if (currentPage == 0) {
				$tho('stfPagingPrev1').style.display = 'none'; 
				$tho('stfPagingPrev2').style.display = 'none';
			} else {
				$tho('stfPagingPrev1').style.display = 'inline';
				$tho('stfPagingPrev2').style.display = 'inline';
			}
			if (currentPage == maxPage-1) {
				$tho('stfPagingNext1').style.display = 'none';
				$tho('stfPagingNext2').style.display = 'none';
			} else {
				$tho('stfPagingNext1').style.display = 'inline';
				$tho('stfPagingNext2').style.display = 'inline';
			}
			
			var numberPageLink = 9;
			var writeStart = (currentPage < (numberPageLink / 2) ? 1 : (currentPage - parseInt(numberPageLink / 2)) + 1);
			writeStart = ((writeStart + numberPageLink) > (maxPage+1) ? ((maxPage+1) - numberPageLink) : writeStart);
			writeStart = (writeStart <= 0 ? 1 : writeStart);
			var writeEnd = (((writeStart + numberPageLink) > (maxPage+1)) ? (maxPage+1) : writeStart + numberPageLink);
			
			for (var i = writeStart; i < writeEnd; i++) {
				var link = document.createElement('a');
				link.innerHTML = i;
				link.href = '#stf';
				if (i == (currentPage+1)) link.className = 'chosen';
				addEvent(link,'click',refPageSelection((i-1)));
				pageBox1.appendChild(link);
				
				var link2 = document.createElement('a');
				link2.innerHTML = i;
				link2.href = '#stf';
				if (i == (currentPage+1)) link2.className = 'chosen';
				addEvent(link2,'click',refPageSelection((i-1)));
				pageBox2.appendChild(link2);
			}
		} else {
			$tho('stfPaging1').style.display = 'none';
			$tho('stfPaging2').style.display = 'none';
		}
	}
	function changePage(val) {
		chVal = 'page';
		if (val == 'prev') {
			currentPage = (currentPage > 0 ? currentPage-1 : 0);
		} else if (val == 'next') {
			currentPage++;
		}
		ajaxCall();
	}
	function refSelect4Compare(params) {
		return function(e) {
			select4Compare(e,params);
		}
	}
	function select4Compare(e,params) {
		if (!params) return;
		window.location.href = '#stf';

		if (tooltipClass) tooltipClass.hideTT();
		
		compareMode(params);
		ajaxCall();
	}
	
	
	var panelStatus = 0;
	var panelLocked = false;
	function panel() {
		if (panelLocked) return;
		if (panelStatus == 0) spacerHeightEnd = 50; else spacerHeightEnd = 3;
		if (panelStatus == 0) {
			panelOpen(false);
		} else {
			panelClose(false);
		}
	}
	function panelClose(p) {
		if (panelLocked && !p) return;
		panelStatus--;
		var eff = new CAppearer();
		var dim = new CDimension();
		if (panelStatus == 2) { panelLocked=true; eff.act('stfExtOpContentElm','BLUR','HIDE',{'bt':10,'st':10},panelClose); }
		if (panelStatus == 1) { dim.act('stfExtOpContent',{'he':spacerHeightEnd,'ak':10,'st':10},panelClose);}
		if (panelStatus == 0) panelLocked=false;
	}
	function panelOpen(p) {
		if (panelLocked && !p) return;
		panelStatus++;
		var eff = new CAppearer();
		var dim = new CDimension();
		if (panelStatus == 1) { panelLocked=true; dim.act('stfExtOpContent',{'he':spacerHeightEnd,'ak':10,'st':10},panelOpen); }
		if (panelStatus == 2) { eff.act('stfExtOpContentElm','BLUR','SHOW',{'bt':10,'st':10},panelOpen);}
		if (panelStatus == 2) panelLocked=false;
	}
			
	function selectPreset(val) {
		if (presets && sliderDia && sliderLen && sliderPun && sliderPri && val) {
			var preset = presets[val];
			if (preset) {
				sliderLen.setActivePercent(preset.len/100);
				sliderDia.setActivePercent(preset.dia/100);
				sliderPun.setActivePercent(preset.pun/100);
				sliderPri.setActivePercent(preset.pri/100);
				
				workPun = preset.pun;
				workLen = preset.len;
				workDia = preset.dia;
				workPri = preset.pri;
				ajaxCall();
			}
			currentPage = 0;
		}
	}
	function resetCompare() {
		currentPage = 0;
		
		clearCompare();
		dropDownArtists.reset();
		compareStick = '';
		$tho('stfArtistCapName').innerHTML = '';
		$tho('stfArtistCapRef').innerHTML = '';
		
		ajaxCall();
	}
	function resetAll() {
		if (chVal == 'artist' || chVal == 'compare') {
			showArmy(false);
			showDisclaimer(false);
			showSmartNav(false);
			clearResult();
		}
	
		chVal = 'reset';
		currentPage = 0;
	
		$tho('stfArtistCapName').innerHTML = '';
		$tho('stfArtistCapRef').innerHTML = '';
	
		clearCompare();
	
		dropDownComp.reset();
		workCompany = '';
		dropDownTipps.reset();
		workTipps = '';
		dropDownArtists.reset();
		workArtists = '';
		compareStick = '';
		dropDownMaterial.reset();
		workMaterial = '';
		
		checkHD.setValue(false);
		checkAV.setValue(false);
		workHD = false;
		workAV = false;
		
		workPriceRFrom = txtPriceRFrom;
		workPriceRUntil = txtPriceRUntil;
		$tho('priceRFrom').value = '';
		$tho('priceRUntil').value = '';
		
		selectPreset('5A');
	}
	function clearResult() {
		debugOutput('CLEAR RESULT');
		while (resultBox.childNodes[0]) {
			resultBox.removeChild(resultBox.childNodes[0]);
		}
	}
	function clearCompare() {
		while (compareBox.childNodes[0]) {
			compareBox.removeChild(compareBox.childNodes[0]);
		}
	}
	function createRequestParms() {
		return "dia=" + workDia + 
			"&len=" + workLen + 
			"&pun=" + workPun + 
			"&pri=" + workPri + 
			(compareStick ? "&comparestick=" + compareStick : "") + 
			(currentPage > 0 ? "&page=" + currentPage : "") + 
			(workTipps != "" ? "&tipp=" + workTipps : "") +
			(workCompany != "" ? "&comp=" + workCompany : "") +
			(workMaterial != "" ? "&mat=" + workMaterial : "") +
			(workAV ? "&av=1" : "") +
			(workHD ? "&hd=1" : "") +
			(workPriceRFrom > 0 ? "&pricerfrom=" + workPriceRFrom : "") +
			(workPriceRUntil > 0 ? "&priceruntil=" + workPriceRUntil : "") + 
			(workArtists != '' ? "&artist=" + workArtists : "");
	}
	function toAssoc(xml){
		if (!xml) return;
		var result = {};
		for(var i = 0; i < xml.length; i++){
			if(!xml[i].firstChild) continue;
			result[xml[i].nodeName] = xml[i].firstChild.data;
		}
		return result;
	}
	function createStickEntry(art,i,buttons) {
		var box = document.createElement('div');
		box.className = 'stickEntry';
		if (i % 2 == 1) box.style.marginRight = '0px';
		
		box.style.zIndex = i;
		
		//headline
		var headline = document.createElement('div');
		headline.className = 'headline';

		var l = document.createElement('a');
		l.href = art.stfArtURL;
		l.appendChild(document.createTextNode(art.stfArtName1 + ' ' + art.stfArtName2));
		
		headline.appendChild(l);
		box.appendChild(headline);
		
		//tipPic
		var tipPic = document.createElement('div');
		tipPic.className = 'tipPic';
		tipPic.style.backgroundImage = 'url(' + guiPicPrefixGlobal + 'modpics/woodpicker/stickpics/thumb/' + art.stfArtArtId + '.jpg)';
		var lupe = document.createElement('img');
		lupe.src = guiPicPrefix + '/lupe' + iePostfix + '.png'
		tipPic.appendChild(lupe);
		box.appendChild(tipPic);
		imgSlider.add(tipPic,guiPicPrefixGlobal + 'modpics/woodpicker/stickpics/1200px/' + art.stfArtArtId + '.jpg',guiPicPrefixGlobal + 'modpics/woodpicker/stickpics/280px/' + art.stfArtArtId + '.jpg',art.stfArtZoomX,art.stfArtThumbX,art.stfArtZoomY,art.stfArtThumbY,(art.stfArtName1 + ' ' + art.stfArtName2),guiPicPrefixGlobal + 'modpics/woodpicker/stickpics/1200px/' + art.stfArtArtId + '.jpg');
		
		//stickdetails
		var details = document.createElement('div');
		details.className = 'details';
		box.appendChild(details);
		
		var list = document.createElement('dl');
		var mat = document.createElement('dt');
		mat.innerHTML = guiResMat + ':';
		var matVal = document.createElement('dd');
		matVal.innerHTML = (art.stfArtMaterial != undefined && art.stfArtMaterial.length > 0 ? art.stfArtMaterial : guiResMatUndef);
		var len = document.createElement('dt');
		len.innerHTML = guiResLen + ':';
		var lenVal = document.createElement('dd');
		lenVal.innerHTML = art.stfArtLen + 'mm';
		var dia = document.createElement('dt');
		dia.innerHTML = guiResDia + ':';
		var diaVal = document.createElement('dd');
		diaVal.innerHTML = art.stfArtDia + 'mm';
		var wei = document.createElement('dt');
		wei.innerHTML = guiResWei + ':';
		var weiVal = document.createElement('dd');
		weiVal.innerHTML = art.stfArtWeight + 'g';
		var rank = document.createElement('dt');
		rank.innerHTML = guiResRank + ':';
		var rankVal = document.createElement('dd');
		rankVal.innerHTML = art.stfArtVKRank;
		
		list.appendChild(mat);
		list.appendChild(matVal);
		list.appendChild(len);
		list.appendChild(lenVal);
		list.appendChild(dia);
		list.appendChild(diaVal);
		list.appendChild(wei);
		list.appendChild(weiVal);
		list.appendChild(rank);
		list.appendChild(rankVal);
		details.appendChild(list);
		
		//web (small + big)
		var webSmall = document.createElement('img');
		//webSmall.src = guiPicPrefix + '/' + art.stfArtArtNr + '_small.gif';
		webSmall.src = guiPicPrefixGlobal + 'modpics/woodpicker/webs/' + art.stfArtArtNr + '_small.png';
		webSmall.className = 'webSmall';
		webSmall.width = 80;
		webSmall.height = 80;
		box.appendChild(webSmall);
		if (tooltipClass) tooltipClass.addText(webSmall,guiTTwebSmall);
		
		var lupe = document.createElement('img');
		lupe.src = guiPicPrefix + '/webLupe.png';
		lupe.className = 'lupe';
		box.appendChild(lupe);
		if (tooltipClass) tooltipClass.addText(lupe,guiTTwebSmall);

		var webBig = createDetailBox(art);
		box.appendChild(webBig);
		bigger.add(webSmall,webBig);
		
		var webBig2 = createDetailBox(art);
		box.appendChild(webBig2);
		bigger.add(lupe,webBig2);

		//bottomBar
		var bottom = document.createElement('div');
		bottom.className = 'bottom';
		box.appendChild(bottom);
		
		//bottomBar buttons
		if (buttons) {
			var infoA = document.createElement('a');
			infoA.href = art.stfArtURL;
			var info = document.createElement('img');
			info.src = guiPicPrefix + '/infoBtn.png';
			info.className = 'buttons';
			infoA.appendChild(info);
			
			var compare = document.createElement('img');
			compare.src = guiPicPrefix + '/diffBtn.png';
			compare.className = 'buttons';
			compare.onclick = refSelect4Compare(art);
			try { compare.style.cursor = 'pointer'; } catch(e) {}
			var cont = document.createElement('img');
			cont.src = guiPicPrefix + '/menuBtn.png';
			cont.className = 'buttons';
			if (tooltipClass) tooltipClass.addText(cont,guiTTcontext);
			
			bottom.appendChild(infoA);
			bottom.appendChild(compare);
			bottom.appendChild(cont);
			
			context.addText(cont,returnContextMenu(art));
			
			if (hoverClass) {
				hoverClass.addImg(info,guiPicPrefix + '/infoBtn.png',guiPicPrefix + '/infoBtnAct.png');
				hoverClass.addImg(compare,guiPicPrefix + '/diffBtn.png',guiPicPrefix + '/diffBtnAct.png');
				hoverClass.addImg(cont,guiPicPrefix + '/menuBtn.png',guiPicPrefix + '/menuBtnAct.png');
			}
			if (tooltipClass) {
				tooltipClass.addText(compare,guiTTcompare,false,true);
				tooltipClass.addText(info,'<b>' + art.stfArtName1 + '<br>' + art.stfArtName2 + '</b><br><img src="' + guiPicPrefixGlobal + 'modpics/woodpicker/stickpics/thumb/' + art.stfArtArtId + '.jpg" style="margin-top:4px;margin-bottom:4px;"><br>' + art.stfAText + '<br><div style="position:relative;height:25px;text-align:right;margin-top:10px;"><div style="position:absolute;top:3px;right:35px;font-size:12px;font-weight:bold;">' + art.stfArtPrice + '</div><div style="position:absolute;top:2px;right:5px;">' + art.stfVfstaCode + '</div></div>' + capTooltip,false,false);
			}
		}  else {
			//lets add resetbutton here.........................................................................................................................................................................................................................................................
			bottom.innerHTML = '<div id="stfArtistCompare"><div class="left"><img src="' + guiPicPrefix + '/buttonLeft' + iePostfix + '.png"></div><div class="mid"><a href="#" onclick="resetCompare(); return false;">&nbsp;' + guiReset + '&nbsp;</a></div><div class="right"><img src="' + guiPicPrefix + '/buttonRight' + iePostfix + '.png"></div></div>' + bottom.innerHTML;
		}

		//bottomBar PriceVFSTA		
		var priceBox = document.createElement('div');
		priceBox.className = 'priceBox';
		priceBox.innerHTML = art.stfArtPrice;
		bottom.appendChild(priceBox);
		
		var vfstaBox = document.createElement('div');
		
		if (tooltipClass && art.stfVfsta && art.stfVfsta.length > 0) tooltipClass.addText(vfstaBox,art.stfVfsta);
		vfstaBox.className = 'vfstaBox';
		vfstaBox.innerHTML = art.stfVfstaCode;
		bottom.appendChild(vfstaBox);
		
		return box;
	}
	function createDetailBox(art) {
		var tmp = document.createElement('div');
		tmp.className = 'webBig';
		
		var headline = document.createElement('div');
		headline.className = 'headline';
		headline.innerHTML = art.stfArtName1 + ' ' + art.stfArtName2;
		tmp.appendChild(headline);

		var img = document.createElement('img');
		img.src = guiPicPrefixGlobal + 'modpics/woodpicker/webs/' + art.stfArtArtNr + '_big.png';
		tmp.appendChild(img);
		
		var detailBox = document.createElement('div');
		detailBox.className = 'webBigDetails';

		var str = '';
		str = '<table cellpadding="0" cellspacing="5" border="0">';
		str = str + '<tr><td align="right">' + guiResDia + ':</td>';
		str = str + '<td class="b"><div style="width:' + (art.stfArtWebDia-5) + '%"></div></td>';
		str = str + '<td><img src="' + guiPicPrefix + '/bw_d.png" border="0"></td></tr>';
		
		str = str + '<tr><td align="right">' + guiResLen + ':</td>';
		str = str + '<td class="b"><div style="width:' + (art.stfArtWebLen-5) + '%"></div></td>';
		str = str + '<td><img src="' + guiPicPrefix + '/bw_l.png" border="0"></td></tr>';
		
		str = str + '<tr><td align="right">' + guiResWei + ':</td>';
		str = str + '<td class="b"><div style="width:' + (art.stfArtWebWei-5) + '%"></div></td>';
		str = str + '<td><img src="' + guiPicPrefix + '/bw_w.png" border="0"></td></tr>';
		
		str = str + '<tr><td align="right">' + guiResPun + ':</td>';
		str = str + '<td class="b"><div style="width:' + (art.stfArtWebPun-5) + '%"></div></td>';
		str = str + '<td><img src="' + guiPicPrefix + '/bw_p.png" border="0"></td></tr>';
		
		str = str + '<tr><td align="right">' + guiResSpeed + ':</td>';
		str = str + '<td class="b"><div style="width:' + (art.stfArtWebSpeed-5) + '%"></div></td>';
		str = str + '<td><img src="' + guiPicPrefix + '/bw_s.png" border="0"></td></tr>';
		
		str = str + '<tr><td align="right">' + guiResRebound + ':</td>';
		str = str + '<td class="b"><div style="width:' + (art.stfArtWebRebound-5) + '%"></div></td>';
		str = str + '<td><img src="' + guiPicPrefix + '/bw_r.png" border="0"></td></tr>';
		
		str = str + '</table>';
		
		detailBox.innerHTML = str;

		tmp.appendChild(detailBox);

		
		return tmp;
	}
	var debugCnt = 0;
	function debugOutput(txt,line) {
		if (txt == null || txt.length == 0) return;
		line = (line ? true : false);
		if (debug) {
			$tho('debug').style.display = 'block';
			var txt = document.createTextNode(debugCnt + ': ' + txt + ' ');
			if (txt == 'reset' || debugCnt > 100) {
				debugCnt = 0;
				while ($tho('debugContent').childNodes[0]) $tho('debugContent').removeChild($tho('debugContent').childNodes[0]);
			} else {
				if ($tho('debugContent').childNodes.length == 0) $tho('debugContent').appendChild(document.createElement('span'));
				if (line) $tho('debugContent').insertBefore(document.createElement('hr'),$tho('debugContent').childNodes[0]);
				$tho('debugContent').insertBefore(document.createElement('br'),$tho('debugContent').childNodes[0]);
				$tho('debugContent').insertBefore(txt,$tho('debugContent').childNodes[0]);
			}
			debugCnt++;
		} else {
			$tho('debug').style.display = 'none';
		}
	}
	
	function closeDebug() {
		$tho('openclose').onclick = openDebug;
		$tho('openclose').innerHTML = '+';
		var dim = new CDimension();
		dim.act('debug',{'he':25,'ak':10,'st':10},function() {})
	}
	function openDebug() {
		$tho('openclose').onclick = closeDebug;
		$tho('openclose').innerHTML = '-';
		var dim = new CDimension();
		dim.act('debug',{'he':750,'ak':10,'st':10},function() {})
	}
	
	
	function showBigger() {
		var imgs = Array();
		var lastOpen;
		
		var __const = function() {
			addEvent(document,'click',closeOthers);
		}
		
		this.add = function (object, bigger) {
			var id = imgs.length;
			imgs[id] = bigger;
			addEvent(object,'click',refClickHandler(id));
			try { object.style.cursor = 'pointer'; } catch(e) {}
		}
		
		var refClickHandler = function(id) {
			return function (e) {
				clickHandler(e,id);
			}
		}
		var clickHandler = function(e,id) {
			lastOpen = id;
			imgs[id].style.display = 'block';
		}
		var closeOthers = function() {
			for (var i = 0; i < imgs.length; i++) {
				if (lastOpen != i) imgs[i].style.display = 'none';
			}
			lastOpen = undefined;
		}
		
		__const();
	}
	
	
	function imgSlider(PcaptMax) {
		var arrImgs = Array();
		
		var scrollHandler = undefined;
		var scrollSpeed = 0;
		
		var smallBoxW = 70;
		var captMax = PcaptMax;
		
		var zoomBox;
		var smallBox;
		var captionBox;
		
		var bigImg;
		var preBigImg;
		var smallImg;
		var maximizeImg;
		var preSmallImg;
		
		var aktImg;
		
		var scrolling = false;
		var mode = '';
		
		var open = false;
		var recentlyOpened = false;
		var __self = this;
		
		function __const () {
			debugOutput('__const');
			zoomBox = createZoomBox();
			smallBox = createSmallBox();
			bigImg = createBigImg();
			maximizeImg = createMaximizeImg();
			smallImg = createSmallImg();
			
			zoomBox.appendChild(bigImg);
			smallImg.appendChild(smallBox);
			zoomBox.appendChild(smallImg);
			zoomBox.appendChild(maximizeImg);
			document.getElementsByTagName('body')[0].appendChild(zoomBox);

			addEvent(document,'click',hideZoomBox);
			addEvent(zoomBox,'mousemove',zoomBoxMoveHandler);

			addEvent(smallBox,'mouseover',refHandlerImg('small'));
			addEvent(smallImg,'mouseover',refHandlerImg('small'));
			addEvent(smallBox,'mouseout',refHandlerImg(''));
			
			addEvent(bigImg,'mouseover',refHandlerImg('big'));
			addEvent(bigImg,'mouseout',refHandlerImg(''));
			
			addEvent(zoomBox,'click',function (e) { e.cancelBubble = true; debugOutput('!!!clickhandler zoombox!!!'); hideZoomBox(); });
		}
		
		//--------------------- HANDLER ------------------------------------------------------------------------------------------------------
		var refHandlerImg = function (v) {
			return function (e) { handlerImg(e,v); }
		}
		var handlerImg = function (e,val) {
			debugOutput('handlerIMG_' + val);
			mode = val;
			if (mode == 'big') {
				startScroll();
				scrolling = true;
			}
			if (mode == 'small') {
				
			}
			if (mode != 'big') {
				scrolling = false;
				if (scrollHandler) window.clearInterval(scrollHandler);
			}
			debugOutput('changed2' + mode);
		}
		
		
		var zoomBoxMoveHandler = function (e) {
			if (mode == 'small') {
				var posZoom = FindXYWH(zoomBox);
				var posSmallImg = FindXYWH(smallImg);
				var smallBoxWidth = (smallBox.offsetWidth == 0 ? smallBoxW : smallBox.offsetWidth);
				
				var pos = e.clientX - posSmallImg.x - smallBoxWidth / 2;
				if (pos < 0) pos = 0;
				if (pos > (posSmallImg.w - smallBoxWidth)) pos = (posSmallImg.w - smallBoxWidth);
				
				smallBox.style.left = pos;
				
				var verh = (arrImgs[aktImg].wBig - bigImg.offsetWidth) / (arrImgs[aktImg].wSmall - smallBox.offsetWidth);
				bigImg.style.backgroundPosition = (-1 * pos * verh) + 'px center';
			}
			if (mode == 'big') {
				var posDim = FindXYWH(bigImg);
				var posRel = ((e.clientX - posDim.x) / posDim.w)*2;
				scrollSpeed = Math.pow((posRel-1),7) * -5;
			}
		}
		
		var refObjOverHandler = function(id) {
			return function (ev) { objOverHandler(ev,id); }
		}
		var objOverHandler = function (e,id) {
			debugOutput('objOverHandler');
			showZoomBox(e,id);
		}
		
		var refObjClickHandler = function(id) {
			return function (ev) { objClickHandler(ev,id); }
		}
		var objClickHandler = function(e,id) {
			debugOutput('objClickHandler');
			//if (open) hideZoomBox(); //<---- hier hakts.
			
			//e.cancelBubble = true;
			recentlyOpened = true;
			showZoomBox(e,id);
		}
		
		var showZoomBox = function (e,id) {
			debugOutput('showZoomBox');
			var showingSmall = false;
			var showingBig = false;
			aktImg = id;
			zoomBox.style.display = 'block';

			preBigImg.onload = function () {
					showingBig = true;
					if (showingSmall && showingBig) updateZoomBoxShow(arrImgs[id].imgBig,arrImgs[id].imgSmall,arrImgs[id].caption,arrImgs[id].imgBigBig);
				}
			preBigImg.src = arrImgs[id].imgBig;
			
			preSmallImg.onload = function () {
					showingSmall = true;
					if (showingSmall && showingBig) updateZoomBoxShow(arrImgs[id].imgBig,arrImgs[id].imgSmall,arrImgs[id].caption,arrImgs[id].imgBigBig);
				}
			preSmallImg.src = arrImgs[id].imgSmall;
			
			
			var posObj = FindXYWH(arrImgs[id].obj);
			var scr = returnCurrentScrollAmount();
			
			zoomBox.style.left = posObj.x - 20;
			zoomBox.style.top = e.clientY + scr[1] - 10;
			//zoomBox.style.left = '0px';
			//zoomBox.style.top = '0px';
			
			var posZoomBox = FindXYWH(zoomBox);
			var posSmallImg = FindXYWH(smallImg);
			smallBox.style.left = 0;
			smallBox.style.height = posSmallImg.h;
			
			smallBox.style.width = (arrImgs[id].wSmall / arrImgs[id].wBig) * zoomBox.offsetWidth;
			open = true;
		}
		var hideZoomBox = function(e) {
			debugOutput('________________');
			if (!open) return;
			if (recentlyOpened) {
				recentlyOpened = false;
				return;
			}
			
			zoomBox.style.border = '1px solid #989084';
			maximizeImg.style.display = 'none';
			smallBox.style.display = 'none';
			captionBox.style.display = 'none';
			bigImg.style.backgroundImage = 'none';
			smallImg.style.backgroundImage = 'none';
			zoomBox.style.backgroundImage = 'url(' + guiPicPrefix + '/waiting.gif)';
			zoomBox.style.display = 'none';

			preBigImg.src = '';
			preSmallImg.src = '';
			
			if (scrollHandler) window.clearInterval(scrollHandler);
			scrolling = false;
			mode = '';
			
			open = false;
		}
		
		
		
		
		
		var updateZoomBoxShow = function (big,small,caption,bigbig) {
			debugOutput('updateZoomBoxShow');
			zoomBox.style.backgroundImage = 'url(' + guiPicPrefix + '/zoomBox_bg.png)';
			zoomBox.style.border = '';
			
			maximizeImg.style.display = 'block';
			maximizeImg.href = bigbig;
			captionBox.innerHTML = caption;
			captionBox.style.display = 'block';
			bigImg.style.backgroundImage = 'url(' + big + ')';
			bigImg.style.backgroundPosition = 'left center'
			smallImg.style.backgroundImage = 'url(' + small + ')';
			smallBox.style.display = 'block';
		}

		var scroll = function() {
			var speed = scrollSpeed * 20;
			var pos = parseInt(bigImg.style.backgroundPosition.split(" ")[0].replace(/px/,''));
			if (isNaN(pos)) pos = 0;

			if (pos + speed > 0) {
				pos = 0;
			} else if ((pos + speed) < (-1 * (arrImgs[aktImg].wBig - bigImg.offsetWidth))) {
				pos = (arrImgs[aktImg].wBig - bigImg.offsetWidth) * -1;
			} else {
				pos = pos + speed;
			}
			bigImg.style.backgroundPosition = pos + 'px center';
			
			var verh = ((arrImgs[aktImg].wSmall - smallBox.offsetWidth) / (arrImgs[aktImg].wBig - bigImg.offsetWidth));
			smallBox.style.left = (verh * pos * -1) + 'px';
		}
		var startScroll = function() {
			debugOutput('startScroll');
			scrollHandler = window.setInterval(scroll,10);
		}
		var returnCurrentScrollAmount = function() {
			debugOutput('returnCurrentScrollAmount');
			var y = (typeof(document.body.scrollTop)=='number') ? document.body.scrollTop : window.pageYOffset;
			var x = (typeof(document.body.scrollLeft)=='number') ? document.body.scrollLeft : window.pageXOffset;
			return [x,y];
		}
		var returnViewport = function() {
			debugOutput('returnViewport');
			var vpW = 0;
			var vpH = 0;
			if (window.innerWidth) {
				vpW = window.innerWidth;
				vpH = window.innerHeight;
			} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
				vpW = document.documentElement.clientWidth;
				vpH = document.documentElement.clientHeight;
			} else {
				vpW = document.getElementsByTagName('body')[0].clientWidth;
				vpH = document.getElementsByTagName('body')[0].clientHeight;
			}
			return [vpW,vpH];
		}
		var createZoomBox = function() {
			debugOutput('createZoomBox');
			var tmpBox = document.createElement('div');
			tmpBox.style.backgroundColor = '#ffffff';
			tmpBox.style.backgroundImage = 'url(' + guiPicPrefix + '/waiting.gif)';
			tmpBox.style.backgroundRepeat = 'no-repeat';
			tmpBox.style.backgroundPosition = 'center center';
			
			tmpBox.style.border = '1px solid #989084';
			tmpBox.style.width = '302px';
			tmpBox.style.height = '152px';
			tmpBox.style.display = 'none';
			tmpBox.style.position = 'absolute';
			tmpBox.style.overflow = 'hidden';
			tmpBox.insideZoomBox = 'true';
			tmpBox.style.zIndex = 400;
			
			captionBox = document.createElement('div');
			captionBox.style.top = '6px';
			captionBox.style.left = '7px';
			captionBox.style.fontSize = '10px';
			captionBox.style.fontFamily = 'Tahoma,sans-serif';
			captionBox.style.fontWeight = 'bold';
			captionBox.style.position = 'absolute';
			captionBox.insideZoomBox = 'true';
			tmpBox.appendChild(captionBox);
			
			preBigImg = document.createElement('img');
			preBigImg.style.display = 'none';
			tmpBox.appendChild(preBigImg);
			preSmallImg = document.createElement('img');
			preSmallImg.style.display = 'none';
			tmpBox.appendChild(preSmallImg);
			
			
			if (document.body.style.MozBorderRadius !== undefined) tmpBox.style.MozBorderRadius = '5px';
			return tmpBox;
		}
		var createSmallBox = function() {
			debugOutput('createSmallBox');
			var tmpBox = document.createElement('div');
			tmpBox.style.backgroundColor = '#92ff87';
			tmpBox.style.width = smallBoxW + 'px';
			tmpBox.style.height = '15px';
			tmpBox.style.display = 'none';
			tmpBox.style.position = 'absolute';
			tmpBox.style.zIndex = '100';
			tmpBox.insideZoomBox = 'true';
			
			var opacity = 50;
			tmpBox.style.opacity = (opacity / 100);
			tmpBox.style.MozOpacity = (opacity / 100);
			tmpBox.style.KhtmlOpacity = (opacity / 100);
			tmpBox.style.filter = "alpha(opacity=" + opacity + ")";
			return tmpBox;
		}
		var createBigImg = function () {
			debugOutput('createBigImg');
			var tmpImg = document.createElement('div');
			tmpImg.insideZoomBox = 'true';
			tmpImg.style.backgroundPosition = 'left center';
			tmpImg.style.backgroundRepeat = 'no-repeat';
			tmpImg.style.position = 'absolute';
			tmpImg.style.height = '65px';
			tmpImg.style.width = '276px'
			tmpImg.style.left = '12px';
			tmpImg.style.top = '31px';
			return tmpImg;
		}
		var createSmallImg = function () {
			debugOutput('createSmallImg');
			var tmpImg = document.createElement('div');
			tmpImg.insideZoomBox = 'true';
			tmpImg.style.position = 'absolute';
			tmpImg.style.backgroundRepeat = 'no-repeat';
			tmpImg.style.backgroundPosition = 'center center';
			tmpImg.style.position = 'absolute';
			tmpImg.style.height = '30px';
			tmpImg.style.width = '280';
			tmpImg.style.left = '11px';
			tmpImg.style.top = '114px';
			return tmpImg;
		}
		var createMaximizeImg = function () {
			debugOutput('createMaximizeImg');
			var tmpImg = document.createElement('img');
			tmpImg.style.position = 'absolute';
			tmpImg.style.top = '6px';
			tmpImg.style.right = '10px';
			tmpImg.style.border = '0px';
			tmpImg.src = guiPicPrefix + '/zoomBox_max.gif';
			
			var b = new CTooltip;
			b.setCSSClass('tooltip');
			b.addText(tmpImg,captMax,false,false);
			
			var tmpA = document.createElement('a');
			tmpA.appendChild(tmpImg);
			tmpA.style.display = 'none';
			tmpA.target = '_blank';
			return tmpA;
		}
		this.add = function(obj,imgBig,imgSmall,wBig,wSmall,hBig,hSmall,caption,imgBigBig) {
			var id = arrImgs.length;
			arrImgs[id] = new Object();
			arrImgs[id].obj = obj;
			arrImgs[id].imgBig = imgBig;
			arrImgs[id].imgSmall = imgSmall;
			arrImgs[id].imgBigBig = imgBigBig;
			arrImgs[id].wBig = wBig;
			arrImgs[id].wSmall = wSmall;
			arrImgs[id].hBig = hBig;
			arrImgs[id].hSmall = hSmall;
			arrImgs[id].caption = caption;
			
			//addEvent(obj,'mouseover',refObjOverHandler(id));
			addEvent(obj,'click',refObjClickHandler(id));
			try { obj.style.cursor = 'pointer'; } catch(e) {}
		}
		this.clearImages = function() {
			arrImgs.length = 0;
		}
		this.closeWindow = function() {
			debugOutput('closeWindow');
			hideZoomBox();
		}
		
		__const();
	}
	

	
	
	
	
	
	
	
