addLoadEvent(sss);

var image = new Array;
var im_el = null;
var img = null;
var opacity = 0;
var loop = 0;
function sss()
{
	img = document.createElement("img");
	im_el = getElementsByClassName("image")[0];
	intro();
}
function intro()
{
	loop++;
	if(loop%3==0)
		num = 1;
	else
		if(loop%2==0)
			num = 3;
		else
			num = 2;
		
	image[0] = new Image();
	image[0].onload = draw;
	image[0].src = BASEURL+"system/application/images/intro"+num+".jpg";
}	
function draw()
{	
	img.src = image[0].src;
	img.style.opacity = 0;
	im_el.appendChild(img);
	setTimeout("animat()","2000");
}
function doAgain()
{
	im_el.style.background = "url("+img.src+") no-repeat top left";
	img.style.opacity = 0;
	opacity = 0;
	intro();
}
function animat()
{
	opacity = opacity+0.1;
	img.style.opacity = opacity;
	if(opacity<1)
		setTimeout("animat()","50");
	else
		doAgain();
}