$(document).ready(function()
{
	$("#email").blur(function()
	{
		//remove all the class add the messagebox classes and start fading
		$("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
		//check the username exists or not from ajax
		$.post("helpers/user_availability.php",{ email:$(this).val() } ,function(data)
        {
		  if(data=='no') //if username not avaiable
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
	document.getElementById('submit').style.display = 'none';
document.getElementById('submit_disabled').style.display = 'block';
			  //add message and change the class of the box and start fading
			  $(this).html('This email address is already being used! <a href="http://www.shopperguard.com/getseal/retrieve_password.php" style="color:#ffffff;"><u>Retrieve Password</u></a>').addClass('messageboxerror').fadeTo(900,1);
			});		
          }
		  else
		  {
		  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
	document.getElementById('submit').style.display = 'block';
document.getElementById('submit_disabled').style.display = 'none';
			});
		  }
				
        });
 
	});
});
