$(document).ready(function(){

	$("#powered").hide();

	$("#results").hide();
	$("#loading").hide();

	// Wenn ein Hashtag angegeben wurde wird dies in das Inputfeld geschrieben
	if(document.location.hash != ""){
		var hash = document.location.hash;
		//alert(hash);
		hash = hash.replace( /^#/, '' );
	
		//alert(hash);
	
		$('input#query').val(hash);
	}

	
    $('form#serverdna').bind('submit', function(e){
		$("#results").fadeOut();
		$("#loading").fadeIn();
		
		var query  = $('input#query').val();
		//alert(query);
		
        e.preventDefault();
		
		$.ajax({
			type: 'POST',
			url: 'getDomains.php?query='+query,
			data: '',
			success: function(theResponse){
				
				
				$("#loading").fadeOut();
				$("#results").html(theResponse);
				$("#results").fadeIn("slow");
				
				//$("#results").animate({opacity: 1.0}, 3000);
				//$(".resultText").fadeOut(1500);
				
				//alert(theResponse);


			},
			error: function(){
				$("#error").fadeIn("slow");
				$("#error").animate({opacity: 1.0}, 3000);
				$("#error").fadeOut(1500);
				$("#results").html(systemError);
				$("#loading").hide();
			}		
		});
	});



    $("body").mousemove(function(e){
      $("#powered").fadeIn(3000);
    });


	$(".showFancybox").fancybox({
		'width'				: '90%',
		'height'			: '90%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	$(".showFancyboxSmall").fancybox({
		'width'				: '50%',
		'height'			: '50%',
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
			
});
