function LoginCore() {
	this.currentPage = Object();
	this.ident ='';
	
	this.Add = function(ident,path,id) {
		
		 this.ident = ident;
		 var data = new Object();	
		 data['ident'] = ident; 
		 data['id'] = id; 
		 data['path'] = path;
		 data['widget'] = 'login';

		 this.InitializeRequest('POST', '/ajax.php');
         this.Commit(postquery(data));	
	}

	this.register = function(nickname, email,password,password_confirm,captcha) {
		if ($('rules_').checked==true)  {
			var data = new Object();	 
			 data['widget'] = 'login';
			 data['nickname'] = encodeURIComponent(nickname);
			 //data['firstname'] = encodeURIComponent(firstname);
			 //data['lastname']=encodeURIComponent(lastname);
			 if ($('type_3').checked==true) {
			 	data['type'] = 3;
			 } else data['type'] = 2;
			 data['email']=encodeURIComponent(email);
			 data['password']=encodeURIComponent(password);
			 data['password_confirm']=encodeURIComponent(password_confirm);
			 data['captcha'] = captcha;	 
			 
			 this.InitializeRequest('POST', '/ajax.php');
	         this.Commit(postquery(data));	
		} else alert('Вы не согласились с правилами');
	}
	
	this.OnSuccess = function()
      {
      	//alert(this.GetResponseText());
      	eval(this.GetResponseText());
      	// fade(0,"form_"+this.ident);
      	// $("loading_"+this.ident).style.display = 'none';
      }

}

LoginCore.prototype = new ajax();
Login = new LoginCore();
