
function lancelin(form) {
  var aglimea=2.3;
  var aglimeb=50.8;
  var aglimec=40.5;
  var aglimed=6.2;
  var aglimee=0.2;
  
  var aglimeaNV=92.0;
  var aglimebNV=92.9;
  var aglimecNV=95.5;  
  var aglimedNV=80.9;
  var aglimeeNV=0.0;
  
  var aglimet=aglimea+aglimeb+aglimec+aglimed+aglimee;
  if ((aglimet > 99) & (aglimet < 101)) aglimet = 100;
  var aglimetNV=(aglimea*aglimeaNV+aglimeb*aglimebNV+aglimec*aglimecNV+aglimed*aglimedNV+aglimee*aglimeeNV)/100;
  
  form.aglimea.value=parseInt(aglimea*100)/100;
  form.aglimeb.value=parseInt(aglimeb*100)/100;
  form.aglimec.value=parseInt(aglimec*100)/100;
  form.aglimed.value=parseInt(aglimed*100)/100;
  form.aglimee.value=parseInt(aglimee*100)/100;
  form.aglimet.value=parseInt(aglimet*100)/100;
  form.aglimeaNV.value=parseInt(aglimeaNV*100)/100;
  form.aglimebNV.value=parseInt(aglimebNV*100)/100;
  form.aglimecNV.value=parseInt(aglimecNV*100)/100;
  form.aglimedNV.value=parseInt(aglimedNV*100)/100;
  form.aglimeeNV.value=parseInt(aglimeeNV*100)/100;
  form.aglimetNV.value=parseInt(aglimetNV*100)/100;
  
  form.aglimeselected.value=1;
  calculateaglimeENV(form);
  form.aglimeprice.value=7.95;
  form.aglimefreight.value=10;
  form.aglimespread.value=8;
  calculateaglimecost(form);

}


function cervantes(form) {
  var aglimea=2.6;
  var aglimeb=66.9;
  var aglimec=28.9;
  var aglimed=1.4;
  var aglimee=0.1;
  
  var aglimeaNV=92.6;
  var aglimebNV=93.3;
  var aglimecNV=95.2;  
  var aglimedNV=89.4;
  var aglimeeNV=0;
  
  var aglimet=aglimea+aglimeb+aglimec+aglimed+aglimee;
  if ((aglimet > 99) & (aglimet < 101)) aglimet = 100;
  var aglimetNV=(aglimea*aglimeaNV+aglimeb*aglimebNV+aglimec*aglimecNV+aglimed*aglimedNV+aglimee*aglimeeNV)/100;
  
  form.aglimea.value=parseInt(aglimea*100)/100;
  form.aglimeb.value=parseInt(aglimeb*100)/100;
  form.aglimec.value=parseInt(aglimec*100)/100;
  form.aglimed.value=parseInt(aglimed*100)/100;
  form.aglimee.value=parseInt(aglimee*100)/100;
  form.aglimet.value=parseInt(aglimet*100)/100;
  form.aglimeaNV.value=parseInt(aglimeaNV*100)/100;
  form.aglimebNV.value=parseInt(aglimebNV*100)/100;
  form.aglimecNV.value=parseInt(aglimecNV*100)/100;
  form.aglimedNV.value=parseInt(aglimedNV*100)/100;
  form.aglimeeNV.value=parseInt(aglimeeNV*100)/100;
  form.aglimetNV.value=parseInt(aglimetNV*100)/100;

  form.aglimeselected.value=1;
  calculateaglimeENV(form);
  form.aglimeprice.value=7.95;
  form.aglimefreight.value=10;
  form.aglimespread.value=8;
  calculateaglimecost(form);

}

