﻿var hg = null;
var cg = new Array();
var mb_tm = null;
var menu_std = null;
var submID = new Array();
function Browser() {
	var ua, s, i; 
	this.isIE    = false;
	this.isOP    = false;
	this.isNS    = false;
	this.version = null; 
	ua = navigator.userAgent; 
	s = "Opera";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isOP = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}
	s = "Netscape6/";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}
	s = "Gecko";
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		this.version = 6.1;
		return;
	}
	s = "MSIE";
	if ((i = ua.indexOf(s))) {
		this.isIE = true;
		this.version = parseFloat(ua.substr(i + s.length));
		return;
	}
}
var browser = new Browser();
function ge(id) {return document.getElementById(id);}
function newClass(id,c) {if(ge(id)) ge(id).className=c;}
function activMenu(e,a) {
	newClass(e,(a?'activ':'noactiv'));
}
function hide(g) {
	for (var i=g; i<=hg; i++) {	
		if (i==1) {
			if (cg[submID[i]]!=0) {
				newClass("rt"+submID[i],"rtmnoactiv");
				newClass("rb"+submID[i],"rbmnoactiv");
				newClass("sma"+submID[i],"noactiv");
			}
			if (ge("sma"+submID[i]).className=="activmore")	{
				newClass("sma"+submID[i],"activ");
			}
		}
		else {
			newClass("sma"+submID[i],"noactiv");
		}
		thissubID = "sm"+submID[i];
		if(ge(thissubID)) {
			subm = ge(thissubID);
			subm.style.visibility = "hidden";
			subm.style.left = 0;
			subm.style.top = 0;
		}
	}
	hg = g;
}
function hide_delay() {
	if(mb_tm !=null) {
		clearTimeout(mb_tm);
	}
	mb_tm = setTimeout("hide(1)",450);
}
function stop() {
	if(mb_tm!=null) {
		clearTimeout(mb_tm);
	}
}
function show(b,event,name,g,a,c) {
	var button;
	var x = 0;
	var y = 0;
	cg[name+"_"+g+"_"+a] = c;
	hide(g);
	if (g==1) {
		if (c!=0)
		{
			newClass("rt"+name+"_"+g+"_"+a,"rtmactiv");
			newClass("rb"+name+"_"+g+"_"+a,"rbmactiv");			
		}
		newClass("sma"+name+"_"+g+"_"+a,"activ"+(ge("sm"+name+"_"+g+"_"+a)?"more":""));
	}
	else {
		newClass("sma"+name+"_"+g+"_"+a,"activ"+(ge("sm"+name+"_"+g+"_"+a)?"more":""));
	}
	
	stop();
	submID[g] = name+"_"+g+"_"+a;
	
	if (!ge("sm"+name+"_"+g+"_"+a)) return;
	
	if(browser.isIE) {
		button = window.event.srcElement;
	}
	else {
		button = event.currentTarget;
	}
	menu_std = b;
	pos = give_pos(button);
	(browser.isNS) ? x = pos[0] + button.offsetWidth : x = pos[0] + button.offsetWidth;
	y = pos[1];
	var m = document.getElementById("sm"+name+"_"+g+"_"+a)
	m.style.left = x + "px";
	m.style.top = y + "px";
	m.style.visibility = "visible";
}
function give_pos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function ge(id) {return document.getElementById(id);}
function newClass(id,c) {if(ge(id)) ge(id).className=c;}
function changeColor(id,c) {ge(id).style.backgroundColor=c;}
function getRequestBody(oForm) {
	var aParams = new Array();
	for (var i=0; i<oForm.elements.length; i++) {
		if (oForm.elements[i].type == 'checkbox'&& oForm.elements[i].checked == false) continue;
		if (oForm.elements[i].type == 'radio'&& oForm.elements[i].checked == false) continue;
		var sParam = encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(oForm.elements[i].value);
		aParams.push(sParam);
	}
	return aParams.join("&");
}
function tAjax() {
	var ax = new Object();
	ax._link = '';
	ax._form = '';
	ax.param = new Object();
	ax.onSuccess = null;
	ax.onError = null;
	ax.ajaxRequest = tAjax.oAjax();
	ax.ajaxRequest.onreadystatechange = function() {
		if (ax==null || ax.ajaxRequest==null) return false;
		if (ax.ajaxRequest.readyState==4) {
			ax.status = ax.ajaxRequest.status;
			ax.statusText = ax.ajaxRequest.statusText;
			ax.ajaxText = ax.ajaxRequest.responseText;
			ax.ajaxXML = ax.ajaxRequest.responseXML;
			if (ax.ajaxRequest.status==200 && typeof(ax.onSuccess)=='function') ax.onSuccess(ax);
			else if(typeof(ax.onError)=='function') ax.onError(ax);
			delete ax.ajaxRequest['onreadystatechange']; 
			ax.ajaxRequest = null;
		}
	}
	ax.startGET = function() {
		
		if (ax._link.length<3) return false;
		ax.ajaxRequest.open('get',ax._link,true);
		ax.ajaxRequest.send('');
	}
	ax.startPOST = function() {
		if (ax._link.length<3) return false;
		var oForm = ax._form;
		var sBody = getRequestBody(oForm);
		ax.ajaxRequest.open('post',ax._link,true);
		ax.ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ax.ajaxRequest.send(sBody);
	}
	ax.opcje = function(opt) {
		for(i in opt) 
			if(typeof(ax[i])=='undefined') ax.param[i]=opt[i]; 
			else ax[i]=opt[i];	
	}
	return ax;
}
tAjax.oAjax = function() {
	if (window.XMLHttpRequest) return new XMLHttpRequest(); 
	else if (window.ActiveXObject) 
		try {
			return new ActiveXObject('Msxml2.XMLHTTP'); 
		} 
		catch(e) {
			try {
				return new ActiveXObject('Microsoft.XMLHTTP'); 
			} 
			catch(e) {
				return null;
			}
		} 
	return null;
}
tAjax.get = function(opt) {
	if (typeof(opt)!='undefined' && opt!=null) {
		var ajax = new tAjax();
		ajax.opcje(opt);
		ajax.startGET();
	}
}
tAjax.post = function(opt) {
	if (typeof(opt)!='undefined' && opt!=null) {
		var ajax = new tAjax();
		ajax.opcje(opt);
		ajax.startPOST();
	}
}
function validEmail(s) {
	if (s.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)) return true;
	else return false;
}
var liczba = '';
function rezSkladka(event,s,o) {
	if (event.srcElement) {
		kc = event.keyCode;
	} 
	else {
		kc = event.which;
	}
	if ((kc < 46 || kc > 57) && kc != 8 && kc != 0 && kc != 37 && (kc < 95 || kc > 106)) {
		s.value = liczba;
	}
	liczba = s.value;
	if (parseInt(s.value)>= 40000000)  {
		ge(o).value = '3000';
	}
	else if (parseInt(s.value)>= 20000000)  {
		ge(o).value = '1500';
	}
	else if (parseInt(s.value)>= 10000000)  {
		ge(o).value = '750';
	}
	else if (parseInt(s.value)>= 5000000)  {
		ge(o).value = '450';
	}
	else if (parseInt(s.value)) {
		ge(o).value = '150';
	}
	
	return true;
}
function formUpdZwiazek(_link,_form,_obj) {
	var emptyfill = false;
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];
	
	if (ge('firma').value=='') {
		ge('kfirma').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kfirma').style.color = '#696969';
		var firma = ge('firma').value;
	}
	if (ge('kod').value=='') {
		ge('kkod').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kkod').style.color = '#696969';
		var kod = ge('kod').value;
	}
	if (ge('miasto').value=='') {
		ge('kmiasto').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kmiasto').style.color = '#696969';
		var miasto = ge('miasto').value;
	}
	if (ge('ulica').value=='') {
		ge('kulica').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kulica').style.color = '#696969';
		var ulica = ge('ulica').value;
	}
	if (ge('wpis').value=='') {
		ge('kwpis').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kwpis').style.color = '#696969';
		var wpis = ge('wpis').value;
	}
	if (ge('nrwpisu').value=='') {
		ge('knrwpisu').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('knrwpisu').style.color = '#696969';
		var nrwpisu = ge('nrwpisu').value;
	}
	if (ge('dochod').value=='') {
		ge('kdochod').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kdochod').style.color = '#696969';
		var dochod = ge('dochod').value;
	}
	
	if (emptyfill) {
		var atmp = ge('a'+_obj).innerHTML;
		ge('a'+_obj).innerHTML = '<p style="color:#ff0000;">Proszę wypełnić wszystkie wymagane dane!</p>';
		setTimeout(
			function()
				{
					ge('a'+_obj).innerHTML = atmp;
				}
			,700
		);
		return false;
	}
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (emptyfill) return false;
				if (parseInt(ax.ajaxText)!=0) {
					ge(_obj).innerHTML = ax.ajaxText;
				}
				else {				
					ge(_obj).innerHTML = '<div style="color:#ffe073; letter-spacing:0px; font-size:12px; line-height:12px; padding:0 0 0 30px;"Taki związek już istnieje.</div>'+tmpobj;
				}
			},
			'onError':function(ax) {
				return false;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="width:100%; height:'+height_obj+'px;"><div style="width:100%; text-align:center; padding-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać!!!</div></div>';
	return false;	
}

