//Coding and design Copyright 2001 Matthew Barr matthewbarr@hotmail.com
var han = 0
var leia = 0
var threepio = 0
var palpatine = 0
var vader = 0
var obiwan = 0
var artoo = 0
var luke = 0
var jabba = 0
var chewie = 0
var yoda = 0
var lando = 0
var fett = 0

//These increment each character total
function incHan(points)  { 
        han+=points
        }

function incLeia(points)  {
        leia+=points
        }

function incThreepio(points)  { 
        threepio+=points
        }

function incPalpatine(points)  { 
        palpatine+=points
        }

function incVader(points)  { 
        vader+=points
        }

function incObiwan(points)  { 
        obiwan+=points
        }

function incArtoo(points)  { 
        artoo+=points
        }

function incLuke(points)  { 
        luke+=points
        }

function incJabba(points)  { 
        jabba+=points
        }

function incChewie(points)  { 
        chewie+=points
        }

function incYoda(points)  { 
        yoda+=points
        }

function incLando(points)  { 
        lando+=points
        }

function incFett(points)  { 
        fett+=points
        }


//This determines which character has the highest score
function compute(form) {
	var nHighest=0
      var sHighest

	if (nHighest<han){
		nHighest=han
		sHighest='Han Solo'
	}
	
        if (nHighest<leia){
		nHighest=leia
		sHighest='Princess Leia'
	}
	
	if (nHighest<threepio){
		nHighest=threepio
		sHighest='Threepio'
	}
	
	if (nHighest<palpatine){
		nHighest=palpatine
		sHighest='Emperor Palpatine'
	}
	
	if (nHighest<vader){
		nHighest=vader
		sHighest='Darth Vader'
	}
	
	if (nHighest<obiwan){
		nHighest=obiwan
		sHighest='Obi Wan Kenobi'
	}
	
	if (nHighest<artoo){
		nHighest=artoo
		sHighest='Artoo'
	}
	
	if (nHighest<luke){
		nHighest=luke
		sHighest='Luke Skywalker'
	}
	
	if (nHighest<jabba){
		nHighest=jabba
		sHighest='Jabba the Hutt'
	}
	
	if (nHighest<chewie){
		nHighest=chewie
		sHighest='Chewbacca'
	}
	
	if (nHighest<yoda){
		nHighest=yoda
		sHighest='Yoda'
	}
	
	if (nHighest<lando){
		nHighest=lando
		sHighest='Lando Calrissian'
	}
	
	if (nHighest<fett){
		nHighest=fett
		sHighest='Boba Fett'
	}

	resultsWindow(sHighest)
}


function resetForm(){
	location='index.htm'
	han = 0
	leia = 0
	threepio = 0
	palpatine = 0
	vader = 0
	obiwan = 0
	artoo = 0
	luke = 0
	jabba = 0
	chewie = 0
	yoda = 0
	lando = 0
	fett = 0
	nHighest = 0
	
}

function resultsWindow(sHighest){
	switch(sHighest){
		case 'Han Solo':
			location='han.htm';break;
		case 'Princess Leia':
			location='leia.htm';break;
		case 'Threepio':
			location='threepio.htm';break;
		case 'Emperor Palpatine':
			location='palpatine.htm';break;
		case 'Darth Vader':
			location='vader.htm';break;
		case 'Obi Wan Kenobi':
			location='obiwan.htm';break;
		case 'Artoo':
			location='artoo.htm';break;
		case 'Luke Skywalker':
			location='luke.htm';break;
		case 'Jabba the Hutt':
			location='jabba.htm';break;
		case 'Chewbacca':
			location='chewie.htm';break;
		case 'Yoda':
			location='yoda.htm';break;
		case 'Lando Calrissian':
			location='lando.htm';break;
		case 'Boba Fett':
			location='fett.htm';break;
		default:
			location='index.htm'
		}
}