function checkUserLoginAjax(frm_id)
{
	var plugin_url = jQuery("#plugin_url").val();
	var data = jQuery("#"+frm_id).serializeArray();

	jQuery("#widget-ajax-loading").show();
	jQuery("#widget_login_error").hide();
	url = plugin_url+"/member/ajax.php?action=check_user_login";
	jQuery.post(url, data, function(response) {
			if(response == 1)
			{
				jQuery("#submit_btn").click();
				jQuery("#widget_login_error").hide();
			}
			else
			{
				jQuery("#widget-ajax-loading").hide();
				jQuery("#widget_login_error").addClass("logError").html(response).show();
				if(!response || response=='' || response==0){
					jQuery("#widget_login_error").html("ERROR: Invalid login details").show();
				}
			}
	
		});

}
function checkLostPassword(frm_id)
{
	var plugin_url = jQuery("#plugin_url").val();
	var data = jQuery("#"+frm_id).serializeArray();

	jQuery("#ajax-loading").show();
	jQuery("#lostpassword_error").hide();
	url = plugin_url+"/member/ajax.php?action=check_user_lostpassword";
	jQuery.post(url, data, function(response) {
			if(response == 1)
			{
				jQuery("#lostpassword_error").hide();
				var redirect_to =jQuery("#redirect_to").val();
				window.location = redirect_to;
			}
			else
			{
				jQuery("#ajax-loading").hide();
				jQuery("#lostpassword_error").html(response).show();
				if(!response){
					jQuery("#lostpassword_error").html("ERROR: Invalid login details").show();
				}
			}
	
		});

}
function resetPassword(frm_id)
{
	var plugin_url = jQuery("#plugin_url").val();
	var data = jQuery("#"+frm_id).serializeArray();

	jQuery("#ajax-loading").show();
	jQuery("#lostpassword_error").hide();
	url = plugin_url+"/member/ajax.php?action=reset_password";
	jQuery.post(url, data, function(response) {
			if(response == 1)
			{
				jQuery("#lostpassword_error").hide();
				var redirect_to =jQuery("#redirect_to").val();
				window.location = redirect_to;
			}
			else
			{
				jQuery("#ajax-loading").hide();
				jQuery("#lostpassword_error").html(response).show();
				if(!response){
					jQuery("#lostpassword_error").html("ERROR: Invalid login details").show();
				}
			}
	
		});
}
function register(frm_id)
{
	var plugin_url = jQuery("#plugin_url").val();
	var data = jQuery("#"+frm_id).serializeArray();

	jQuery("#ajax-loading").show();
	jQuery("#lostpassword_error").hide();
	url = plugin_url+"/member/ajax.php?action=register";
	jQuery.post(url, data, function(response) {
			if(response == 1)
			{
				jQuery("#register_error").hide();
				var redirect_to =jQuery("#redirect_to").val();
				window.location = redirect_to;
			}
			else
			{
				jQuery("#ajax-loading").hide();
				jQuery("#register_error").html(response).show();
				if(!response){
					jQuery("#register_error").html("ERROR: Invalid login details").show();
				}
			}
	
		});
}
function checkChangePassword(frm_id)
{
	var plugin_url = jQuery("#plugin_url").val();
	var data = jQuery("#"+frm_id).serializeArray();

	jQuery("#ajax-loading").show();
	jQuery("#lostpassword_error").hide();
	url = plugin_url+"/member/ajax.php?action=change_password";
	jQuery.post(url, data, function(response) {
			if(response == 1)
			{
				jQuery("#ajax-loading").hide();
				jQuery("#changepassword_error").removeClass('logError').addClass('logSuccess').html('Password change successfull.').show();
			}
			else
			{
				jQuery("#ajax-loading").hide();
				jQuery("#changepassword_error").html(response).show();
				if(!response){
					jQuery("#changepassword_error").html("ERROR: Invalid login details").show();
				}
			}
	
		});
}
