/* Obviously inspired by cornify.com */

var clickies = 2;
howDareYou = function() 
{
	var xPos = Math.random();
	var yPos = Math.random();
	
	var div = document.createElement('div');
	div.onclick = howDareYou;
	div.style.zIndex = Math.floor(9000 -  (xPos + (1 - yPos)) * 1000);
	div.style.position = 'fixed';
	div.style.left = Math.floor(xPos * 80) + '%';
		
	var windowHeight; 
	var de = document.documentElement;
	
	if (typeof(window.innerHeight) == 'number')
	{	
		windowHeight = window.innerHeight;
	} 
	else if (de && de.clientHeight)
	{	
		windowHeight = de.clientHeight;		
	}
	else
	{
		windowHeight = 768;	
	}
		
	div.style.top = Math.round(windowHeight * yPos * .90) + 'px';
		
	var img = document.createElement('img');
	img.setAttribute('src', 'http://nuclide.com/css/img/howdareyou/'
				+ Math.ceil(Math.random() * 5) + '.png');		
	document.getElementsByTagName('body')[0].appendChild(div);
	div.appendChild(img);
	
	document.getElementById("HeaderTextBubble").src = 'http://nuclide.com/css/img/howdareyou/bubbles/'
				+ Math.min(clickies++, 3) + '.png';

	if (clickies == 25)
	{
		document.body.style.backgroundImage = 'url(http://nuclide.com/css/img/rainblow.gif)';
		document.body.style.backgroundRepeat = "repeat";
	}
}