function sendFormAction(formname, action){
	document.forms[formname].k_a.value = action;
	document.forms[formname].submit();
}

function sendFormActionAsk(formname, action,pytanie){
	if(confirm(pytanie)){
		document.forms[formname].k_a.value = action;
		document.forms[formname].submit();
	}
}

function sendFormAsk(formname,pytanie){
	if(confirm(pytanie)){
		document.forms[formname].submit();
	}
}


function sendForm(formname){
	document.forms[formname].submit();
}

function linkAsk(pytanie, link){
	if(confirm(pytanie)){
		location.href = link;
	}
}

function linkTo(link){
	location.href = link;
}

function checkAll(nazwa)
  {
  for (var i=0;i<document.list.elements.length;i++)
    {
    var e = document.list.elements[i];
    var re = new RegExp(nazwa);
    if ((e.name != nazwa) && (re.test(e.name))){
      e.checked = document.list.lidall.checked;
      }
    }
  }

function newWindow(strona,_width,_height,_positionX,_positionY,autoprint){
	var width=450;
	var height=350;
	if (_width!=0 && _height!=0) {
		if (_width<0) {
			width=-0.01*screen.width*_width;
		}else {width=_width;}
		if (_width<0) {
			{height=-0.01*screen.height*_height;}
		}else 	 {height=_height;}
	}
	if (_positionX!=0 && _positionY!=0){
		var top=(screen.height-height)*0.01*_positionY;
		var left=(screen.width-width)*0.01*_positionX;
		}
	okienko=window.open(strona,'','left='+left+',top='+top+',toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,personalbar=no,directories=no,status=no,width='+width+',height='+height);
	okienko.focus();
	if (autoprint==true) okienko.onload=okienko.print;
}	

function newWindowAsk(pytanie,strona,_width,_height,_positionX,_positionY,autoprint){
	if(confirm(pytanie)){
		newWindow(strona,_width,_height,_positionX,_positionY,autoprint);
	}
}


function newWindow2(strona){
	okienko=window.open(strona,'');
	okienko.focus();
}	



function resize() {
  var i=0;
  if (navigator.appName == 'Netscape') i=40;
  if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
  self.focus();
}


function dymek(T,t){
 T.title='';
 T.parentNode.lastChild.style.display=t?'block':'none';
}

function flipDisplay(rid)
	{
	current=(document.getElementById(rid).style.display == 'none') ? 'block' : 'none';
	document.getElementById(rid).style.display = current;
	}

function flipDisplayNewsEditor(rid1,rid2)
	{
	current=(document.getElementById(rid1).style.display == 'none') ? 'block' : 'none';
	document.getElementById(rid1).style.display = current;

	current=(current=='none') ? 'block' : 'none';
	document.getElementById(rid2).style.display = current;
	}

function sendNumber(url,ile,podpis,endlink)
{
	var ilosc =  prompt (podpis, ile );		
	
	if ( !isNaN(parseInt(ilosc)) ) 
	{
		location.href = url + ilosc + endlink;
	}
}
function sendText(url,text,podpis,endlink)
{
	var text =  prompt (podpis, text );
	if (text!=null){
		location.href = url + text + endlink;
	}
}

function trim(value) {
   var temp = value;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   var obj = / +/g;
   temp = temp.replace(obj, " ");
   if (temp == " ") { temp = ""; }
   return temp;
}

