// JavaScript Document
<!-- 
//Browser Support Code
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function submitcomment(){
        var name = document.getElementById('Name').value;
		var location = document.getElementById('Location').value;
		var comment = document.getElementById('ArtComment').value;
		var articleid = document.getElementById('articleid').value;
		
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browqser is incompatible. Please consider using Internet Explorer or Firefox.");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
//state 1 means is sending variables to php
		if(ajaxRequest.readyState == 1){
			//show loader graphic to disable using from sending multiple times
			var loader = document.getElementById('loader');
	        loader.style.display = 'block';
			setTimeout("hideloader()",9000);
		}
		//state 4 indicates that variables were received by php
		if(ajaxRequest.readyState == 4){
			//hide form and show the echo back from php
			document.getElementById('commentform').innerHTML = ajaxRequest.responseText;
			setTimeout("comment()",9000);
		}
	}
	
	//gather variables to send to php via post
	var queryString = 'name='+name+'&location='+location+'&comment='+comment+'&submitcomment='+articleid;
	//true returns echo back from php file
	ajaxRequest.open("POST", "http://www.chiroeco.com/news/comment.php", true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
	ajaxRequest.send(queryString);
}

//function to hide the loader graphic.
function hideloader(){
	var loader = document.getElementById('loader');
	loader.style.display = 'none';
}
//-->