function writeChar(i) {
	if (chars[i].used==true) {
		if (chars[i].mount!=0 && chars[i].mount<36) {
			wr('<TR><TD VALIGN="top"><B>'+ chars[i].type +'</B><BR>'+ mounts[chars[i].mount].name +'<FONT SIZE=-1>'+ chars[i].equip +'</FONT></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].m +'</B><BR>'+ mounts[chars[i].mount].m +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].ws +'</B><BR>'+ mounts[chars[i].mount].ws +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].bs +'</B><BR>'+ mounts[chars[i].mount].bs +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].s +'</B><BR>'+ mounts[chars[i].mount].s +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].t +'</B><BR>'+ mounts[chars[i].mount].t +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].w +'</B><BR>'+ mounts[chars[i].mount].w +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].i +'</B><BR>'+ mounts[chars[i].mount].i +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].a +'</B><BR>'+ mounts[chars[i].mount].a +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].ld +'</B><BR>'+ mounts[chars[i].mount].ld +'</TD>')
		}
		else if (chars[i].mount>35) {
			wr('<TR><TD VALIGN="top"><B>'+ chars[i].type +'</B><BR>'+ mounts[chars[i].mount].name +'<BR>'+ mounts[chars[i].mount].amountB +' '+ mounts[chars[i].mount].beasts.name +'<FONT SIZE=-1>'+ chars[i].equip +'</FONT></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].m +'</B><BR>'+ mounts[chars[i].mount].m +'<BR>'+ mounts[chars[i].mount].beasts.m +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].ws +'</B><BR>'+ mounts[chars[i].mount].ws +'<BR>'+ mounts[chars[i].mount].beasts.ws +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].bs +'</B><BR>'+ mounts[chars[i].mount].bs +'<BR>'+ mounts[chars[i].mount].beasts.bs +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].s +'</B><BR>'+ mounts[chars[i].mount].s +'<BR>'+ mounts[chars[i].mount].beasts.s +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].t +'</B><BR>'+ mounts[chars[i].mount].t +'<BR>'+ mounts[chars[i].mount].beasts.t +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].w +'</B><BR>'+ mounts[chars[i].mount].w +'<BR>'+ mounts[chars[i].mount].beasts.w +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].i +'</B><BR>'+ mounts[chars[i].mount].i +'<BR>'+ mounts[chars[i].mount].beasts.i +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].a +'</B><BR>'+ mounts[chars[i].mount].a +'<BR>'+ mounts[chars[i].mount].beasts.a +'</TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].ld +'</B><BR>'+ mounts[chars[i].mount].ld +'<BR>'+ mounts[chars[i].mount].beasts.ld +'</TD>')
		}
		else {
			wr('<TR><TD VALIGN="top"><B>'+ chars[i].type +'</B><FONT SIZE=-1>'+ chars[i].equip +'</FONT></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].m +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].ws +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].bs +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].s +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].t +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].w +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].i +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].a +'</B></TD>')
			wr('<TD ALIGN="center" VALIGN="top"><B>'+ chars[i].ld +'</B></TD>')
		}
		wr('<TD><BR></TD>')
		wr('<TD VALIGN="top">'+ chars[i].magic +'<BR></TD>')
		wr('<TD ALIGN="center">'+ chars[i].cost +'</TD>')
	}
}
function printArmy(cha, mon) {
	p=window.open("", "printWindow", "status,menubar,scrollbars=yes")
	wr('<TABLE BORDER=1><TR><TH WIDTH=230>Models/Unit</TH><TH WIDTH=25>M</TH><TH WIDTH=25>WS</TH>'+
	'<TH WIDTH=25>BS</TH><TH WIDTH=25>S</TH><TH WIDTH=25>T</TH><TH WIDTH=25>W</TH><TH WIDTH=25>I</TH>' +
	'<TH WIDTH=25>A</TD><TH WIDTH=25>Ld</TH><TH WIDTH=35>Save</TH><TH WIDTH=150>Notes/Magic Items</TH><TH WIDTH=75>Points</TH>')
	for (i=0; i<cha; i++) {
		if (i>10 && i<21) { continue }
		writeChar(i)
	}
	for (i=0; i<11; i++) {
		if (units[i].used==true) {
			if (units[i].mount!=0) {
				wr('<TR><TD VALIGN="top"><B>'+ units[i].amount +' '+ units[i].type +'</B><BR>'+ mounts[units[i].mount].name +'<FONT SIZE=-1>'+ units[i].equip +'</FONT>')
				if (units[i].stand==true) { wr('<BR>Standard') }
				if (units[i].music==true) { wr('<BR>Musician') }
				wr('</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].m +'</B><BR>'+ mounts[units[i].mount].m +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].ws +'</B><BR>'+ mounts[units[i].mount].ws +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].bs +'</B><BR>'+ mounts[units[i].mount].bs +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].s +'</B><BR>'+ mounts[units[i].mount].s +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].t +'</B><BR>'+ mounts[units[i].mount].t +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].w +'</B><BR>'+ mounts[units[i].mount].w +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].i +'</B><BR>'+ mounts[units[i].mount].i +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].a +'</B><BR>'+ mounts[units[i].mount].a +'</TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].ld +'</B><BR>'+ mounts[units[i].mount].ld +'</TD>')
			}
			else {
				wr('<TR><TD VALIGN="top"><B>'+ units[i].amount +' '+ units[i].type +'</B><FONT SIZE=-1>'+ units[i].equip +'</FONT>')
				if (units[i].stand==true) { wr('<BR>Standard') }
				if (units[i].music==true) { wr('<BR>Musician') }
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].m +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].ws +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].bs +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].s +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].t +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].w +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].i +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].a +'</B></TD>')
				wr('<TD ALIGN="center" VALIGN="top"><B>'+ units[i].ld +'</B></TD>')
			}
			wr('<TD><BR></TD>')
			wr('<TD VALIGN="top">'+ units[i].banner +'<BR></TD>')
			wr('<TD ALIGN="center">'+ units[i].cost +'</TD>')
			writeChar(i+10)			
		}
	}
	printMachine()
	for (i=1; i<mon; i++) {
		if (mUnits[i].amount>0) {
			wr('<TR><TD><B>'+ mUnits[i].amount +' '+ mUnits[i].type +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].m +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].ws +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].bs +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].s +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].t +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].w +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].i +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].a +'</B></TD>')
			wr('<TD ALIGN="center"><B>'+ mUnits[i].ld +'</B></TD>')
			wr('<TD><BR></TD><TD><BR></TD>')
			wr('<TD ALIGN="center">' + mUnits[i].cost +'</TD>')
		}
	}
	if (document.armyT.moreSpace.checked==true) {
		wr('<TR><TD><BR><BR><BR><BR><BR><BR><BR><BR></TD>')
		wr('<TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD>')
	}
	wr('<TR><TD COLSPAN=12 ALIGN="right"><B>Total:</B></TD>')
	wr('<TD ALIGN="center"><B>'+ document.armyT.armyTotal.value +'</B></TD>')
	wr('</TABLE>')
}
