// JavaScript Document

	function hideContent(elem) {
		document.getElementById(elem).innerHTML = '';
	}
	
	function hideAllCurrentContent() {
		var ccArray = new Array('introduction','agenda','venue');
		for (i=0; i<ccArray.length; i++) {
			document.getElementById(ccArray[i]).className = 'hide';
		}
	}
	
	function hideAllPreviousContent() {
		var ccArray = new Array('previousList');
		for (i=0; i<ccArray.length; i++) {
			document.getElementById(ccArray[i]).className = 'hide';
		}
	}
	
	function showCurrentContent(contentSelected) {
		hideAllCurrentContent();
		document.getElementById(contentSelected).className = 'show';
	}
	
	function showPreviousContent(contentSelected) {
		hideAllPreviousContent();
		document.getElementById(contentSelected).className = 'show';
	}

	function changeSelectedButton(button1, button2) {
		document.getElementById(button1).className = 'selected';
		document.getElementById(button2).className = 'deselected';
	}
	
	function hideSingleContent(contentId) {
		document.getElementById(contentId).className = 'hide';
	}

	function showSingleContent(contentId) {
		document.getElementById(contentId).className = 'show';
	}
	
	function switchContent(contentArea1, contentArea2) {
		document.getElementById(contentArea1).className = 'contentAreaOpen';
		document.getElementById(contentArea2).className = 'contentAreaClosed';		
	}



	function showSection(buttonPressed) {
		var current = new RegExp('current');
		if (buttonPressed.match(current)) {
			
			hideAllPreviousContent();
			changeSelectedButton('current','previous');
			showSingleContent('currentMenu');
			switchContent('currentContent','previousContent');
			showCurrentContent('introduction');
		
		} else {
			
			hideAllCurrentContent();
			changeSelectedButton('previous','current');
			hideSingleContent('currentMenu');
			switchContent('previousContent','currentContent');
			showPreviousContent('previousList');
		
		}
	
	}
	
function countContent(f, charMax, id, mycolor) {
	var doc = document.getElementById(id);
	
	value = f.value;
	vLength = value.length;
	
	doc.innerHTML = charMax-vLength;
		
	if (vLength <= charMax) {
		doc.style.color = mycolor;
		doc.innerHTML = charMax - vLength;
	} else if (vLength > charMax) {
		doc.style.color = "darkred";
		doc.innerHTML = charMax - vLength;
	}
	

}


//external length check fn - use onBlur eevnt to check specific fields
function quickLengthCheck(elm, myLength) {
			if (elm.value.length > myLength) 
				{ 	alert('Your entry is too long. Please restrict to '+myLength+' characters.')
					elm.focus();
					return false;}	
}
