$(document).ready(function () { 
	$("#registerForm").submit(function () {
		$("#msgboxRegister").removeClass().addClass('messagebox').text('Sereive is thinking ...').fadeIn('fast');
		if ($('#agreeS').attr("checked")) {
			$.post(
					"login-register.php",
					{
						registerName: $('#registerName').val(),
						registerPassword: $('#registerPassword').val(),
						registerEmail: $('#registerEmail').val(),
						registerLanguage: $('#registerLanguage').val(),
						registerIp: $('#registerIp').val(),
						registerHost: $('#registerHost').val(),
						registerAgent: $('#registerAgent').val(),
						rand: Math.random(),
						registerPlan: $('#plan').val()
					},
					function (a) {
						$("#msgboxRegister").fadeOut('fast', function () {
							if (a == 'no') {
								$(this).html('seReive says: Username or Email already exists, please choose different one.').addClass('messageboxerror').fadeIn('fast');
							} else if (a == 'empty') {
								$(this).html('seReive says: All fields are mandatory. Please fill ALL fields and try again. Thank you!').addClass('messageboxerror').fadeIn('fast');
							} else {
								$(this).html('seReive writes down your details and suggest you to check your email for further steps.').addClass('messageboxok').fadeIn('fast');
							}
						});
					}
			);
		} else {
			$("#msgboxRegister").fadeOut('fast', function() {
				$(this).html('You must agree with Terms and Conditions.').addClass('messageboxok').fadeIn('fast');
			});
		}
		return false;
	});
});
