
	function runEffect(id, both) {
		
		if ( both ) {
			var curc = jQuery( '#c' + id ).is(':visible');
			var cura = jQuery( '#a' + id ).is(':visible');
			if ( curc == cura ) {
				jQuery( '#a' + id ).toggle('blind');
			}
			jQuery( '#c' + id ).toggle('blind');
			
			var e = document.getElementById('co' + id);
			var num = parseInt(strip_tags(e.innerHTML));
			if ( curc ) {
				e = document.getElementById('cobtn' + id).innerHTML = '<a href="#" onclick="return runEffect(\'' + id + '\', true);">Show Comments (<div id="co' + id +  '" class="commentnum">' + num + '</div>)</a>';	
			}
			else {
				e = document.getElementById('cobtn' + id).innerHTML = '<a href="#" onclick="return runEffect(\'' + id + '\', true);">Hide Comments (<div id="co' + id +  '" class="commentnum">' + num + '</div>)</a>';	
			}
			
			
		}
		else {
			jQuery( '#a' + id ).toggle('blind');
		}
		
		
		return false;
	}
	
	function checkComment(id) {
		
		var msg = '';
		var e = document.getElementById('n' + id);
		if ( e.value == '' ) {
			msg += 'Please enter your name!' + "\n";
		}
		
		e = document.getElementById('e' + id);
		if ( e.value == '' ) {
			msg += 'Please enter a email address!' + "\n";
		}
		else {
			if ( ! validEmail(e.value) ) {
				msg += 'Please enter a valid email address!' + "\n";
			}
		}
		
		e = document.getElementById('t' + id);
		if ( e.value == '' ) {
			msg += 'Please enter comment text!' + "\n";
		}
		
		if ( msg != '' ) {
			alert(msg);
			return false;	
		}
		
		/*
		e = document.getElementById('b' + id);
		e.style.display = 'none';
		*/
		
		var r = jQuery.post("comment.php", { 
			save: document.getElementById('ai' + id).value,
			section: document.getElementById('si' + id).value,
			name: document.getElementById('n' + id).value, 
			email: document.getElementById('e' + id).value,
			comment: document.getElementById('t' + id).value
			 });
			 
			 
		var now = new Date();
		var timestr = dateFormat(now, "HH:MM, mmmm d - yyyy");

		
		jQuery('#c' + id).prepend( '<div class="commententry"><b>' +
					strip_tags(document.getElementById('n' + id).value, '') + 
					'</b> on ' + timestr + '<hr />' +
					nl2br(strip_tags(document.getElementById('t' + id).value),false) + 
					'</div>' );
		
		e = document.getElementById('co' + id);
		var num = parseInt(strip_tags(e.innerHTML));
		num++;
		e.innerHTML = num;
		
		
		document.getElementById('n' + id).value = '';
		document.getElementById('e' + id).value = '';
		document.getElementById('t' + id).value = '';
		
		//return true;
		return false;
	}
	
