doCount = true;

function startCount() {
	
	hideAlert();

	doCount = true;
	runCount();

}

function runCount() {
	
	if (document.all) {
	
		if (doCount) {			
			comSize = document.theform.body.value.length;
			alrt = document.getElementById("alert");
			if (comSize > 850) {				
				alrt.innerHTML = "Internet Explorer can't handle long comments. Firefox can.";	
				showAlert();
			}
			else {
				alrt.innerHTML = "Please enter a comment first.";
				hideAlert();
			}
			
			setTimeout("runCount()",100);
		}

	}

}


function endCount() {

	if (document.all) {

		comSize = document.theform.body.value.length;
		alrt = document.getElementById("alert");
		if (comSize > 850) {
			alrt.innerHTML = "Internet Explorer can't handle long comments. Firefox can.";	
			showAlert();
		}
		else {
			alrt.innerHTML = "Please enter a comment first.";
			hideAlert();
		}
		doCount = false;

	}
	
}


function checkForm() {
	
	if (document.theform.body.value.length > 5) {
		hideAlert();
		document.getElementById("postbutton").style.display = "none";
		document.getElementById("progress").style.display = "block";
		//document.theform.action = "post.php";
		
		body2 = document.theform.body.value;
		email2 = document.theform.email.value;
		subject2 = document.theform.subject.value;
		name2 = document.theform.name.value;
		id2 = document.theform.post.value;
		msgid2 = document.theform.msgid.value;
		last2 = document.theform.last.value;
		
		postToList(escape(body2),escape(subject2),email2,escape(name2),id2,msgid2,last2);
	
	}
	else {
		showAlert();
	}
}



function checkWebForm() {
	
	if (document.theform.body.value.length > 5) {
		hideAlert();
		document.getElementById("postbutton").style.display = "none";
		document.getElementById("progress").style.display = "block";
		//document.theform.action = "post.php";
		
		body2 = document.theform.body.value;
		email2 = document.theform.email.value;
		subject2 = document.theform.subject.value;
		name2 = document.theform.name.value;
		id2 = document.theform.post.value;
		last2 = document.theform.last.value;
		
		postToWeb(escape(body2),escape(subject2),email2,escape(name2),id2,last2);
	
	}
	else {
		showAlert();
	}
}



function checkTag() {
	
	if (false) {
		showTagAlert();
	}
	else {
		thepost = document.tagForm.post.value;
		
		if (thepost!="" && thepost!=" ") {
			document.tagForm.action = "discuss.php?post=" + thepost + "#tags";	
			setTimeout("document.tagForm.submit()",10);
		}
	}
}


function showTagAlert() {
	// coming soon
}	



function showAlert() {
	a = document.getElementById("alert");
	if (a) a.style.display = "block";
	
	t = document.getElementById("commentbody");
	if (t) t.style.backgroundColor = "#FFC";
}

function hideAlert() {
	a = document.getElementById("alert");
	if (a) a.style.display = "none";

	t = document.getElementById("commentbody");
	if (t) t.style.backgroundColor = "#FFF";
	
}