function jurien(form) {
  var aglimea=1.3;
  var aglimeb=51.4;
  var aglimec=42.6;
  var aglimed=4.6;
  var aglimee=0.1;
  
  var aglimeaNV=87.7;
  var aglimebNV=91.6;
  var aglimecNV=94.0;  
  var aglimedNV=93.6;
  var aglimeeNV=0;
  
  var aglimet=aglimea+aglimeb+aglimec+aglimed+aglimee;
  if ((aglimet > 99) & (aglimet < 101)) aglimet = 100;
  var aglimetNV=(aglimea*aglimeaNV+aglimeb*aglimebNV+aglimec*aglimecNV+aglimed*aglimedNV+aglimee*aglimeeNV)/100;
  
  form.aglimea.value=parseInt(aglimea*100)/100;
  form.aglimeb.value=parseInt(aglimeb*100)/100;
  form.aglimec.value=parseInt(aglimec*100)/100;
  form.aglimed.value=parseInt(aglimed*100)/100;
  form.aglimee.value=parseInt(aglimee*100)/100;
  form.aglimet.value=parseInt(aglimet*100)/100;
  form.aglimeaNV.value=parseInt(aglimeaNV*100)/100;
  form.aglimebNV.value=parseInt(aglimebNV*100)/100;
  form.aglimecNV.value=parseInt(aglimecNV*100)/100;
  form.aglimedNV.value=parseInt(aglimedNV*100)/100;
  form.aglimeeNV.value=parseInt(aglimeeNV*100)/100;
  form.aglimetNV.value=parseInt(aglimetNV*100)/100;

  form.aglimeselected.value=1;
  calculateaglimeENV(form);
  form.aglimeprice.value=5.95;
  form.aglimefreight.value=10;
  form.aglimespread.value=8;
  calculateaglimecost(form);

}

function dongara(form) {
  var aglimea=7.8;
  var aglimeb=84.2;
  var aglimec=7.2;
  var aglimed=0.5;
  var aglimee=0.4;
  
  var aglimeaNV=93.8;
  var aglimebNV=95.3;
  var aglimecNV=91.2;  
  var aglimedNV=67.2;
  var aglimeeNV=0;
  
  var aglimet=aglimea+aglimeb+aglimec+aglimed+aglimee;
  if ((aglimet > 99) & (aglimet < 101)) aglimet = 100;
  var aglimetNV=(aglimea*aglimeaNV+aglimeb*aglimebNV+aglimec*aglimecNV+aglimed*aglimedNV+aglimee*aglimeeNV)/100;
  
  form.aglimea.value=parseInt(aglimea*100)/100;
  form.aglimeb.value=parseInt(aglimeb*100)/100;
  form.aglimec.value=parseInt(aglimec*100)/100;
  form.aglimed.value=parseInt(aglimed*100)/100;
  form.aglimee.value=parseInt(aglimee*100)/100;
  form.aglimet.value=parseInt(aglimet*100)/100;
  form.aglimeaNV.value=parseInt(aglimeaNV*100)/100;
  form.aglimebNV.value=parseInt(aglimebNV*100)/100;
  form.aglimecNV.value=parseInt(aglimecNV*100)/100;
  form.aglimedNV.value=parseInt(aglimedNV*100)/100;
  form.aglimeeNV.value=parseInt(aglimeeNV*100)/100;
  form.aglimetNV.value=parseInt(aglimetNV*100)/100;
  
  form.aglimeselected.value=1;
  calculateaglimeENV(form);
  form.aglimeprice.value=5.95;
  form.aglimefreight.value=10;
  form.aglimespread.value=8;
  calculateaglimecost(form);

}

