function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}



function addR()
{
tempBin = readCookie('ra');
tempBin = tempBin * 1 + 10;
createCookie('ra', tempBin ,'1');
tempBin = readCookie('page');
tempBin++;
createCookie('page', tempBin ,'1');
window.location='' + tempBin * 1 + '.html';
}

function addI()
{
tempBin = readCookie('ide');
tempBin = tempBin * 1 + 10;
createCookie('ide', tempBin ,'1');
//alert('I created a cookie it has the value :' + tempBin);
tempBin = readCookie('page');
tempBin++;
createCookie('page', tempBin ,'1');
window.location='' + tempBin + '.html';
}

function addG()
{
tempBin = readCookie('gu');
tempBin = tempBin * 1 + 10;
createCookie('gu', tempBin ,'1');
//alert('I created a cookie it has the value :' + tempBin);
tempBin = readCookie('page');
tempBin++;
createCookie('page', tempBin ,'1');
window.location='' + tempBin + '.html';

}

function addA()
{
tempBin = readCookie('ar');
tempBin = tempBin * 1 + 10;
createCookie('ar', tempBin ,'1');
//alert('I created a cookie it has the value :' + tempBin);
tempBin = readCookie('page');
tempBin++;
createCookie('page', tempBin ,'1');
window.location='' + tempBin + '.html';
}

function addFinalR()
{
tempBin = readCookie('ra');
tempBin = tempBin * 1 + 10;
createCookie('ra', tempBin ,'1');
ScoreIt()
}

function addFinalI()
{
tempBin = readCookie('ide');
tempBin = tempBin * 1 + 10;
createCookie('ide', tempBin ,'1');
//alert('I created a cookie it has the value :' + tempBin);
ScoreIt()
}

function addFinalG()
{
tempBin = readCookie('gu');
tempBin = tempBin * 1 + 10;
createCookie('gu', tempBin ,'1');
//alert('I created a cookie it has the value :' + tempBin);
ScoreIt()

}

function addFinalA()
{
tempBin = readCookie('ar');
tempBin = tempBin * 1 + 10;
createCookie('ar', tempBin ,'1');
//alert('I created a cookie it has the value :' + tempBin);
ScoreIt()
}

function ScoreIt()
{
ar = readCookie('ar');
ra = readCookie('ra');
ide = readCookie('ide');
gu = readCookie('gu');
if (ra == gu) ra++;
if (ra == ar) ra++;
if (ra == ide) ide++;
if (gu == ar) gu++;
if (gu == ide) gu++;
if (ide == ar) ide++;

if (ra > ar  && ra > gu && ra > ide)
{
window.location="general.html";
}

if (ar > ra  && ar > gu && ar > ide)
{
window.location="artist.html";
}

if (gu > ra  && gu > ar && gu > ide)
{
window.location="guard.html";
}

if (ide > ra  && ide > ar && ide > gu)
{
window.location="ide.html";
}
}
