var ns=document.layers?1:0
var ie=document.all?1:0


function drukuj()
{
	if (!window.print)
      	{
	    alert("Musisz mieæ NS4.x lub IE5!")
	    return
      	}
      	window.print()
}

//nie uzywana aktualnie
function displayWindow(url, width, height)
{
	Win = window.open(url,"pictures",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no' );
}

function displayKalk(url)
{
      	Win = window.open(url,"kalkulator",'width=450,height=480,resizable=0,scrollbars=no,menubar=no' );
}

function displayOferent(url)
{
      	Win = window.open(url,"oferent",'width=315,height=200,resizable=0,scrollbars=no,menubar=no' );
}

function displayInfo(url)
{
 	window.open(url,'_blank','resizable=yes, scrollbars=yes, menubar=no, toolbar=no') ;
}

function displayForm(url)
{
      	Win = window.open(url,"zapytanie",'width=450,height=350,resizable=0,scrollbars=no,menubar=no' );
}

function PokazUkryjTooltip(Blok,zamknij)
{
	if (getEl(Blok).style.display=="block")
	  UkryjTooltip(Blok);
	else
	  PokazTooltip(Blok,zamknij);
}

function PokazTooltip(Blok,zamknij)
{
	getEl(Blok).style.display="block";
	if (zamknij==1) setTimeout("UkryjTooltip('"+Blok+"')", 3500);
}

function UkryjTooltip(Blok)
{
    	getEl(Blok).style.display="none"
}

function Powieksz(arr)
{
	if (getEl(arr).style.height=='')
          getEl(arr).style.height = 8 ;

	if (parseInt(getEl(arr).style.height) < 12)
	{
	  getEl(arr).style.height=parseInt(getEl(arr).style.height)+1;
	  setTimeout("Powieksz('"+arr+"');",15);
	}
}

function Zmniejsz(arr)
{
	if (parseInt(getEl(arr).style.height) > 8)
	{
	  getEl(arr).style.height=parseInt(getEl(arr).style.height)-1;
	  setTimeout("Zmniejsz('"+arr+"');",15);
	}
}

function Zaznacz(szuk)
{
    szuk.className='buttonSzukajHover';
}

function Odznacz(szuk)
{
    szuk.className='buttonSzukaj';
}

function getEl(id)
{
	if (ie)
 	   el=document.all[id];
 	else
 	   el=document.getElementById(id);
 	if(!el.style)
   	   el.style=el;
 	return el
}

function maskujKlawisze(AEvent, AMaska)
{
    if (AEvent.keyCode) keycode=AEvent.keyCode;
    else keycode=AEvent.which;

    spec_kode='8,9,13,37,39,46';          // enter,->, <-, backspace, delete, tab
    if (spec_kode.indexOf(keycode) >= 0)
        return true;

    klawisz = String.fromCharCode(keycode);

    if (AMaska.indexOf(klawisz) == -1)
        return false;
    else
        return true;
}

function wysylanieZapytania()
{
   f=document.zapytanie;
   wysylaj=true;
   if (f.pytanko.value == "")
   {
      f.pytanko.style.background = "#FFFFAA"
      wysylaj=false;
   }
   if (!sprawdzEmail(f.kontakt_mail.value))
   {
      f.kontakt_mail.style.background = "#FFFFAA"
      wysylaj=false;
   }
   if (wysylaj)
   {
      f.submit();
   }
}

function sprawdzEmail(email)
{
   if(email.length == 0 || email.indexOf("@") == -1 ||  email.indexOf("@") == 0 || email.indexOf(".") == -1 || email.length == (email.indexOf("@")+1) || email.length == (email.indexOf(".")+1) || email.indexOf(' ') != -1)
   { 
      return false;
   }
            
   return true;
}


function wyczysc(el)
{
   el.style.background = "#FFFFFF;"
}
