var imgFile = new Array();

imgFile[0]="/img/pic1.png";
imgFile[1]="/img/pic2.png";
imgFile[2]="/img/pic3.png";
imgFile[3]="/img/pic4.png";
imgFile[4]="/img/pic5.png";
imgFile[5]="/img/pic6.png";

var image = 0;

var margintop = new Array();

margintop = Array(90, 75, 0, 0, 90, 0);
width = Array(401, 439, 464, 417, 289, 480);
height = Array(264, 275, 335, 361, 272, 356);

function main()
{
	setTimeout("photo_hide()", 5000);
}

function change_photo()
{
	image = (image == (imgFile.length - 1) ? 0 : (image + 1));
	document.getElementById('img0').style.marginTop = margintop[image] + 'px';
	document.getElementById('img0').width = width[image];
	document.getElementById('img0').height = height[image];
	document.getElementById('img0').src = imgFile[image];
	photo_show();
}

var i = 0;
function photo_hide()
{
	if (i != 10)
	{
		setElementOpacity(document.getElementById('img0'), ((10 - i) / 10));
		setTimeout('photo_hide()', 20);
		i++;
	}
	else
	{
		setElementOpacity(document.getElementById('img0'), 0);
		i = 1;
		change_photo();
	}
}

function photo_show()
{
	if (i != 10)
	{
		setElementOpacity(document.getElementById('img0'), i / 10);
		setTimeout('photo_show()', 20);
		i++;
	}
	else
	{
		setElementOpacity(document.getElementById('img0'), 1);
		i = 0;
		setTimeout('photo_hide()', 5000);
	}
}
