function tool(e)
{
	var error = 'Request Timed Out';
	$().ajaxStart($.blockUI).ajaxStop($.unblockUI);
	switch(e) 
	{
		case 'ping':
			var host = $('#ping_input input#id_host').val().toLowerCase();
			$.ajax({
				type: 'POST',
				url: '/ping/',
				data: 'host='+host,
				timeout: 100000,
				success: function(msg) {
					$('#restxt').append(msg);
				},
				error: function() {
					$('#restxt').append(error);
				}
			});
			break;
		case 'traceroute':
			var host = $('#traceroute_input input#id_host').val().toLowerCase();
      $.ajax({
        type: 'POST',
        url: '/traceroute/',
        data: 'host='+host,
        timeout: 100000,
        success: function(msg) {
          $('#restxt').append(msg);
        },
        error: function() {
          $('#restxt').append(error);
        }
      });
			$('#restxt').focus();
      break;			
		case 'dns':
			var host = $('#dns_input input#id_host').val().toLowerCase();
			var type = $('#dns_input select#id_type').val();
      $.ajax({
        type: 'POST',
        url: '/dns/',
        data: 'host='+host+'&type='+type,
        timeout: 50000,
        success: function(msg) {
          $('#restxt').append(msg);
        },
        error: function() {
          $('#restxt').append(error);
        }
      });
			break;
		default:
			break;
	}
	return false;
}
