// JavaScript Document
function frmsub() { 
	document.wordcount.submit();
} 

function countit(){

var formcontent=document.wordcount.wordcount2.value
formcontent=formcontent.split(" ")
document.wordcount.wordcount3.value=formcontent.length
}

function calculate() { 
	var checked_value 	= parseInt(getCheckedValue(document.forms['wordcount'].elements['inp_radio']));	
	var count_words		= parseInt(document.wordcount.wordcount3.value); 
	var costs 			= checked_value * count_words;
	var costs			= parseInt(costs);
	var costs			= costs/100;
	
	if (isNaN(costs) || costs<25) { 
		costs = 25;
	}  
	document.wordcount.inp_kosten.value = "€ "+costs;
} 

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}