
function check(e, regexp) 
{
	if(navigator.userAgent.indexOf('Gecko') != -1) 
	{
		charCode = e.which;
	} 
	else 
	{
		charCode = e.keyCode;
	}
		
	if(charCode > 31) 
	{	 
		znak = String.fromCharCode(charCode);
		return regexp.test(znak);
	}
}

<!--Ustawia kursor w polu logowania-->

function setFocus() 
{
	document.loginForm.usrname.select();
	document.loginForm.usrname.focus();
}

//funkcja noweokno otwiera popupa

function noweokno_scroll(url, width, height) 
{
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no,left=50,top=100' );
}
function noweokno(url, width, height) 
{
        var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,left=50,top=100' );
}
function noweokno2(url, nr, width, height) 
{
        var Win = window.open(url, nr,'width=' + width + ',height=' + height + ',resizable=0,scrollbars=no,menubar=no,left=50,top=100' );
}


function select_sor(id)
	{
		
		document.getElementById('sor').selected=document.getElementById('parent').options[id];
		
		
	/*	
	advAJAX.get({
    url: "../mod/menu/private/include/func/ajax.php?strona="+id,
    onSuccess : function(obj) { 

			document.getElementById('sor').innerHTML = obj.responseText;
		
	}
	});	
	*/
	}
function uwaga(text)
{
	alert(text);	
}

function CheckAll()
   {
      for (var i=0;i<document.loginForm.elements.length;i++)
      {
         var e = document.loginForm.elements[i];
         if (e.name != "allbox")
            e.checked = document.loginForm.allbox.checked;
      }
   }
	 
	

	
function oblicz1(id)
{
	cena=document.getElementById('stawka_'+id).value;
	sel=document.getElementById('jednostka_'+id);
	s=sel.options[sel.selectedIndex].value;
	document.getElementById('netto_'+id).value=cena*s;
	document.getElementById('brutto_'+id).value=Math.round(cena*s*1.22);

}

function sumuj()
{
	
var cala=0;
	for (i=0;i<document.getElementsByTagName("input").length; i++)
			{
				if(document.getElementsByTagName("input").item(i).className == "brutto")
					{
						
						//d=document.getElementsByTagName("input").item(i).value
						
						cala+=eval(document.getElementsByTagName("input").item(i).value)
						//cala++;
					}
			}
	

	document.getElementById("netto_suma").value=Math.round(cala/1.22*100)/100;
	document.getElementById("brutto_suma").value=cala;
	//alert(suma)
	
	setTimeout("sumuj()",10);
}











function zapisz(fo, query)
{
	fo.setAttribute('target', '_self')
	fo.setAttribute('method', 'post')
	fo.setAttribute('action', query)
	fo.submit();

}


function pokaz_fakture(fo)
{

	fo.setAttribute('method', 'get')
	fo.setAttribute('target', '_blank')
	fo.setAttribute('action', 'faktura.php')
	fo.submit();

}

function wyslij_fakture(fo)
{
	fo.setAttribute('method', 'post')
	fo.setAttribute('action', '../ajax/wyslij_fakture.php')

	
 advAJAX.submit
 (
	document.getElementById("bilingForm"), 
	{
		
		onInitialization : function(obj)
		{
			document.getElementById("submitBtn_wyslij").value = "Proszę czekać... Trwa wysyłanie faktury!";
		},
		onComplete : function()
		{
			document.getElementById("submitBtn_wyslij").value = "Faktura została wysłana.. wyślij jeszcze jedną";
		},
		onSuccess : function(obj) 
		{ 
			alert(obj.responseText); 
			
		}
		
	}
 );




}









	function obsluga_warstw()
 {
  if (document.layers) return true;
  if (document.all) return false;
  if (document.getElementById) return true;
  return true;
 }


function get_elem(co)
 {
  if (!obsluga_warstw()) return document.all[co];
  else return document.getElementById(co);
 }
	
function widac(co)
 {
  return get_elem(co).style.display == 'block';
 }


function pokaz(co)
 {
  get_elem(co).style.display = 'block';
 }


function schowaj(co)
 {
  get_elem(co).style.display = 'none';
 }

function pok_schow(co, id_obj)
{
  if (widac(co))
	{
		schowaj(co);
	}
  else
	{
		pokaz(co);
	}
}

