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 +":" ) } ;

//
p.tooFewStitches.value = "javascript is on.  Thanks! I can calculate.";
p.Tension2.value=p.Tension.value;
  
  circumference = mult(p.headCircumference.value, 1-eval(p.tightnessFactor.value)/100);
  p.hatBand.value=Math.round(circumference*10)/10;

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

p.castOn.value=castOn;

hatDiameter=circumference/Math.PI;
hemDepth= Math.max(1.2,hatDiameter/2.8);
hemRows=2*Math.round(mult(hemDepth,p.mainRowIn.value)/2);
p.hemRows.value=hemRows;
p.hemRows2.value=hemRows;

earFlapStitches= 2*Math.round((castOn/5.)/2);
firstEarFlapStitch = Math.round(castOn/4.8);
lastEarFlapStitch=firstEarFlapStitch+earFlapStitches;

p.lowFlapNeedle.value=firstEarFlapStitch;
p.highFlapNeedle.value=lastEarFlapStitch;

hatHeight= hatDiameter*1.25; // this is the height to the divide.
p.hatRows.value=2*Math.round(mult(hatHeight,p.mainRowIn.value)/2);
//p.hatRows.value=Math.round((totalHatRows-hemRows));

}