function formRejZwiazek(_link,_form,_obj) {
	var emptyfill = false;
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];
	
	if (ge('firma').value=='') {
		ge('kfirma').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kfirma').style.color = '#696969';
		var firma = ge('firma').value;
	}
	if (ge('kod').value=='') {
		ge('kkod').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kkod').style.color = '#696969';
		var kod = ge('kod').value;
	}
	if (ge('miasto').value=='') {
		ge('kmiasto').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kmiasto').style.color = '#696969';
		var miasto = ge('miasto').value;
	}
	if (ge('ulica').value=='') {
		ge('kulica').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kulica').style.color = '#696969';
		var ulica = ge('ulica').value;
	}
	if (ge('wpis').value=='') {
		ge('kwpis').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kwpis').style.color = '#696969';
		var wpis = ge('wpis').value;
	}
	if (ge('nrwpisu').value=='') {
		ge('knrwpisu').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('knrwpisu').style.color = '#696969';
		var nrwpisu = ge('nrwpisu').value;
	}
	if (ge('dochod').value=='') {
		ge('kdochod').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kdochod').style.color = '#696969';
		var dochod = ge('dochod').value;
	}
	
	if (emptyfill) {
		var atmp = ge('a'+_obj).innerHTML;
		ge('a'+_obj).innerHTML = '<p style="color:#ff0000;">Proszę wypełnić wszystkie wymagane dane!</p>';
		setTimeout(
			function()
				{
					ge('a'+_obj).innerHTML = atmp;
				}
			,700
		);
		return false;
	}
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (emptyfill) return false;
				if (parseInt(ax.ajaxText)!=0) {
					ge(_obj).innerHTML = ax.ajaxText;
				}
				else {				
					ge(_obj).innerHTML = '<div style="color:#ffe073; letter-spacing:0px; font-size:12px; line-height:12px; padding:0 0 0 30px;"Taki związek już istnieje.</div>'+tmpobj;
				}
			},
			'onError':function(ax) {
				return false;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="width:100%; height:'+height_obj+'px;"><div style="width:100%; text-align:center; padding-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać!!!</div></div>';
	return false;	
}
function formUpdataUser(_link,_form,_obj,pass,pass_rep,passmd5) {
	
	var emptyfill = false;
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];	

	if (ge('imie').value=='') {
		ge('kimie').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kimie').style.color = '#696969';
		var imie = ge('imie').value;
	}
	if (ge('nazwisko').value=='') {
		ge('knazwisko').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('knazwisko').style.color = '#696969';
		var nazwisko = ge('nazwisko').value;
	}
	if (ge('emial').value=='' || !validEmail(ge('emial').value)) {
		ge('kemial').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kemial').style.color = '#696969';
		var emial = ge('emial').value;
	}
	if (ge('rhaslo').value!=ge('rrhaslo').value) {
		ge('krhaslo').style.color = 'red';
		ge('krrhaslo').style.color = 'red';
		emptyfill = true;
	} else {
		ge('krhaslo').style.color = '#696969';
		ge('krrhaslo').style.color = '#696969';
	}	
	if (ge('nick').value=='') {
		ge('knick').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('knick').style.color = '#696969';
		var nick = ge('nick').value;
	}
	if (emptyfill) {
		var atmp = ge('a'+_obj).innerHTML;
		ge('a'+_obj).innerHTML = '<p style="color:#ff0000;">Proszę wypełnić wszystkie wymagane dane!</p>';
		setTimeout(
			function()
				{
					ge('a'+_obj).innerHTML = atmp;
				}
			,700
		);
		return false;
	}
		
	if (ge('rhaslo').value!='') {
		md5hash(pass,passmd5);
	}
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				ge(_obj).innerHTML = ax.ajaxText;
			},
			'onError':function(ax) {
				return false;
			}
		}
	);
	
	ge(_obj).innerHTML = '<div style="width:100%; height:'+height_obj+'px;"><div style="width:100%; text-align:center; padding-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</div></div>';
	return false;	
}
function formRejUser(_link,_form,_obj,pass,pass_rep,passmd5) {
	var emptyfill = false;
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];	
	
	if (ge('id_zwiazku').value==0) {
		ge('kid_zwiazku').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kid_zwiazku').style.color = '#696969';
		var id_zwiazku = ge('id_zwiazku').value;
	}	
	if (ge('imie').value=='') {
		ge('kimie').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kimie').style.color = '#696969';
		var imie = ge('imie').value;
	}
	if (ge('nazwisko').value=='') {
		ge('knazwisko').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('knazwisko').style.color = '#696969';
		var nazwisko = ge('nazwisko').value;
	}
	if (ge('emial').value=='' || !validEmail(ge('emial').value)) {
		ge('kemial').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('kemial').style.color = '#696969';
		var emial = ge('emial').value;
	}
	if (ge('rhaslo').value!=ge('rrhaslo').value) {
		ge('krhaslo').style.color = 'red';
		ge('krrhaslo').style.color = 'red';
		emptyfill = true;
	} else {
		ge('krhaslo').style.color = '#696969';
		ge('krrhaslo').style.color = '#696969';
	}
	if (ge('rhaslo').value=='') {
		ge('krhaslo').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('krhaslo').style.color = '#696969';
		var rhaslo = ge('rhaslo').value;
	}	
	if (ge('rrhaslo').value=='') {
		ge('krrhaslo').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('krrhaslo').style.color = '#696969';
		var rrhaslo = ge('rrhaslo').value;
	}	
	if (ge('nick').value=='') {
		ge('knick').style.color = 'red';
		emptyfill = true;
	} else	{
		ge('knick').style.color = '#696969';
		var nick = ge('nick').value;
	}
	if (emptyfill) {
		var atmp = ge('a'+_obj).innerHTML;
		ge('a'+_obj).innerHTML = '<p style="color:#ff0000;">Proszę wypełnić wszystkie wymagane dane!</p>';
		setTimeout(
			function()
				{
					ge('a'+_obj).innerHTML = atmp;
				}
			,700
		);
		return false;
	}
	md5hash(pass,passmd5);
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)==1) {
					ge(_obj).innerHTML = '<div style="color:#ffe073; letter-spacing:0px; font-size:12px; line-height:12px; padding:0 0 0 30px;">Użytkownik o takim loginie lub adresie e-mail już istnieje.</div>'+tmpobj;
				}
				else {
					setTimeout(
						function()
						{
							ge(_obj).innerHTML = ax.ajaxText;
						}
						,2000
					);
				}
			},
			'onError':function(ax) {
				return false;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="width:100%; height:'+height_obj+'px;"><div style="width:100%; text-align:center; padding-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</div></div>';
	return false;	
}
function loginPanel(_link,_form,_obj,pass,passmd5) {
	var oForm = document.forms[_form];
	if (ge('login').value=='') {
		var logobj = ge('logkom').innerHTML;
		ge('logkom').innerHTML = '<p class="komlog">Podaj login</p>';
		setTimeout(
			function()
				{
					ge('logkom').innerHTML = logobj;
				}
			,1000
		);
		return;
	}
	if (!validEmail(ge('login').value)) {
		var logobj = ge('logkom').innerHTML;
		var varlog = ge('login').value;
		ge('logkom').innerHTML = '<p class="komlog">Login jako adres e-mail</p>';
		setTimeout(
			function()
				{
					ge('logkom').innerHTML = logobj;
					ge('login').value = varlog;
				}
			,1000
		);
		return;
	}	
	var varlog = ge('login').value;
	if (ge('password').value=='') {
		var passobj = ge('paskom').innerHTML;
		ge('paskom').innerHTML = '<p class="komlog">Podaj hasło</p>';
		setTimeout(
			function()
				{
					ge('paskom').innerHTML = passobj;
				}
			,1000
		);
		return;
	}
	var tmpobj = ge(_obj).innerHTML;	
	md5hash(pass,passmd5);
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				var badlog = false;
				switch (parseInt(ax.ajaxText)) {
					case 0: ge(_obj).innerHTML = '<p style="padding-top:30px;">Błędny login lub hasło.</p>'; break;
					case 1: ge(_obj).innerHTML = '<p style="padding-top:30px;">Konto zostało usunięte.</p>'; break;
					case 2: ge(_obj).innerHTML = '<p style="padding-top:30px;">Konto jest nieatkywne.</p>'; break;
					case 3: ge(_obj).innerHTML = '<p style="padding-top:10px;">Prosimy o zaakceptowanie danych podanych w procesie rejestracyjnym.</p>'; break;
					case 4: ge(_obj).innerHTML = '<p style="padding-top:10px;">Członek związku jest nieaktywny lub został dezaktywowany.</p>'; break;
					case 5: ge(_obj).innerHTML = '<p style="padding-top:10px;">Członek związku został usunięty.</p>'; break;
					default:
					badlog = true;
					setTimeout(
						function()
						{
							window.location.reload();
							return;
						}
						,1000
					);
				}
				if (!badlog)
				{
					setTimeout(
						function()
						{
							ge(_obj).innerHTML = tmpobj;
							ge('login').value = varlog;
						}
						,3000
					);
				}
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);	
	ge(_obj).innerHTML = '<div style="height:130px; width:200px; float:left; text-align:center;"><p style="margin-top:20px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function forgetPanel(_link,_form,_obj) {
	var oForm = document.forms[_form];
	if (ge('login').value=='') {
		var logobj = ge('logkom').innerHTML;
		ge('logkom').innerHTML = '<p class="komlog">Podaj login</p>';
		setTimeout(
			function()
				{
					ge('logkom').innerHTML = logobj;
				}
			,1000
		);
		return;
	}
	if (!validEmail(ge('login').value)) {
		var logobj = ge('logkom').innerHTML;
		var varlog = ge('login').value;
		ge('logkom').innerHTML = '<p class="komlog">Login jako adres e-mail</p>';
		setTimeout(
			function()
				{
					ge('logkom').innerHTML = logobj;
					ge('login').value = varlog;
				}
			,1000
		);
		return;
	}	
	var varlog = ge('login').value;
	var tmpobj = ge(_obj).innerHTML;
	
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)==1) {
					ge(_obj).innerHTML = tmpobj;
					ge('logkom').innerHTML = '<p class="komlog">Hasło zostało wysłane!!!</p>';
				}
				else {
					ge(_obj).innerHTML = tmpobj;
					ge('logkom').innerHTML = '<p class="komlog">Użytkownik nie istnieje!!!</p>';
				}
				timerL = setTimeout(
					function()
						{
							ge(_obj).innerHTML = tmpobj;
							ge('login').value = varlog;
						}
					,3000
				);
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);	
	ge(_obj).innerHTML = '<div style="height:130px; width:200px; float:left; text-align:center;"><p style="margin-top:20px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function activUser(_link,_form,_obj,_c) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	
	if(_c.checked) {
		var agree = confirm("Czy napewno chcesz aktywować użytkownika?");
		if (agree) {
			_c.checked = true;
			tAjax.post(
				{
					'_link':_link,
					'_form':oForm,
					'onSuccess':function(ax) {
						ge(_obj).innerHTML = ax.ajaxText;
						//window.location.href = '?';
					},
					'onError':function(ax) {
						ge(_obj).innerHTML = tmpobj;
					}
				}
			);
		} else {
			_c.checked = false;
			return;
		}
	} else	{
		var agree = confirm("Czy napewno chcesz deaktywować użytkownika?");
		if (!agree) {
			_c.checked = true;
			return;
		} else {
			_c.checked = false;
			tAjax.post(
				{
					'_link':_link,
					'_form':oForm,
					'onSuccess':function(ax) {
						ge(_obj).innerHTML = ax.ajaxText;
						//window.location.href = '?';
					},
					'onError':function(ax) {
						ge(_obj).innerHTML = tmpobj;
					}
				}
			);
		}
	}
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px; width:100%; text-align:center;"><p style="margin-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function activZw(_link,_form,_obj,_c) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	
	if(_c.checked) {
		var agree = confirm("Czy napewno chcesz aktywować członka związku?");
		if (agree) {
			_c.checked = true;
			tAjax.post(
				{
					'_link':_link,
					'_form':oForm,
					'onSuccess':function(ax) {
						ge(_obj).innerHTML = ax.ajaxText;
						//window.location.href = '?';
					},
					'onError':function(ax) {
						ge(_obj).innerHTML = tmpobj;
					}
				}
			);
		} else {
			_c.checked = false;
			return;
		}
	} else	{
		var agree = confirm("Czy napewno chcesz deaktywować członka związku?");
		if (!agree) {
			_c.checked = true;
			return;
		} else {
			_c.checked = false;
			tAjax.post(
				{
					'_link':_link,
					'_form':oForm,
					'onSuccess':function(ax) {
						ge(_obj).innerHTML = ax.ajaxText;
						//window.location.href = '?';
					},
					'onError':function(ax) {
						ge(_obj).innerHTML = tmpobj;
					}
				}
			);
		}
	}
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px; width:100%; text-align:center;"><p style="margin-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function deleteZw(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	
	var agree = confirm("Czy napewno chcesz usunąć członka związku?");
	if (agree) {
		tAjax.post(
			{
				'_link':_link,
				'_form':oForm,
				'onSuccess':function(ax) {
					ge(_obj).innerHTML = ax.ajaxText;
					//window.location.href = '?';
				},
				'onError':function(ax) {
					ge(_obj).innerHTML = tmpobj;
				}
			}
		);
	}
	else {
		return;
	}
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px; width:100%; text-align:center;"><p style="margin-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function deleteUser(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	
	var agree = confirm("Czy napewno chcesz usunąć użytkownika?");
	if (agree) {
		tAjax.post(
			{
				'_link':_link,
				'_form':oForm,
				'onSuccess':function(ax) {
					ge(_obj).innerHTML = ax.ajaxText;
				},
				'onError':function(ax) {
					ge(_obj).innerHTML = tmpobj;
				}
			}
		);
	}
	else {
		return;
	}
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px; width:100%; text-align:center;"><p style="margin-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function setAdmin(_link,_form,_obj,_c) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	
	if(_c.checked) {
		var agree = confirm("Czy napewno chcesz zmienić administratora dostępu?");
		if (agree) {
			_c.checked = true;
			tAjax.post(
				{
					'_link':_link,
					'_form':oForm,
					'onSuccess':function(ax) {
						ge(_obj).innerHTML = ax.ajaxText;
					},
					'onError':function(ax) {
						ge(_obj).innerHTML = tmpobj;
					}
				}
			);
		} else {
			_c.checked = false;
			return;
		}
	}
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px; width:100%; text-align:center;"><p style="margin-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function addKom(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)==0)
				{
					ge(_obj).innerHTML = '<p style="padding-top:30px;">Musisz się zalogować, aby móc dodawać komentarze!!!</p>';
					setTimeout(
						function()
						{
							ge(_obj).innerHTML = tmpobj;
						}
						,2000
					);
				}
				else if (parseInt(ax.ajaxText)==1)
				{
					ge(_obj).innerHTML = '<p style="padding-top:30px;">Wpisz tekst komentarza!!!</p>';
					setTimeout(
						function()
						{
							ge(_obj).innerHTML = tmpobj;
						}
						,2000
					);
				} 
				else {
					ge(_obj).innerHTML = '<p style="padding-top:30px;">Komentarz został dodany!!!</p>';
					setTimeout(
						function()
						{						
							ge(_obj).innerHTML = tmpobj;
							ge('ilkom').innerHTML = parseInt(ge('ilkom').innerHTML) + 1;
							ge('contkom').innerHTML = ax.ajaxText + ge('contkom').innerHTML;
							ge('idkom').innerHTML = ge('ilkom').innerHTML;
						}
						,2000
					);
				}
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px; width:100%; text-align:center;"><p style="margin-top:'+(height_obj/3-20)+'px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function badKom(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				ge(_obj).innerHTML = 'Nadużycie zgłoszone!';
				setTimeout(
					function()
					{						
						ge(_obj).innerHTML = tmpobj;
					}
					,10000
				);
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = 'Proszę czekać';
	return;
}
function formSave(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				setTimeout(
					function()
					{						
						ge(_obj).innerHTML = ax.ajaxText;
					}
					,1000
				);
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="height:300px; width:100%; text-align:center;"><p style="margin-top:200px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function formApel(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (ax.ajaxText) ge(_obj).innerHTML = ax.ajaxText;
				else ge(_obj).innerHTML = '<div style="width:100%; text-align:center;"><p style="padding-top:100px;">Błąd połączenia z bazą, prosimy spróbować później!!!</p></div>';
				setTimeout(
					function()
					{	
						ge(_obj).innerHTML = tmpobj;
					}
					,2000
				);
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="width:100%; text-align:center;"><p style="padding-top:100px;"><img src="gfx/loading.gif" width="32" height="32" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function filtrInttoString(s) {

	var l = '';
	var ss = s.toString();
	
	for(i=0; i<ss.length; i++)
	{
		if (ss.charCodeAt(i) >= 48 && ss.charCodeAt(i) <= 57) l += ss.charAt(i);
	}
	
	return l;
}
function checkInput(event,s) {
	if (event.srcElement) {
		kc = event.keyCode;
	} 
	else {
		kc = event.which;
	}
	if ((kc < 46 || kc > 57) && kc != 8 && kc != 0 && kc != 37 && (kc < 95 || kc > 106)) {
		var l = filtrInttoString(s.value);
		s.value = l==''?'':l;
	}
	return true;
}
var udzProc = 0;
function checkUdzProc(event,s) {
	checkInput(event,s);
	if (s.value>100 || (100-ge('2_1_3_1').value-ge('2_1_3_2').value-ge('2_1_3_3').value-ge('2_1_3_4').value)<0)
	{
		s.value = '';		
	}
	ge('2_1_3_5').value=(100-ge('2_1_3_1').value-ge('2_1_3_2').value-ge('2_1_3_3').value-ge('2_1_3_4').value);
	return;
}
function checkSumPrzych(event,s,w,n,p) {
	checkInput(event,s);
	if (isNaN(parseInt(ge(p).value))) return;
	ge(w).value=((ge(n).value-ge(p).value)/ge(p).value)*100;
	return;
}


