﻿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-12) + "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;
}
function addEmail() {
	var _obj = 'newscont';
	var _form = 'f_news';	
	var tmpobj = ge(_obj).innerHTML;
	if (ge("newsletter").value=="") {
		ge(_obj).innerHTML = "Wpisz swój adres e-mail!";
		setTimeout(
			function()	{
				ge(_obj).innerHTML = tmpobj;
			}
			,1000
		);
		return false;
	}
	else {
		var tmpval = ge('newsletter').value;
		if(!validEmail(ge('newsletter').value)) {
			ge(_obj).innerHTML = "Wpisz poprawnie e-mail!";
			setTimeout(
				function()	{
					ge(_obj).innerHTML = tmpobj;
					ge('newsletter').value = tmpval;
				}
				,1000
			);
			return false;
		}
	}	
	var oForm = document.forms[_form];
	var _link = "cmstoobase.php?newsletter&add";
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)==1) {
					ge(_obj).innerHTML = "E-mail został dodany!";
				}
				else {
					ge(_obj).innerHTML = "E-mail już zapisany!";
				}				
				setTimeout(
					function()	{
						ge("newscont").innerHTML = tmpobj;
					}
					,5000
				);				
			},
			'onError':function(ax) {
				ge("newscont").innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = "Proszę poczekać!!!";
	return false;
}
function delEmail() {
	var _obj = 'newscont';
	var _form = 'f_news';	
	var tmpobj = ge(_obj).innerHTML;
	if (ge("newsletter").value=="") {
		ge(_obj).innerHTML = "Wpisz swój adres e-mail!";
		setTimeout(
			function()	{
				ge(_obj).innerHTML = tmpobj;
			}
			,1000
		);
		return false;
	}
	else {
		var tmpval = ge('newsletter').value;
		if(!validEmail(ge('newsletter').value)) {
			ge(_obj).innerHTML = "Wpisz poprawnie adres e-mail!";
			setTimeout(
				function()	{
					ge(_obj).innerHTML = tmpobj;
					ge('newsletter').value = tmpval;
				}
				,1000
			);
			return false;
		}
	}
	var oForm = document.forms[_form];
	var _link = "cmstoobase.php?newsletter&del";
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)==1) {
					ge(_obj).innerHTML = "E-mail został usunięty!";
				}
				else {
					ge(_obj).innerHTML = "E-mail nie istnieje!";
				}
				setTimeout(
					function()	{
						ge("newscont").innerHTML = tmpobj;
					}
					,5000
				);				
			},
			'onError':function(ax) {
				ge("newscont").innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = "Proszę poczekać!!!";
	return false;
}
function loginPanel(_link,_form,_obj,pass,passmd5) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	
	var height_obj = ge(_obj).offsetHeight;
	
	if (ge('login').value=='') {
		ge('logkom').innerHTML = '<div style="color:#ff0000; padding-top:3px;">wpisz login</div>';
		setTimeout(
			function()
				{
					ge(_obj).innerHTML = tmpobj;
				}
			,700
		);
		return false;
	}
	var varlog = ge('login').value;
	if (ge('password').value=='') {
		ge('paskom').innerHTML = '<div style="color:#ff0000; padding-top:3px;">wpisz hasło</div>';
		setTimeout(
			function()
				{
					ge(_obj).innerHTML = tmpobj;
					ge('login').value = varlog;
				}
			,700
		);
		return false;
	}
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)==0)
				{
					ge(_obj).innerHTML = '<div style="color:#ff0000; padding:13px 0 0 30px; float:left;">Błędny login lub hasło!!!</div>';
					setTimeout(
						function()
						{
							ge(_obj).innerHTML = tmpobj;
							ge('login').value = varlog;
						}
						,700
					);
				} 
				else {
					ge(_obj).innerHTML = ax.ajaxText;
				}
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = ax.ajaxText;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><div style="text-align:center; padding-top:'+(height_obj/2)+'px;">Proszę czekać</div></div>';
	return false;
}


