if (mobile) {
	canvas.width = window.innerWidth;
	canvas.height = window.innerHeight;
	
	$("menu").style.visibility= "hidden";
	canvas.style.border = "none";
	
	fps = 50;
}
else {
	canvas.width = 500;
	canvas.height = 500;
	
	fps = 30;
}

function init() {
	paused = false;
	gameOver = false;
	frames = 0;
	
	// mouse/finger
	m.x = 0;
	m.y = 0;
	m.c = false;
	
	// trail
	t.x = [0];					// x coordinate
	t.y = [0];					// y coordinate
	t.lim = mobile ? 10 : 15;	// max number of trail nodes
	t.s = 0;					// score
	
	// house
	h.sx = canvas.width/2;		// spin x coordinate
	h.sy = canvas.height/2;		// spin y coordinate
		
	h.x = canvas.width/2;
	h.y = canvas.height/2;
		
	h.v = rand(0, d2r(5));
	h.a = rand(0, d2r(360));
	h.ro = canvas.width / 7.5;
	h.r = 20;
	h.c = "rgba(255, 0, 0, 0.3)";
	
	// enemies
	n.x = [];
	n.y = [];
	n.dx = [];
	n.dy = [];
	n.r = [];	// radius
	n.c = [];	// color
	n.k = 0;	// kills
	n.t = [];	// type
	
	used_tm = 0;
	
	gameOverTimes = 0; // prevent from sending game over and over again
	
	d = new Date();
	start_time = d.getTime();
	
	fixPos();
	draw_interval = setInterval(draw, 1000 / fps);
}

/*
var webappCache = window.applicationCache;

webappCache.addEventListener("updateready", function() {
	webappCache.swapCache()
}, false);
*/

init();

