var step=0
var string1 = "Test"
var string2
var string3
var string4
var string5
var string6
var string7
var endString ="\\end{array}"
var string0 = string1+endString

function writeEqn(){
   if (step == 0){
     string1 = "\\begin{array}{rcl}\\lim_{\\theta\\rightarrow 0}\\frac{1-\\cos \\theta}{\\theta}&=&\\lim_{\\theta\\rightarrow 0}\\frac{1-\\cos \\theta}{\\theta}\\cdot\\frac{1+\\cos \\theta}{1+\\cos \\theta}\\\\"
     string0 = string1+endString
     step = 1
   }
   else { if (step == 1) {
     string2 = "&=&\\lim_{\\theta\\rightarrow 0}\\,\\frac{1-\\cos^2 \\theta}{\\theta(1+\\cos \\theta)}\\\\"
     string0 = string1+string2+endString
     step=2
   }
   else { if (step == 2) {
     string3 = "&=&\\lim_{\\theta\\rightarrow 0}\\,\\frac{\\sin^2\\theta}{\\theta(1+\\cos \\theta)}\\\\"
     string0 = string1+string2+string3+endString
     step=3
   }
   else { if (step == 3) {
     string4 = "&=&\\lim_{\\theta\\rightarrow 0}\\,\\frac{\\sin\\theta}{\\theta}\\cdot\\frac{\\sin\\theta}{1+\\cos \\theta}\\\\"
     string0 = string1+string2+string3+string4+endString
     step=4
   }
   else { if (step == 4) {
     string5 = "&=&\\lim_{\\theta\\rightarrow 0}\\,\\frac{\\sin\\theta}{\\theta} \\cdot \\lim_{\\theta\\rightarrow 0}\\,\\frac{\\sin\\theta}{1+\\cos \\theta}\\\\"
     string0 = string1+string2+string3+string4+string5+endString
     step=5
   }   
   else { if (step == 5) {
     string6 = "&=&1\\cdot \\frac{\\sin\\, 0}{1+\\cos\\, 0}\\, =\\, 0\\\\"
     string0 = string1+string2+string3+string4+string5+string6+endString     
     step=6
     document.derivative.Continue.value="Done!"
   }
   }}}}}
}
