// functions_application.js
//


function test_fill_geo_location()
{

	// just a test
	document.getElementById("edit_geo_location").value='fill_geo_location called';

}

// used by application.php V3
function CheckOnSubmit(ThisForm)
{
	minimum_comment_words = ThisForm.minimum_comment_words.value;
	word_count = ThisForm.wc.value;

	// This forces a numerical test.
	var short = minimum_comment_words - word_count ;

	if ( short > 0 )
	{
		alert("Too few words were entered into Background & Qualifications field. Must be at least "+minimum_comment_words+" words. You have entered only "+word_count+". You are "+short+" words short.");
		return false;
	}
}

// special word count function. http://javascript.about.com/library/blcount.htm
function cnt(w,x)
{
	minimum_words = document.entry_form.minimum_comment_words.value;

	var y=w.value;
	var r = 0;
	a=y.replace(/\s/g,' ');
	a=a.split(' ');
	for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
	x.value=r;
	if ( r >= minimum_words )
	{
		var thehint=document.getElementById("hint_comments");
		thehint.innerHTML="(OK)"
		//thehint.innerHTML="<b style=\"color: green\">OK</b>"
		document.getElementById("hint_comments").style.color='green';
		document.getElementById("hint_comments").style.fontWeight='bold';
	}
	else
	{
		var thehint=document.getElementById("hint_comments");
		thehint.innerHTML="(NOT OK)"
		//thehint.innerHTML="<b style=\"color: green\">OK</b>"
		document.getElementById("hint_comments").style.color='red';
		document.getElementById("hint_comments").style.fontWeight='bold';
	}
}
