/* 
@copyright 2004 Lucia Liljegren
*/

//--------------------------------lucia knitting fiend -------------------------
function inOrCm(){
var q = parent.left.document.ControlForm
var p =parent.content.document.sweater_data

/* 
@copyright 2004 Lucia Liljegren
*/


/* make sure the toggle doesn't fill with letters! 
Should be redundant: coding of HTML page should also give text box and toggles different names.
*/
if(isNaN(q.unit.value) ){
   if(q.unit.value == "cm" || q.unit.value == 1 ){q.unit.value =1}
    else {q.unit.value = 0}}

if(q.unit.value == 0) {p.unit2.value = "inches"}
else if(q.unit.value == 1){p.unit2.value = "cm"}
else{p.unit2.value = "??"}

}
//---------------------lucia knitting fiend-------------------
function divide(neckCirc,widthFact) {
/* 
@copyright 2004 Lucia Liljegren
*/

var width
if(isNaN(neckCirc) || isNaN(widthFact) ) { width = "TBD";}
else {
 width = Math.round(1000*eval(neckCirc)/eval(widthFact))/1000;

  }
return width;
}
//----------------Lucia------------------------
function mult(neckWidth,widthFact) {
/* 
@copyright 2004 Lucia Liljegren
*/

var width
if(isNaN(neckWidth) || isNaN(widthFact) ) { width = "TBD"}
else {
 width = Math.round(1000*eval(neckWidth)*eval(widthFact))/1000;
}
return width;
}
//----------------------------------------
function add(base,ease){
/* 
@copyright 2004 Lucia Liljegren*/

var design
if(isNaN(base) || isNaN(ease) ) { design ="TBD"}
else{
     design = Math.round(1000* (eval(base)+eval(ease)) )/1000;
     if(eval(design) < 0.) {design = 0;}
}
return design; }
//--------------------Liljegren--------------------
function sub(design,ease){
/* 
@copyright 2004 Lucia Liljegren
*/

var base
if(isNaN(design) || isNaN(ease) ) { base ="TBD"}
else{
       base = Math.round(1000*(eval(design)-eval(ease))  )/1000;}
return base; }
//--------------------lucia--------------------
function subFloor(design,ease){
var base
if( isNaN(design) || isNaN(ease) ) {base = "TBD"}
else{
  base = Math.round(1000*(eval(design)-eval(ease))  )/1000;
   if(eval(base)<0){base = 0;} }
return base; 
}
//------------------------
function justRound(value){
/* 
@copyright 2004 Lucia Liljegren
*/

var base
if( isNaN(value)  ) {base = "TBD"}
else{
    base = Math.round( 1000*eval(value)  )/1000;
    return base; 
}
}
//----------------------knittingfiend.------------------
/* 
@copyright 2004 Lucia Liljegren
*/
