﻿//update by yang 08.12.10 add returnpage parameter
$(document).ready(function() {
	$('#_loginButton').click(function(){
		$('#_msg').show();
		$('#_msg').html("<img src=\"/common/loading.gif\">正在验证用户数据...");
		var thedata = $("#loginform").serialize();
		$.ajax({
		type: "POST",
		data :thedata,
		url: "/login/login_action.asp",
		success: function(data){
			$('#_msg').fadeOut();	
	        setTimeout("finishRequest('_msg', '"+escape($.trim(data))+"','"+$('#returnpage').val()+"')", 1000);
		}
		});
		return false;
	})

	
});

function finishRequest(id, response, page) {	
	if (response == "ok")
	{
		$('#'+id).show();
		$('#'+id).html("登录成功,页面引导中...");	
		if (page != "")
		{
			top.location.href = page;
		}
		else{		
			top.location.href = "/membercenter/index.asp";
		}
		
	}
	else
	{
	  $('#'+id).show();
	  $('#'+id).html(unescape(response));
	  $('#'+id).fadeIn();
	}
} 

 

