//AJAX form validation.
$(document).ready(function() { 

	//See if the login is available.
	$("#Email_address").blur( function() {
		
		//Get the value.
		var login = $(this).attr('value');
		
		$.ajax({
		    url: SETTINGS.webRoot + "page/validateSiteLogin?login=" + login,
		    type: 'GET',
		    success: function(html){
				
				//This message will let the user know if the login is available 
				//or not. Place the message on the page.
				if ($("#login-validation").length) {
					$("#login-validation").remove();
				}
				$("#Email_address").after(html);
		    }
		});
	});
	
	//Check if this domain is available.
	$("#Site_Domain_Name").blur( function() {
		
		//Get the value.
		var domain = $(this).attr('value');
		
		$.ajax({
		    url: SETTINGS.webRoot + "page/validateSiteDomain?domain=" + domain,
		    type: 'GET',
		    success: function(html){
				
				//This message will let the user know if the domain is 
				//available or not. Place the message on the page.
				if ($("#domain-validation").length) {
					$("#domain-validation").remove();
				}
				$("#Site_Domain_Name").after(html);
		    }
		});
	});
});