function regPanel(_link,_form,_obj) {
	var emptyfill = false;
	//obj = _obj;	
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];
	
	if (ge('rlogin').value=='') {
		ge('krlogin').innerHTML = '<font style="color:#ff0000">wpisz login!!!</font>';
		emptyfill = true;
	} else	{
		ge('krlogin').innerHTML = '';
		var rlogin = ge('rlogin').value;
	}
	if (ge('rpassword').value=='') {
		ge('krpassword').innerHTML = '<font style="color:#ff0000">wpisz hasło!!!</font>';
		emptyfill = true;
	} else {
		ge('krpassword').innerHTML = '';
	} 
	if (ge('rpassword').value!=ge('rpassword_rep').value) {
		ge('krpassword').innerHTML = '<font style="color:#ff0000;">hasła muszą być takie same!!!</font>';	
		ge('krpassword_rep').innerHTML = '';
		emptyfill = true;
	} else {
		ge('krpassword_rep').innerHTML = '';
	}
	if (ge('rpassword_rep').value=='') {
		ge('krpassword_rep').innerHTML = '<font style="color:#ff0000">powtórz hasło!!!</font>';
		emptyfill = true;
	} else	{
		ge('krpassword_rep').innerHTML = '';
	}
	if(ge('remail').value!='') {
		if(!validEmail(ge('remail').value)) {
			ge('kremail').innerHTML = '<font style="color:#ff0000">wpisz poprawnie adres e-mail!!!</font>';
			emptyfill = true;
		} 
		else {
			ge('kremail').innerHTML = '';
			var remail = ge('remail').value;
		}
	} else {
		ge('kremail').innerHTML = '<font style="color:#ff0000">wpisz swój adres e-mail!!!</font>';
		emptyfill = true;
	}	
	if (ge('rimie').value=='') {
		ge('krimie').innerHTML = '<font style="color:#ff0000">wpisz swoje imię!!!</font>';
		emptyfill = true;
	} else	{
		ge('krimie').innerHTML = '';
		var rimie = ge('rimie').value;
	}
	if (emptyfill) return false;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (emptyfill) return false;
				if (parseInt(ax.ajaxText)==1) {
					ge(_obj).style.height = "30px";
					ge(_obj).innerHTML = '<div style="color:#ff0000; padding:0 0 0 30px; float:left;">Proces rejestracji przebiegł pomyślnie.<br>Możesz się zalogować!!!.</div>';
				}
				else {
					ge(_obj).innerHTML = '<div style="color:#ff0000; padding:0 0 0 30px; float:left;">Użytkownik o takim loginie lub adresie e-mail już istnieje.</div>'+tmpobj;
					ge('rlogin').value = rlogin;
					ge('remail').value = remail;
					ge('rimie').value = rimie;
				}
			},
			'onError':function(ax) {
				return false;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><div style="text-align:center; padding-top:'+(height_obj/3-20)+'px;">Proszę czekać</div></div>';
	return false;	
}
function addTopic(_link,_form,_obj,_f) {
	ge('ktresc'+_f).innerHTML = '';
	ge('komtop'+_f).innerHTML = '';
	ge('ktemat'+_f).innerHTML = '';
	tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];
	var temat = ge('temat'+_f).value;
	var tresc = ge('tresc'+_f).value;
	tAjax.post(
		{
			'_link':_link+'&checkauth',
			'_form':oForm,
			'onSuccess':function(ax) {
				if (ax.ajaxText=='logout') {
					setTimeout(
						function()
							{
								ge(_obj).innerHTML = tmpobj;
								ge('komtop'+_f).innerHTML = '<div style="color:#ff0000; padding-top:4px;">Musisz być zalogowowany, żeby dodać nowy temat!!!</div>';
								ge('tresc'+_f).value = tresc;
								ge('temat'+_f).value = temat;
							}
						,500
					);					
					return false;
				}
				if (temat=='') {
					ge(_obj).innerHTML = tmpobj;
					ge('tresc'+_f).value = tresc;
					ge('ktemat'+_f).innerHTML = '<div style="color:#ff0000; padding-top:4px;">wpisz temat</div>';
					return false;
				}
				if (tresc=='') {
					ge(_obj).innerHTML = tmpobj;
					ge('temat'+_f).value = temat;
					ge('ktresc'+_f).innerHTML = '<div style="color:#ff0000; padding-top:4px;">wpisz treść</div>';
					return false;
				}
				setTimeout(
					function()
						{
							ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><div style="text-align:center; padding-top:'+(height_obj/2-20)+'px;">Dziękujemy.<br>Temat został dodany i będzie widoczny po odświeżeniu strony.<br>.</div></div>';
						}
						,500
					);
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><div style="text-align:center; padding-top:'+(height_obj/2-20)+'px;">Proszę czekać</div></div>';
	return false;
}

function repTopic(_link,_form,_obj) {
	ge('ktresc').innerHTML = '';
	ge('komtop').innerHTML = '';
	tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];
	var tresc = ge('tresc').value;
	tAjax.post(
		{
			'_link':_link+'&checkauth',
			'_form':oForm,
			'onSuccess':function(ax) {
				if (ax.ajaxText=='logout') {
					setTimeout(
						function()
							{
								ge(_obj).innerHTML = tmpobj;
								ge('komtop').innerHTML = '<div style="color:#ff0000; padding-top:4px;">Musisz być zalogowowany, żeby dodać odpowiedź!!!</div>';
								ge('tresc').value = tresc;
							}
						,500
					);					
					return false;
				}
				if (tresc=='') {
					ge(_obj).innerHTML = tmpobj;
					ge('ktresc').innerHTML = '<div style="color:#ff0000; padding-top:4px;">wpisz treść</div>';
					return false;
				}
				setTimeout(
					function()
						{
							ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><div style="text-align:center; padding-top:'+(height_obj/2-20)+'px;">Dziękujemy.<br>Odpowiedź została dodana i będzie widoczna po odświeżeniu strony.</div></div>';
						}
						,500
					);
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><div style="text-align:center; padding-top:'+(height_obj/2-20)+'px;">Proszę czekać</div></div>';
	return false;
}

function bookmarkit() {
	window.external.addFavorite('http://www.','');
}













function sprintf() {
	if (!arguments || arguments.length < 1 || !RegExp) {
		return;
	}
	var str = arguments[0];
	var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
	var a = b = [], numSubstitutions = 0, numMatches = 0;
	while (a = re.exec(str))
	{
		var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
		var pPrecision = a[5], pType = a[6], rightPart = a[7];
		numMatches++;
		if (pType == '%') {
			subst = '%';
		} else {
			numSubstitutions++;
			if (numSubstitutions >= arguments.length) {
				alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
			}
			var param = arguments[numSubstitutions];
			var pad = '';
			if (pPad && pPad.substr(0,1) == "'") pad = leftpart.substr(1,1);
			else if (pPad) pad = pPad;
			
			var justifyRight = true;
			if (pJustify && pJustify === "-") justifyRight = false;
			var minLength = -1;
			if (pMinLength) minLength = parseInt(pMinLength);
			var precision = -1;
			if (pPrecision && pType == 'f') precision = parseInt(pPrecision.substring(1));
			var subst = param;
			if (pType == 'b') subst = parseInt(param).toString(2);
			else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
			else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
			else if (pType == 'u') subst = Math.abs(param);
			else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
			else if (pType == 'o') subst = parseInt(param).toString(8);
			else if (pType == 's') subst = param;
			else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
			else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
		}
		str = leftpart + subst + rightPart;
	}
	return corectZero(str);
}
function corectZero(str) {
	return ((poz = str.toString().indexOf('.', 0))!= -1) ? (str.toString()+'00').substr(0, (poz+3)): str.toString() + '.00';
}
function addProd(_link,_id,_obj) {
	
	var ilosc = parseInt(ge('iladdprod'+_obj).value);
	
	if (isNaN(ilosc)) return;
	
	ge('addprod'+_obj).style.display = "none";
	
	tAjax.get(
		{
			'_link':_link+'&ilprod='+ilosc+'&cenaprod='+parseFloat(ge('cenaprod'+_obj).value),
			'onSuccess':function(ax) {
				var axsplit = ax.ajaxText.split('|^|');
				if (parseInt(axsplit[0])==1) {
					ge('komaddprod'+_obj).innerHTML = 'BŁĄD POŁĄCZENIA';
				}
				else {
					ge('komaddprod'+_obj).innerHTML = axsplit[1];
					var axaxsplit = axsplit[2].split('#');
					ge('addil').innerHTML = axaxsplit[0];
					ge('wartosc').innerHTML = axaxsplit[1];
				}
				timerL = setTimeout(
					function()
						{
							ge('komaddprod'+_obj).innerHTML = "";
							ge('addprod'+_obj).style.display = "block";
						}
					,1000
				);
			},
			'onError':function(ax) {
				ge('addprod'+_obj).style.display = "block";
				ge('komaddprod'+_obj).innerHTML = "";
			}
		}
	);	
	ge('komaddprod'+_obj).innerHTML = '... Proszę czekać ...';
	return;
}
function delAllProd(_link,_form,_obj) {
	var height_obj = ge(_obj).offsetHeight;
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)!=0) {
					ge(_obj).innerHTML = ax.ajaxText;
				}
				else {
					ge(_obj).innerHTML = tmpobj;
				}
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);	
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><p><img src="gfx/loading.gif" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function logout(_link) {
	var height_obj = ge('contener').offsetHeight;
	tAjax.get(
		{
			'_link':_link,
			'onSuccess':function(ax) {
				//window.location.reload();
				//alert(ax.ajaxText)
				window.location.href = ax.ajaxText;
			},
			'onError':function(ax) {
			}
		}
	);	
	ge('contener').innerHTML = '<div style="height:'+height_obj+'px;"><p style="padding-top:'+(height_obj/3-20)+'px; text-align:center;"><img src="gfx/loading.gif" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
function loadForm(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var height_obj = ge(_obj).offsetHeight;
	var tmpobj = ge(_obj).innerHTML;
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				if (parseInt(ax.ajaxText)!=0) {
					ge(_obj).innerHTML = ax.ajaxText;
				}
				else {
					ge(_obj).innerHTML = tmpobj;
				}
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);	
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><p style="padding-top:'+(height_obj/3-20)+'px; text-align:center;"><img src="gfx/loading.gif" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}
var liczba = 1;
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==''?1:l;
	}
	liczba = s.value;	
	return true;
}

