function LineOne()
{
document.write("<h3>STEP 4. Enter the names of the taxa - e.g. species - for your key down the left side of the table. <br>")
document.write("<br>STEP 5. Indicate presence, absence or ambiguity - indicated by the question mark - for each character state for each taxon.<br></h3>")

document.write("<TR><TD>Taxa</TD>")
{
for (y=1; y <= w; y++)
{
document.write("<TD>Char # "+y+"</TD>")
}}
document.write("</TR>")
}



function MakeTable()

{
x=1;
y=1;
z=document.forms.Params.TaxaNumber.value;
w=document.forms.Params.CharNumber.value;
CharList();
document.write("<center><FORM NAME='DataSeta'><INPUT TYPE='text' NAME='dataset' value='The Name of Your Data Set' size = '100'></center></Form><br>")
document.write("<FORM NAME = 'TaxaTable'><TABLE border='2'>");
{
LineOne();
{ 
for (x=1; x <= z; x++)
{
document.write("<TR><TD><INPUT TYPE='text' NAME='T"+x+"' value='Taxon # "+x+"'></TD>");
chars();
document.write("<TD><INPUT TYPE='text' NAME='L"+x+"' value='Link for Taxon # "+x+"'></TD></TR>");
}}}
document.write("<script language='JavaScript' src='sliksmaker.js'></script>")
document.write("</TABLE></FORM>")
document.write("<h3>STEP 6. If you have links - such as to images or web pages - for each taxon, put them in the links boxes at the right side of the table.")
document.write(" If a link is to an image that will be in the same folder as the key files when you run it, you can just put the filename - e.g. planta_alba.jpg -")
document.write(" but if you want to link to another website, you must put in the entire URL - e.g. http://www.stingersplace.com/images/GFG000361.jpg</h3>")
document.write("<h3>Taxon links are required. If you leave the original text in the box without a link, by default the program will link to Google images.</h3>")
document.write("<font size = '-1'>Hint: You can use URLs of the form: <PRE> http://plants.usda.gov/java/nameSearch?keywordquery=poa+annua&mode=sciname</PRE> and just replace the poa+annua with your species name, and it will go to a PLANTS database profile.</font>")
document.write("<h3><br>STEP 7. Hit the - Make the Input File - button below.</h3><br>");
document.write("<FORM><input value='Make the Input File' onClick='MakeFile()' type='button'></form>");
}

function chars()
{
for (y=1; y <= w ; y++)
{
document.write("<TD><input type='radio' value='1' name='T"+x+"C"+y+"'>Present<br>")
document.write("<input type='radio' value='2' checked name='T"+x+"C"+y+"'>Absent<br>")
document.write("<input type='radio' value='?' name='T"+x+"C"+y+"'>?<br></TD>")
}
}


function CharList()
{
y=1;
var h=document.forms.Params.CharNumber.value;
document.write("<h3>STEP 2. Fill in the character states in the list below. Their numbers will correspond to the character numbers in the main table below.</h3>");
document.write("<h3>Character links are optional. Please leave the original text in the box if you are not using a link. In the link box you can just put the name of a file that illustrates the character if the file will be in the same folder as SLIKS when the program runs -  alternatively, you can link to any image or web page on the internet - remember to include the whole URL including http:// etc.</h3>");
document.write("<font size = '-1'>Hint: remember that using the Lookup button in SLIKS automatically shows a definition on Google for any term that you highlight anywhere in the key, but you can also have the character link to Google images as well using the URL form <PRE> http://images.google.com/images?hl=en&q=opposite+leaves </PRE> in which you replace opposite+leaves with your character state name.")

document.write("<FORM NAME = 'CharTable'><TABLE>");
{
for (y=1; y <= h; y++)
{
document.write("<TR><TD>"+y+". <INPUT TYPE='text' NAME='char' value='Character State # "+y+"'></TD><TD><INPUT TYPE='text' NAME='link' value='Link for Char State # "+y+"'></TD></TR>");
}}
document.write("</TABLE></FORM><br>");
document.write("<h3>STEP 3. Enter the name of your data set in the box indicated. This name will appear as the centered title when your key runs in SLIKS.<br></h3>");
}




function MakeMatrix()
{
t=0;
var ta = document.forms[2].length;
document.write("var items=[[\"")
for (t=0; t < ta; t++)
{
p=document.forms[2][t].name
pp=document.forms[2][t].value
ppp=document.forms[2][t].type
pppp=document.forms[2][t].checked

{
if ((ppp == 'text') && (p.indexOf("L") != 0 ))
{
document.write("\"],<br>[\""+pp);
j=pp;
k=j.replace(' ','+');
}
if ((ppp == 'text') && (p.indexOf("L") == 0 ) && (pp.indexOf("#") == 15))
{
document.write("\",\"http://images.google.com/images?hl=en&q="+k+"")
}
if ((ppp == 'text') && (p.indexOf("L") == 0 ) && (pp.indexOf("#") != 15))
{
document.write("\",\""+pp)
}
ddd = eval(pppp);
if ((ppp == 'radio') && (ddd == true))
{
document.write("\",\""+pp)
}}}
document.write("\"]]")
}


function MakeFile()
{
ch = (document.forms.CharTable.length -1);
document.write("<H3>STEP 8. Select everything BELOW the dotted line and hit Ctrl-C.<br><br>STEP 9. Open Notepad - it is Usually under ACCESORIES in your program files menu.<br><br> STEP 10. Put your cursor in the notepad window and hit Ctrl-V.<br><br>STEP 11. Save the file with the .JS extension - e.g. SLIKS.js - and make sure that the file is in the same folder with your other SLIKS files.<br> <br><center>...............................................................................</h3></center>")
document.write("var dataset = \"&#060B>&#060center>"+ document.forms.DataSeta.dataset.value +"&#060/center>&#060/B>\"")
document.write("<br>")
document.write("var binary = 1")
document.write("<br>")
document.write("var chars = [[\"Latin Name\"]")
q=0;
for (q=0; q < ch; q++)
{
u = (q+1);
uu=document.forms.CharTable[q].value
uuu=document.forms.CharTable[q].name
ud=document.forms.CharTable[u].value
if ((uuu == 'char') && (ud.indexOf('#') != 20)) 
{
document.write(",<br>[\"&#060A href='"+ud+"' target = '_blank'&#062"+uu+"&#060/A&#062\",\"yes\",\"no\"]")
}
if ((uuu == 'char') && (ud.indexOf('#') == 20))
{
document.write(",<br>[\""+uu+"\",\"yes\",\"no\"]");
}
}
document.write("]<br><br>");
MakeMatrix()
}






