function signNewsletter(fld){
	if($(fld).value==null || $(fld).value.trim()=='' ){
		alert('podaj adres e-mail');
		return false;
	}
	var field = fld;
	var mail = $(fld).value.trim();

	var rq = mint.Request();
	rq.retryNum = 0;
	rq.timeout = 10000;
	rq.evalScripts = true;
	rq.evalResponse = true;

	rq.OnError = function (){
		alert('wystąpił błąd - odśwież stronę i spróbuj ponownie');
		alert(this.responseText);
	}

	rq.OnSuccess = function (){
		eval(this.responseText);
		$(field).value = '';
	}

	rq.OnAbort = function (){
		alert('nie udało się połączyć z serwerem.'+"\n"+'spróbuj ponownie za chwilę');
	}

	rq.AddParam('mod', mailingModule);
	rq.AddParam('act', 'save');
	rq.AddParam('newsletter', mail);
	rq.AddParam('type', 'ajax');
	rq.Send(scriptName);
}

function unsignNewsletter(fld){
	if($(fld).value==null || $(fld).value.trim()=='' ){
		alert('podaj adres e-mail');
		return false;
	}
	var field = fld;
	var mail = $(fld).value.trim();

	var rq = mint.Request();
	rq.retryNum = 0;
	rq.timeout = 10000;
	rq.evalScripts = true;
	rq.evalResponse = true;

	rq.OnError = function (){
		alert('wystąpił błąd - odśwież stronę i spróbuj ponownie');
		alert(this.responseText);
	}

	rq.OnSuccess = function (){
		eval(this.responseText);
		$(field).value = '';
	}

	rq.OnAbort = function (){
		alert('nie udało się połączyć z serwerem.'+"\n"+'spróbuj ponownie za chwilę');
	}

	rq.AddParam('mod', mailingModule);
	rq.AddParam('act', 'remove');
	rq.AddParam('newsletter', mail);
	rq.AddParam('type', 'ajax');
	rq.Send(scriptName);
}

function loginUser(l, p){
	if($(l).value==null || $(l).value.trim()=='' ){
		alert('podaj login');
		return false;
	}
	if($(p).value==null || $(p).value.trim()=='' ){
		alert('podaj hasło');
		return false;
	}
	var login = $(l).value.trim();
	var pass = $(p).value.trim();

	var rq = mint.Request();
	rq.retryNum = 5;
	rq.timeout = 10000;
	rq.evalScripts = true;
	rq.evalResponse = true;
	rq.resetForm = false;
	rq.disableForm = true;

	rq.OnError = function (){
		alert('wystąpił błąd - odśwież stronę i spróbuj ponownie');
		alert(this.responseText);
	}

	rq.OnSuccess = function (){
		eval(this.responseText);
	}

	rq.OnAbort = function (){
		alert('nie udało się połączyć z serwerem.'+"\n"+'spróbuj ponownie za chwilę');
	}

	rq.SendForm("loginForm", scriptName, "post");
}

function logoutUser(){
	var rq = mint.Request();
	rq.retryNum = 5;
	rq.timeout = 10000;
	rq.evalScripts = true;
	rq.evalResponse = true;

	rq.OnError = function (){
		alert('wystąpił błąd - odśwież stronę i spróbuj ponownie');
		alert(this.responseText);
	}

	rq.OnSuccess = function (){
		eval(this.responseText);
	}

	rq.OnAbort = function (){
		alert('nie udało się połączyć z serwerem.'+"\n"+'spróbuj ponownie za chwilę');
	}

	rq.AddParam('mod', 'usr');
	rq.AddParam('act', 'logout');
	rq.AddParam('type', 'ajax');
	rq.Send(scriptName);
}

function registerUser(){
	window.location.href = 'rejestracja.html';
}

function sendNewUserRequest(formID){
	showHide('errors','none');
	if($('relogin').value==null || $('relogin').value.trim()=='' ){
		alert('podaj login');
		return false;
	}
	if($('passwd').value==null || $('passwd').value.trim()=='' ){
		alert('podaj hasło');
		return false;
	}
	if($('repasswd').value==null || $('repasswd').value.trim()=='' ){
		alert('powtórz hasło');
		return false;
	}
	if( $('passwd').value.trim()!=$('repasswd').value.trim() ){
		alert('niepoprawne powtórzenie hasła');
		return false;
	}

	var rq = mint.Request();
	rq.retryNum = 0;
	rq.timeout = 10000;
	rq.evalScripts = true;
	rq.evalResponse = true;
	rq.resetForm = false;
	rq.disableForm = true;

	rq.OnError = function (){
		alert('wystąpił błąd - odśwież stronę i spróbuj ponownie');
		alert(this.responseText);
	}

	rq.OnSuccess = function (){
		eval(this.responseText);
	}

	rq.OnAbort = function (){
		alert('nie udało się połączyć z serwerem.'+"\n"+'spróbuj ponownie za chwilę');
	}

	rq.SendForm(formID, scriptName, "post");	
}

function editUser(){
	window.location.href = 'edycja-danych.html';
}

function sendEditUserRequest(formID){
	showHide('errors','none');
	if($('login').value==null || $('login').value.trim()=='' ){
		alert('podaj login');
		return false;
	}
	if($('passwd').value==null || $('passwd').value.trim()=='' ){
	}else{
		if( $('passwd').value.trim()!=$('repasswd').value.trim() ){
			alert('niepoprawne powtórzenie hasła');
			return false;
		}
	}

	var rq = mint.Request();
	rq.retryNum = 0;
	rq.timeout = 10000;
	rq.evalScripts = true;
	rq.evalResponse = true;
	rq.resetForm = false;
	rq.disableForm = true;

	rq.OnError = function (){
		alert('wystąpił błąd - odśwież stronę i spróbuj ponownie');
		alert(this.responseText);
	}

	rq.OnSuccess = function (){
		eval(this.responseText);
	}

	rq.OnAbort = function (){
		alert('nie udało się połączyć z serwerem.'+"\n"+'spróbuj ponownie za chwilę');
	}

	rq.SendForm(formID, scriptName, "post");	
}

function reactivateUser(){
	window.location.href = 'ponowna-aktywacja.html';
}

function forgotPass(){
	window.location.href = 'przypomnij-haslo.html';
}

function reservUser(){
	window.location.href = 'moje-rezerwacje.html';
}

