// ---------------------------------------------- 
// ---------- THIS FILE IS COPYRIGHTED! --------- 
// CONSTRUCTED BY TISTSIDE-PROJECTS FOR RACMC.DE! 
// ---------------------------------------------- 

// ------------------------------------------ 
// Index.html: preloader for all images       

url	= "willkommen.html";

progress= new Array("images/00_design/background.jpg",
"images/00_design/left.jpg",
"images/00_design/logo.jpg",
"images/01_willkommen/content_box.gif",
"images/01_willkommen/foto1.jpg",
"images/02_kinderschminken/content_box.gif",
"images/03_bodypainting/content_box.gif",
"images/04_team/content_box.gif",
"images/05_referenzen/content_box.gif",
"images/06_kontakt/content_box.gif",
"images/06_kontakt/email.jpg");

x	= 0;
p	= new Array();
t	= new Array();
opi	= (navigator.userAgent.indexOf("Opera"));
opv	= (navigator.appVersion.charAt(0));

function preload()
{
 	for(i=0;i<progress.length;i++)
	{
		if(opi>-1)
		{
			p[i] 		= new Image();
			p[i].src	= progress[i];
			t[i]		= false;
		}
		else
		{
			p[i] 		= new Image();
			p[i].onabort 	= update;
			p[i].onerror 	= update;
			p[i].onload  	= update;
			p[i].src	= progress[i];
		}
	}
	if(opi>-1) operaLoad();
}

function operaLoad()
{
	r=setTimeout("operaLoad()",0);
	for(i=0;i<p.length;i++)
	{
		if(t[i]==false&&p[i].complete)
		{
			t[i]	= true;
			x++;
			pro	= Math.floor((x/progress.length)*100);

			if(document.all)
			document.all["balken"].style.left=(-200)+(pro*2);
			else if(document.getElementById)
			document.getElementById("balken").style.left=(-200)+(pro*2);

			if(opi<0 && opv<=6)
			{
				(document.all) ?
				dom=document.all["loadausgabe"] :
				dom=document.getElementById("loadausgabe");
				dom.innerHTML= x+" von "+progress.length+" Bildern geladen.<br>"+pro+" %";
			}
		}
	}
	if(pro==100)
	{
		clearTimeout(r);
		location.href=url;
	}
}

function update()
{
	x++;
	pro=Math.floor((x/progress.length)*100);

	if(document.all)
	document.all["balken"].style.left=(-200)+(pro*2);
	else if(document.getElementById)
	document.getElementById("balken").style.left=(-200)+(pro*2);

	(document.all) ?
	dom=document.all["loadausgabe"] :
	dom=document.getElementById("loadausgabe");
	dom.innerHTML= +pro+" % geladen";

	if(pro==100) location.href=url;
}