function logForm(_link,_form,_obj) {
	var oForm = document.forms[_form];
	var tmpobj = ge(_obj).innerHTML;
	var height_obj = ge(_obj).offsetHeight;	
	var varlogin_user = ge("login_user").value;
	
	md5hash(oForm.password,oForm.passwordmd5);
	tAjax.post(
		{
			'_link':_link,
			'_form':oForm,
			'onSuccess':function(ax) {
				var axsplit = ax.ajaxText.split('|^|');
				if (parseInt(axsplit[0])==1) {
					//alert(axsplit[1])
					window.location.href = axsplit[1];
				}
				else if (ax.ajaxText!='') {
					ge(_obj).innerHTML = '<p style="padding-top:'+(height_obj/3-20)+'px; text-align:center;">'+ax.ajaxText+'</p>';
					timerL = setTimeout(
						function()
						{
							ge(_obj).innerHTML = tmpobj;
							ge("login_user").value = varlogin_user;
						}
						,2000
					);
				}
				else {
					ge(_obj).innerHTML = tmpobj;
					ge("login_user").value = varlogin_user;
				}
			},
			'onError':function(ax) {
				ge(_obj).innerHTML = tmpobj;
			}
		}
	);	
	ge(_obj).innerHTML = '<div style="height:'+height_obj+'px;"><p style="padding-top:'+(height_obj/3-20)+'px; text-align:center;"><img src="gfx/loading.gif" border="0" /><br>Proszę czekać !!!</p></div>';
	return;
}