// (c)2009 Remind Advertising GmbH

(function($){var gc=0;var count=0;var hl=0;$.fn.cswitch=function(html,speed,callback){container=$(this);$.cswitch.load(container,html,speed,callback);};$.cswitch={load:function(c,h,speed,callback){h=$('<div id="from">'+h+'</html>');c.wrapInner('<div id="to"></div>');h.children().hide();$('<div id="from">'+h.html()+'</div>').prependTo(c);$("#to").children("#re-content-blacklayer").prependTo(c);h=$('#from');c=$('#to');cl=c.children("div").length;hl=h.children("div").length;$.cswitch.switchoff(c.children(":first"),speed);$.cswitch.switchto(h.children(":first"),speed);count=cl+hl;stoptime=hl;gc=0;$("#re-content").everyTime(400,function(i){if(gc>stoptime){stoptime=100;callback();}
if(gc>=count){$("#re-content").stopTime();$("#to").remove();$("#from").children(".re-content-element").appendTo($("#from").parent());$("#from").remove();}});},preperation:function(id){if($(id).find(".re-ref-element").length>0){$(id).addClass("re-ref-container");}
id.children(".inner_content").hide();},switchto:function(id,sp){$nextone=$(id).next();$(id).fadeIn(sp,function(){gc++;$.cswitch.switchto($nextone);});},switchoff:function(id,sp){$nexttone=$(id).next();$(id).fadeOut(sp,function(){gc++;$.cswitch.switchoff($nexttone);});}};})(jQuery);