basex = -2;
arrayIntervals = new Array();
characters = new Array('stoning','beer','and','partying','REPEAT','drugs','stoning','beer','and','BASS','REPEAT','drugs','stoning','beer','and','partying','REPEAT','drugs','stoning','beer','and','high','as','fuck','party','as','fuck','COME TO','TRILOBIT','COPYPARTY','2013!','!');
changeCharacter = function() {
	cci++;
	if(cci == characters.length-2) {
		clearInterval(arrayIntervals[0]);
	}
	text.textContent = characters[cci];
	console.log();
	text.setAttribute('x',basex-(1.1*text.textContent.length)*(text.textContent=="as"?0.5:1.0)*(text.textContent=="REPEAT"||text.textContent=="COME TO"||text.textContent=="COPYPARTY"?1.4:1.0)*(text.textContent=="COPYPARTY"?1.1:1.0));
	oi = 20;
	oscOpacityInterval = setInterval(oscOpacity, 20);
}
oscOpacity = function() {
	oi--;
	if(oi<0) {
		clearInterval(oscOpacityInterval);
	}
	text.setAttribute('opacity',oi/20);
	flash.setAttribute('opacity',oi/20);
}
beginDrawRect = function() {
	console.log('draw rect');
	arrayIntervals.push(setInterval(drawRect, 20));
}
beginDrawCircle = function() {
	console.log('draw circle');
	arrayIntervals.push(setInterval(drawCircle, 20));
}
drawRect = function() {
	ri++
	rect.setAttribute('x',-ri/6);
	rect.setAttribute('y',-ri/9);
	rect.setAttribute('width',ri*2/6);
	rect.setAttribute('height',ri*2/9);
}
drawCircle = function() {
	ci++
	circle.setAttribute('r',ci/10);
	if(ci == 86) {
		clearInterval(arrayIntervals[2]);
	}
}
drawSwastika = function() {
	console.log('draw swastika');
	swastika.appendChild(path);
}
function init(evt) {
	console.log('swastika begin');
	swastika = document.getElementById('swastika');
	rect = document.getElementById('rect');
	circle = document.getElementById('circle');
	path = document.getElementById('path');
	text = document.getElementById('text');
	flash = document.getElementById('flash');
	ri = ci = cci = 0;
	arrayIntervals.push(setInterval(changeCharacter, 224));
	setTimeout(beginDrawRect,1920);
	setTimeout(beginDrawCircle,3720);
	setTimeout(drawSwastika,6980);
}
