
var imageArray = new Array(
"portfolio/loading.gif",
"pics_mood/CRW_0987.jpg",
"pics_mood/CRW_1453.jpg",
"pics_mood/CRW_1432.jpg",
"pics_mood/CRW_1469.jpg",
"pics_mood/CRW_1501.jpg",
"pics_mood/CRW_1443.jpg",
"pics_mood/CRW_0980.jpg",
"pics_mood/_N2E2844.jpg",
"pics_mood/_N2E2494.jpg",
"pics_mood/_N2E3147.jpg",
"pics_mood/CRW_1062.jpg",
"pics_mood/CRW_1077.jpg",
"pics_mood/CRW_1494.jpg",
"pics_mood/_N2E0934.jpg",
"pics_mood/_N2E0967.jpg",
"pics_mood/_N2E0962.jpg",
"pics_mood/_N2E0868.jpg",
"pics_mood/_N2E4996-01.jpg",
"pics_mood/_N2E4992-01.jpg",
"pics_mood/_N2E5048-01.jpg",
"pics_mood/_N2E3152b.jpg",
"pics_mood/_N2E0867.jpg",
"pics_mood/_N2E5051-01.jpg",
"pics_mood/CRW_1511.jpg",
"pics_mood/_N2E2496.jpg",
"portfolio/copyright.png"
);

/***************************************************************************************
Copyright (C) 2001 ab_ditto
This script is made by and copyrighted to ab_ditto at back.to/ab or ab_ditto@hotmail.com
This may be used freely as long as this msg is intact!
date:2001-09-30

Slightly modified by Roberto Chaves. Center image, flickerfix for firefox...
***************************************************************************************/
ImageWidth=500; //set this to the width of your widest pic
ImageHeight=420; //... and this to the height of your highest pic
BackgroundColor="#ffffff"; //set this to the background color you want to use for the slide-area

sdur=3; //time to show a pic between fades in seconds
fdur=1; //duration of the complete fade in seconds
steps=20; //steps to fade from on pic to the next
startwhen=1;
// "startwhen" leave it at "null" to start the function by calling it from your page by link
// or set it to 1 to start the slide automatically as soon as the images are loaded
//*****nothing more to do, have fun :)
//**************************************************************************************
ftim=fdur*1000/steps;
stim=sdur*1000;
NumImages=imageArray.length;

for(i=0; i<imageArray.length; i++)
{
	theid="img"+i;
	document.write("<div id='"+theid+"'><img src='"+imageArray[i]+"' border='0'></img></div>");
}
document.write("<style type='text/css'>");

for(b=0; b<NumImages; b++)
{
	thestylid="img"+b;
	thez=1;
	thevis='hidden';
	if(b<1)
	{
		thez=2;
		thevis='visible';
	}

	// Get windows size	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' )
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	// Calculate center position
	ImageLeftPos=myWidth/2-ImageWidth/2;
	ImageTopPos=50;
	
	document.write("#"+thestylid+" {position:absolute; left:"+ImageLeftPos+"px; top:"+ImageTopPos+"px; width:"+ImageWidth+"px; height:"+ImageHeight+"px; background-color:"+BackgroundColor+"; layer-background-color:"+BackgroundColor+"; visibility:"+thevis+"; z-index:"+thez+";}");
}
document.write("</style>");

function myfade()
{
	PicArray = new Array();
	for(a=0; a<=NumImages; a++)
	{
		ImgID="img"+a;
		paktImgID=document.getElementById(ImgID);
		ie5exep=new Array(paktImgID);
		PicArray=PicArray.concat(ie5exep);
	}
	i=1;
	u=0;
	slide(i);
}
	
function slide(numa)
{
	ptofade = PicArray[numa-1];
	if(numa<=NumImages)
	{
		pnext=PicArray[numa];
	}
	if(numa==NumImages)
	{
//		pnext=PicArray[1]; // start from pic#2 (skip loading when looping)
		window.location = 'eng_portfolios.html';
	}

	pnext.style.visibility = "visible";
	pnext.style.filter = "Alpha(Opacity=100)";
	pnext.style.MozOpacity = .99;
	ptofade.style.filter = "Alpha(Opacity=100)";
	ptofade.style.MozOpacity = .99;
	factor = 100/steps;
	slidenow();
}

function slidenow()
{
	check1=ptofade.style.MozOpacity;
	maxalpha = (100 - factor*u)/100*105;
//	if(check1<=maxalpha/100)
	if(check1<maxalpha/100)
	{
		u=u+1;
	}
	curralpha = 100 - factor*u;
	ptofade.style.filter = "Alpha(Opacity="+curralpha+")";
	ptofade.style.MozOpacity = curralpha/100;

	if(u<steps)
	{
		window.setTimeout("slidenow()",ftim);
	}
	if(u>=steps && i<NumImages)
	{
		ptofade.style.visibility = "hidden";
		ptofade.style.zIndex = 1;
		pnext.style.zIndex = 2;
		i=i+1;u=0;
		window.setTimeout("slide(i)",stim);
	}
	
	if(u>=steps && i>=NumImages)
	{
		ptofade.style.visibility = "hidden";
		ptofade.style.zIndex = 1;
		pnext.style.zIndex = 2;
		i=1;u=0;
		window.setTimeout("slide(i)",stim);
	}
}

function dostart()
{
	window.setTimeout("myfade()", stim);
}
onload=dostart;

