var CarouselControl=function(d,c,b,a){this.classname=d;this.identifyingClassPrefix=this.classname+"_item_";this.newStageId="";this.viewportSize=c;this.stageItemPrefix=this.classname+"_stageitem_";this.distance2center=Math.floor(this.viewportSize/2);this.centerId=Math.floor(this.viewportSize/2);this.dontMoveToFirst=false;this.transitionTime=b;this.delay=a;this.startButtonVisible=true;var e=this;this.registerEventhandlers=function(){jQuery("#"+this.classname).bind("mouseover",function(){e.pauseLoop()});jQuery("#"+this.classname).bind("focus",function(){e.pauseLoop()});jQuery("#"+this.classname).bind("mouseout",function(){e.resumeLoop()});jQuery("#"+this.classname).bind("blur",function(){e.resumeLoop()})},this.startint=function(){return setInterval(function(){e.doInterval()},this.delay)},this.pauseLoop=function(){this.getCarousel().lock()},this.resumeLoop=function(){this.getCarousel().unlock()},this.setCenterId=function(f){this.centerId=f}};CarouselControl.prototype.initialize=function(){this.registerEventhandlers();this.noOfItems=this.getCarousel().size()};CarouselControl.prototype.start=function(){this.startLoop()};CarouselControl.prototype.stop=function(){this.stopLoop()};CarouselControl.prototype.prev=function(){this.stopLoop();this.getCarousel().prev()};CarouselControl.prototype.next=function(){this.stopLoop();this.getCarousel().next()};CarouselControl.prototype.startLoop=function(){this.showStartStop(false);this.dontMoveToFirst=false;this.timer=this.startint()};CarouselControl.prototype.doInterval=function(){this.getCarousel().next()};CarouselControl.prototype.stopLoop=function(){this.getCarousel().unlock();this.showStartStop(true);clearInterval(this.timer)};CarouselControl.prototype.showStartStop=function(a){this.startButtonVisible=a;this.showButton(this.classname+"_start",a);this.showButton(this.classname+"_stop",!a)};CarouselControl.prototype.showButton=function(c,b){var a=document.getElementById(c);if(a!=undefined){a.style.visibility=b?"visible":"hidden"}};CarouselControl.prototype.toggleLoop=function(){if(this.startButtonVisible){this.startLoop()}else{this.stopLoop()}};CarouselControl.prototype.pauseLoop=function(){this.getCarousel().lock()};CarouselControl.prototype.resumeLoop=function(){this.getCarousel().unlock()};CarouselControl.prototype.getCarousel=function(){return jQuery("#"+this.classname+"").data("jcarousel")};CarouselControl.prototype.carousel_moveCallback=function(d,b,a,c){if(c!="init"){if(!this.dontMoveToFirst){this.changeStageItem(this.determineNewItemOnStage(b))}}jQuery("#"+this.classname+"_stage").css("visibility","visible")};CarouselControl.prototype.changeStageItem=function(a){if(a!=undefined){jQuery("#"+this.classname+"_stage div:visible").first().fadeOut(this.transitionTime,function(){jQuery("#"+a).fadeIn(this.transitionTime)})}};CarouselControl.prototype.determineNewItemOnStage=function(d){var c=jQuery().add(d).children().first().attr("class");var a=this.getIdentifyingClass(c);if(a!=undefined){var b=Number(a.substring(this.identifyingClassPrefix.length));this.newStageId=(b+this.distance2center)%this.noOfItems;this.centerId=this.newStageId;this.removeCenterMark();return this.stageItemPrefix+this.newStageId}return undefined};CarouselControl.prototype.getIdentifyingClass=function(d){if(d!=undefined){var c=d.split(" ");var a=new RegExp(this.identifyingClassPrefix);for(var b=0;b<c.length;b++){if(a.test(c[b])){return c[b]}}}return undefined};CarouselControl.prototype.removeCenterMark=function(){jQuery("."+this.classname+"_center").removeClass(this.classname+"_center")};CarouselControl.prototype.setCenterMark=function(){jQuery("."+this.identifyingClassPrefix+this.newStageId).addClass(this.classname+"_center")};CarouselControl.prototype.changeStageItemWithoutFadeOut=function(a){jQuery("#"+this.classname+"_stage div:visible").first().hide();jQuery("#"+a).show()};ThemeCarouselControl.prototype=new CarouselControl();function ThemeCarouselControl(e,d,c,b,a){CarouselControl.apply(this,[e,d,c,b]);this.centerId=a}ThemeCarouselControl.prototype.initialize=function(){this.getCarousel().parentObject=this;this.noOfItems=this.getCarousel().size()};ThemeCarouselControl.prototype.hideControls=function(){jQuery("."+this.classname+"_control_left, ."+this.classname+"_control_right, #"+this.classname+"_control_play").hide()};ThemeCarouselControl.prototype.showControls=function(){jQuery("."+this.classname+"_control_left, ."+this.classname+"_control_right, #"+this.classname+"_control_play").show()};ThemeCarouselControl.prototype.determineNewItemOnStage=function(e){var d=jQuery().add(e).children().first().attr("class");var b=this.getIdentifyingClass(d);var c=Number(b.substring(this.identifyingClassPrefix.length));var a=(c+this.distance2center)%this.noOfItems;this.centerId=a;this.markCenterItem(a);return this.stageItemPrefix+a};ThemeCarouselControl.prototype.markCenterItem=function(a){jQuery("."+this.classname+"_center").removeClass(this.classname+"_center");jQuery("."+this.identifyingClassPrefix+a).addClass(this.classname+"_center")};ThemeCarouselControl.prototype.getIdentifyingClass=function(d){var c=d.split(" ");var a=new RegExp(this.identifyingClassPrefix);for(var b=0;b<c.length;b++){if(a.test(c[b])){return c[b]}}};ThemeCarouselControl.prototype.carousel_moveCallback=function(d,b,a,c){if(c!="init"){var e=d.parentObject;e.changeStageItem(e.determineNewItemOnStage(b))}};ThemeCarouselControl.prototype.changeStageItem=function(a){jQuery("#"+this.classname+"_stage div:visible").first().hide();jQuery("#"+a).show()};ThemeCarouselControl.prototype.moveToStage=function(a){this.swrthemecarousel_control_close_audio();this.stopLoop();this.changeStageItem(this.stageItemPrefix+a);this.getCarousel().scroll(a-1,false)};ThemeCarouselControl.prototype.swrthemecarousel_control_close_audio=function(){var f=this;var e=jQuery(".teasermitaudio ."+this.classname+"_audio_close");for(var b=0;b<e.length;b++){if(jQuery(e[b]).css("display")=="block"||jQuery(e[b]).attr("style")==undefined){var a=jQuery(e[b]).parents();var d=jQuery(a[1]).find("object").attr("id");var c=jQuery(a[1]).attr("id");jQuery("#"+c+" ."+this.classname+"_audio_close, #"+c+" .themenmodulaudio").hide();document.getElementById(d).sendEvent("STOP","true");jQuery("#"+c+" .play_btn").toggle();jQuery("#"+c+" .teasermitaudio .play_btn").click(function(){f.audioThemenmodulToggle();f.stopLoop()})}}this.showControls()};ThemeCarouselControl.prototype.audioThemenmodulToggle=function(){var d=jQuery("#"+this.classname+"_stage ."+this.classname+"_stage:visible").find("object").attr("id");if(d==null||d==undefined){var c=jQuery("#swrthemecarousel_stage .swrthemecarousel_stage:visible").attr("id");jQuery("#"+c+" .teasermitaudio .play_btn").toggle();jQuery("#"+c+" .themenmodulaudio").toggle();jQuery("#"+c+" .themenmodulaudio").css("position","relative");jQuery("#"+c+" .themenmodulaudio div:[id^=flashPlayer]").css("width","100%");return false}var a=jQuery("#"+d).parents();var c=jQuery(a[3]).attr("id");this.hideControls();jQuery("#"+c+" .teasermitaudio .play_btn").toggle();jQuery("#"+c+" .teasermitaudio .play_btn").unbind("click");jQuery("#"+c+" ."+this.classname+"_audio_close, #"+c+" .themenmodulaudio").show();if(navigator.appName=="Microsoft Internet Explorer"){var b=document.getElementById(d);if(b.sendEvent!=undefined){b.sendEvent("PLAY","true")}}};
