function triggerHandlers(){
	// Place any handlers here that you want called after pages get loaded.	
	var id = 0;
	$("#domain-querybox").keyup(function(){
		var search;
		query = $("#domain-querybox").val();
		id += 1;
		if (query.length > 0){
		    //TRIGGER AJAX
		    $('#loading').show();
		    $.getJSON("/domain-files/ajax/lookup_responder.php", { q: query, id: id },function(response){
		        var responseid = response['id'];
		        var responsedata = response['data'];
		        if (responseid == id){
		            var responsehtml = "<table>";
		            $.each(responsedata,function(index,value){
		                if (value.status == "available"){
		                    color="00FF00";
		                } else {
		                    color="FF0000";
		                }
		                responsehtml 
		                    += "<tr>"
		                    + "<td><a href='http://" + value.domain + "'>" + value.domain + "</a></td>"
		                    + "<td style='color:#"+color+"'>" + value.status + "</td>"
		                    + "</tr>";
		            })
		            responsehtml += "</table>"
		            $("#domain-response").html(responsehtml);
		            $('#loading').hide();
		        }
		    });
		} else {
		    //Empty response list
		    $("#response").empty();
		}
	});
}
//This code is triggered once the DOM is loaded, but before elements have actually been placed
//on the screen.
$(document).ready(function() {
	//If the URL is appended with #url, then load all the content from the "content" element
	//at that URL into our "content" element
	var hash = window.location.hash.substr(1);
	var href = $('#nav tr td a').each(function(){
		var href = $(this).attr('href');
		if (hash == href.substr(0, href.length)) {
			var toLoad = hash + '.php #content';
			$('#content').load(toLoad, null, function(){
				//Ensure all javascript effects are loaded correctly
				EnableEffects();
			});
		}											
	});
	

	
	//Changes the default behavior of a link inside the submenu to perform the transition
	$('#nav a').click(function() {
		var toLoad = $(this).attr('href') + ' #content';
		
		//Make sure there's a section content div in existence
		if (document.getElementById('content') != null) 
		{
			//Add the loading image to the page
			$('#loading').show();
			
			//Fade out this page's content and load the linked page's content thereafter
			$('#content').slideUp(600, loadContent);
			
			//Alter the URL in the address bar
			window.location.hash = $(this).attr('href').substr(0, $(this).attr('href').length);
		}
		
		//This function loads the content from the page selected
		function loadContent() 
		{
			$('#content').load(toLoad, null, showNewContent);
		}
		
		//Fade in the content div
		function showNewContent() 
		{
			//Ensure all javascript effects are loaded correctly
			EnableEffects();
			
			//Fade in the new content
			$('#content').slideDown(600, function(){
				triggerHandlers();
				$('#loading').hide();
				
				
			});
		}
		
		return false;
		
	});

	//Creates a click event for submenu table elements which causes them to call up the click event of the
	//"a" tag contained within them.
	$('#nav tr td').click(function(){
		$(this).click($(this).find('a').click());
		return false;
	});
});
