
function laskeHinta() { 
    var taul=document.hl; 
	var matkanhinta; 
	matkanhinta = 0; 

	if (document.forms.hl.aika.options[document.forms.hl.aika.selectedIndex].text == "Arkisin 06.00-20.00") { 
			matkanhinta = 5.30; 
	} else if (document.forms.hl.aika.options[document.forms.hl.aika.selectedIndex].text == "Lauantaisin ja aattona 06.00-16.00") { 
			matkanhinta = 5.30; 
	} else { 
			matkanhinta = 8.30; 
	}	 
	 
	if (document.forms.hl.kpl.options[document.forms.hl.kpl.selectedIndex].text == "1-2") { 
		matkanhinta = matkanhinta + document.forms.hl.pituus.value * 1.39; 
	} 
	else if (document.forms.hl.kpl.options[document.forms.hl.kpl.selectedIndex].text == "3-4") { 
		matkanhinta = matkanhinta + document.forms.hl.pituus.value * 1.67; 
	} 
	else if (document.forms.hl.kpl.options[document.forms.hl.kpl.selectedIndex].text == "5-6") { 
		matkanhinta = matkanhinta + document.forms.hl.pituus.value * 1.81; 
	} 
	else if (document.forms.hl.kpl.options[document.forms.hl.kpl.selectedIndex].text == "yli 6") { 
		matkanhinta = matkanhinta + document.forms.hl.pituus.value * 1.94; 
	} 
	else { 
		matkanhinta = matkanhinta + document.forms.hl.pituus.value * 0.94; 
		matkanhinta = (122 * matkanhinta) / 108; 
	} 
	 
		document.forms.hl.euro.value = Math.round(matkanhinta); 
 
} 

function pyorista(arvo) { 
	if (arvo == 0) { return "";} 
	 
	arvo = Math.round(100*arvo)/100; 
	arvo = arvo.toString(); 
	 
	if (arvo.indexOf(".") == -1) { 
		arvo = arvo + ".00"; 
	} 
	else if (arvo.indexOf(".") == arvo.length-2) { 
		arvo = arvo + "0"; 
	} 

	return arvo; 
} 


