var ie = document.all?true:false;

window.onload = loaded;

var featuresheader = new Array('dennis1.jpg', 'dennis2.jpg', 'dennis3.jpg');
var indexh = rand(featuresheader.length);

function getElement(id){
	return document.getElementById(id);
}

function loaded(e){

	playFeaturesHeader();
	
	if(getElement('feature1')){
		playFeaturesLeft(true);
		playFeaturesRight(true);
	}
}

function playFeaturesLeft(first){	
	if(first){
		move('feature1_info', 0, 92);
	}

	if(index == featuresleft.length) index = 0;

	path = 'http://www.brandnewparty.nl/gallery/djdolphin.nl/gallery/large/';

	feat = getElement('feature1');

	feat.style.backgroundImage = 'url('+path+featuresleft[index]+')';
	new Effect.Appear(feat);
	window.setTimeout('new Effect.Fade(feat);', 4000);
	window.setTimeout('playFeaturesLeft(false);', 5200);

	index++;
}

function playFeaturesRight(first){	
	if(first){
		move('feature2_info', 0, 92);
	}

	if(indexr == featuresright.length) indexr = 0;

	path = 'http://www.brandnewparty.nl/gallery/djdolphin.nl/gallery/large/';

	feat2 = getElement('feature2');

	feat2.style.backgroundImage = 'url('+path+featuresright[indexr]+')';
	new Effect.Appear(feat2);
	window.setTimeout('new Effect.Fade(feat2);', 6000);
	window.setTimeout('playFeaturesRight(false);', 7300);

	indexr++;
}

function playFeaturesHeader(){	

	path = '/images/header/features/';
	feath = getElement('feature');
		
	if(indexh == featuresheader.length) indexh = 0;
	feath.src = path+featuresheader[indexh];
	
	new Effect.Appear(feath);
	window.setTimeout('new Effect.Fade(feath);', 7000);
	window.setTimeout('playFeaturesHeader();', 8300);

	indexh++;
}


function move(div, posx,posy){
	new Effect.Move(div, {x: posx, y: posy, mode: 'absolute', transition: Effect.Transitions.sinoidal});
}

function rand(n){
  return ( Math.floor ( Math.random ( ) * n) );
}