// JavaScript Document
function clearField(id){
	if(document.getElementById(id).value=="adresa email")	document.getElementById(id).value="";	
}

function calculeaza(){
	km = document.getElementById('k').value;
	if(isNaN(km))
	{
		alert("Numarul kilometrilor trebuie exprimat in cifre");
		return
	}
	meters = document.getElementById('m').value;
	if(isNaN(meters))
	{
		alert("Numarul metrilor trebuie exprimat in cifre");
		return
	}
	hour = document.getElementById('h').value;
	if(isNaN(hour))
	{
		alert("Numarul orelor trebuie exprimat in cifre");
		return
	}
	minute = document.getElementById('i').value;
	if(isNaN(minute))
	{
		alert("Numarul minutelor trebuie exprimat in cifre");
		return
	}
	seconds = document.getElementById('s').value;
	if(isNaN(seconds))
	{
		alert("Numarul secundelor trebuie exprimat in cifre");
		return
	}
	if(km=="") km=0;
	if(meters=="") meters=0;
	if(hour=="") hour=0;
	if(minute=="") minute=0;
	if(seconds=="") seconds=0;
	km = km*1000;
	distanta = km+meters;
	hour = hour *3600;
	minute = minute *60;
	timp = hour+minute+seconds;
	viteza = distanta / timp;
	document.getElementById('rez').innerHTML = viteza+' m/s';
}

function clearRez(){
	document.getElementById('rez').innerHTML="";
}

function countChars(id,maxim){
	x = document.getElementById(id).value.length;
	x = maxim-x;
	document.getElementById(id+"Chars").innerHTML= x;
}