			function setProductsPosition(){
				$('inhalt').select('.productSingle').each(function(singleEl){
					//return;
					//if(singleEl.select('.tech').length)return;
					var inhWidth = $('inhalt').getWidth();
					var mW=0;
					var tW=0;
					var vW=0;
					var pW=0;
					var cor=0;
					var corM=0;
					var pMaxW=0;
					var desc=false;
					singleEl.select('.productTitle').each(function(el){
						tW=el.getWidth();
					});
					singleEl.select('.productDesc').each(function(el){
						el.setStyle({'marginLeft':(tW+20+32)+'px'});
						desc=true;
					});
					if(desc)
						return;
					singleEl.select('.menu').each(function(el){
						mW=el.getWidth();
					});
					singleEl.select('.productVariants').each(function(el){
						el.setStyle({'maxWidth':(inhWidth-(tW+20)) +'px'});
						vW=el.getWidth();
					});
					singleEl.select('.productArticles').each(function(el){
						el.setStyle({'maxWidth':(inhWidth-mW) +'px'});
						pW = el.getWidth();
					});
					
					cor = Math.abs(pW-vW)/2;
					corM = (inhWidth - ((pW<vW?vW:pW)+(tW<mW?mW:tW)))/2;
					corM = corM<0?0:corM;
	
					singleEl.select('.productVariants').each(function(el){
						var mcor=0;
						if(vW<pW)
							mcor=cor;
						if(tW<mW)
							mcor +=  mW - (tW+20);
						mcor += corM;
						var max = inhWidth-(mW+vW);
						mcor = max < mcor?max:mcor;
						el.setStyle({'marginLeft':mcor+'px'});
					});
	
					singleEl.select('.productArticles').each(function(el){
						var mcor=0;
						if(vW>pW)
							mcor=cor;
						if(tW>mW)
							mcor += (tW+20) - mW;
							
						mcor += corM;
						var max = inhWidth-(mW+pW);
						mcor = max < mcor?max:mcor;
						el.setStyle({'marginLeft':mcor+'px'});
					});
					singleEl.select('.productQualities').each(function(el){
						var mcor = mW>tW?mW:tW;
						mcor += corM;
						//el.setStyle({'maxWidth':(-mcor) +'px'});
						el.setStyle({'marginLeft':mcor+'px'});
					});
					
				});	
			}
			
		

			function setmenuHeightProductsList(id)
			{
				var display=true;
				if (typeof(moveProductsList)=='function')
					return moveProductsList();
					//display=false;
					
				//return;
				var height=120;
				$(id).select('.productCluster').each(function(el){
					el.select('ul').each(function(ulel){
						var h = ulel.getHeight();
						if(h>height)
							height=h;
					});
				});
				height +=8;
				var height = Math.round(height/16*1000)/1000;
				//alert(height);
				$(id).select('.productCluster').each(function(el){
					el.select('ul').each(function(ulel){
						if(display)
							ulel.setStyle({'height':height+'em','left':0,'bottom':0});
						else
							ulel.setStyle({'display':'none','height':height+'em'});
					});
				});
				if (typeof(moveProductsList)=='function')
					moveProductsList();
				
				//alert(height);
			}


			function menuMotionProducts(id)
			{
				$(id).select('ul').each(function(item){
					item.select('li').each(function(elem){
		  	  	  	  	var mdiv = new Element('div',{'style':'position:absolute;background:#949494;height:1.7em;display:none;zIndex:0'});
		  	  	  	  	mdiv.setOpacity(.8);
		  	  	  	  	mdiv.inOut=false;
						mdiv.down=false;
						mdiv.timerIn = function(evt){
							evt.stop();
							//alert(evt.me);
							if(evt.me.inOut == true){
								evt.me.setStyle({'top':0,'height':'1.75em','display':'none'})
								evt.me.down=true;
								Effect.BlindDown(evt.me,{scaleFromCenter:true,duration:.3});
							}
						};	
		  	  	  	  	elem.insert({'top':mdiv});
						elem.select('a').each(function(aElem){
							mdiv.setStyle({width:aElem.getWidth()+'px'});
							aElem.makePositioned(); 
						    aElem.setStyle({'zIndex':'100'});
							aElem.observe('mouseover',function(event){
									mdiv.inOut = true;
									mdiv.down=false;
									Event.stop(event);
									var timerOut = new PeriodicalExecuter(mdiv.timerIn,.3);
									timerOut.me = mdiv;
							});
							aElem.observe('mouseout',function(event){
									Event.stop(event);
									mdiv.inOut = false;
									Effect.BlindUp(mdiv,{scaleFromCenter:true,duration:.5});
									//}
							});
							
						});	
					});
				});
			}
			

			function galleryPrevNextImage(dir,classname){
				$('content').select('.'+classname).each(function(el){
					var groups  = el.select('.group');
					var vis='';
					var set = -1;
					for (var i=0;i<groups.length;i++){
					 	vis  = groups[i].getStyle('display');
						if(vis=='block'){
							Effect.Fade(groups[i].identify(),{queue: 'end',duration:.3});
						 	set = i;
						 	break;
						}	 
					}
					if(dir=='+'){
						if(set<groups.length-1 ){
							el.select('span.prev').each(function(elsp){
								elsp.show();
							});	
							set++;
						}else{	
							el.select('span.prev').each(function(elsp){
									elsp.hide();
							});		
							set=0;
						}	
					}else{
						if(set==0){
							el.select('span.prev').each(function(elsp){
								elsp.hide();
							});	
							//set = groups.length-1;
						}else	
							set--;
							if(set==0){
								el.select('span.prev').each(function(elsp){
									elsp.hide();
								});	
							}	
					}
					if(set == groups.length-1){
							el.select('span.next').each(function(elsp){
								elsp.hide();
							});
					}else	
							el.select('span.next').each(function(elsp){
								elsp.show();
							});	

					var imgs=0;
					var lastNum=0;
					for (var i=0;i<=set;i++){
						imgs += lastNum = groups[i].select('img').length;
					}	
					el.select('.imgCount').each(function(elsp){
						elsp.innerHTML = (imgs-lastNum+1)+' - '+imgs;
					});	
					Effect.Appear(groups[set].identify(),{queue: 'end',duration:.5});
				});
					
			}	
			
			function shadowBoxInit(){
				Shadowbox.init({
				        skipSetup: true,
				        enableKeys:false,
				        handleOversize:'none'	
				    });
			}    	

		    

			function shadowBoxOpen(params){
		if(params.title)
			var content = '<div class="verlegeMuster" id="verlegeMuster_id" ><table id="verlegeMuster_T"><tr><td id="pattDesc"><h2 style="padding:0 0 4px 0;font-size:16px;">'+params.title+':</h2><h3></h3><div id="descrTxt"></div></td><td id="pattImg"><img src="" alt="" /></td><td id="form"><form id="verlegemuster-form" name="verlegemuster-form"  method="post"></form></td></tr><tr style="height:2em;"><td style="height:2em;">&nbsp;</td><td id="print">&nbsp;</td><td id="prevnext"></td></tr><tr><td colspan="3" style="height:1em;font-size:.75em;"><p id="footerTxt"></p></td></tr></table></div>';
		else
			var content = '<div class="verlegeMuster" id="verlegeMuster_id" ><table id="verlegeMuster_T"><tr><td id="pattDesc"><h3></h3><div id="descrTxt"></div></td><td id="pattImg"><img src="" alt="" /></td><td id="form"><form id="verlegemuster-form" name="verlegemuster-form"  method="post"></form></td></tr><tr style="height:2em;"><td style="height:2em;">&nbsp;</td><td id="print">&nbsp;</td><td id="prevnext"></td></tr><tr><td colspan="3" style="height:1em;font-size:.75em;"><p id="footerTxt"></p></td></tr></table></div>';
		Shadowbox.open({
		    player:     'html',
		    title:      '',
		    content:    content,
		    height:     276,
		    width:      720
		    },{	onFinish: function(){
		        processNewVerlegeMuster(params);
		    }
		    }
    
		    );
		}    	
			

		function getParamStr () {
	             var paramStr = '';
	             for ( i=0; i < document.forms['verlegemuster-form'].elements.length; i++ ) {
	                var element = document.forms['verlegemuster-form'].elements[i];
	                paramStr = paramStr + element.name + '=' + element.value + '&';
	             }
	             return paramStr;
      	}			
			
		function createVerlegeMuster(form,params){
				var img = $('pattImg').select('img')[0];
				//alert(img);
				img.setAttribute('src',params.img);
				img.setAttribute('width',params.imgW);
				img.setAttribute('height',params.imgH);
				img.setStyle({'width':params.imgW+'px','height':params.imgH+'px'});
				var txt = $('pattDesc').select('h3')[0];
				txt.innerHTML = params.title; 
				var html = '<div class="prevNext prev">';
				if(params.prevId)
					html += '<a href="#" onclick="processNewVerlegeMuster({prodId:'+params.prodId +',patt:'+params.prevId +'});return false;">'+params.prevIdLabel +'</a>';
				html += "</div>";
				if(params.nextId)
					html += '<div class="prevNext next"><a href="#" onclick="processNewVerlegeMuster({prodId:'+params.prodId +',patt:'+params.nextId +'});return false;" >'+params.nextIdLabel +'</a></div>';
				$('prevnext').innerHTML = html;
			    $(form).innerHTML = "";		
			    var elem = new Element('input', {
			  							'name':params.prefix+'[patternId]', 
			  							'type': 'hidden',
			  							'value': params.id,
			  							'class': ''}
			  							);
			    $(form).insert({'bottom':elem});
				$(form).setAttribute('action','');// params.formUrl);
				$(form).setAttribute('onsubmit',"wind=window.open('"+params.formUrl+"&'+getParamStr(),'print','width=670,height=500,menubar=0,scrollbars=0');wind.focus();return true;");
				
				aPattern.each(function(item){
					  label = new Element('LABEL',{});
					  label.innerHTML = item.label;		
					  $(form).insert({'BOTTOM':label});
					  item.elem = new Element('input', {
					  							'id':'pattern_inp['+item.id +(item.inp?'inp':'')+']', 
					  							'name':params.prefix+'[pattern_inp]['+item.id +(item.inp?'inp':'')+']', 
					  							'class': '',
					  							'value':''});

					  $(form).insert({'bottom':item.elem});
					  if(item.inp==false){
					  	//item.elem.disable();
					  	item.elem.setAttribute('readonly','readonly');
					  }else{
			    		item.elem.observe('keyup',calcVerlegeMuster);
			    	  }				
			    	  var span= new Element('span');
			    	  span.innerHTML = item.labelpre;
					  $(form).insert({'bottom':span});
					  $(form).insert({'bottom':new Element('br',{'class':'nofloat'})});
				});


				var dim = $("verlegeMuster_T").getDimensions();
				if( /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) && navigator.platform == "Win32")
			    	Shadowbox.setDimensions(dim.height+40,dim.width+28,false);
			    else
			    	Shadowbox.setDimensions(dim.height+40,dim.width+40,false);
				
			    //Shadowbox.setDimensions(dim.height+10,dim.width+10,false);
			}
			

			function calcVerlegeMuster()
			{
				var inp = new Object();
				var num=true;
				var value="";
				aPattern.each(function(item){
					if(item.inp){
						if($('pattern_inp['+item.id+'inp]').value.length){
							value=$('pattern_inp['+item.id+'inp]').value;
							value= value.replace(/,/g, ".");
							inp[item.type] = parseFloat(value);
						}else	
							inp[item.type] = 0;
						if(isNaN(inp[item.type]) || inp[item.type]<0){
							num=false;
							return;
						}	
					}	 
				});
				if(num==false){
					aPattern.each(function(item){
						if(item.inp)inp[item.type] = 0;
					});
				}
				var sub = 0; 
				aPattern.each(function(item){
					if(!item.inp && item.type!='qm'){
						item.value = inp[item.type] * item.num;
						if(item.value<0)
							item.value=0; 
						$('pattern_inp['+item.id+']').value = Math.ceil(item.value);
						sub += item.value * item.size;	
					}	  
				});
				aPattern.each(function(item){
					if(!item.inp && item.type=='qm'){
						var res =Math.ceil((inp[item.type]-sub) * item.num);
						$('pattern_inp['+item.id+']').value = res<0?0:res;
					}
				});
			}

			