function gotohref(new_href) {
    location.href=new_href;
}

function im1(element) {
    // zmien obrazek na _over
    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) {
	// przywroc obrazek z _over (bez)
    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) {
	// obetnij value do zadanej dlugosci
    if(element.value.length>max) element.value=element.value.substring(0, max);
}

function submit_form(element) {
    //element ma na celu zablokowanie linku
    var el=document.getElementById(element);
    el.submit();
}

function set_value(element,new_value) {
    //element ma na celu zablokowanie linku
    var el=document.getElementById(element);
    el.value=new_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 pokaz_pole_z_grupy(id, div_base, styl, id_elementow, ustaw_na_start) {
    //div_base=div_base_id+'_';
    var tablica_id=id_elementow.split(':');
    for(i in tablica_id) {
        ukryj(div_base+tablica_id[i]);
    }
    pokaz(div_base+id, styl);
}

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 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';
    }
}