function whois_check()
{
	url = $("#url").val();
	
	url = replace("http://www.",'',url);
	url = replace("http://",'',url);
	 
	location.hash = '#'+url;

	$("#result").html('<div align="center"><img src="img/wait.gif" width="66px" height="66px" alt="wait"></div>');

	$.post("whois.php",
	{
		url: 			url,
	},
	function(data)
	{
		$("#round_up_spacer").animate({"height": 100}, "slow");
	
		$("#result").html(data);
	});
}

function whois_keyPressed(obj, event)
{
	event = event || window.event;
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : null;
	
	if (keyCode == 13)
		whois_check();
}

function replace(search, replace, subject)
{
	var 	ra = replace instanceof Array, 
			sa = subject instanceof Array,
			l = (search = [].concat(search)).length,
			replace = [].concat(replace),
			i = (subject = [].concat(subject)).length;
			
	while (j = 0, i--)
		while
			(subject[i] = subject[i].split(search[j]).join(ra ? replace[j] || "" : replace[0]), ++j < l);
	
	return sa ? subject : subject[0];
}

$(document).ready(function()
{
	url = location.href.split('#')[1];
			
	if (url!=undefined && url!='')
	{
		$("#url").val(url);
		whois_check();
	}
		
});
