//Count the number of words
function cnt(w,x){
	var y=w.value;
	var r = 0;
	a=y.replace(/\s+/g,' '); //Some whitespace
	a=a.replace("' ",' '); //Single quote with space
	a=a.replace("'",''); //Single quote no space
	a=a.replace(/-/g,''); //Em-dash (needs regular expression)
	a=a.replace(/^[^A-Za-z0-9]+/gi,''); //Non alphanumeric characters
	a=a.replace(/[^A-Za-z0-9]+/gi,' ');
	a=a.split(' ');
	for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
	if (r > 300) {
		document.getElementById('wordcount').innerHTML = '<br/><span style="color:red">Your Biography Abstract is over the 300 word limit, please edit this to stay within the requirements of the submission.<br/>You currently have approximately '+r+' words in your biography abstract.</span>';
		//document.getElementById('submit-button').disabled = true;
	}
	else {
		document.getElementById('wordcount').innerHTML = r;
		//document.getElementById('submit-button').disabled = false;
	}
}

//Function shows or hides submission detail
function showDetail (selDiv) {
curDiv = document.getElementById(selDiv);
	if (curDiv.style.display == 'none') {
		curDiv.style.display = '';
	}
	else {
		curDiv.style.display = 'none';
	}
}