doc=document;
obrazek=new Image();
otwarte=0
path="images/"
function chmOn(o){
  with(document.getElementById('chmurka').style){
    left=(o.offsetLeft+o.offsetWidth/2)+'px'
    display='block';
  }
}
function chmOff(){
  document.getElementById('chmurka').style.display='none';
}
function ImOn(o){o.src=eval(o.id+'On.src')} 
function ImOf(o){o.src=eval(o.id+'Of.src');}
function show(name){
   var lay=document.getElementById('powiekszenie')
   var o
   lay.innerHTML='<table cellpadding="0" cellspacing="0" border="0"><tr><td width="150" height="150" align="center" valign="middle">ładowanie zdjęcia</td></tr></table>'
   o=new Image();
   o.onload=fun
   function fun(){
      var w=this.width
      var h=this.height
      var lay=document.getElementById('powiekszenie')
      if(w>h){lay.style.left=v1X;lay.style.top=v1Y}
      else{lay.style.left=v2X;lay.style.top=v2Y}
      lay.innerHTML='<img src="'+this.src+'" width="'+this.width+'" height="'+this.height+'" alt="">'
   }
   o.src=path+name
}
function zoom(load){
	posx = ((screen.width/2)-(100));
	posy =((screen.height/2)-(100));	
	if(otwarte)noweOkno.close();	
	noweOkno = window.open('','noweOkno','resizible=no,location=no,status=no,menubar=no,toolbar=no,scrollbars=no,width=200,height=200');
	noweOkno.document.open()
	noweOkno.document.write('<html><head><title>Powiększenie</title><script>opener.otwarte=1</script></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><table border=0 cellpadding=0 cellspacing=0 ><tr><td width=200 height=200 align="center" valign="middle" style="font:12px Arial;color:#2F3C45;">Prosze poczekac <br> trwa ladowanie obrazka...</td></tr></table></body></html>');
	noweOkno.document.close()
	noweOkno.moveTo(posx,posy);
	obrazek.onload=cd;
	obrazek.src=load;
	function cd(){
		x=obrazek.width;
		y=obrazek.height;
		posx = ((screen.width/2)-(x/2));
		posy =((screen.height/2)-(y/2));
		if(!otwarte)noweOkno = window.open('','noweOkno','resizible=no,location=no,status=no,menubar=no,toolbar=no,scrollbars=no,width='+x+',height='+y);
		noweOkno.moveTo(posx,posy);
		noweOkno.resizeTo(x+14,y+32);
		noweOkno.document.open()
		noweOkno.document.write('<html><head><title>Powiekszenie</title><script>opener.otwarte=1</script></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><table border=0 cellpadding=0 cellspacing=0><tr><td><img src='+obrazek.src+'></td></tr></table></body></html>');
		noweOkno.document.close()
	}
}
function printpage(idK,idA,b,c,iz,bad,find,lit){
	noweOkno = window.open('print.php?idK='+idK+'&idA='+idA+'&b='+b+'&c='+c+'&iz='+iz+'&bad='+bad+'&find='+find+'&lit='+lit,'noweOkno','resizible=yes,location=no,status=no,menubar=no,toolbar=no,scrollbars=yes,width=600,height=500');
	noweOkno.moveTo(0,0);
}
function printmap(){
	noweOkno = window.open('mapa.html','noweOkno','resizible=no,location=no,status=no,menubar=no,toolbar=no,scrollbars=no,width=427,height=377');
	noweOkno.moveTo(0,0);
}

function printmapzielona(){
	noweOkno = window.open('mapa_zielona.html','noweOkno','resizible=no,location=no,status=no,menubar=no,toolbar=no,scrollbars=no,width=427,height=377');
	noweOkno.moveTo(0,0);
}

function printmapgorzow (){
	noweOkno = window.open('mapa_gorzow.html','noweOkno','resizible=no,location=no,status=no,menubar=no,toolbar=no,scrollbars=no,width=427,height=377');
	noweOkno.moveTo(0,0);
}

function findPromptS()
{
	//alert($('finder').find.value);
	new Ajax.Request('operation.php', {
	    method: 'post',
	    postBody: 'find='+$('finder').find.value,
	    onSuccess: findPromptSAnswer,
	    onFailure: findPromptSError});
}



function findPromptSAnswer(request)
{
    var odp = request.responseText;
    if(odp.length==0){
    	Element.hide('findPrompt');
    } else 
    {
    	$('findPrompt').innerHTML=odp;
    	Element.show('findPrompt');
    }
    //alert("Treść zapisana");
}

function findPromptSError()
{}


function finderInsert(name)
{
	$('finder').find.value = name;
	Element.hide('findPrompt');
	//$('finder').submit();
}

function questionForm()
{
	Element.show('qform');
	Element.hide('qnavi');
}

