//Coding and design Copyright 2001 Matthew Barr matthewbarr@hotmail.com
var abe = 0
var apu = 0
var barney = 0
var bart = 0
var edna = 0
var hibbert = 0
var homer = 0
var krusty = 0
var lisa = 0
var maggie = 0
var marge = 0
var moe = 0
var mrburns = 0
var ned = 0
var sideshowbob = 0
var skinner = 0
var smithers = 0
var wiggum = 0
var willie = 0

//These increment each character total
function incAbe(points)  { 
        abe+=points
        }

function incApu(points)  { 
        apu+=points
        }

function incBarney(points)  { 
        barney+=points
        }

function incBart(points)  { 
        bart+=points
        }

function incEdna(points)  { 
        edna+=points
        }

function incHibbert(points)  { 
        hibbert+=points
        }

function incHomer(points)  { 
        homer+=points
        }

function incKrusty(points)  { 
        krusty+=points
        }

function incLisa(points)  {
        lisa+=points
        }

function incMaggie(points)  { 
        maggie+=points
        }

function incMarge(points)  { 
        marge+=points
        }

function incMoe(points)  { 
        moe+=points
        }

function incMrburns(points)  { 
        mrburns+=points
        }

function incNed(points)  { 
        ned+=points
        }

function incSideshowbob(points)  { 
        sideshowbob+=points
        }

function incSkinner(points)  { 
        skinner+=points
        }

function incSmithers(points)  {
        smithers+=points
        }

function incWiggum(points)  { 
        wiggum+=points
        }

function incWillie(points)  { 
        willie+=points
        }


//This determines which character has the highest score
function compute(form) {
	var nHighest=0
      var sHighest

	if (nHighest<abe){
		nHighest=abe
		sHighest='Abe'
	}
	
        if (nHighest<apu){
		nHighest=apu
		sHighest='Apu'
	}
	
	if (nHighest<barney){
		nHighest=barney
		sHighest='Barney'
	}
	
	if (nHighest<bart){
		nHighest=bart
		sHighest='Bart'
	}
	
	if (nHighest<edna){
		nHighest=edna
		sHighest='Edna'
	}
	
	if (nHighest<hibbert){
		nHighest=hibbert
		sHighest='Hibbert'
	}
	
	if (nHighest<homer){
		nHighest=homer
		sHighest='Homer'
	}
	
	if (nHighest<krusty){
		nHighest=krusty
		sHighest='Krusty'
	}
	
	if (nHighest<lisa){
		nHighest=lisa
		sHighest='Lisa'
	}

	if (nHighest<maggie){
		nHighest=maggie
		sHighest='Maggie'
	}
	
        if (nHighest<maggie){
		nHighest=maggie
		sHighest='Maggie'
	}
	
	if (nHighest<marge){
		nHighest=marge
		sHighest='Marge'
	}
	
	if (nHighest<moe){
		nHighest=moe
		sHighest='Moe'
	}
	
	if (nHighest<mrburns){
		nHighest=mrburns
		sHighest='Mr Burns'
	}
	
	if (nHighest<ned){
		nHighest=ned
		sHighest='Ned'
	}
	
	if (nHighest<sideshowbob){
		nHighest=sideshowbob
		sHighest='Sideshow Bob'
	}
	
	if (nHighest<skinner){
		nHighest=skinner
		sHighest='Skinner'
	}
	
	if (nHighest<smithers){
		nHighest=smithers
		sHighest='Smithers'
	}
	
	if (nHighest<wiggum){
		nHighest=wiggum
		sHighest='Wiggum'
	}
	
	if (nHighest<willie){
		nHighest=willie
		sHighest='Willie'
	}

	resultsWindow(sHighest)
}


function resetForm(){
	location='index.htm'
	abe = 0
	apu = 0
	barney = 0
	bart = 0
	edna = 0
	hibbert = 0
	homer = 0
	krusty = 0
	lisa = 0
	maggie = 0
	marge = 0
	moe = 0
	mrburns = 0
	ned = 0
	sideshowbob = 0
	skinner = 0
	smithers = 0
	wiggum = 0
	willie = 0
	nHighest = 0
	
}

function resultsWindow(sHighest){
	switch(sHighest){
		case 'Abe':
			location='abe.htm';break;
		case 'Apu':
			location='apu.htm';break;
		case 'Barney':
			location='barney.htm';break;
		case 'Bart':
			location='bart.htm';break;
		case 'Edna':
			location='edna.htm';break;
		case 'Hibbert':
			location='hibbert.htm';break;
		case 'Homer':
			location='homer.htm';break;
		case 'Krusty':
			location='krusty.htm';break;
		case 'Lisa':
			location='lisa.htm';break;
		case 'Maggie':
			location='maggie.htm';break;
		case 'Marge':
			location='marge.htm';break;
		case 'Moe':
			location='moe.htm';break;
		case 'Mr Burns':
			location='mrburns.htm';break;
		case 'Ned':
			location='ned.htm';break;
		case 'Sideshow Bob':
			location='sideshowbob.htm';break;
		case 'Homer':
			location='homer.htm';break;
		case 'Skinner':
			location='skinner.htm';break;
		case 'Smithers':
			location='smithers.htm';break;
		case 'Wiggum':
			location='wiggum.htm';break;
		case 'Willie':
			location='willie.htm';break;
		default:
			location='index.htm'
		}
}