function calcPoncho(){
/* @copyright 2004 Lucia Liljegren*/

pester = document.location;
p =document.ponchoForm;

expireDate = new Date;
expireDate.setMonth(expireDate.getMonth()+6);
username = pester;

document.cookie="pester=" + username + "expires="+ expireDate.toGMTString(); 

if(document.cookie ==""){
/* @copyright 2004 Lucia Liljegren
*/

    alert("Please set your browser to accept cookies. You must accept cookies to run this page.");
}
else {
    pesterZero=document.cookie.split("/")[0];  //figure out if local or away.    
    pesterRead = document.cookie.split("/")[4];
    pesterAway=document.cookie.split("/")[2];    
}
pester = "yes";
    if(pesterZero == "pester=file" || pesterRead =="lucia"){pester="no"}
else if(pesterZero == "pester=http:" || pesterAway == "www.thedietdiary.com"){pester="no"}
else if(pesterZero == "pester=http:" || pesterAway == "thedietdiary.com"){pester="no"}
 
else{ pester = "yes"; 
   p.mainStIn.value=0.01;
    p.mainRowIn.value=0.01;
    alert(" Please run my programs from my site at www.thedietdiary.com!"  ) } ;
//===================
if(pester == "no"){
/* @copyright 2004 Lucia Liljegren*/

       /* 
@copyright 2004 Lucia Liljegren
*/
if(p.size.selectedIndex == 0){ length=12; width = 12; neckWidth= 4.2; neckDepth=neckWidth;}//6 moths
if(p.size.selectedIndex == 1){ length=13; width = 14; neckWidth= 4.4; neckDepth=neckWidth;}// 1 year
if(p.size.selectedIndex == 2){ length=14; width = 16; neckWidth= 4.7; neckDepth=neckWidth;}// 18 months
if(p.size.selectedIndex == 3){ length=16; width = 18; neckWidth= 5.7; neckDepth=neckWidth;}// 2 years
if(p.size.selectedIndex == 4){ length=17; width = 19; neckWidth= 6; neckDepth=neckWidth;}// 3 years
if(p.size.selectedIndex == 5){length= eval(p.length.value); width= eval(p.width.value); neckWidth=eval(p.neckWidth.value); neckDepth=eval(p.neckDepth.value); }
p.length.value=length;
p.width.value=width;
p.neckWidth.value=Math.min(neckWidth,eval(p.width.value));
p.neckWidth2.value=p.neckWidth.value;
p.neckDepth.value=neckDepth;

castOn=Math.round(mult(p.mainStIn.value,width)/2)*2;
p.castOn.value=castOn;


toNeck=length-neckDepth;
headOpening= 2*Math.sqrt( neckDepth*neckDepth + (neckWidth*neckWidth)/4) + neckWidth
p.headOpen.value=Math.round(10*headOpening)/10;
p.toNeck.value=Math.round(toNeck*10)/10;
p.toNeckRows.value=Math.round(mult(toNeck,p.mainRowIn.value)/2)*2;
p.leftToShoulder.value=Math.round(neckDepth*10)/10;
p.rightShoulder.value=castOn/2;
p.leftShoulder.value=castOn/2;
centerFrontStitch=Math.round(mult(p.neckWidth.value,p.mainStIn.value)/2);
p.leftShoulderStitch.value=castOn/2-centerFrontStitch;
p.leftShoulderStitch2.value=p.leftShoulderStitch.value;
p.centerFront.value=centerFrontStitch;
lengthEight=divide(8,p.mainRowIn.value)
p.neckTrim.value=2*Math.round(mult(0.95*(neckDepth +lengthEight),p.mainStIn.value));


p.length2.value=length;
p.toEndRows.value=Math.round(mult(length,p.mainRowIn.value)/2)*2;
p.toEndRowsInc.value=sub(p.toEndRows.value,p.toNeckRows.value);

p.sideIcord.value= Math.round(mult(length, p.mainStIn.value)+1)*2
p.sideIcord2.value = p.sideIcord.value;
p.bottomIcord.value = (castOn+2)*2;

//p.neckIcord.value=Math.round(mult(neckDepth,p.mainStIn.value)+1)*2;
//p.neckIcord2.value=p.neckIcord.value;
//p.backNeckICord.value=Math.round(mult(neckWidth,p.mainStIn.value)+1)*2;

p.tooFewStitches.value = "Thanks for running this from lucia's site. I'll fill the boxes now!" ;
}

else {
     alert(" Please run my programs from my site at www.thedietdiary.com!"  )
    alert("Sorry! I didn't fill the boxes. Please run this page from my site at www.thedietdiary.com!")
    p.tooFewStitches.value = "Please run this from lucia's site!  I'm not filling the result boxes.  ("+pesterZero +" : "+ pesterAway+" : "+pesterRead +")";
    p.mainStIn.value=0.01;
    p.mainRowIn.value=0.01;
}

}

//================ROW STITCH TABLE-----------------------------------
function rowStitchTable(){
    rowStitchWindow= window.open('','rowStitch','toolbar=yes, location=yes, scrollbars=yes, resizable=yes, width=300, height=600, left=0,top=0')
    rowStitchWindow.document.write("<HTML><HEAD><BODY><H1>Row-Stitch Table For Poncho</H1>")
    rowStitchWindow.document.write("<p>This table decribes the needle set up for your poncho.<p><HR>")
    
    rowStitchWindow.document.write("<p>I haven't written this portion of the code yet.  Since the number of stitches on the bed remains constant, it's probably just going to indicate the rows where you hang markers!<HR>")

    
     rowStitchWindow.document.write("<p>Note: When a value is positive, the needle indicated is in work. When it is negative, that needles is taken out of work. This is because there is no 0 needle on the machine bed. If you are a hand knitter, and want to use this sheet, hang yarn between the center two stitches.  Each needle represents one stitch, and you should count stitches to the right and left of center.<HR>")
     // calculate values for table.
     
     
    // first row in table    
    rowStitchWindow.document.writeln("<p><Table Caption= 'Poncho Rectangle 1'><tr> <td>row<\/td> <td>[left,<\/td> <td>right]<\/td> <td>total in row <\/td> <\/tr>")
    // table rows.
    rowStitchWindow.document.writeln("<tr> <td>row<\/td> <td>[left needle,<\/td> <td>right needle]<\/td> <td>total in row <\/td> <\/tr>")
    // final row in table.
    
   // rowStitchWindow.document.writeln("<tr> <td>" + rowCount + "<\/td> <td> [ " + firstLeft +", <\/td> <td> "+firstRight+ "] <\/td> <td>"+total+"<\/td> <\/tr>")
   
    // close table
    rowStitchWindow.document.writeln("</Table>")
    
    // close both windows-----------------------------------
    rowStitchWindow.document.write("<\/BODY><\/HEAD><\/HTML>")
    rowStitchWindow.document.close();
    
}
/* 
@copyright 2004 Lucia Liljegren */
