$(document).ready(function() {
	$('#Loading').hide();
	$('#Loading').hide();
	$('#inputIdent').hide();
	$('#ident').blur(function(){
	  $('#Loading').show();
      $.post("func/check_ident.php", {
        val: $('#ident').val()
      }, function(response){
        $('#identResult').fadeOut();
		if(response != 'ok'){
	        setTimeout("finishAjaxIdent('identResult', '"+escape(response)+"')", 400);
			//$('#button').hide();
		}
		else {
			 $('#Loading').hide();
			// $('#button').show();
			 
		}
      });
	   	return false;
	});
	$('#url').blur(function(){
	  $('#Loading').show();
      $.post("func/check_url.php", {
        val: $('#url').val()
      }, function(response){
        $('#urlResult').fadeOut();
		if(response != 'ok'){
       		 setTimeout("finishAjaxUrl('urlResult', '"+escape(response)+"')", 400);
			 //$('#button').hide();
		}
		else {
			 $('#Loading').hide();
			 //$('#button').show();
		}
      });
	  	  	return false;
	});
	
});

		
function finishAjaxIdent(id, response) {
  $('#Loading').hide();
  $('#'+id).html(unescape(response));
  $('#'+id).fadeIn();
} 

function finishAjaxUrl(id, response) {
  $('#Loading').hide();
  $('#'+id).html(unescape(response));
  $('#'+id).fadeIn();
} 

function generateIdent(){
		$.get("func/generate.php", "generateRandom", function(response){        
      		 document.create.ident.value = response;
	      });
		}
function showIdent(){
		 $('#inputIdent').fadeIn();
		}