
	// SQF:HAM Cost Comparison Calculator v 1.0. Coyright 2003 Teras Kasi Order All rights reserved.
	// Stephen C. Hiraoka schiraoka@hotmail.com
	function calcSkillCosts() {
		// TK Skills Cost Calculations and Fields Updates		
		var thisNum = 100000/65
		var hamCost = new Array (69)
		//  Health              Action           Mind
				// Berserk
				hamCost[0]=90;      hamCost[1]=60;   hamCost[2]=5;
				// Intimidate
				hamCost[3]=80;      hamCost[4]=60;   hamCost[5]=10;
				// Taunt
				hamCost[6]=50;      hamCost[7]=50;   hamCost[8]=75;
				// Warcry
				hamCost[9]=160;    hamCost[10]=90;  hamCost[11]=10;
				// UAH1
				hamCost[12]=6;      hamCost[13]=9;   hamCost[14]=6;
				// Lunge1 | Stun | Blind | Spin1
				hamCost[15]=9;       hamCost[16]=13;  hamCost[17]=9;
				// UAH2 | Dizzy
				hamCost[18]=12;     hamCost[19]=18;  hamCost[20]=12;
				// KD1 | Combo1
				hamCost[21]=15;     hamCost[22]=22;  hamCost[23]=15;
				// BodyHit | LegHit
				hamCost[24]=18;     hamCost[25]=27;  hamCost[26]=18;
				// Spin2 | Combo2 | HeadHit
				hamCost[27]=20.667; hamCost[28]=31;  hamCost[29]=20.667;
				// KD2
				hamCost[30]=24;     hamCost[31]=36;  hamCost[32]=24;
				// Hit3
				hamCost[33]=26.667; hamCost[34]=40;  hamCost[35]=26.667;
				// Center of Being
				hamCost[36]=50;     hamCost[37]=100; hamCost[38]=150;
				
  for (var ia=1; ia<=2; ia++) {
	  if (ia==1) {var is=""}
		else if (ia==2) {var is="b"}
		for (var ib=0; ib<=13; ib++) {
			var hCount = ib*3
			var aCount = (ib*3)+1
			var mCount = (ib*3)+2
			
			var hBase = hamCost[hCount]
			var aBase = hamCost[aCount]
			var mBase = hamCost[mCount]
			
			var sStat = parseInt(document.getElementById("sStat" + ia).value)
			var qStat = parseInt(document.getElementById("qStat" + ia).value)
			var fStat = parseInt(document.getElementById("fStat" + ia).value)
				
			var hStep = thisNum/hBase
			var aStep = thisNum/aBase
			var mStep = thisNum/mBase
			
			var hTotal = (hBase-0.555)-(sStat/hStep)
			var aTotal = (aBase-0.555)-(qStat/aStep)
			var mTotal = (mBase-0.555)-(fStat/mStep)
				
			// Begin rounding check and correct
			var hRound = Math.round(hTotal)
			var aRound = Math.round(aTotal)
			var mRound = Math.round(mTotal)
		
			var hCheck = hTotal-hRound
			var aCheck = aTotal-aRound
			var mCheck = mTotal-mRound
				
			if (hCheck > 0.444444444444444 && hCheck < 0.5) {
				hTotal = hRound + 0.5
			}
			if (aCheck > 0.444444444444444 && aCheck < 0.5) {
				aTotal = aRound + 0.5
			}
			if (mCheck > 0.444444444444444 && mCheck < 0.5) {
				mTotal = mRound + 0.5
			}
			// End rounding check and correct
			
			document.getElementById("hSkill" + (ib+1) + is).value = Math.round(hTotal)
			document.getElementById("aSkill" + (ib+1) + is).value = Math.round(aTotal)
			document.getElementById("mSkill" + (ib+1) + is).value = Math.round(mTotal)
		}
	}
}