// TOP NEWS

 function nextTop(topChg) {
  clearTimeout(timeoutTopNews);
  new Effect.Appear('topNewsContent',  {duration:0.5, from:1.0, to:0.0, afterFinish: function(effect) { chgTopNews(topChg) }});
 }

 function chgTopNews(topChg) {
  if(!topChg || topChg <0) akTop++;
  else akTop = (topChg-1);

  if(akTop > anzTop) {
   akTop = 0;
  }

  for(i = 1; i <= 5; i++) {
   if(i == akTop+1) $('newsTopBG'+(i)).style.backgroundImage = 'url(images/main/news-top-corner-over.jpg)';
   else $('newsTopBG'+i).style.backgroundImage = 'url(images/main/news-top-corner.jpg)';
  }

  $('topNewsPic').src = arrayBild[akTop];
  $('topNewsLink').innerHTML = "<a href=\""+arrayLink[akTop]+"\" title=\"Top-News zu &quot;"+arrayTitel[akTop]+"&quot;\"><strong>"+arrayTitel[akTop]+"</strong></a>";
  $('topNewsA').href = arrayLink[akTop];

  new Effect.Appear('topNewsContent',  {duration:0.5, from:0.0, to:1.0});
  timeoutTopNews = setTimeout(nextTop, 5000,'-1');
 }

// Last Articles

function fadeX(x) {
 clearTimeout(t);

 if(x == "-1") {
  if(ak == "action") id = "all";
  else if(ak == "rollenspiel") id = "action";
  else if(ak == "strategie") id = "rollenspiel";
  else if(ak == "hardware") id = "strategie";
  else if(ak == "simulation") id = "hardware";
  else if(ak == "preview") id = "simulation";
  else if(ak == "special") id = "preview";
  else if(ak == "all") id = "special";
 } else {
  if(ak == "action") id = "rollenspiel";
  else if(ak == "rollenspiel") id = "strategie";
  else if(ak == "strategie") id = "hardware";
  else if(ak == "hardware") id = "simulation";
  else if(ak == "simulation") id = "preview";
  else if(ak == "preview") id = "special";
  else if(ak == "special") id = "all";
  else if(ak == "all") id = "action";
 }

 if(id == 'all') $('articleRubrik').innerHTML = 'Alle';
 else $('articleRubrik').innerHTML = id.substr(0,1).toUpperCase()+id.substr(1);

 element = $('lastArticles').cleanWhitespace();
 element.makePositioned();

 new Effect.Appear(element, {duration:0.5, from:1.0, to:0.0, afterFinish: function(effect) {
  getPost(type[id], 'lastArticles', 'lastArticles', cates[id])
  t = setTimeout(fadeX, 7000, '1');
 }  });
 /*
 new Effect.Move(element, {x: -element.getWidth(),duration:1, afterFinish: function(effect) {
  getPost(type[id], 'lastArticles', 'lastArticles', cates[id])
  t = setTimeout(fadeX, 7000, '1');
 }  });
 */
// getPost(type[id], 'lastArticles', 'lastArticles', cates[id]);
 ak = id;
}
