// JavaScript Document

function dispStates()
{
	if($("#country").val() != 'India')
		{
			$("#state_div").html("<input type=\"text\" name=\"state\" id=\"state\" class=\"form_inputs\" value=\"\" />");
			$("#flag").val('2');
		}
	else
		{
			form_loading("common_msg");
			$.ajax({
			type	: "POST",
			url		: "ajaxforms/register-action.php",
			data	: "action_flg=drpdwn_country",
			success	: function(msg)
				{	
					if(msg.indexOf("Failure")=="-1")
						{
							$("#common_msg").css("display","none");
							$("#state_div").html(msg);
							$("#flag").val('1');
						}
					else
						{
							//error
						}
				}
				
			});
		}
}

$(document).ready(function()
{
	$("#register_form").submit(function() 
		{
			form_loading("common_msg");
			$.ajax({
				type	: "POST",
				url		: "ajaxforms/register-action.php",
				data	: $("#register_form").serialize(),
				success	: function(msg)
					{	
						showEditMessage("register_form","");	
						$("#common_msg").css("display","none");	
						if(msg.indexOf("Failure")=="-1")
						{
							window.location = "thanks.php?message=1";
							/*
							alert(msg);
							reset_form();
							*/
						}
						else
						{
							showEditMessage("register_form",msg);
						}
					}
			});
   });
});


function reset_form()
{
	$("#first_name").val("");
	$("#last_name").val("");
	$("#email").val("");
	$("#password").val("");
	$("#re_password").val("");
}