var Interval=Class.create();Interval.prototype={initialize:function(b,e,c){if(typeof b=="function"){var a=0;var d=window.setInterval(function(){try{b();}catch(f){}if(++a==(c||1)){window.clearInterval(d);}},(e||5)*1000);}}};var CHANGE_INTERV=6;var SPRING=false;var AJAX_EFFECT=1500;var Heading=new Array();var Details=new Array();var Links=new Array();var IMGs=new Array();var anzahl=0;var active=1;var hier=0;var inWork=true;var i_done=1;document.observe("dom:loaded",function(){new Ajax.Updater("slide_content","slide.php",{method:"get",onSuccess:function(d){$("slide_content").innerHTML=d.responseText;$$('ul[class="bild"]').each(function(e){var f=IMGs.length;Heading[f]=e.select('[title="Heading"]')[0].innerHTML;Details[f]=e.select('[title="Details"]')[0].innerHTML;Links[f]=e.select('[title="Links"]')[0].innerHTML;IMGs[f]=e.select('[title="IMG"]')[0].innerHTML;e.parentNode.removeChild(e);});anzahl=IMGs.length;for(var b=1;b<=Heading.length;b++){if(Links[b-1].length>0){var a=document.createElement("a");a.id="link"+b;a.href=Links[b-1]||"#";a.rel="lightbox[]";a.target="_blank";var c=document.createElement("img");c.id="img"+b;c.src="blank.gif";c.alt="Erline IT";a.appendChild(c);$("outer").appendChild(a);$("img"+b).addClassName("bilder");}else{var c=document.createElement("img");c.id="img"+b;c.src="blank.gif";c.alt="Erline IT";$("outer").appendChild(c);$("img"+b).addClassName("bilder");}}loadImg();setTimeout(function(){init();},AJAX_EFFECT);$("next").observe("click",function(){next();});$("prev").observe("click",function(){prev();});if(CHANGE_INTERV){startNEXTperiod();}}});});function startNEXTperiod(){new PeriodicalExecuter(function(a){next();if(check_pos_direction()=="prev"){a.stop();startPREVperiod();}},CHANGE_INTERV);}function startPREVperiod(){new PeriodicalExecuter(function(a){prev();if(check_pos_direction()=="next"){a.stop();startNEXTperiod();}},CHANGE_INTERV);}function Move(d,a,c,b){if(b){new Effect.Move(d,{x:a,y:c,transition:Effect.Transitions.spring});}else{new Effect.Move(d,{x:a,y:c});}}function prev(){if(active>1&&inWork==false){inWork=true;if(active==2){Move($("outer"),250,0,SPRING);}else{Move($("outer"),174,0,SPRING);}new Effect.Morph($("img"+active.toString()),{style:"height: 117px; width: 230px; margin-top: 35px;",duration:0.8});active--;hier=active+2;if(hier<=anzahl){new Effect.Morph($("img"+hier.toString()),{style:"height: 78px; width: 154px; margin-top: 65px;",duration:0.5});}hier=active-1;if(hier>=1){new Effect.Morph($("img"+hier.toString()),{style:"height: 117px; width: 230px; margin-top: 35px;",duration:0.8});}new Effect.Morph($("img"+active.toString()),{style:"height: 156px; width: 307px; margin-top: 15px;",duration:0.5});showData();buttons();setTimeout(function(){inWork=false;},850);}return false;}function next(){if(active<anzahl&&inWork==false){inWork=true;if(active==1){Move($("outer"),-250,0,SPRING);}else{Move($("outer"),-174,0,SPRING);}new Effect.Morph($("img"+active.toString()),{style:"height: 117px; width: 230px; margin-top: 35px;",duration:0.8});active++;hier=active-2;if(hier>=1){new Effect.Morph($("img"+hier.toString()),{style:"height: 78px; width: 154px; margin-top: 65px;",duration:0.5});}hier=active+1;if(hier<=anzahl){new Effect.Morph($("img"+hier.toString()),{style:"height: 117px; width: 230px; margin-top: 35px;",duration:0.5});}new Effect.Morph($("img"+active.toString()),{style:"height: 156px; width: 307px; margin-top: 15px;",duration:0.5});showData();buttons();setTimeout(function(){inWork=false;},850);}return false;}function showData(){$("heading").fade({duration:0.2,from:1,to:0.1});$("details").fade({duration:0.2,from:1,to:0.1});setTimeout(function(){$("heading").innerHTML=Heading[active.toString()-1];$("details").innerHTML=Details[active.toString()-1];$("heading").appear({duration:0.4});$("details").appear({duration:0.4});},205);}function buttons(){if(active==1){$("prev").fade({duration:0.5,from:1,to:0.2});}else{$("prev").appear({duration:0.5});}if(active==anzahl){$("next").fade({duration:0.5,from:1,to:0.2});}else{$("next").appear({duration:0.5});}}function check_pos_direction(){if(active==1){return"next";}if(active==anzahl){return"prev";}}function init(){Move($("outer"),260,0,SPRING);new Effect.Morph($("img"+active.toString()),{style:"height: 156px; width: 307px; margin-top: 15px; ",duration:0.5});hier=active+1;new Effect.Morph($("img"+hier.toString()),{style:"height: 117px; width: 230px; margin-top: 35px;",duration:0.5});showData();buttons();setTimeout(function(){inWork=false;},550);}function loadImg(){$("img"+i_done.toString()).fade({duration:0.3,from:1,to:0.1});setTimeout(function(){$("img"+i_done.toString()).src=IMGs[i_done-1];$("img"+i_done.toString()).appear({duration:0.5});$("img"+i_done.toString()).alt=Heading[i_done-1];if(Links[i_done-1].length>0){$("link"+i_done.toString()).href=Links[i_done-1]||"#";}i_done++;if(i_done<=anzahl){loadImg();}},310);}
