/**
 *
 * @version $Id$
 *
 * @author Dario Minnucci <dario.minnucci@midworld-networks.com>
 * @copyright Copyright 2010, Dario Minnucci <dario.minnucci@midworld-networks.com>
 * @license http://www.midworld-networks.com/licenses/MNL1.html
 *
 * @package iputils.org
 * @subpackage javascript
 *
 */

/**
 * PING
 */
function ping() {

	$(document)
			.ready(
					function() {
						var target = $('input[name=target]').val();
						var stamp = $('input[name=stamp]').val();

						$('label').css('display', 'none');
						$('input[name=target]').css('display', 'none');
						$(".button").css('display', 'none');

						var actionStr = "<div style='height:32px;line-height:32px'><img style='float:left;margin-right:10px;' src='images/loading.gif'>Pinging <b>"
								+ target + "</b>, please wait... </div>";
						$(".result").html(actionStr);
						$('.result').css('display', 'block');

						$.post("exec_ping.php", {
							'stamp' : stamp,
							'target' : target
						}, function(data) {
							// alert("Data Loaded: " + data);
								$('.result').css('background-color', '#FFF');
								$('.result').html(data);
							});
					});

}

/**
 * TRACEROUTE
 */
function traceroute() {

	$(document)
			.ready(
					function() {
						var target = $('input[name=target]').val();
						var stamp = $('input[name=stamp]').val();

						$('label').css('display', 'none');
						$('input[name=target]').css('display', 'none');
						$(".button").css('display', 'none');

						var actionStr = "<div style='height:32px;line-height:32px'><img style='float:left;margin-right:10px;' src='images/loading.gif'>Tracerouting <b>"
								+ target + "</b>, please wait... </div>";
						$(".result").html(actionStr);
						$('.result').css('display', 'block');

						$.post("exec_traceroute.php", {
							'stamp' : stamp,
							'target' : target
						}, function(data) {
							// alert("Data Loaded: " + data);
								$('.result').css('background-color', '#FFF');
								$('.result').html(data);
							});
					});

}

/**
 * WHOIS
 */
function whois() {

	$(document)
			.ready(
					function() {
						var target = $('input[name=target]').val();
						var stamp = $('input[name=stamp]').val();

						$('label').css('display', 'none');
						$('input[name=target]').css('display', 'none');
						$(".button").css('display', 'none');

						var actionStr = "<div style='height:32px;line-height:32px'><img style='float:left;margin-right:10px;' src='images/loading.gif'>Querying WHOIS about <b>"
								+ target + "</b>, please wait... </div>";
						$(".result").html(actionStr);
						$('.result').css('display', 'block');

						$.post("exec_whois.php", {
							'stamp' : stamp,
							'target' : target
						}, function(data) {
							// alert("Data Loaded: " + data);
								$('.result').css('background-color', '#FFF');
								$('.result').html(data);
							});
					});

}