
var defaultEmptyOK = false


function check_tax_form()
{
	if (isInteger(document.calculator.capacit.value) && document.calculator.tip.value != '' && document.calculator.vechime.value != '' && document.calculator.emisii.value != '') 
		if (document.calculator.tip.value == 'mare') document.calculator.submit();	
		else 
			{
				if ((document.calculator.emisii.value == 'euro3') || (document.calculator.emisii.value == 'euro4')) 
					if (isInteger(document.calculator.emisieco2.value)) document.calculator.submit();
					else alert('              In cazul normelor de poluare EURO 3 si EURO 4,\nva rugam sa completati o valoare pentru emisia de dioxid de carbon !');	
				else document.calculator.submit();	
			}
	else alert('Va rugam completati toate campurile cerute pentru a calcula taxa !');
	
	
}


function setCO2(){
	if ((document.calculator.emisii.value == 'euro3') || (document.calculator.emisii.value == 'euro4')) 
		{
			if (document.all) document.getElementById('tr_emisie').style.display = 'block'
			else document.getElementById('tr_emisie').style.display = 'table-row';
			
		}
		else document.getElementById('tr_emisie').style.display = 'none';
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

function isInteger (s)

{   var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);    

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

