var active = true;
function logout(path) {
	var current = window.location.href;
	$.ajax({
		type: "GET",
		data: '',
		url: path+"/widget/logout.php",
		async : false,
		success: function(response){
            reflushPanel();
		}
	});
}
function login(path) {
	var email = $('#email').val();
	var password = $('#password').val();
	email = $.trim(email);
	password = $.trim(password);

	if(!email)
	{
		$('#email').focus();
		return false;
	}
	if(!password)
	{
		$('#password').focus();
		return false;
	}
	if(!active){ 
       //alert("正在进行中，请稍候....."); 
	   return false;
	}
	
	active = false; 
	$.ajax({
		type: "POST",
		url: path+"/widget/login.php",
		data: "email="+email+"&password="+password,
		success: function(response){
                if(parseInt(response, 10) ==  100) {
                    active = true; // activate it again !
                    var html = response;
                    $('#email').attr('disabled','disabled');
                    $('#password').attr('disabled','disabled'); 
                    $('#tips').html('<font style="color:green;">登录成功</font>');
                    $('#tips').css('display', '');
                    reflushPanel();
                }else {
                    $('#tips').html(response);
                    $('#tips').css('display', '');
                }
		}
	});
	 return true;
}




	
function gup(b){
	b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
	var a="[\\?&]"+b+"=([^&#]*)";
	var d=new RegExp(a);
	var c=d.exec(window.location.href);
	if(c==null){
		return ""
	}else{
		return c[1]
	}
}

$(document).ready(function() { 
    $('#agree').bind('click', function() {
		if($(this).is(':checked')) { 
			$('#message').css('display', 'none');
		}
	}); 
}); 