var item=0;
var a=0;
var alpha=0;
var blinkalpha=0;

function blinkup(f) {
	alpha += 0.1;
	alpha = (Math.round(alpha*10))/10;

	document.getElementById('button'+f+'-blink').style.opacity = alpha;
	document.getElementById('button'+f+'-blink').style.MozOpacity = alpha;
	document.getElementById('button'+f+'-blink').style.KhtmlOpacity = alpha;
/*	document.getElementById('button'+f+'-blink').style.filter = "alpha(opacity="+(alpha*100)+")";
IE has a bug when displaying PNGs with opacity filter (even at 100%!) so I've disabled this feature for IE*/

	if (alpha>=1) {
		alpha=1;
		clearInterval(blinkalpha);
		a=f;
		setTimeout("blinkalpha = setInterval('blinkdown(a)',10);",500);
	}
}


function blinkdown(f) {
	alpha -= 0.1;
	alpha = (Math.round(alpha*10))/10;

	document.getElementById('button'+f+'-blink').style.opacity = alpha;
	document.getElementById('button'+f+'-blink').style.MozOpacity = alpha;
	document.getElementById('button'+f+'-blink').style.KhtmlOpacity = alpha;
/*	document.getElementById('button'+f+'-blink').style.filter = "alpha(opacity="+(alpha*100)+")";
*/

	if (alpha<=0) {
		alpha=0;
		clearInterval(blinkalpha);
		blinkoff(f);
	}
}


function blinkon(f) {
	a=f;

	alpha=0;
	document.getElementById('button'+f+'-blink').style.opacity = alpha;
	document.getElementById('button'+f+'-blink').style.MozOpacity = alpha;
	document.getElementById('button'+f+'-blink').style.KhtmlOpacity = alpha;
/*	document.getElementById('button'+f+'-blink').style.filter = "alpha(opacity="+(alpha*100)+")";
*/
	document.getElementById('button'+f+'-blink').style.visibility = 'visible';

	blinkalpha = setInterval('blinkup(a)',10);
}


function blinkoff(f) {
	document.getElementById('button'+f+'-blink').style.visibility = "hidden";	
	blink();
}

function doblink(f) {
	blinkon(f);
}


function blink() {
	var rand=(Math.round(Math.random()*2000))+1100;
	item=Math.round(Math.random()*5)+1;

//	if (item!=selected && item!=a) {
	if (item!=a) {
		var startblink=setTimeout('doblink(item);',rand);
	} else {
		blink();
	}
}


function start() {
	document.getElementById('header-blink').style.display = "block";
	document.getElementById('contactback').style.visibility = "hidden";
	blink();
}