function submitCommentForm(){
	var csForm = document.getElementById('formWrapper');
	var qaBox = document.getElementById('qaBox');

	setOpacity(csForm, 20);

	//dynamically add text input box
	if(!document.getElementById('qa_a')){
		var a_data_td = document.getElementById('a_data');
		var textBox = document.createElement('input');
		textBox.id = 'qa_a';
		a_data_td.appendChild(textBox);
	}
	qaBox.style.display = "block";
	return false;
}

function verify(){

	var url = "./captcha/qa_answer.php";
	xmlhttpPost(url);
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";

  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function cancel(){

	var csForm = document.getElementById('formWrapper');
	var qaBox = document.getElementById('qaBox');

	setOpacity(csForm, 100);

	qaBox.style.display = "none";

}
//********************************
//ajax functions
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            checkanswer(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(/*getquerystring()*/null);
}

function checkanswer(a_actual){
	var a_typed = document.getElementById('qa_a').value;
	//alert(a_typed+' - '+a_actual);
	if(a_typed.toLowerCase() == a_actual.toLowerCase()){
		var csForm = document.getElementById('newman_form');
		alert('Sorry! This form is currently undergoing maintenance.  Please try back in a few minutes');
		//csForm.submit();
		document.forms[0].submit();
		//alert(document.forms[0].id);
		//window.location = './commentsuggest.php?test&value=1';
	}
	else
		alert('Sorry! That is not correct.  Please try again, or are you a robot?');
}