   function Update(){
   var p = document.Slipper
   var stdRatio = 1.8; // use to change ratio of length to width.
   
 
      //------
pester = document.location;
expireDate = new Date;
expireDate.setMonth(expireDate.getMonth()+6);
username = pester;

document.cookie="pester=" + username + "expires="+ expireDate.toGMTString(); 
/* @copyright 2004 Lucia Liljegren*/

if(document.cookie ==""){
    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{ 
	pester = "yes"; 
	p.stGauge.value=p.prStGauge.value=0.01;
	p.rowGauge.value=p.prRowGauge.value=0.01;
	alert(" Please run my programs from my site at www.thedietdiary.com!"  )
	p.tooFewStitches.value =" Please run my programs from my site at www.thedietdiary.com!" 
	} ;
		
//==================================
if(pester == "no"){
    /* @copyright 2004 Lucia Liljegren*/
    

    // guess for foot length based on shoe size.   
    var extra;
	if(p.range.selectedIndex == 0){extra = 2;}
	else if(p.range.selectedIndex == 1){ extra = 0;}
	else{extra = -12; }
    
    p.tooFewStitches.value = "Thanks for running this from lucia's site and turning javascript on. I'll fill the boxes now." ;
    
    if(isNaN(p.size.value)){p.size.value = 1;}
    else{
       p.size.value = Math.round(2*eval(p.size.value)) /2
        }
    
    var normSize= eval(p.size.value)+extra;
    stdLength = Math.round( 100*(6.8 + normSize/3) ) /100;
    p.stdLength.value = Math.round(100*stdLength)/100; 
    p.stdWidth.value = stdWidth=Math.round( eval(p.stdLength.value)/stdRatio * 100)/100;
       
    
    // Select length used.
    var tightRatio=1.0;
	    if(p.customFoot[0].checked ) {  }
	    else {
		    p.slLength.value=Math.round(100*tightRatio* eval(p.stdLength.value))/100;
		    p.slWidth.value=Math.round(100*tightRatio*eval(p.stdWidth.value))/100;
	    }
    // suggest gauge based on bulky etc.
	    if(p.yarnType[0].checked){p.prStGauge.value=2.5;}
	    if(p.yarnType[1].checked){p.prStGauge.value=4.5;}
	    if(p.yarnType[2].checked){p.prStGauge.value=6.5;}
	    if(p.yarnType[3].checked){p.prStGauge.value=8.0;}
	    
	p.prRowGauge.value= eval(p.prStGauge.value)*3/2;
    
	    // let them pick their own gauge.
	if(p.customGauge[1].checked ){
	    p.stGauge.value = eval(p.prStGauge.value);
	    p.rowGauge.value=eval(p.prRowGauge.value);
	}
	else {	
	}
    
    // Calculate directions
    // make everythign even.  That's easiest.
    var stG, rowG;
    
	if(!isNaN(p.stGauge.value)){stG= eval(p.stGauge.value);}
	else {stG=0;}
	if(!isNaN(p.rowGauge.value) ) {rowG= eval(p.rowGauge.value);}
	else{ rowG=0;}
    
    // find slipper length first
	    // the heel and toes are really 1/2 the rows because you increase and decrease.
	    // inside heel and toes will be the same size.
	    var totRows = Math.round(rowG* eval(p.slLength.value)/2)*2;
	    p.castOn.value = Math.round(totRows* (1.35)/4)*2;	//I'm increasing from 1.22 (38/31) which 
    // I used for the first slippers.
    
	    var totStraight=Math.round(0.10 * rowG*eval(p.slLength.value)/2)*2; // add a few straight shapes to make slipper opening bigger.
    
	    var totRem=totRows-totStraight;
	    var toeRows =  Math.round(1.00*totRem/4)*2+1;
	    var heelRows = Math.min(totRem-toeRows,toeRows);				
	    toeRows= totRem-heelRows;
	    
    p.totRows.value=totRows;
    p.toeRows.value= toeRows;
    p.heelRows.value=heelRows;	
    p.straightRows.value=totStraight;
    
    p.heelN1.value = p.castOn.value - (heelRows-1);
    p.toeN1.value = p.castOn.value - (toeRows-1);
    
    
    // the reason I do heel rows 2 times is that the toe is pointy.
    
    p.toeN2.value=p.toeN1.value;
    p.toeN1.value=Math.max(2*Math.ceil(eval(p.heelN1.value)/4),2);  // pointy outer toe.
    p.heelN2.value=p.heelN1.value;
    p.straightRows2.value=p.straightRows.value;
    
   
    /* @copyright 2004 Lucia Liljegren*/
}

else {
/* @copyright 2004 Lucia Liljegren*/
    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.stGauge.value=p.prStGauge.value=0.01;
    p.rowGauge.value=p.prRowGauge.value=0.01;
    }


//==================
}

// end update--------------------

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

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

document.cookie="pester=" + username + "expires="+ expireDate.toGMTString(); 
/* @copyright 2004 Lucia Liljegren*/

if(document.cookie ==""){
    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"}

    if(pester =="no"){
	newWindowL = window.open('EasySlipperChild.html','directions','left=screen.width-225,top=0,scrollbars=yes,toolbar=yes,resizable=yes,width=150,height=150');
}
    else{alert("Sorry, I can't open the window.");}
}// end open window

//=====================

function fillWin(){
Update();
   // openWin();
    
 var q = newWindowL.document.Slipper;
 var p = document.Slipper;
 
//q values
q.slLength.value=p.slLength.value
q.slWidth.value=p.slWidth.value

q.stGauge.value=p.stGauge.value;
q.rowGauge.value=p.rowGauge.value;

q.castOn.value = p.castOn.value;
q.heelN1.value = p.heelN1.value;

q.toeN1.value = p.toeN1.value;
q.toeN2.value=p.toeN2.value;

q.heelN2.value=p.heelN2.value;


// add 1 to simplify directions -- removes the 1 from the heel and toe roes and 
// puts into straight rows discussion.

p.straightRows.value=eval(p.straightRows.value)+1;
p.straightRows2.value=eval(p.straightRows2.value)+1;

q.straightRows.value=eval(p.straightRows.value);
q.straightRows2.value=eval(p.straightRows2.value);

//q.straightRows3.value = Math.round(q.straightRows.value/2);
//q.extraNeedles.value = Math.ceil(eval(q.straightRows3.value/2));

// make appropriate one show in directions
if(p.toeShape.selectedIndex == 0) 
     {q.toeNshow.value=q.toeN2.value ;}
else {q.toeNshow.value=q.toeN1.value }
//========================

newWindowL.document.close()
//================================
}
/* @copyright 2004 Lucia Liljegren*/