function gotohref(new_href)
{
	location.href=new_href;
}

function g(element)
{
        //element ma na celu uruchomienie linku gdy można (go==1)
        var el=document.getElementById(element);
        if(el.go!=0)
                location.href=el.href;
        el.go=1;
}

function s(element)
{
        //element ma na celu zablokowanie linku
        var el=document.getElementById(element);
        el.go=0;
}

function sub(element)
{
        var el=document.getElementById(element);
        el.submit();
}
function im1(element)
{
       tl=element.src.length;
       extension=element.src.substr(tl-3,3);
       ns=element.src.substr(0,tl-4)+'_over.'+extension;
       element.src=ns;
       return;
}

function im0(element)
{
       tl=element.src.length;
       extension=element.src.substr(tl-3,3);
       ns=element.src.substr(0,tl-9)+'.'+extension;
       element.src=ns;
       return;
}
function sprawdz_dlugosc(element, max){
                  if(element.value.length>max) element.value=element.value.substring(0, max);
}

function set_value(element,new_value)
{
        //element ma na celu zablokowanie linku
        var el=document.getElementById(element);
        el.value=new_value;
        //alert(el.value);
}

function ukryj(element){
        var el=document.getElementById(element);
        if(el)
        {
            el.style.display='none';
        }
}

function pokaz(element, styl){
        var el=document.getElementById(element);
        if(el)
        {
            if(styl="") styl="block"
            el.style.display=styl;
        }
}

function pokaz_pole_jezyka(id, div_base_id)
{
	div_base_id=div_base_id+'_';
	for(i=1;i<20;i++)
	{
		ukryj(div_base_id+i);
	}
	pokaz(div_base_id+id,'block');
}


function powieksz_wysokosc(element, wysokosc){
        var el=document.getElementById(element);
        el.style.height=wysokosc+'em';
}

function turn(element,styl)
{
        var el=document.getElementById(element);
        if(styl="") styl="block"
        if(el.style.display=='none')        
                el.style.display=styl;
        else
                el.style.display='none';
}

function open_link(plik,okno)
{
  pop=window.open(plik,okno);
  pop.focus();
}

function jump(plik)
{
	ar=plik.split('|');
	s=new String();
	for(i=0;i<ar.length;i++)
		s=s+ar[i];
  pop=window.open(s);
  pop.focus();
}

function open_image(img_x,img_y,img_title,img_file,window_name){
  wym_x=img_x+40;
  wym_y=img_y+40;
  scrollx=0;
  scrolly=0;
  if((wym_x<=0)||(wym_x>(screen.availWidth-20))) {scrollx=1; wym_x=screen.availWidth-20;}
  if((wym_y<=0)||(wym_y>(screen.availHeight-40))){scrolly=1; wym_y=screen.availHeight-40;}
  x=(screen.availWidth-wym_x)/2;
  y=(screen.availHeight-wym_y)/2;
  if(scrollx || scrolly ) scrollbars='scrollbars=yes';
  else scrollbars='scrollbars=no';
  pop=window.open('',window_name, 'toolbar=no,menubar=no,'+scrollbars+',resizable=no,height='+wym_y+',width='+wym_x+',left='+x+',top='+y);
  pop.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-type" content="text/html; charset=utf-8" /><title>'+img_title+'</title></head><body style="margin: 20px; padding: 0px; background: #efefef;">');
  pop.document.write('<a style="margin:auto;" href="javascript:self.close()" title="Zamknij / Close /"><img style="border:0px solid white;" src="'+img_file+'"');
  if(img_y>0) pop.document.write(' height='+img_y); 
  if(img_x>0) pop.document.write(' width='+img_x);
  pop.document.write(' ></a>');
  pop.document.write('</body></html>');
  pop.focus();
}

function open_window(url,wym_x,wym_y,window_name){
  scrollx=0;
  scrolly=0;
  if((wym_x<=0)||(wym_x>(screen.availWidth-20))) {scrollx=1; wym_x=screen.availWidth-20;}
  if((wym_y<=0)||(wym_y>(screen.availHeight-40))){scrolly=1; wym_y=screen.availHeight-40;}
  x=(screen.availWidth-wym_x)/2;
  y=(screen.availHeight-wym_y)/2;
  if(scrollx || scrolly ) scrollbars='scrollbars=yes';
  else scrollbars='scrollbars=no';
  pop=window.open(url,window_name, 'toolbar=no,menubar=no,'+scrollbars+',resizable=no,height='+wym_y+',width='+wym_x+',left='+x+',top='+y);
  pop.focus();
}

function zmienrozmiar(wym_x,wym_y,plus_x,plus_y)
{
	wym_x=parseInt(wym_x)+parseInt(plus_x);
	wym_y=parseInt(wym_y)+parseInt(plus_y);
  x=(screen.availWidth-wym_x)/2;
  y=(screen.availHeight-wym_y)/2;
  window.moveTo(x,y);
	window.resizeTo(wym_x,wym_y);
}


function pokaz_szukaj_form(selekcja, formularz)
{
	el=document.getElementById(selekcja);

	for(i=0;i<el.options.length;i++)
	{
		form_el=document.getElementById(formularz+'_'+el.options[i].value);
		if(el.options[i].selected)
			form_el.style.display='inline';
		else
			form_el.style.display='none';
	}
	 
}

