
//================
function raglanDirections(){

    raglanCalcs();
	
    patternWindow= window.open('','rowStitch','toolbar=yes, location=yes, scrollbars=yes, resizable=yes, width=400, height=500, left=0,top=0')
    patternWindow.document.write("<HTML><HEAD><\/HEAD><BODY><H1>Knitting Directions For Seamless Knit Raglan Sweater.</H1>")
    patternWindow.document.writeln("Knit bottom to top. <br> Author: Lucia Liljegren.<br>")
    
    // intro
    stuff="These directions were created based on user supplied information entered in a design form for my pattern generator located at  "+ window.location.href +" on "+ currentDate +" .  Additional information, including schematics, on the design page and a number of supporting web pages. I advise you print out the design form for your records. Code and general sweater design by Lucia Liljegren, <i>The  Knitting Fiend.<\/i> ";
    
stuff +='<br>'+ p.tooFewStitches.value;
    
    patternWindow.document.writeln(stuff); stuff="";
    
    // Preliminaries
    stuff+="<hr><h2>Preliminaries<\/h2>";
	stuff+="<br> Size is "+misses + " "+ missesSize +".   Print out the design web page for further details. <P> You must achieve both the row and stitch gauge or your sweater may not fit and the yardage estimate will be incorrect.   I advise double checking your gauge as you knit.  ";

	stuff+="Stitch Gauge: "+ mainStIn +" st/inch; "+  mainRowIn +" row/inch in whatever pattern you picked as your main stitch pattern <em>after</em> you wash, dry and block the swatch. ";
	
	stuff += shrinks;
	
	
	    stuff+="<p><b>Materials:</b> To knit the main portion of the sweater, you will need circular needles in several lengths with the same diameter you used to knit your swatch.  You may also need double pointed needles to work the sleeves.  I recommend using smaller diameter needles to knit the trim on the cuffs and hem; I use 2 sizes smaller.  The directions suggest using 'appropriate' diameter needles to cast on.  I cast on tightly, so I use my larger diameter needles to cast on. If you cast on loosely, use the smaller needles to cast on. You must determine which diameter is most appropriate for your knitting style.<p>An estimate for the amount of yarn you need appears at the end of the pattern. ";  

if(trimStitch=="rib"){	
	oneByOneRib="1 x 1 rib";
	firstRow="then repeat (p1, k1)";
	}
else {
	oneByOneRib = "garter stitch"; 
	firstRow="then knit all stitches"; 
	}

 stuff+="<p>Option The program consistently suggests you knit "+oneByOneRib+"  for the trim. You may substitute <em>any</em> non curling stitch pattern, including rib, garter or seed stitch.";    
 
    patternWindow.document.writeln(stuff);stuff="";
    
     // ============ Sleeves
    stuff = "<h2>Sleeves<\/h2>";
    stuff+= "<ol><li>Cast On: Using appropriate  needles, cast on " + castOnCuffP1 + " stitches. Using smaller diameter circular needle or a set of double pointed needles, knit cuffs in "+oneByOneRib+".  Begin by slipping first stitch, then "+firstRow+" until only one stitch remains on working needle.  Slip the final stitch.  To join, place tips together, check that the knitting is not twisted. Slip the stitch on the right hand tip onto the left hand needle, k2 together. "+ castOnCuff + " stitches remaining in round.  Place a stitch marker <em> before<\/em> the stitch you just formed to indicate beginning of a round. The knit stitch after the stitch  marker will be a 'fake seam', and is neither on the front nor back of the sleeve.  <\/li>";
    stuff+= "<li>Rib: Knit in "+oneByOneRib+ " until work  measures "+ Math.round(mult(p.cuffTrim.value,lengthBeforeRatio)*10)/10 + " inches from cast on, finishing at the end of the round. Hang a row marker somewhere on this row. (I recommend you try on the cuff and test fit before continnuing to knit the sleeve.)<\/li>";
    stuff+= "<li>On next round, change to larger diameter needles and knit all stitches. Increase " +   incCuff + " stitches evenly over  " + castOnCuff +" stitches.  There are now "+ cuffStitches +" stitches on the needle.  Begin knitting in pattern stitch of your choice. (Notes: I recommend making sure the 'fake seam' stitch is always knit in stockinette, no matter what the stitch pattern because sweaters fold better along a knit ridge rather than a purl bump.  However, this is optional.  Also, if you are clever and know how to increase and establish your stitch pattern at the same time,  you can knit this row in your pattern stitch.  )<\/li>";  
    stuff+= "<li>Hang a row marker under the row you just knit. You will use this to measure the length of the sleeve below the yoke.</li> ";
    stuff+= "<li>Work " +fastIncSleeve+ " rounds ending at stitch  marker.  <\/li>"; 
    stuff+= "<li>You will now increase " + incSleeveStitches + " stitches over " + printIncRowsSleeve + " rows by periodically working increase rounds as follows: Slip marker, Knit 1 stitch (this is the fake seam stitch), k1, m1, work until 1 stitch remains in round, m1, k1.  (Note: 'm1' stands for 'make 1'; it's an increase; you are working them on either side three stitches, with the 'fake sema' in the middle.)<\/li>"; 
    if(0 < fastTimes){
	stuff+= "<li>Do the following " +fastTimes+ " times: **Work one increase round.  Work "+ fastIncSleeve +" rounds even. **  (There should be "+stitchesAfterFast+" stitches on the needle. )<\/li> "; }
    if(0 < slowTimes){
	stuff+= "<li>Do the following " +slowTimes+ " times: **Work one increase round.   Work "+ slowIncSleeve +" rounds even. ** <\/li> "; }  
	
	lengthFromCastOn=sleeveLengthToUnderarmM1+eval(p.cuffTrim.value);
	
    stuff+= "<li>There should be " +bicepStitches + " stitches on the needle. Work even in pattern stitch until sleeve  measures " + Math.round(mult(sleeveLengthToUnderarmM1,lengthBeforeRatio)*10)/10 +" inches from end of rib. (If your row gauge is correct, there will be a total of  "+rowsSleeve +" rounds in worked in pattern stitch up to the armhole. The length from the cast on should be "+Math.round(mult(lengthFromCastOn,lengthBeforeRatio)*10)/10  +" inches";
	
	if(lengthBeforeRatio != 1){
		stuff+= "; after you wash the sweater, the length from the cast on to this point will be "+ Math.round(lengthFromCastOn*10)/10 + " inches";
	}
	
	stuff+= ". )<\/li> "; 
    stuff+= "<li>If you are knitting a decorative stitch pattern, note the row number in the pattern sequence. You will want to make sure both sleeves and body end on the same row.<\/li>";
    stuff+= "<li>Slip stitch marker, knit "+firstSleeveYoke+"  stitches, bind off "+ halfUnderArmStitches + " stitches, drop marker, bind off "+ halfUnderArmStitchesP1 + " stitches. (The second bind off includes the fake seam stitch.  The bound off stitches should be symmetric around the fake seam.)  <\/li> ";  
    stuff+= "<li>Put sleeves on a stitch holder, keeping round marker in place.  <\/li> ";  
    stuff+= "<\/ol>";
    patternWindow.document.writeln(stuff);stuff="";

   
    //  Front =========================================================================
    
    stuff = "<h2>Body<\/h2>";
	stuff = "Worked back and forth. However, I advise using circular needles because there are a lot of stitches. Although it's a matter of preference, I've organized so the first row you knit is the right side facing row, and there are two 'seam' stitches, between the front and back. These will be knit (as opposed to purled) when the right side is facing. ";
    
    stuff+= "<ol><li>Cast On: Using appropriate  needles, cast on " + castOnBody + " stitches. <\/li>";
    
	stuff+= "<li>Rib: Begin right side facing. Work "+ oneByOneRib +" (i.e. "+ k1p1 +" Note, the first row is a 'right side facing' row, and begins and ends with a "+  firstStitch + " )<\/li><li>Place a total of four markers as follows: Count over "+ halfCastOnFront +" stitches from the tip of one needle. Place a marker on both sides of the next stitch to mark the seam stitch,. (Note that the seam stitch should be a knit stitch when the right side is facing.)  Repeat on the other side.  There should be "+sub(castOnBack,1) + " stitches back between the markers. <\/li>";
	
	stuff+= "<li>Work even until ribbing  measures "+Math.round(mult(p.bodyTrim.value,lengthBeforeRatio)*10)/10   + " inches from cast on. <\/li>";
      stuff+= "<li>On next right side facing row, change to larger diameter needles and begin working in stockinette (that is, knit all stitches on right side, purl all stitches on wrong side.) ";
	  
	  if( (0<incBack) || (0< halfIncFront) ){
	  		
// I need to adjust to leave a "seam" stitch.		
	    stuff+= "While working this row, increase " + halfIncFront  + " stitches evenly over the first " + halfCastOnFront +" stitches.   Place a stitch marker. Knit 1 (this is the seam stitch.), place a stitch marker.  Increase " + incBack + " stitches evenly over the remaining "+ sub(castOnBack,1) +" stitches.  Place a stitch marker. k1, place marker, increase " + halfIncFront + " stitches evenly over the first " + halfCastOnFront +" stitches. There are now "+ halfBodyFront +" stitches on each front and "+ bodyBackM1  + " stitches between back markers plus the two seam stitches. ";}
		
		else{
			stuff+= "Knit " + halfBodyFront+ " stitches, place a stitch marker, knit " + bodyBack + " stitches. Knit " + halfBodyFront + " stitches. You have reached the end of the row.";
		}
		
		 stuff+= "<\/li>";
      stuff+= "<li>Hang a row marker under the row you just knit. You will use this to measure length.</li>";
	  
	  lengthFromCastOn= lengthToUnderarm-lengthOneRow + eval(p.bodyTrim.value);
	  
      stuff+= "<li>Work all stitches in row using pattern stitch of your choice until work measures "+ Math.round(mult(lengthToUnderarm-lengthOneRow,lengthBeforeRatio)*10)/10 +" inches from the end of rib (which is the beginning of the main stitch pattern).  If your row gauge is correct, there will be "+ rowsToUnderArm +" rounds between the ribbing and underarm. The length from the cast on should be "+Math.round(mult(lengthFromCastOn,lengthBeforeRatio)*10)/10 +" inches.<\/li>";
      stuff+= "<li>If you are knitting a complicated stitch pattern, note the row number in the pattern sequence. You will want to make sure the sleeves and body end on the same row. Knit an extra row if necessary.<\/li>";

     stuff+= "<li>Slip stitch marker. Knit the fake seam stitch, knit "  +  frontYoke  +"  stitches. Bind off "+halfUnderArmStitches+" stitches, drop stitch marker, bind off "+halfUnderArmStitchesP1+" stitches (including the fake seam stitch); knit "+ backYoke+"  stitches, bind off "+halfUnderArmStitches+" stitches, drop stitch marker, bind off "+halfUnderArmStitchesP1+" stitches; knit to end of row. <li>  Place front stitches and back stitches on separate stitch holders or on separate circular needles. <\/li>";

    stuff+= "<\/ol>";
    patternWindow.document.writeln(stuff);stuff="";  
      
// Yoke
  stuff = "<h2>Yoke<\/h2>";
  stuff+= "<b>Discussion:</b>";
  stuff+= "<ol><li>The yoke will be approximately "+ Math.round(10*frontArmholeDepth)/10 + " inches deep measured at the center of the sleeve <em>after you wash the sweater<\/em> ";
  
 if(lengthBeforeRatio !=1){stuff+= ", but "+ Math.round(10*mult(frontArmholeDepth,lengthBeforeRatio))/10 + " inches deep before you wash the sweater";}
  
  stuff+= ". This will require you to knit approximately "+ ragRows+ " rows.  Double check your row gauge before proceeding, if it's off, the armhole depth will be off."; 
  stuff+= "<li><b>Note</b>: You will need to begin shaping the neckline before you finish the raglan shaping.  So, read ahead, and make sure you start when you need to.  <\/li>";
  stuff+= "<li>You will shape the raglan by alternating reduction rounds and plain rounds.   <ol style='list-style-type: lower-alpha;'><li> Reductions rounds are worked as follows: Begin 2 stitches <em>before</em> reaching back right shoulder shoulder marker. Then, (K2tog,  slip marker,  SSK, work in stitch pattern across sleeve until you are 2 stitches ahead of the next marker), repeat 3 times, you will end up 2 stitche ahead of the marker.  If you are working broken rib, or a fancy stitch pattern,  continue working the fancy stitch pattern. However, I recommend you work the stitch before and the stitch after each markers in stockinette; that is, knit these stitches every row). This creates a decorative two stitch wide 'ray' along the raglan. <\/li>";
  stuff+= "<\/li>";
  stuff+="<li>Plain rounds are worked as follows: Begin 2 stitches before marker,(work 1 stitch in pattern stitch, k1, slip marker,  k1, work in pattern stitch until 2 stitches remain before marker) repeat 3 times. <\/li><\/ol>";
  
  
  stuff+= "<\/ol><\/li>";

  stuff+= "<b>Begin Shaping Raglan:</b>";
  stuff+= "<ol><li>Put the two sleeves and the body on a circular needle which must be sufficiently large to hold all the stitches.  ";
  stuff+= " Place front body stitches on needle ( "+ frontYoke+ " stitches ), place a marker; place one sleeve on needle ( "+sleeveYoke+ " stitches ); place a marker; place back stitches on needle ( "+ backYoke+ " stitches ); place a marker; place other sleeve on  needle ( "+sleeveYoke+ " stitches ); place a marker; place other front stitches on needle.   <\/li>";
 stuff+= "<li>Begin work with the knit side facing you.  Attach yarn at center front. Work "+smallRegRagP1+" rounds even.   <\/li>";
 stuff+= "<li>Now begin to shape as follows:  <\/li>";
 if(0<largeTimesRag){
    stuff+= "<ol style='list-style-type: lower-alpha;'><li>Do the following "+largeTimesRag+" times: **Knit 1 reduction round, knit "+largRegRag+" rounds even. ( "+ remBeforeSmall +" stitches remain between markers on back; " + remSleeveBeforeSmall+" stitches remain between sleeve markers.)<\/ol>";
    }
if(0<smallTimesRag){
    stuff+= "<ol style='list-style-type: lower-alpha;'><\/li><li>Do the following "+smallTimesRag+" times: **Knit 1 reduction round, knit  "+smallRegRag+" rounds even.<\/ol>";
    }
stuff+= "<\/li><\/ol>";

// placket -- actually, I'll want to cut and paste the shaping with the placket back in!


stuff += "<b>Front Neck Shaping:<\/b><br>";
 
stuff+= "<ol><li> When  " + frontNeckShapeStitches + " stitches remain between back markers, and " + sleeveStitchesAtNeck +" stitches remain between sleeve markers, and " +frontFrontNeckShapeStitches + " remain on either front edge, begin shaping the curved portion of the front neck. Begin shaping on a raglan reduction round; with the public side (outside) of the garment should be facing you.<\/li>";

frontNeckShapeStitchesM2=frontNeckShapeStitches-2
begShapeNeckStitchesM1=begShapeNeckStitches-1;
  
    //alert("placketStitches= "+ placketStitches );
    
    firstNeckBindOff= frontFrontNeckShapeStitches-begShapeNeckStitches;
	
	//alert("firstNeckBindOff " + firstNeckBindOff+" = frontFrontNeckShapeStitches " +frontFrontNeckShapeStitches +" -begShapeNeckStitches " + begShapeNeckStitches );
    
    //alert("placket" + placketStitches+": front"+ frontNeckStitches);
    
    stuff+= "<li>At beginning of row, bind off " + firstNeckBindOff+ "  stitches. (There should now be "+begShapeNeckStitches+ " stitches on the neck side of the first stitch marker immediately after the first bindoff.)<\/li><li>Working required raglan decreases, work in pattern stitch to the end of the row. Turn work. At beginning or row,  bind off " + firstNeckBindOff+ " stitches; work to the end of the row. (There should be "+frontNeckShapeStitchesM2+" stitches between back markers and " + begShapeNeckStitchesM1 +" stitches on the each side of the front.)<\/li>";



stuff+= "<li>While continuuing to shape raglans as described earlier, shape front neck as follows: <\/li>";
stuff+= "<ol style='list-style-type: lower-alpha;'>";

// note: I made this end up even. So, I need to frong of the cardigan to always end up even.
// 
if(begShapeNeckStitchesM1%2==0 ){
stuff+= "<li>Do the following  " + edgeNeckStitchesM1+ " times: ** SSK,  work to end of row in pattern stitch  until 2 stitches remain on working side of needle, K2tog.  Turn. Work next row plain. **  <\/li><\/ol>";
stuff+= "<li>There should now be 2 stitches left on the front neck side of the stitch markers; right side facing.<\/li>";
stuff+= "<li>K2 tog, slip marker work in pattern stitch, working the remaining raglan decreases as you normally do. End with an SSK decrease.  <\/li>";
 stuff+= "<li>There is now 1 stitch remaining on front neck side of each marker;  "+ neckStitches + " stitches on the back neck and "+remSleeveAfterSmall+" stitches remain between sleeve markers. <\/li>";
 }
 else {
 stuff+= "<li>Do the following  " + sub(edgeNeckStitchesM1,1) + " times: ** SSK,  work to end of row in pattern stitch  until 2 stitches remain on working side of needle, K2tog.  Turn. Work next row plain. **  <\/li><\/ol>";
 stuff+= "<li>There should now be 3 stitches left on the front neck side of the stitch markers; right side facing. Slip 1, k2 tog, psso,  slip marker, now work until 3 stitches remaining in row-- remembering to working all required raglan decreases; slip 1stitch, k2tog, psso.<\/li>";

// stuff+= "<li>There should now be 1 stitch left on the front neck side of the stitch markers; right side facing. Remove the edge stitch markers before working the next row.<\/li>";
//stuff+= "<li>K2 tog, working the remaining raglan decreases as you normally do. End with an SSK decrease.  <\/li>";
 stuff+= "<li>You have "+ neckStitches + " stitches on the back neck; "+remSleeveAfterSmall+" stitches remain for the sleeves tops. <\/li>";
 }
 
 stuff+= "<li>Optional:  You may either place all stitches on a holder and work the back neck, or raise the back neck as follows.  While raising back neck, continue working raglan decreases. <\/li><li> Begin on a wrong side facing row.  At beginning of row, bind off " + halfRemSleeve +" stitches,  work to the end of the row.  Turn, bind off "+ halfRemSleeve +" stitches, work to end of row. Turn work.</li>At beginning of row, bind off 2 stitches, work to the end of the row, but, bind off 2 stitches, turn, work to the end of the row. Repeat until all sleeve stitches are bound off.  (You may only be able to decrease 1 stitch on the final pass.)  Place remaining "+ neckStitches +" stitches on a string.<\/li>";
 stuff+= "<li>Try on the neck and see if you like it!  If not rip back and work the front neck shaping a few rows earlier or later, depending on whether the neck is too tight or too loose.  If it fits, you're ready to add a neck treatment of your choice.  <\/li>";
 stuff+= "<\/ol><br>";
 
stuff += "<b>Front Bands<\/b><br>";
stuff+= "<ol>";
stuff +="<li>Identify the front edge that will not have buttonholes.  Using smaller diameter needles pick up "+ threeStitches + " stitches every "+ fourRows + " rows along that edge.  ";
stuff +="  Knit "+ bandRows +" rows. Bind off. (I advise not breaking the yarn yet.) <\/li>";

stuff +="<li>Check the band to decide whether you like the appearance.  If the band draws up, rip back and pick up a larger number of stitches; if it droops, rip back and pick up a larger number.  Likewise, decide if you'd like fewer or more rows for the band.</li>";

stuff +="<li>Decide how many buttons you want and how large the buttonholes must be to fit the buttons. I recommend between 5 - 7 buttons on a standard man's sweater and I like the buttonholes to be roughly half the width of the band. As a general rule I knit 2 stitch buttonholes on a 5 row band, and 4 stitch buttonholes on a 10 row band.<\/li>"; 

stuff +='<li>Repeat for edge with buttonholes, but work 2 stitch buttonholes on the row before the center row.  Place one button near the hem, then space the buttons evenly, bearing in mind that the final buttonhole will be on the neck band. ( Some people simply place pins on the first band and then count stitches to position the buttons. If you prefer to calculate, visit <a href="http://www.thedietdiary.com/blog/lucia/386">http://www.thedietdiary.com/blog/lucia/386</a> to calculate how to space the buttons. Visit <a href="http://www.thedietdiary.com/blog/lucia/205">http://www.thedietdiary.com/blog/lucia/205</a> to learn how to knit buttonholes. ) <\/li>';

//stuff +="<li><\/li>";
//stuff +="<li><\/li>";
stuff+= "<\/ol><br>";
patternWindow.document.writeln(stuff);stuff="";  

//
stuff += "<b>Collar:<\/b><br>";
stuff+= "<ol>";
//alert(lengthBeforeRatio);
if(p.neckStyle.selectedIndex==0){
    stuff+= "<li>For a crew neck: Using a circular needle, starting at back shoulder, pick up "+ pickUpSlant + " stitches on neck edge between back and front, slide front neck stitches onto needle, pick up "+ pickUpSlant + " stitches from neck edge, put back neck stitches on needle. With knit side facing, purl 1 round, reducing stitches to make sure you have an odd number of stitches on the needle.  Using smaller diameter needles, knit " +  Math.round((bandRows-1)/2) + " rows of  1 x 1 ribbing, always slipping the first stitch to give a nice edge. On the next wrong side facing row, work buttonhole on the appropriate edge. The continue working in stitch pattern until collar measures "+ Math.round( mult(p.bandWidth.value,10))/10  + " inches tall. Bind off.   <\/li>";
    }
 
 else{
 
    frontPickUp=pickUpSlant+firstNeckBindOff;
    changeNeedlePt=Math.round(divide(p.collarHeight.value,3));
    
    stuff+= "<li>Polo: Using a circular needle, pick up "+ frontPickUp + " stitches between outside edge of placket and back stitches on stitch holder; place back neck stitches on needle. Pick up " +frontPickUp+" stitches bewteen back and placket edge.  If necessary, reduce a stitch to be sure the number of stitches is a multiple of two.  Using smaller diameter needles, knit  1 x 1 ribbing until collar measures " +changeNeedlePt + " inches from sweater edge.  Switch to larger diameter needles. Knit until collar measures "+ Math.round(10*mult(p.collarHeight.value,lengthBeforeRatio))/10 + " inches tall. Bind off. <\/li>";
 }
 
   stuff+= "<\/ol>";
  patternWindow.document.writeln(stuff);stuff="";
  stuff += "<b>Finish Up:<\/b><br>";
   stuff+= "<ol><li> Sew underarm seams. Weave in ends. Sew on buttons. Tidy everything up. Block as appropriate for your yarn; wear.  Send me a photo and let me show you off at my blog. <\/li><\/ol>";
 stuff+= "<\/ol>";
  patternWindow.document.writeln(stuff);stuff="";
  
 
 // 
 yarnUsedText();
/* 
   stuff+= "<ol style='list-style-type: lower-alpha;'><li><\/li>"; 
   stuff+= "    <li>Test Line<\/li>"   
     
*/

     stuff+= "<HR>Copyright, Lucia Liljegren 2005<br> You may print an individual copy directly from my site, and knit your sweater. No other form of reproduction or redistribution permitted.";
     patternWindow.document.writeln(stuff);stuff="";
	           
    patternWindow.document.write("<\/BODY><\/HTML>")
    patternWindow.document.close();
 }
    

