var time;
var timerID = null;
var timerRunning = false;
var delay = 100;

function startTimer(id,pixels,side) {
    // Set the length of the timer, in milliseconds
	time = 500;
	a = id;
	b = pixels;
	c = side;
	//alert(a+" "+b+" "+c);
	StopTheClock();
	StartTheTimer(a,b,c);
};

function stopTimer() {
	StopTheClock();
};

function StopTheClock() {
	if(timerRunning) {
		clearTimeout(timerID);
	};
	timerRunning = false;
};

function StartTheTimer(aa,bb,cc) {
	if (time<=0) {
		StopTheClock();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
		//alert(aa+" "+bb+" "+cc);

//		moveDiv(aa,bb,cc);
		hideAll();
	} else {
		//alert(aa+" "+bb+" "+cc);
		a = aa;
		b = bb;
		c = cc;
		time = time - delay;
		timerRunning = true;
		timerID = self.setTimeout("StartTheTimer(a,b,c)", delay);
	};
};


//TIMER 2
var time2;
var timerID2 = null;
var timerRunning2 = false;
var delay2 = 100;

function startTimer2(id,pixels,side) {
    // Set the length of the timer, in milliseconds
	time2 = 500;
	a2 = id;
	b2 = pixels;
	c2 = side;
	//alert(a+" "+b+" "+c);
	StopTheClock2();
	StartTheTimer2(a2,b2,c2);
};

function stopTimer2() {
	StopTheClock2();
};

function StopTheClock2() {
	if(timerRunning2) {
		clearTimeout(timerID2);
	};
	timerRunning2 = false;
};

function StartTheTimer2(aa,bb,cc) {
	if (time2<=0) {
		StopTheClock2();
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
		//alert(aa+" "+bb+" "+cc);

		moveDiv(aa,bb,cc);
//		hideAll();
	} else {
		//alert(aa+" "+bb+" "+cc);
		a2 = aa;
		b2 = bb;
		c2 = cc;
		time2 = time2 - delay2;
		timerRunning2 = true;
		timerID2 = self.setTimeout("StartTheTimer2(a2,b2,c2)", delay2);
	};
};
