/*
* jQuery Baur Autoteaser Plugin $Revision: 1.11 $ - $Date: 2011/12/05 14:20:53 $
* @requires jQuery v1.3.2 or later 
* $Author: berlwein $
* Copyright: BAUR Versand, 96222 Burgkunstadt
* Doc: http://docs.jquery.com/Plugins/Authoring
* minified version created with : http://compressorrater.thruhere.net/ Compressor: YUI Compressor, Options: preserveAllSemi, disableOpt
*/
(function(b){var c={teaserList:null,animationInterval:10,waitingTimeBeforeStart:3,mainContainerHeight:370,animationType:"fading",fadingSpeed_autoanimation:"slow",fadingSpeed_onclick:"fast",selectorAnimationGroupContainer:".animationGroupContainer",selectorAnimationGroup:".animationGroup",selectorCustomClassNameAdded:".animationCustomClassNameAdded",scopeBuffer:{customClassTarget:null,customClassName:null},callFunctionAfterSuccess:function(){},debug:false,debugOuputMessagePrefix:"Baur Autoteaser : "};var a={init:function(p){var h=jQuery(this).eq(0);if(h.length>0){var p=jQuery.extend({},c,p);a.debugOutput({error:h});if(p.teaserList){a.debugOutput({error:p.teaserList});jQuery.each(p.teaserList,function(x,u){if(u!=""){var A=u["imageurl"];var B=u["flashurl"];var z=u["linkurl"];var t=u["width"];var C=u["height"];var y=u["delay"];if((typeof(B)!="undefined")||(typeof(A)!="undefined"&&typeof(z)!="undefined")){var w='<div class="teaser visibleNo">';if(typeof(B)!="undefined"){w+='<div class="slotFlashBackground" id="flashcontent_'+x+'"></div>';}else{if(typeof(A)!="undefined"&&typeof(z)!="undefined"){w+='<a class="slotImageBackground" href="'+z+'">';w+='<input type="hidden" name="imagepath" value="'+A+'">';w+="</a>";}}w+="</div>";jQuery(p.selectorAnimationGroup,h).append(w);var v=((typeof(B)!="undefined"&&typeof(t)!="undefined"&&typeof(C)!="undefined")&&(B!=""&&t!=""&&C!="")?true:false);if(v){a.debugOutput({error:"init Flash Content"});swfobject.addDomLoadEvent(function(){swfobject.createSWF({data:B,width:t,height:C},{wmode:"transparent"},"flashcontent_"+x);});}}}});}if(p.mainContainerHeight){a.debugOutput({error:"custom height: "+p.mainContainerHeight});h.height(p.mainContainerHeight);h.find(".teaser, .teaser .slotFlashBackground, .teaser .slotImageBackground").height(p.mainContainerHeight);h.find(p.selectorAnimationGroupContainer+" .teaser:first").addClass("firstItem");h.find(p.selectorAnimationGroupContainer+" .teaser:last").addClass("lastItem");}var q=h.find(p.selectorAnimationGroup);var e=h.find("div.teaser");var s=h.find("div.teaser:first");if(p.animationType=="fading"){e.hide().removeClass("visibleNo");s.fadeIn(p.fadingSpeed_autoanimation,function(){jQuery(this).addClass("active prepareAnimation");});}else{s.removeClass("visibleNo").addClass("active");}if(e.length>1){var g="div.teaserAnimationNavigator span#teaserAnimationNavigatorDynamicMenue";var r="div.teaserAnimationNavigator span#teaserAnimationNavigatorAutomaticNavigation";var n='<a class="teaserAnimationNavigatorMenuePrev" href="javascript:void(0);"></a><a class="hiddenMenueForAutoNavigationPrev" href="javascript:void(0);"></a>';n+='<a class="teaserAnimationNavigatorMenueNext" href="javascript:void(0);"></a><a class="hiddenMenueForAutoNavigationNext" href="javascript:void(0);"></a>';n+='<div class="teaserAnimationNavigator">';n+='<div class="teaserAnimationNavigatorContent">';n+='<span id="teaserAnimationNavigatorDynamicMenue">';n+='<a class="flashGroupPlayButton" href="javascript:void(0);"><span></span></a>';n+="</span>";n+='<span id="teaserAnimationNavigatorAutomaticNavigation"></span>';n+="</div>";n+="</div>";h.append(n);var o=0;e.each(function(u){o++;var y=jQuery(this);var v=y.find(".slotImageBackground");var t=y.find(".slotImageBackground input[name='imagepath']").val();y.attr({"animationgroupindex":o});if(v.find(".imageMapCont").length>0){var x="teaseranimation_imagemap_"+o;var w="";v.find(".imageMapCont").each(function(z){var C=jQuery(this);var B=C.find("input[name='map_coord']").val();var A=C.find("input[name='map_link']").val();w+='<area shape="rect" coords="'+B+'" href="'+A+'">';});v.html(v.html()+'<img usemap="#'+x+'" src="'+t+'" border="0">'+'<map name="'+x+'">'+w+"</map>");}else{v.css({"background-image":"url("+t+")"});}h.find(g).append('<a class="flashGroupMenueItem" animationgroupindex="'+o+'" href="javascript:void(0);"><span>'+o+"</span></a>");h.find(r).append('<a class="hiddenMenueForAutoNavigation" animationgroupindex="'+o+'" href="javascript:void(0);"></a>');}).append('<input type="hidden" name="customclassadded_target" value="">'+'<input type="hidden" name="customclassadded_classname" value="">');function i(w){if(typeof(w)=="undefined"||typeof(w)!="boolean"){var w=false;}var t=h.find(g+" a.flashGroupMenueItem.active, "+r+" a.active").attr("animationgroupindex");var u=h.find("div.teaserAnimationNavigator a.teaserAnimationNavigatorMenuePrev, div.teaserAnimationNavigator a.hiddenMenueForAutoNavigationPrev");var v=h.find("div.teaserAnimationNavigator a.teaserAnimationNavigatorMenueNext, div.teaserAnimationNavigator a.hiddenMenueForAutoNavigationNext");if(t>1){u.addClass("active");}else{u.removeClass("active");}if(t==o){v.removeClass("active");}else{v.addClass("active");}if(w){d({animationInterval:p.animationInterval,clearCustomInterval:w});}}function k(){var u=jQuery(r+" a").length;var t=parseInt(h.find(r+" a.active").attr("animationgroupindex"));if(t==u){h.find(r+" a:first").click();}else{h.find("a.hiddenMenueForAutoNavigationNext").trigger("clickeventofautoanimation");}}function d(t){var t=jQuery.extend({playButton:jQuery(g+" a.flashGroupPlayButton",h),animationInterval:null,clearCustomInterval:false},t||{});if(t.clearCustomInterval){window.clearInterval(startAutoNavigation);t.playButton.removeClass("stop").addClass("start");}else{t.animationInterval=Math.abs(t.animationInterval*1000);if(t.animationInterval<1000){t.animationInterval=Math.abs(t.animationInterval*5000);}if(t.playButton.hasClass("stop")){window.clearInterval(startAutoNavigation);t.playButton.removeClass("stop").addClass("start");}else{if(t.playButton.hasClass("start")){startAutoNavigation=window.setInterval(k,t.animationInterval);t.playButton.removeClass("start").addClass("stop");}else{startAutoNavigation=window.setInterval(k,t.animationInterval);t.playButton.addClass("stop");}}}}setTimeout(function(){d({animationInterval:p.animationInterval});},Math.abs(p.waitingTimeBeforeStart*1000));jQuery(g+" a.flashGroupPlayButton").click(function(t){d({playButton:jQuery(this),animationInterval:p.animationInterval});});h.find(g+" a.flashGroupMenueItem:first, "+r+" a:first").addClass("active");h.find("a.teaserAnimationNavigatorMenueNext, a.hiddenMenueForAutoNavigationNext").addClass("active");function m(y){if(p.scopeBuffer["customClassTarget"]&&p.scopeBuffer["customClassName"]){jQuery(p.scopeBuffer["customClassTarget"]).removeClass(p.scopeBuffer["customClassName"]);}var v=jQuery("input[type='hidden'][name='customclassadded_target']");var x=jQuery("input[type='hidden'][name='customclassadded_classname']");if(y.find(".setCustomClass").length>0){var u=y.find(".setCustomClass");var w=u.find("input[type='hidden'][name='target']").val().trim();var t=u.find("input[type='hidden'][name='classname']").val().trim();jQuery(w).addClass(t);v.val(w);x.val(t);p.scopeBuffer["customClassTarget"]=w;p.scopeBuffer["customClassName"]=t;}else{jQuery(v.val()).removeClass(x.val());}}h.find(g+" a.flashGroupMenueItem, "+r+" a").unbind("click").bind("click",function(x){var y=jQuery(this);h.find(g+" a.flashGroupMenueItem, "+r+" a").removeClass("active");y.addClass("active");var v=(y.attr("animationgroupindex")-1);var u=q.find("div.teaser").get(v);var t=jQuery(u);if(p.animationType=="fading"){t.fadeIn(p.fadingSpeed_onclick,function(){q.find(".teaser.prepareAnimation").fadeOut(p.fadingSpeed_onclick,function(){jQuery(this).removeClass("active prepareAnimation");t.addClass("active prepareAnimation");});});}else{q.find("div.teaser").removeClass("active").addClass("visibleNo");t.removeClass("visibleNo").addClass("active");}m(t);var w=h.find(g+" a.flashGroupMenueItem, "+r+" a").get(v);jQuery(w).addClass("active");l({clearInterval:y.hasClass("flashGroupMenueItem")});});h.find("a.teaserAnimationNavigatorMenuePrev, a.hiddenMenueForAutoNavigationPrev").unbind("click clickeventofautoanimation").bind("click clickeventofautoanimation",function(t){var u=p.fadingSpeed_onclick;if(t.type=="clickeventofautoanimation"){u=p.fadingSpeed_autoanimation;}if(j()=="first"){f({type:"jumptolast",getCurrentSelectedGroupTeaser:jQuery("div.teaser:last",q),getCurrentSelectedMenueDynamic:jQuery(g+" a.flashGroupMenueItem:last",h),getCurrentSelectedAutomaticNavigation:jQuery(r+" a:last",h),clearInterval:true,animationType:p.animationType,fadingSpeed:u});}else{f({type:"prev",getCurrentSelectedGroupTeaser:jQuery("div.teaser.active:not(':first')",q),getCurrentSelectedMenueDynamic:jQuery(g+" a.flashGroupMenueItem.active",h).not(jQuery(g+" a.flashGroupMenueItem:first",h)),getCurrentSelectedAutomaticNavigation:jQuery(r+" a.active",h).not(jQuery(r+" a:first",h)),clearInterval:jQuery(this).hasClass("teaserAnimationNavigatorMenuePrev"),animationType:p.animationType,fadingSpeed:u});}});h.find("a.teaserAnimationNavigatorMenueNext, a.hiddenMenueForAutoNavigationNext").unbind("click clickeventofautoanimation").bind("click clickeventofautoanimation",function(t){var u=p.fadingSpeed_onclick;if(t.type=="clickeventofautoanimation"){u=p.fadingSpeed_autoanimation;}if(j()=="last"){f({type:"jumptofirst",getCurrentSelectedGroupTeaser:jQuery("div.teaser:first",q),getCurrentSelectedMenueDynamic:jQuery(g+" a.flashGroupMenueItem:first",h),getCurrentSelectedAutomaticNavigation:jQuery(r+" a:first",h),clearInterval:true,animationType:p.animationType,fadingSpeed:u});}else{f({type:"next",getCurrentSelectedGroupTeaser:jQuery("div.teaser.active:not(':last')",q),getCurrentSelectedMenueDynamic:jQuery(g+" a.flashGroupMenueItem.active",h).not(jQuery(g+" a.flashGroupMenueItem:last",h)),getCurrentSelectedAutomaticNavigation:jQuery(r+" a.active",h).not(jQuery(r+" a:last",h)),clearInterval:jQuery(this).hasClass("teaserAnimationNavigatorMenueNext"),animationType:p.animationType,fadingSpeed:u});}});function l(t){var t=jQuery.extend({clearInterval:false},t||{});i(t.clearInterval);}function j(){var u=q.find("div.teaser.prepareAnimation").attr("animationgroupindex");var t="";if(u==o){t="last";}else{if(u==1){t="first";}else{}}return t;}function f(u){var u=jQuery.extend({type:null,getCurrentSelectedGroupTeaser:null,getCurrentSelectedMenueDynamic:null,getCurrentSelectedAutomaticNavigation:null,clearInterval:null,animationType:null,fadingSpeed:null},u||{});a.debugOutput({error:"fadingSpeed: "+u.fadingSpeed});if(u.type&&u.getCurrentSelectedGroupTeaser&&u.getCurrentSelectedMenueDynamic&&u.getCurrentSelectedAutomaticNavigation){if(u.animationType=="fading"){if(u.type=="next"||u.type=="prev"){u.getCurrentSelectedGroupTeaser.removeClass("active");u.getCurrentSelectedMenueDynamic.removeClass("active");u.getCurrentSelectedAutomaticNavigation.removeClass("active");}else{h.find(g+" a.flashGroupMenueItem.active").removeClass("active");h.find(r+" a.active").removeClass("active");}if(u.type=="next"){var w=u.getCurrentSelectedGroupTeaser.next("div.teaser");var v=u.getCurrentSelectedMenueDynamic.next("a");var t=u.getCurrentSelectedAutomaticNavigation.next("a");w.fadeIn(u.fadingSpeed,function(){u.getCurrentSelectedGroupTeaser.fadeOut(u.fadingSpeed,function(){jQuery(this).removeClass("active prepareAnimation");w.addClass("active prepareAnimation");v.addClass("active");t.addClass("active");});});m(w);}else{if(u.type=="prev"){var w=u.getCurrentSelectedGroupTeaser.prev("div.teaser");var v=u.getCurrentSelectedMenueDynamic.prev("a");var t=u.getCurrentSelectedAutomaticNavigation.prev("a");w.fadeIn(u.fadingSpeed,function(){u.getCurrentSelectedGroupTeaser.fadeOut(u.fadingSpeed,function(){jQuery(this).removeClass("active prepareAnimation");w.addClass("active prepareAnimation");v.addClass("active");t.addClass("active");});});m(w);}else{if(u.type=="jumptolast"||u.type=="jumptofirst"){var w=u.getCurrentSelectedGroupTeaser;var v=u.getCurrentSelectedMenueDynamic;var t=u.getCurrentSelectedAutomaticNavigation;jQuery("div.teaser.active.prepareAnimation").fadeOut(u.fadingSpeed,function(){jQuery(this).removeClass("active prepareAnimation");w.fadeIn(u.fadingSpeed,function(){jQuery(this).addClass("active prepareAnimation");v.addClass("active");t.addClass("active");});});m(w);}else{}}}}else{u.getCurrentSelectedGroupTeaser.removeClass("active").addClass("visibleNo");u.getCurrentSelectedMenueDynamic.removeClass("active");u.getCurrentSelectedAutomaticNavigation.removeClass("active");if(u.type=="next"){u.getCurrentSelectedGroupTeaser.next("div.teaser").removeClass("visibleNo").addClass("active");u.getCurrentSelectedMenueDynamic.next("a").addClass("active");u.getCurrentSelectedAutomaticNavigation.next("a").addClass("active");m(u.getCurrentSelectedGroupTeaser.next("div.teaser"));}else{u.getCurrentSelectedGroupTeaser.prev("div.teaser").removeClass("visibleNo").addClass("active");u.getCurrentSelectedMenueDynamic.prev("a").addClass("active");u.getCurrentSelectedAutomaticNavigation.prev("a").addClass("active");m(u.getCurrentSelectedGroupTeaser.prev("div.teaser"));}}l({clearInterval:u.clearInterval});}}}p.callFunctionAfterSuccess();}else{a.debugOutput({error:"no animation container found!"});}},debugOutput:function(e){var e=jQuery.extend({error:null,debugOuputMessagePrefix:""},e||{});e=jQuery.extend({},c,e);if(e.debug&&e.error&&(("console" in window)&&("firebug" in console))){d();}function d(){var f=(typeof(e.error)=="object"?e.error:e.debugOuputMessagePrefix+e.error);console.log(f);}}};jQuery.fn.autoteaser=function(d){if(a[d]){return a[d].apply(this,Array.prototype.slice.call(arguments,1));}else{if(typeof d==="object"||!d){return a.init.apply(this,arguments);}else{jQuery.error("Method "+d+" does not exist on jQuery.autoteaser");}}};})(jQuery);
