function umrech() { 

if (document.form.kpl.value == "") {
alert ("Preis pro Liter eingeben"); 
document.form.kpl.focus (); 
document.form.kpl.select (); 
return false;
}
if (document.form.verb.value == "") {
alert ("Verbrauch eingeben"); 
document.form.verb.focus (); 
document.form.verb.select (); 
return false;
}
if (document.form.kml.value == "") {
alert ("Kilometerleistung eingeben"); 
document.form.kml.focus (); 
document.form.kml.select (); 
return false;
}

calc_show();

var akos=0.71; //Autogaskosten pro Liter
var av=13.5; // Vderbrauch Autogas proo 100km
var ebk=2900; //Einbaukosten

var v=document.form.verb.value; 
var k=document.form.kml.value; 
var kos=document.form.kpl.value; 

var v = "" + v //Umwandlung in String
   while (v.indexOf(",")>-1){//Kommata durch Punkte ersetzen
      v=v.substring(0,v.indexOf(",")) + "." 
+ v.substring(v.indexOf(",")+1 ,v.length)
}
var k = "" + k //Umwandlung in String
   while (k.indexOf(",")>-1){//Kommata durch Punkte ersetzen
      k=k.substring(0,k.indexOf(",")) + "." 
+ k.substring(k.indexOf(",")+1 ,k.length)
}
var kos = "" + kos //Umwandlung in String
   while (kos.indexOf(",")>-1){//Kommata durch Punkte ersetzen
      kos=kos.substring(0,kos.indexOf(",")) + "." 
+ kos.substring(kos.indexOf(",")+1 ,kos.length)
}

var d=0; 
if (document.form.kmlp.selectedIndex == 0){d = 1;
}
if (document.form.kmlp.selectedIndex == 1){d = 30;
}
if (document.form.kmlp.selectedIndex == 2){d = 365;
}

var x = kos*(v/100)*(k/d);
var ax =  akos*(av/100)*(k/d);

var kost=Math.round(x*100)/100 ;
var kosm=Math.round(x*30*100)/100;
var kosvj=Math.round(x*365*100)/100;

var akost=Math.round(ax*100)/100;
var akosm=Math.round(ax*30*100)/100;
var akosvj=Math.round(ax*365*100)/100;

var ersm=Math.round((kosm-akosm)*100/100);
var ersvj=Math.round((kosvj-akosvj)*100/100);

var amom=Math.round(ebk/ersm*10)/10

//document.form.kpt.value = kost;
document.form.kpm.value = kosm;
document.form.kpvj.value = kosvj;
document.form.em.value = ersm;
document.form.evj.value = ersvj;
document.form.amo.value = amom;
} 
function checkform () 
{ 
if (document.form.verb.value == "") {
alert ("Verbrauch eingeben"); 
document.form.verb.focus (); 
document.form.verb.select (); 
return false;
}
if (document.form.kml.value == "") {
alert ("Kilometerleistung eingeben"); 
document.form.kml.focus (); 
document.form.kml.select (); 
return false;
}
if (document.form.kpl.value == "") {
alert ("Preis pro Liter eingeben"); 
document.form.kpl.focus (); 
document.form.kpl.select (); 
return false;
}
return true;
} 




function umrecha() { 

if (document.forma.kpl.value == "") {
alert ("Preis pro Liter eingeben"); 
document.forma.kpl.focus (); 
document.forma.kpl.select (); 
return false;
}
if (document.forma.verb.value == "") {
alert ("Verbrauch eingeben"); 
document.forma.verb.focus (); 
document.forma.verb.select (); 
return false;
}
if (document.forma.kml.value == "") {
alert ("Kilometerleistung eingeben"); 
document.forma.kml.focus (); 
document.forma.kml.select (); 
return false;
}

calca_show();

var akos=0.71; //Autogaskosten pro Liter
var av=13.5; // Verbrauch Autogas pro 100km
var ebk=2900; //Einbaukosten

var v=document.forma.verb.value; 
var k=document.forma.kml.value; 
var kos=document.forma.kpl.value; 

var v = "" + v //Umwandlung in String
   while (v.indexOf(",")>-1){//Kommata durch Punkte ersetzen
      v=v.substring(0,v.indexOf(",")) + "." 
+ v.substring(v.indexOf(",")+1 ,v.length)
}
var k = "" + k //Umwandlung in String
   while (k.indexOf(",")>-1){//Kommata durch Punkte ersetzen
      k=k.substring(0,k.indexOf(",")) + "." 
+ k.substring(k.indexOf(",")+1 ,k.length)
}
var kos = "" + kos //Umwandlung in String
   while (kos.indexOf(",")>-1){//Kommata durch Punkte ersetzen
      kos=kos.substring(0,kos.indexOf(",")) + "." 
+ kos.substring(kos.indexOf(",")+1 ,kos.length)
}

var d=0; 
if (document.forma.kmlp.selectedIndex == 0){d = 1;
}
if (document.forma.kmlp.selectedIndex == 1){d = 30;
}
if (document.forma.kmlp.selectedIndex == 2){d = 365;
}

var stil=0; 
if (document.forma.stil.selectedIndex == 0){stil = 1.3;
}
if (document.forma.stil.selectedIndex == 1){stil = 1.35;
}
if (document.forma.stil.selectedIndex == 2){stil = 1.4;
}
var stil = stil/1.35;
var av = av*stil;

var x = kos*(v/100)*(k/d);
var ax =  akos*(av/100)*(k/d);

var kost=Math.round(x*100)/100 ;
var kosm=Math.round(x*30*100)/100;
var kosvj=Math.round(x*365*100)/100;

var akost=Math.round(ax*100)/100;
var akosm=Math.round(ax*30*100)/100;
var akosvj=Math.round(ax*365*100)/100;

var ersm=Math.round((kosm-akosm)*100/100);
var ersvj=Math.round((kosvj-akosvj)*100/100);

var amom=Math.round(ebk/ersm*10)/10

//document.forma.kpt.value = kost;
document.forma.kpm.value = kosm;
document.forma.kpvj.value = kosvj;
document.forma.em.value = ersm;
document.forma.evj.value = ersvj;
document.forma.amo.value = amom;
} 
function checkform () 
{ 
if (document.forma.verb.value == "") {
alert ("Verbrauch eingeben"); 
document.form.verba.focus (); 
document.form.verba.select (); 
return false;
}
if (document.forma.kml.value == "") {
alert ("Kilometerleistung eingeben"); 
document.forma.kml.focus (); 
document.forma.kml.select (); 
return false;
}
if (document.forma.kpl.value == "") {
alert ("Preis pro Liter eingeben"); 
document.forma.kpl.focus (); 
document.forma.kpl.select (); 
return false;
}
return true;
} 

