var activepic = 1;
function overButton(el){	
	var number = el.id.replace('button','');
	if(activepic != number){	
		$('fadepic'+activepic).tween('opacity',[1,0]);
		
		activepic = number;
		
		$('button1').className = 'button';
		$('button2').className = 'button';
		$('button3').className = 'button';
		$(el.id).className = 'button button_on';
		
		var image = $('fadepic'+number);
		image.tween('opacity',[1,0]);
		image.tween('opacity',[0,1]);
		
		$('playlink').href = $('link'+activepic).href;
	}
}
function goto_nextButton(){
	if(activepic == 1){
		overButton(document.getElementById('button2'));
	}
	else if(activepic == 2){
		overButton(document.getElementById('button3'));		
	}
	else if(activepic == 3){
		overButton(document.getElementById('button1'));
	}
}

var intval = '';
function startFader(){
	intval = window.setInterval("goto_nextButton()", 3000);	
}
function stopFader(){
	if(intval != ''){
		window.clearInterval(intval);
		intval = '';
	}
}