function questionFormAbort()
{
	Element.hide('qform');
	Element.show('qnavi');
	$('qmsg').innerHTML = '';
}

function qformSave()
{
	new Ajax.Request('operation.php', {
	    method: 'post',
	    postBody: 'question='+$('qformid').question.value+'&name='+$('qformid').name.value+'&mail='+$('qformid').mail.value+'&tel='+$('qformid').tel.value,
	    onSuccess: qformSaveAnswer,
	    onFailure: qformSaveError});
}

function qformSaveAnswer(request)
{
    var odp = request.responseText;
    if(odp =='1') $('qmsg').innerHTML = 'Proszę podać pytanie';
    if(odp == '0') 
    {
    	$('qmsg').innerHTML = 'Dziękujemy za skorzystanie z formularza';
    	
    	$('qformid').question.value='';
    	$('qformid').name.value='';
    	$('qformid').mail.value='';
    	$('qformid').tel.value='';
    	Element.hide('qform');
    	Element.show('qnavi');
    }
}

function qformSaveError()
{}

function newsd()
{
	$('newsForm').newsletter_zapisz.value='2';
	$('newsForm').submit();
}

function newsstep2()
{	
	if($('newsForm').email.value=='')
	{
		$('msg_letter').innerHTML = '<span class="msg">PROSZĘ PODAĆ ADRES E-MAIL</span>';
	} else 
	if($('newsForm').email.value.indexOf('@')==-1)
	{
		$('msg_letter').innerHTML = '<span class="msg">PODAJ POPRAWNY E-MAIL</span>';
	} else
	{
		Element.show('newspodzial');
		$('newspodzial').style.display='inline';
		$('msg_letter').innerHTML = '';
	}
	//alert('step 2 to newsletter');
}

function newssdzial()
{
	//if($('newsForm').newstyp[0].checked) alert($('newsForm').newstyp[0].value);
	//if($('newsForm').newstyp[1].checked) alert($('newsForm').newstyp[1].value);
	
	if($('newsForm').newstyp[0].checked)
	{
		$('newsspec').style.display='none';
		//$('newspodzial').style.height='75px';
	}
	
	if($('newsForm').newstyp[1].checked)
	{
		$('newsspec').style.display='inline';
		//$('newspodzial').style.height='300px';
	}
}

function newssend()
{
	if($('newsForm').newstyp[0].checked)
	{
		$('newsForm').submit();
		//$('newspodzial').style.height='75px';
	}
	
	if($('newsForm').newstyp[1].checked)
	{
		//alert('prosze wybrac specjalizacje');
		//alert($('newsForm').elements +'--'+$F('newsForm').elements.lenght);
		//alert(document.forms["newsForm"].elements.length);
		var f = document.forms["newsForm"].elements;
		//alert(f.length);
		var che = 0;
		for(i=0;i<f.length;i++) 
		{
			if(f[i].name.indexOf('newsspeclist') > -1)
			{
				//alert(f[i].checked);
				if(f[i].checked) che++;
			}
		}
		
		if(che == 0)
		{
			$('msg_letter').innerHTML = '<span class="msg">PROSZĘ WYBRAĆ SPECJALIZACJE</span>';
		} else 
		{
			$('newsForm').submit();
		}
		
	}
}

function sd(id,v)
{
	if(v<100) 
	{
		$(id).setOpacity(v/100);
		v+=5;
		setTimeout("sd('"+id+"',"+v+")",1);
	}
}

function hd(id,v)
{
	if(v>0) 
	{
		$(id).setOpacity(v/100);
		v-=5;
		setTimeout("hd('"+id+"',"+v+")",1);
	}
	if(v<=0) 
	{
		Element.hide(id);
		$(id).setOpacity(1);
	}
}

function sansw(shw)
{
	$(shw).setOpacity(0);
	Element.show(shw);
	$(shw).style.display='inline';
	//$(shw).setOpacity(0.92);
	
	if(shw == 'dlaplacmed_odp')
	{
		sd(shw,0);
		Element.hide('dlalek_odp');
		Element.hide('dlapac_odp');
	}
	
	if(shw == 'dlalek_odp')
	{
		sd(shw,0);
		Element.hide('dlaplacmed_odp');
		Element.hide('dlapac_odp');
	}
	
	if(shw == 'dlapac_odp')
	{
		sd(shw,0);
		Element.hide('dlaplacmed_odp');
		Element.hide('dlalek_odp');
	}
}

function sanswc(shw)
{
	//Element.hide(shw);
	//alert($(shw).getOpacity);
	hd(shw,100);
}

function allclose()
{
	Element.hide('dlaplacmed_odp');
	Element.hide('dlalek_odp');
	Element.hide('dlapac_odp');
}