function otherlime(form) {
  var othera=20.0;
  var otherb=20.0;
  var otherc=20.0;
  var otherd=20.0;
  var othere=20.0
  
  var otheraNV=80.0;
  var otherbNV=80.0;
  var othercNV=80.0;  
  var otherdNV=80.0;
  var othereNV=80.0;
  
  var othert=othera+otherb+otherc+otherd+othere;
  if ((othert > 99) & (othert < 101)) othert = 100;
  var othertNV=(othera*otheraNV+otherb*otherbNV+otherc*othercNV+otherd*otherdNV+othere*othereNV)/100;
  
  form.othera.value=parseInt(othera*100)/100;
  form.otherb.value=parseInt(otherb*100)/100;
  form.otherc.value=parseInt(otherc*100)/100;
  form.otherd.value=parseInt(otherd*100)/100;
  form.othere.value=parseInt(othere*100)/100;
  form.othert.value=parseInt(othert*100)/100;
  form.otheraNV.value=parseInt(otheraNV*100)/100;
  form.otherbNV.value=parseInt(otherbNV*100)/100;
  form.othercNV.value=parseInt(othercNV*100)/100;
  form.otherdNV.value=parseInt(otherdNV*100)/100;
  form.othereNV.value=parseInt(othereNV*100)/100;
  form.othertNV.value=parseInt(othertNV*100)/100;

  calculateotherENV(form);
  form.otherprice.value=20.0;
  form.otherfreight.value=25;
  form.otherspread.value=8;
  calculateothercost(form);
  form.otherselected.value=1;

}

function blank(form) {
  var othera=1;
  var otherb=1;
  var otherc=1;
  var otherd=1;
  var othere=1
  
  var otheraNV=1;
  var otherbNV=1;
  var othercNV=1;  
  var otherdNV=1;
  var othereNV=1;
  
  var othert=othera+otherb+otherc+otherd+othere;
  if ((othert > 99) & (othert < 101)) othert = 100;
  var othertNV=(othera*otheraNV+otherb*otherbNV+otherc*othercNV+otherd*otherdNV+othere*othereNV)/100;
  
  form.othera.value="";
  form.otherb.value="";
  form.otherc.value="";
  form.otherd.value="";
  form.othere.value="";
  form.othert.value="";
  form.otheraNV.value="";
  form.otherbNV.value="";
  form.othercNV.value="";
  form.otherdNV.value="";
  form.othereNV.value="";
  form.othertNV.value="";
  
  form.otherprice.value="";
  form.otherfreight.value="";
  form.otherspread.value="";

  form.otheraENV.value="";
  form.otherbENV.value="";
  form.othercENV.value="";
  form.otherdENV.value="";
  form.othereENV.value="";
  form.othertENV.value="";
  form.otherrate.value="";
  form.othertotalcost.value="";
  

}




function calculateaglimeENV(form) {
  var aglimea = parseFloat(form.aglimea.value, 5);
  var aglimeb = parseFloat(form.aglimeb.value, 5);
  var aglimec = parseFloat(form.aglimec.value, 5);
  var aglimed = parseFloat(form.aglimed.value, 5);
  var aglimee = parseFloat(form.aglimee.value, 5);
  var aglimeaNV = parseFloat(form.aglimeaNV.value, 5);
  var aglimebNV = parseFloat(form.aglimebNV.value, 5);
  var aglimecNV = parseFloat(form.aglimecNV.value, 5);
  var aglimedNV = parseFloat(form.aglimedNV.value, 5);
  var aglimeeNV = parseFloat(form.aglimeeNV.value, 5);

  var aglimet=aglimea+aglimeb+aglimec+aglimed+aglimee;
  if ((aglimet > 99) & (aglimet < 101)) aglimet = 100;
  var aglimetNV=(aglimea*aglimeaNV+aglimeb*aglimebNV+aglimec*aglimecNV+aglimed*aglimedNV+aglimee*aglimeeNV)/100;


  var aglimeaENV=aglimea*aglimeaNV/100;
  var aglimebENV=aglimeb*aglimebNV/100;
  var aglimecENV=aglimec*aglimecNV/100;
  var aglimedENV=aglimed*aglimedNV*0.5/100;
  var aglimeeENV=aglimee*aglimeeNV*0.25/100;
  var aglimetENV=aglimeaENV+aglimebENV+aglimecENV+aglimedENV+aglimeeENV;
  var aglimerate=1;
  
  form.aglimet.value=parseInt(aglimet*100)/100;
  form.aglimetNV.value=parseInt(aglimetNV*100)/100;
  form.aglimeaENV.value=parseInt(aglimeaENV);
  form.aglimebENV.value=parseInt(aglimebENV);
  form.aglimecENV.value=parseInt(aglimecENV);
  form.aglimedENV.value=parseInt(aglimedENV);
  form.aglimeeENV.value=parseInt(aglimeeENV);
  form.aglimetENV.value=parseInt(aglimetENV);
  form.aglimerate.value=parseInt(aglimerate*100)/100;
  
  
  
  var otherselected =  parseFloat(form.otherselected.value);
  if  (otherselected == 1) {
  calculateotherENV(form);
  calculateothercost(form);
  }


}

