/*------------------------ Checkbox value management -----------------------*/	

function toggleValue(checkbox)
{
	if ( checkbox.checked == true )
		checkbox.value = 'Y';
	else
		checkbox.value = '';
}

function wordCount(string)
{
	var words = string.split(/\s+/g);
	if ( string == "" )
		return 0;
	else
		return words.length;
}

function wcUpdate()
{
	counter = document.getElementById('wCounter');
	aBox = document.getElementById('AbstractBox');
	counter.innerHTML = wordCount(aBox.value);
	setTimeout('wcUpdate()', 500);
}

function verifyForm()
{
	aBox = document.getElementById('AbstractBox');
	wcount = wordCount(aBox.value);
	if ( wcount > 300 )
	{
		alert("Your abstract must be 300 words or less. Please reduce the length of your abstract and then click the Submit button again.");
	}
	else
	{
		document.emailForm.submit();
	}
	
}
