var phpURL = 
"http://www.notedpokerauthority.com/wordpress/wp-content/themes/npa/npatools_exec.php";

function run_tool(tool) {
var ajaxRequest;

// Browser detection
	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 browser broke!");
			}
		}
	}

	var game = 'h';
	if (tool == 'eq') game = document.getElementById('npatool-' + tool + '-game').value;
	var board = document.getElementById('npatool-' + tool + '-board').value;
	var hands = document.getElementById('npatool-' + tool + '-hands').value;

	var cmd = "?tool=" + tool + "&game=" + encodeURIComponent(game) + "&board=" + encodeURIComponent(board) + "&hands=" + encodeURIComponent(hands);

	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState > 0 && ajaxRequest.readyState < 4){
			document.getElementById('npatool-' + tool + '-output').innerHTML = '<span style=\'font-size: 18px; font-weight: bold; color: #000;\'>Thinking...</span>';
			document.getElementById('npatool-' + tool + '-submit').disabled = true;
		}
		if(ajaxRequest.readyState == 4){
			document.getElementById('npatool-' + tool + '-output').innerHTML = ajaxRequest.responseText;
			document.getElementById('npatool-' + tool + '-submit').disabled = false;
		}
	}
	ajaxRequest.open("GET", phpURL + cmd, true);
	ajaxRequest.send(null);
}