function calculateotherENV(form) {
  var othera = parseFloat(form.othera.value, 5);
  var otherb = parseFloat(form.otherb.value, 5);
  var otherc = parseFloat(form.otherc.value, 5);
  var otherd = parseFloat(form.otherd.value, 5);
  var othere = parseFloat(form.othere.value, 5);
  var otheraNV = parseFloat(form.otheraNV.value, 5);
  var otherbNV = parseFloat(form.otherbNV.value, 5);
  var othercNV = parseFloat(form.othercNV.value, 5);
  var otherdNV = parseFloat(form.otherdNV.value, 5);
  var othereNV = parseFloat(form.othereNV.value, 5);
  var aglimetENV = parseFloat(form.aglimetENV.value, 5);
  
  var aglimeselected =  parseFloat(form.aglimeselected.value);

  var othert=othera+otherb+otherc+otherd+othere;
  if ((othert > 99) & (othert < 101)) othert = 100;
  var othertNV=(othera*otheraNV+otherb*otherbNV+otherc*othercNV+otherd*otherdNV+othere*othereNV)/100;


  var otheraENV=othera*otheraNV/100;
  var otherbENV=otherb*otherbNV/100;
  var othercENV=otherc*othercNV/100;
  var otherdENV=otherd*otherdNV*0.5/100;
  var othereENV=othere*othereNV*0.25/100;
  var othertENV=otheraENV+otherbENV+othercENV+otherdENV+othereENV;
  
  
  if  (aglimeselected == 1) {
  var otherrate = aglimetENV/othertENV;
  }
  
  if ( aglimeselected == 0) {
  var otherrate= 90 / othertENV;
  }
  
  
  form.othert.value=parseInt(othert*100)/100;
  form.othertNV.value=parseInt(othertNV*100)/100;
  form.otheraENV.value=parseInt(otheraENV);
  form.otherbENV.value=parseInt(otherbENV);
  form.othercENV.value=parseInt(othercENV);
  form.otherdENV.value=parseInt(otherdENV);
  form.othereENV.value=parseInt(othereENV);
  form.othertENV.value=parseInt(othertENV);
  form.otherrate.value=parseInt(otherrate*100)/100;
}


function calculateenv(form) {
  calculateotherENV(form);
  form.otherselected.value=1;
}

function calculateaglimecost(form) {
  var aglimeprice=parseFloat(form.aglimeprice.value, 5);
  var aglimefreight=parseFloat(form.aglimefreight.value, 5);
  var aglimespread=parseFloat(form.aglimespread.value, 5);
  var aglimerate=parseFloat(form.aglimerate.value, 5);
  var aglimetotalcost=(aglimeprice+aglimefreight+aglimespread)*aglimerate;
  form.aglimetotalcost.value=parseInt(aglimetotalcost*100)/100;
  form.aglimesubtotal.value= aglimeprice + aglimefreight + aglimespread;

}

function calculateothercost(form) {
  var otherprice=parseFloat(form.otherprice.value, 5);
  var otherfreight=parseFloat(form.otherfreight.value, 5);
  var otherspread=parseFloat(form.otherspread.value, 5);
  var otherrate=parseFloat(form.otherrate.value, 5);
  var othertotalcost=(otherprice+otherfreight+otherspread)*otherrate;
  form.othertotalcost.value=parseInt(othertotalcost*100)/100;
  form.othersubtotal.value= otherprice + otherfreight + otherspread;
}

function calculatecost(form) {
  calculateaglimecost(form);
  calculateothercost(form);
}


