function infoFader(options){this._counterId=++infoFader._counterId;var self=this;this._fadeInDuration=options._fadeInDuration||333;this._fadeOutDuration=options._fadeOutDuration||333;this._height=options.height;this._width=options.width;this._offsetX=options.offsetX||12;this._offsetY=options.offsetY||12;this._offsetScrollbars=24;this._querySelector=options.querySelector;this._queryRoot=options.queryRoot||false;this._className=options.className;this._div='';this._fadeIn='';this._fadeOut='';this._ieFaderChildren='';if(options.useTitle){this._useTitle=options.useTitle;}
else{if(dojo.isFunction(options.setContent)){this._setContent=options.setContent;}
else{alert('infoFader.js: options.setContent is not a function. You have to provide a function that sets the content.');return;}}
if(options.setEvents){if(dojo.isFunction(options.setEvents)){this._externalEventSetter=options.setEvents;}}
this._init=function(){self._getPageDimensions();dojo.connect(window,"onresize",self._getPageDimensions);self._setupDivs();if(self._externalEventSetter){self._externalEventSetter();}
else{self._setupEventhandlers();}
self._setupAnimations();self._setupContentPlacement();}
this._getPageDimensions=function(){if(dojo.isIE>0){self._pageHeight=document.documentElement.clientHeight;self._pageWidth=document.documentElement.clientWidth;}
else{self._pageHeight=window.innerHeight;self._pageWidth=window.innerWidth;}}
this._setupDivs=function(){var divOuter=document.createElement('div');var divInner=document.createElement('div');dojo.attr(divOuter,'id','infoFader_'+self._counterId);divInner.className=self._className;dojo.style(divOuter,{'width':self._width?self._width+'px':'auto','height':self._height?self._height+'px':'auto','position':'absolute','zIndex':'999','display':'none'});dojo.style(divInner,{'width':'100%','height':'100%','opacity':0});divOuter.appendChild(divInner);document.getElementsByTagName('body')[0].appendChild(divOuter);self._div=divOuter;}
this._setupEventhandlers=function(){var matchingElements=dojo.query(self._querySelector,self._queryRoot).onmouseenter(function(event){self.show(event)}).onmousemove(function(event){self.move(event)}).onmouseleave(function(event){self.hide(event)});if(this._useTitle){matchingElements.forEach(function(element){dojo.attr(element,'infoFaderTitle',dojo.attr(element,'title'));dojo.attr(element,'title','');});}}
this._setupAnimations=function(){if(dojo.isIE){self._fadeIn=dojo.fadeIn({node:self._div.firstChild,duration:self._fadeInDuration,delay:0,beforeBegin:self._ieGetFaderChildren,onAnimate:self._ieSetFaderChildrenOpacity})
self._fadeOut=dojo.fadeOut({node:self._div.firstChild,duration:self._fadeOutDuration,beforeBegin:self._ieGetFaderChildren,onAnimate:self._ieSetFaderChildrenOpacity});}
else{self._fadeIn=dojo.fadeIn({node:self._div.firstChild,duration:self._fadeInDuration,delay:0})
self._fadeOut=dojo.fadeOut({node:self._div.firstChild,duration:self._fadeOutDuration});}
dojo.connect(self._fadeOut,"onEnd",function(){dojo.style(self._div,'display','none');});}
this._setupContentPlacement=function(){if(self._useTitle){this._setContent=this._setContentViaTitle;}
dojo.subscribe('fadeIn_'+self._counterId,null,self._setContent);}
this._ieGetFaderChildren=function(){self._ieFaderChildren=dojo.query(">",self._div.firstChild);}
this._ieSetFaderChildrenOpacity=function(arguments){dojo.forEach(self._ieFaderChildren,function(element){dojo.style(element,'opacity',dojo.style(element.parentNode,'opacity'))});}
this._setContentViaTitle=function(topic){dojo.attr(topic.div,'innerHTML',dojo.attr(topic.event.currentTarget,'infoFaderTitle'));}
this._cacheFaderDimensions=function(event){if(!parseInt(dojo.attr(event.target,'infoFaderHeight'))){coords=dojo.coords(self._div);dojo.attr(event.target,'infoFaderHeight',coords.h);dojo.attr(event.target,'infoFaderWidth',coords.w);}}
this._getCachedFaderDimensions=function(event){var faderHeight=parseInt(dojo.attr(event.target,'infoFaderHeight'));var faderWidth=parseInt(dojo.attr(event.target,'infoFaderWidth'));if(isNaN(faderHeight)){faderHeight=parseInt(dojo.attr(event.target.parentNode,'infoFaderHeight'));faderWidth=parseInt(dojo.attr(event.target.parentNode,'infoFaderWidth'));}
return{height:faderHeight,width:faderWidth};}
this.show=function(event){self._fadeOut.stop();dojo.publish('fadeIn_'+self._counterId,[{'div':self._div.firstChild,'event':event}]);dojo.style(self._div,'display','block');self._fadeIn.play();self._cacheFaderDimensions(event);self.move(event);}
this.move=function(event){var faderDimensions=self._getCachedFaderDimensions(event);var faderY,faderX;if((event.pageY+self._offsetY+faderDimensions.height+self._offsetScrollbars)>(self._pageHeight+document.documentElement.scrollTop)){faderY=(self._pageHeight+document.documentElement.scrollTop-faderDimensions.height-self._offsetScrollbars)+'px';}
else{faderY=event.pageY+self._offsetY+'px';}
if((event.pageX+self._offsetX+faderDimensions.width+self._offsetScrollbars)>(self._pageWidth+document.documentElement.scrollLeft)){faderX=(self._pageWidth+document.documentElement.scrollLeft-faderDimensions.width-self._offsetScrollbars)+'px';}
else{faderX=event.pageX+self._offsetX+'px';}
dojo.style(self._div,{'top':faderY,'left':faderX});}
this.hide=function(event){self._fadeIn.stop();self._fadeOut.play();}
dojo.addOnLoad(this._init);}
infoFader._counterId=0;;var previewPath=cat_path+'images/products/S/';var loadingGifPath=cat_path+'templates/'+tpl+'/img/loading.gif';var loadingGif=new Image();loadingGif.src=loadingGifPath;function loadPreviewimage(topic){var imageName=topic.event.target.src.substring(topic.event.target.src.lastIndexOf('/')+1);dojo.style(topic.div,{'backgroundImage':'url('+loadingGifPath+')','backgroundPosition':'center center'});var previewImage=new Image();previewImage.onload=function(){dojo.style(topic.div,{'backgroundImage':'url('+previewImage.src+')','backgroundPosition':'0px 0px'});};previewImage.src=previewPath+imageName;}
var infoFaderImage=new infoFader({className:'infoFaderThumbnails',offsetX:18,width:156,height:208,fadeInDuration:500,fadeOutDuration:500,querySelector:'#col_right div.listing div.thumbnail img.preview',setContent:loadPreviewimage});var infoFaderInfoDeliveryAndInfoPrice=new infoFader({className:'infoFaderInfoDeliveryAndInfoPrice',offsetX:18,querySelector:'#col_right div.listing div.infoDeliveryAndInfoPrice, span[title]',useTitle:true});function setDeliveryWeekEventhandlers(){dojo.query('#col_right div.listing div.deliveryWeek').forEach(function(div){title=dojo.attr(div,'title');title=title.replace(/^(.+)\s(\d{2}\.\d{2}\.\d{4})$/,'$1<br />$2');dojo.attr(div,'infos',title);dojo.removeAttr(div,'title');if(dojo.attr(div,'infofaderEventsSet')){return;}
dojo.connect(div,'onmouseover',function(event){infoFaderDeliveryWeek.show(event);});dojo.connect(div,'onmousemove',function(event){infoFaderDeliveryWeek.move(event);});dojo.connect(div,'onmouseout',function(event){infoFaderDeliveryWeek.hide(event);});dojo.attr(div,'infofaderEventsSet',1);})}
function loadInfoDeliveryWeek(topic){var infoDiv=topic.event.target;topic.div.innerHTML=dojo.attr(infoDiv,'infos');}
infoFaderDeliveryWeek=new infoFader({className:'infoFaderDeliveryWeek',offsetX:18,fadeInDuration:500,fadeOutDuration:500,setContent:loadInfoDeliveryWeek,setEvents:setDeliveryWeekEventhandlers});