NUMSPOTS = 20;
//spots = new Array(NUMSPOTS);
nextspot = 0;
nexttype = 0;

NUMSIZES = 6;
sizes = new Array("100%","150%","200%","300%","450%","600%");
colrs = new Array("#2c67c7","#5181d0","#7d9cd9","#a8b5e2","#d4d0eb","#e8ecf4");
showedLarge = false;

checkCount = 0;
checkThres = 50;
checkInter = 50;
checkMaxMove = 4;

var isIE = /*@cc_on!@*/false;


function clickspot (spot) {
}

function clickback (event) {
	var posx = 0;
	var posy = 0;
	//document.getElementById("stuff").innerHTML = event.clientX+","+event.clientY;
	posx = event.clientX; posy = event.clientY;
	//auf einem Spot?
	onspot = -1;
	for (i=0;i<NUMSPOTS;i++) {
		elem = document.getElementById("spot"+i);
		ex = parseInt(elem.style.left); ey = parseInt(elem.style.top);
		//ew = elem.style.width; eh = elem.style.pixelHeight;
		//s2.innerHTML += ex+","+ey+": "+ew+"x"+eh+"<br/>";
		if (ex-10<=posx && posx<=ex+10
		 && ey-15<=posy && posy<=ey+15 ) {
			//document.getElementById("stuff").innerHTML = elem.style.fontSize;
			for (j=0;j<NUMSIZES;j++) {
				if (elem.style.fontSize==sizes[j]) {
					if (j+1==NUMSIZES) {
						elem.style.fontSize=sizes[0];
						elem.style.color   =colrs[0];
					}	else {
						elem.style.fontSize=sizes[j+1];
						elem.style.color   =colrs[j+1];
					}
					break;
				}
			}
			onspot=i;
			break;
		}
	}
	if (onspot<0) { //nein
		elem = document.getElementById("spot"+nextspot);
		if (elem) {
			elem.style.display = '';
			elem.style.color = 'red';
			elem.style.left = posx-8;
			elem.style.top = posy-10;
			elem.style.fontSize = sizes[0];
			elem.style.color    = colrs[0];
			nextspot++;
			if (nextspot>=NUMSPOTS) nextspot=0;
		}
	}
	checkCount = 0;
}


function drop () {
	dy = Math.round((checkCount-checkThres)/5); if (dy>checkMaxMove) dy=checkMaxMove; if (dy<1) dy=1;
	/*
	countOnTop = 0;
	for (i=0;i<NUMSPOTS;i++) {
		elem = document.getElementById("spot"+i);
		if (elem) {
			y = parseInt(elem.style.top);
			if (y>0) {
				y-=dy; if (y<0) y=0;
				elem.style.top = y+"px";
			} else countOnTop++;
		}
	}
	if (countOnTop==NUMSPOTS) {
		for (i=0;i<NUMSPOTS;i++) {
			elem = document.getElementById("spot"+i);
			if (elem) {
				x = parseInt(elem.style.left);
				if (x>0) {
					x-=dy; if (x<0) x=0;
					elem.style.left = x+"px";
					if (x==0) elem.style.color="transparent";
				}
			}
		}
	}
	*/
	for (i=0;i<NUMSPOTS;i++) {
		elem = document.getElementById("spot"+i);
		if (elem) {
			y = parseInt(elem.style.top);
			if (y>0) {
				y-=dy; if (y<0) y=0;
				elem.style.top = y+"px";
			} else {
				x = parseInt(elem.style.left);
				if (x>0) {
					x-=dy; if (x<0) x=0;
					elem.style.left = x+"px";
				} else {
					if (isIE) elem.style.color="white"; else elem.style.color="transparent";
				}
			}
		}
	}
}

function checkTime () {
	checkCount++;
	if (checkCount>checkThres) drop();
	setTimeout ("checkTime()",checkInter);
}

function bewegt (event) {
	checkCount = 0;
}

/*
function taste (event) {
	elem = document.getElementById("spot"+nexttype);
	if (elem) {
		elem.innerHTML = event.which;
	}
	nexttype++; if (nexttype>=NUMSPOTS) nexttype=0;
}
*/

setTimeout ("checkTime()",checkInter);

