var showtimer;
var testbild=new Array(9);

function start_intro()
{for (i=0; i<5; i++) {testbild[i]=new Image(); testbild[i].onerror=skip;}
 testbild[0].src="bg/main.jpg";
 testbild[1].src="gif/raa-schatten.jpg";
 testbild[2].src="gif/raa-logo.gif";
 testbild[3].src="gif/raa-text.gif";
 testbild[4].src="bg/bluebar.gif";
 showtimer=setTimeout("wait()",200);}

function wait()
{var komplett=true;
 for (i=0; i<5; i++) {komplett=komplett&&testbild[i].complete;}
 if (komplett) {window.onresize=show_on; show_foto(0);}
 else showtimer=setTimeout("wait()",500);}

function show_foto(n)
{if (n<8)
 {document.images[foto[n].name].src=fotopfad+foto[n].quelle+".jpg";
  showtimer=setTimeout("show_foto("+(n+1)+")",180);}
 else show_text(0);}

function show_text(n)
{if (n<8)
 {button[foto[n].button].off.src=pfad+button[foto[n].button].name+".gif";
  button[foto[n].button].on.src=pfad+button[foto[n].button].name+".gif";
  document.images[button[foto[n].button].name].src=button[foto[n].button].off.src;
  showtimer=setTimeout("show_text("+(n+1)+")",180);}
 else {preload_button(); preload_task(); finish_intro();}}

//function show_sponsor()
//{document.images[document.images.length-2].src=pfad+"xenos-logo.gif";
 //document.images[document.images.length-1].src=pfad+"eu.gif";}

function preload_button()
{for (i=0; i<12; i++)
 {button[i].off.src=pfad+button[i].name+".gif";
  button[i].on.src=pfad+button[i].name+"-on.gif";}}

function finish_intro()
{for (i=6; i<10; i++) {testbild[i]=new Image(); testbild[i].onerror=skip;}
 //testbild[5].src="gif/xenos-logo.gif";
 testbild[6].src="gif/xenos-on.gif";
 testbild[7].src="gif/sitemap-on.gif";
 testbild[8].src="gif/kontakt-on.gif";
 testbild[9].src="gif/brief-on.gif";
 showtimer=setTimeout("wait_again()",200);}

function wait_again()
{var komplett=true;
 for (i=6; i<10; i++) {komplett=komplett&&testbild[i].complete;}
 if (komplett) preload_foto();
 else showtimer=setTimeout("wait_again()",1000);}

function preload_foto()
{for (i=0; i<8; i++) foto[i].xl.src=fotopfad+foto[i].quelle+"-xl.jpg";}

function skip()
{clearTimeout(showtimer); window.onresize=show_on;
 show_on(); preload_button(); preload_task(); setTimeout("preload_foto()",2000);}

function show_on()
{for (i=0; i<8; i++)
 {document.images[button[foto[i].button].name].src=pfad+button[foto[i].button].name+".gif";
  document.images[foto[i].name].src=fotopfad+foto[i].quelle+".jpg";}
 show_sponsor();}
