$(function(){
	$('<div id="dec"><blink>Loading...</blink><br/><img src="images/indicator.gif" /></div>')
	.ajaxStart(function() {$(this).show();})
	.ajaxStop(function() {$(this).hide();})
	.appendTo('#decxt');
});

$(document).ready(function()
{
  var nodes = $('.button');
  $('form').each(function(i)
  {
    $(this).bind('submit', function(e)
    {
      nodes[i].onclick();
      e.preventDefault();
    })
  });
});

function aboutclick()
{
$('#about').css('display','block');
$(document).ready(function(){
  $("#about").dialog({
    title: "#About",
    width: 300,
    height: 200,
    resizable: false,
    draggable: true,
    position: 'center',
    buttons: {  
      "Close": function() {
        $(this).dialog("close");
	$('#about').css('display','none');
      }  
    }  
  });
});
$("#about").dialog("open");
}

function contactclick()
{
    $.post("contacts.php", { pwd: 'notspam' },
   function(data)
   {
        document.getElementById("contact").innerHTML = data;
   });
$('#contact').css('display','block');
$(document).ready(function(){
  $("#contact").dialog({
    title: "#Contacts",
    width: 220,
    height: 150,
    resizable: false,
    draggable: true,
    position: 'center',
    buttons: {  
      "Close": function() {
        $(this).dialog("close");
	$('#contact').css('display','none');
      }  
    }  
  });
});
$("#contact").dialog("open");
}

function show(id)
{
	tmp = id.search("\\d+");
	result = id.substring(tmp);

	x = document.getElementById(id);

	if($('#node'+result).is(undefined) || $('#node'+result).is(':hidden')) 
	{
                $('#node'+result).toggle('slow');
		document.getElementById('img'+result).src = 'images/more2.gif';
        }
	else
	{
		$('#node'+result).toggle('slow');
		document.getElementById('img'+result).src = 'images/more.gif';
	}
}

function sqlhex(path)
{
    $.post("tools.php", { path: document.getElementById("path").value },
   function(data)
   {
        document.getElementById("sqlhex").innerHTML = data;
   });
}

function encdec(cryptmethod, text)
{
    $.post("tools.php", { cryptmethod: document.getElementById("cryptmethod").value, text: document.getElementById("text").value },
   function(data)
   {
        document.getElementById("ext").innerHTML = data;
   });
}

function md5_encode(md5)
{
    $.post("tools.php", { md5: document.getElementById("md5").value },
   function(data)
   {
        document.getElementById("md5_ext").innerHTML = data;
   });
}

function md5_decode(md5)
{
    $.post("tools.php", { md5_de: document.getElementById("md5_de").value },
   function(data)
   {
        document.getElementById("md5d_ext").innerHTML = data;
   });
}

function ssha1(sha1_code)
{
    $.post("tools.php", { sha1_code: document.getElementById("sha1_code").value },
   function(data)
   {
        document.getElementById("sha1_ext").innerHTML = data;
   });
}

function ssha1_dec(sha1_decode)
{
    $.post("tools.php", { sha1_de: document.getElementById("sha1_de").value },
   function(data)
   {
        document.getElementById("sha1de_ext").innerHTML = data;
   });
}

function who_is(whois)
{
    $.post("tools.php", { whois: document.getElementById("whois").value },
   function(data)
   {
        document.getElementById("whois_ext").innerHTML = data;
   });
}

function reverse_ip(reverse)
{
    $.post("tools.php", { reverse: document.getElementById("reverse").value },
   function(data)
   {
        document.getElementById("reverse_ext").innerHTML = data;
   });
}

function check_port(ip)
{
    $.post("tools.php", { ip: document.getElementById("ip").value },
   function(data)
   {
        document.getElementById("port_ext").innerHTML = data;
   });
}

function geo_ip(geoip)
{
    $.post("tools.php", { geoip: document.getElementById("geoip").value },
   function(data)
   {
        document.getElementById("geoip_ext").innerHTML = data;
   });
}

function xss_attack(xss)
{
    $.post("tools.php", { xss: document.getElementById("xss").value },
   function(data)
   {
        document.getElementById("xss_ext").innerHTML = data;
   });
}

function charset_en(input_text, input_encoding, output_encoding)
{
    $.post("tools.php", { input_text: document.getElementById("input_text").value,input_encoding: document.getElementById("input_encoding").value, output_encoding: document.getElementById("output_encoding").value },
   function(data)
   {
        document.getElementById("charset_ext").innerHTML = data;
   });
}

function check_pr(prlink)
{
    $.post("tools.php", { prlink: document.getElementById("pr").value },
   function(data)
   {
        document.getElementById("pr_ext").innerHTML = data;
   });
}

function check_ic(iclink)
{
    $.post("tools.php", { iclink: document.getElementById("ic").value },
   function(data)
   {
        document.getElementById("ic_ext").innerHTML = data;
   });
}

function check_alexa(alexa)
{
    $.post("tools.php", { alexa: document.getElementById("alexa").value },
   function(data)
   {
        document.getElementById("alexa_ext").innerHTML = data;
   });
}

function check_inv(inv_uin)
{
    $.post("tools.php", { inv_uin: document.getElementById("inv_uin").value },
   function(data)
   {
        document.getElementById("inv_ext").innerHTML = data;
   });
}