function mkBeret(){
p =document.hatForm;

pester = document.location;

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(pesterAway == "www.thedietdiary.com"){pester="no"}
else if(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! " + " xaway  =" + pesterAway +":" ) } ;

//

if(p.garter.selectedIndex == 0){purl="knit"; factor=1; }
  else{purl="purl"; factor=0.85 }

  p.purl.value=purl;


if(p.felted.selectedIndex == 0){felted=1; }
  else{felted = 0; p.mainStIn.value=p.mainStInBefore.value; p.mainRowIn.value=p.mainRowInBefore.value; }

p.tooFewStitches.value = "javascript is on";

heightTwoRows=divide(2,p.mainRowIn.value)
widthOneStitch=divide(1,p.mainStIn.value);
tanTheta=widthOneStitch/heightTwoRows;
cosTheta=heightTwoRows/Math.sqrt(widthOneStitch*widthOneStitch+heightTwoRows*heightTwoRows);

widthScarf=eval(p.widthScarf.value)*divide(p.mainStIn.value,p.mainStInBefore.value)
p.widthScarfBefore.value=Math.round(widthScarf*10)/10;

lengthScarf=eval(p.lengthScarf.value);
halfWidth=widthScarf/2-widthOneStitch;
p.length2.value= lengthScarf*divide(p.mainRowIn.value,p.mainRowInBefore.value)


halfRowWidth=halfWidth/cosTheta;
stitchHalfRow=Math.round(mult(halfRowWidth,p.mainStIn.value));
p.stitchHalfRow.value=stitchHalfRow-3;
p.stitchHalfRow2.value=stitchHalfRow-3;

realHalfRowWidth=divide(stitchHalfRow,p.mainStIn.value)*cosTheta;
realScarfWidth=2*realHalfRowWidth +2*widthOneStitch;
afghanWidth=Math.round(mult(p.number.value,realScarfWidth)*10)/10;
p.afghanWidth.value=afghanWidth;
p.afghanWidthAfter.value=Math.round(10*afghanWidth*divide(p.mainStInBefore.value,p.mainStIn.value))/10;

castOn=2*(stitchHalfRow+1);
p.castOn.value=castOn;
TopStitches= Math.round(mult(factor*castOn,p.number.value));
sideStitches=Math.round(mult(p.lengthScarf.value,p.mainStIn.value)+6);
p.TopStitches.value=TopStitches;
p.sideStitches.value=sideStitches;
p.length3.value=p.length2.value
}