function checkKey(e,item) {
	var intKeyCode = 0;
	if (navigator.appName == "Microsoft Internet Explorer") {
		if (window.event.keyCode == 13)	{
			document.getElementById('id_kategorii').selectedIndex=0;
			if (item=='tytul') {
				document.getElementById('szukaj_autor').value='';
			} else {
				document.getElementById('szukaj_tytul').value='';
			}
			document.forms.wyszukiwarka.submit();
		}
	}
	if (navigator.appName == "Netscape") {
		intKeyCode = e.which;
		if (intKeyCode == 13) {
			document.getElementById('id_kategorii').selectedIndex=0;
			if (item=='tytul') {
				document.getElementById('szukaj_autor').value='';
			} else {
				document.getElementById('szukaj_tytul').value='';
			} 
			document.forms.wyszukiwarka.submit();
		}
	}
}

function sprawdzDate(pole) {
//  var str = document.getElementById( 'termin_data_rok'  ).value + '-' + document.getElementById( 'termin_data_miesiac'  ).value + '-' + document.getElementById( 'termin_data_dzien'  ).value;
  var dataTab = pole.split('-');
	var r = dataTab[0];
	var m = dataTab[1];
	var d = dataTab[2];
	
	if (!isInteger(r) || !isInteger(m) || !isInteger(d)) {
  	alert ('Niepoprawna data realiazacji');
  	otworz_kalendarz( 'termin_data' );
  } else {
  	  var dzis = new Date();
	  var strData = new Date(document.getElementById('termin_data_rok').value,document.getElementById( 'termin_data_miesiac').value-1,document.getElementById('termin_data_dzien').value);
	  if (strData.getDay() == 0 || strData.getDay() == 6) {
	  	alert('Wybrano dzień wolny od pracy');
	  	otworz_kalendarz( 'termin_data' );
	  } else {
	  		if (dzis.getYear() == strData.getYear() && dzis.getMonth() == strData.getMonth() && dzis.getDay() == strData.getDay() && dzis.getHours() >= 17) {
	  			alert('Zbyt krótki termin realizacji');
	  		} else {
	  	 		//WyslijZlecenie();
	  	 		if(flex) 
					 	WyslijZlecenie2();
				 else 
				 		WyslijZlecenie();
	  	 	}
	  }
	}
  /*
  var miesiac = za_dwa_dni.getMonth() + 1;
  if( miesiac < 10 )
   miesiac = '0' + miesiac;
  var dzien = za_dwa_dni.getDate();
  if( dzien < 10 )
   dzien = '0' + dzien;
  document.getElementById( 'termin_data_rok' ).value = za_dwa_dni.getFullYear();
  document.getElementById( 'termin_data_miesiac' ).value = miesiac;
  document.getElementById( 'termin_data_dzien' ).value = dzien;
  */
}


function sprawdzDate(r,m,d) {
//  var str = document.getElementById( 'termin_data_rok'  ).value + '-' + document.getElementById( 'termin_data_miesiac'  ).value + '-' + document.getElementById( 'termin_data_dzien'  ).value;
  if (!isInteger(r) || !isInteger(m) || !isInteger(d)) {
  	alert ('Niepoprawna data realiazacji');
  	otworz_kalendarz( 'termin_data' );
  } else {
  	  var dzis = new Date();
	  var strData = new Date(document.getElementById('termin_data_rok').value,document.getElementById( 'termin_data_miesiac').value-1,document.getElementById('termin_data_dzien').value);
	  if (strData.getDay() == 0 || strData.getDay() == 6) {
	  	alert('Wybrano dzień wolny od pracy');
	  	otworz_kalendarz( 'termin_data' );
	  } else {
	  		if (dzis.getYear() == strData.getYear() && dzis.getMonth() == strData.getMonth() && dzis.getDay() == strData.getDay() && dzis.getHours() >= 17) {
	  			alert('Zbyt krótki termin realizacji');
	  		} else {
	  	 		//WyslijZlecenie();
	  	 		if(flex) 
					 	WyslijZlecenie2();
				 else 
				 		WyslijZlecenie();
	  	 	}
	  }
	}
  /*
  var miesiac = za_dwa_dni.getMonth() + 1;
  if( miesiac < 10 )
   miesiac = '0' + miesiac;
  var dzien = za_dwa_dni.getDate();
  if( dzien < 10 )
   dzien = '0' + dzien;
  document.getElementById( 'termin_data_rok' ).value = za_dwa_dni.getFullYear();
  document.getElementById( 'termin_data_miesiac' ).value = miesiac;
  document.getElementById( 'termin_data_dzien' ).value = dzien;
  */
}

function PokazOpisSerii( ){
	document.getElementById('okno_over').style.display='block';
	return true;
}
 
function $( id )
{
 var el = document.getElementById( id );
 return el;
}

function PrzypomnijSubmit()
{
 var forma = document.forms['przypomnij'];
 if( forma.elements['przypomnij_login'].value == '' || forma.elements['przypomnij_email'].value == '' ){
  alert( 'Błędny login - wpisz właściwy login lub skontaktuj się z konsultantem: 0 22 627 33 33  ' );
 } else {
  forma.submit()
 }
}

function PokazFormZamowienia()
{
 document.getElementById( 'zamowienie' ).style.display = 'inline' 
}

function InnyAdresWysylki( t )
{
 if( document.forms['zamowienie_nagrod'].elements['check_inny_adres'].checked ) 
 {
  document.getElementById( 'inny_adres' ).style.display = 'inline';
 }
 else
 {
   document.getElementById( 'inny_adres' ).style.display = 'none';
 }
  
}

function ZmienIloscWynikowNaStronie(wartosc) {

	document.getElementById('limit').value = wartosc;
	document.forms.wyszukiwarka.submit();
}


function AjaxKalendarz(){
 mysz_nad_kalendarzem = true;
 xajax.$('kalendarz_wew').innerHTML = '<img src="gfx/preloader.gif">';
 xajax_CalendarInfo( xajax.getFormValues("kalendarz_form") );
}

function pokaz_odpowiedz( id )
{
 var el = document.getElementById( 'odp_' + id );
 
 if( el.style.display == 'inline' )
  el.style.display = 'none';
 else
  el.style.display = 'inline';
}

function zmien_obrazek( nazwa, sciezka )
{
 var obrazek = document.getElementById( nazwa );
 obrazek.src = sciezka;
}

function zamknij_komunikat()
{
 document.getElementById( 'komunikat_okno' ).style.display = 'none';
 var ramka = document.getElementById( 'komunikat_r' );
 if( ramka )
  ramka.style.display = 'none';
}

var
mysz_nad_kalendarzem = false;
mysz_nad_info = false;

function zamknij_panele2( )
{
 mysz_nad_kalendarzem = false;
 mysz_nad_info = false;
 zamknij_panele( );
}

function zamknij_panele( )
{
  var p1 = document.getElementById( 'kal' );
  if( p1 && !mysz_nad_kalendarzem )
  {
    document.getElementById( 'kal_tmp' ).style.display = 'none';
    p1.style.display = 'none';
  }
  var p2 = document.getElementById( 'inf' );
  if( p2 && !mysz_nad_info )
  {
   document.getElementById( 'inf_tmp' ).style.display = 'none';
    p2.style.display = 'none';
  }
  var zakl = document.getElementById( 'panel_kalen2' );
  var zakl2 = document.getElementById( 'panel_kalen' );
  if( zakl && zakl2 && !mysz_nad_kalendarzem )
  {
   zakl2.style.display = 'inline';
   zakl.style.display = 'none';
  }
}
        
function pokaz_panel( nazwa )
{
 var warstwa = document.getElementById( nazwa );
 if( warstwa.style.display == 'none' ) 
 {
  warstwa.style.display = 'inline';
  document.getElementById( nazwa + '_tmp' ).style.display = 'inline';
 }
 else 
 {
  warstwa.style.display = 'none';
  document.getElementById( nazwa + '_tmp' ).style.display = 'none';
 }

 if( nazwa == 'inf')
 {
  document.getElementById( 'kal' ).style.display = 'none';
  document.getElementById( 'kal_tmp' ).style.display = 'none';
  
  var zakl = document.getElementById( 'panel_kalen2' );
  var zakl2 = document.getElementById( 'panel_kalen' );
     
   zakl2.style.display = 'inline';
   zakl.style.display = 'none';
 }
  
 if( nazwa == 'kal')
 {
  document.getElementById( 'inf' ).style.display = 'none';
  document.getElementById( 'inf_tmp' ).style.display = 'none';
  
   var zakl = document.getElementById( 'panel_kalen2' );
   var zakl2 = document.getElementById( 'panel_kalen' );
     
  if( warstwa.style.display == 'none' )  
  {
   zakl2.style.display = 'inline';
   zakl.style.display = 'none';
  } 
  else
  {
   zakl2.style.display = 'none';
   zakl.style.display = 'inline';
  }
 }
}


function otworz_kalendarz( pole )
{
openWindow('kalendarz', 'kalendarz.php?field=' + pole, '290', '220');
}

function confirmLink(theLink, theWarning)
{
    var is_confirmed = confirm(theWarning);
    if (is_confirmed) {
        document.location=theLink;
    }
    return is_confirmed;
} // end of the 'confirmLink()' function


// dymki
/*
Graculini's Popup Engine - GPE v1.0
Copyright Gracjan Lech 2003.
Contact me: gracjan.lech@poczta.fm
This notice must remain untouched at all times.
*/

var cienX = 1;
var cienY = 1;
var cienKolor = '#aaaaaa';

function dostosuj(pX, pY, pKolor)
{
  var z = document.getElementById('info').scrollHeight;
  var tpX = 0;
  var tpY = 0;
  var sX = 0;
  pX++; pY++;
  
  //alert(navigator.userAgent + ', ' + navigator.userAgent.indexOf('IE'));
  
  if ((popupBorderWidth == 0) && (navigator.userAgent.indexOf('IE') > -1)) pX++;
  if ((textPadding > 0) && (navigator.userAgent.indexOf('IE') < 0))
  {
    pX -= 1;
    pY -= 1;
    tpX = textPadding + 1;
    tpY = textPadding - 1;
    sX = -1;
  }
  //pX += 2*textPadding;
  //pY += 2*textPadding;
  

  document.getElementById('main').style.height = z + pY + popupBorderWidth;
  document.getElementById('main').style.width = popupWidth + pX - 1;

  document.getElementById('info').style.width = popupWidth - (popupBorderWidth - 1);

  document.getElementById('shadow').style.height = z + pY;
  document.getElementById('shadow').style.top = popupBorderWidth + pY - 2;
  document.getElementById('shadow').style.left = popupBorderWidth + pX - 2;
  document.getElementById('shadow').style.width = popupWidth + 2*tpX + 2 + sX;
  document.getElementById('shadow').style.backgroundColor = pKolor;
}

function displayConfig() {
 //KONFIGURACJA START
 //Odstęp popup'a od kursora w poziomie
 if ((popupOffsetX=getValue("popupOffsetX"))==NA)
  popupOffsetX=15
 //Odstęp popup'a od kursora w pionie
 if ((popupOffsetY=getValue("popupOffsetY"))==NA)
  popupOffsetY=20
 //Położenie popup'a względem myszki
 if ((popupAlign=getValue("popupAlign"))==NA)
  popupAlign="center" //Inne opcje - left, center
 //Długość popup'a
 if ((popupWidth=getValue("popupWidth"))==NA)
  popupWidth=230
 if (getValue("popupv2"))
  popupWidth=390
 //Szerokość obramowania całego popup'a
 if ((popupBorderWidth=getValue("popupBorderWidth"))==NA)
  popupBorderWidth=1
 //Kolor obramowania popup'a
 if ((popupBorderColor=getValue("popupBorderColor"))==NA)
  popupBorderColor="#C7C7C7"
 //Styl obramowania popup'a (dotted, double...)
 if ((popupBorderStyle=getValue("popupBorderStyle"))==NA)
  popupBorderStyle="solid"
 //Domyślna przeźroczystość popup'a
 if ((popupOpacity=getValue("popupOpacity"))==NA)
  popupOpacity=97
 //Kolor czcionki nagłówka
 if ((captionColor=getValue("captionColor"))==NA)
  captionColor="Black"
 //Styl czcionki nagłówka
 if ((captionFontStyle=getValue("captionFontStyle"))==NA)
  captionFontStyle="normal"
 //Pogrubienie czcionki nagłówka
 if ((captionFontWeight=getValue("captionFontWeight"))==NA)
  captionFontWeight="bold"
 //Wielkość czcionki nagłówka
 if ((captionFontSize=getValue("captionFontSize"))==NA)
  captionFontSize="9px"
 //Czcionka nagłówka
 if ((captionFontFamily=getValue("captionFontFamily"))==NA)
  captionFontFamily="Verdana, sans-serif"
 //Wypełnienie ogólne
 if ((captionPadding=getValue("captionPadding"))==NA)
  captionPadding="0px";
 //Kolor tła nagłówka
 if ((captionBackgroundColor=getValue("captionBackgroundColor"))==NA)
  captionBackgroundColor=popupBorderColor
 //Tło nagłówka
 if ((captionBackgroundImage=getValue("captionBackgroundImage"))==NA)
  captionBackgroundImage=""
 //Dodatki do tła
 if ((captionBackgroundImageProperties=getValue("captionBackgroundImageProperties"))==NA)
  captionBackgroundImageProperties=""
 //Kolor czcionki tekstu
 if ((textColor=getValue("textColor"))==NA)
  textColor="Black"
 //Styl czcionki tekstu
 if ((textFontStyle=getValue("textFontStyle"))==NA)
  textFontStyle="normal"
 //Pogrubienie czcionki tekstu
 if ((textFontWeight=getValue("textFontWeight"))==NA)
  textFontWeight="normal"
 //Wielkość czcionki tekstu
 if ((textFontSize=getValue("textFontSize"))==NA)
  textFontSize="7pt"
 //Czcionka tekstu
 if ((textFontFamily=getValue("textFontFamily"))==NA)
  textFontFamily="Tahoma"
 //Wypełnienie ogólne
 if ((textPadding=getValue("textPadding"))==NA)
  textPadding=5;
 //Kolor tła tekstu
 if ((textBackgroundColor=getValue("textBackgroundColor"))==NA)
  textBackgroundColor="#FFFFBF"
 //Tło tekstu
 if ((textBackgroundImage=getValue("textBackgroundImage"))==NA)
  textBackgroundImage=""
 //Dodatki do tła 
 if ((textBackgroundImageProperties=getValue("textBackgroundImageProperties"))==NA)
  textBackgroundImageProperties=""
 //fadeIn
 if ((fadeIn=params.indexOf("fadeIn"))!=-1)
  fadeIn=true
 //Domyślny czas fadeIn
 if (fadeIn && ((fadeInTime=getValue("fadeInTime"))==NA))
  fadeInTime=1
 //fadeOut
 if ((fadeOut=params.indexOf("fadeOut"))!=-1)
  fadeOut=true
 //Domyślny czas fadeOut
 if (fadeOut && ((fadeOutTime=getValue("fadeOutTime"))==NA))
  fadeOutTime=1
 
 //DODATKOWE SZATY
 
 layout[1]="textBackgroundColor: #ffffe1; popupBorderColor: #000000; textFontFamily: verdana; textFontSize: 11px;"
 layout[2]="textFontStyle: italic;"
 
 //KONFIGURACJA KONIEC  
}

document.write("<div id=\"popupDiv\" style=\"position: absolute; display: none; z-index: 1000; filter: alpha(opacity=100); -moz-opacity: 1;\">GPE v1.1 - popup engine</div>")
popup=document.getElementById("popupDiv")
OP=NS=IE=false
if (navigator.userAgent.indexOf("Opera")!=-1) OP=true
else if (navigator.appName=="Netscape") NS=true
else if (navigator.appName=="Microsoft Internet Explorer") IE=true

function gpe(arguments) {
 fadingIn=false
 fadeOut=false
 params=arguments
 layout=new Array()
 captionClass=getValue("captionClass")
 caption=getValue("caption")
 textClass=getValue("textClass")
 text=getValue("text")
 popupLayout=getValue("popupLayout")
 if (popupLayout!=null) params+=grabLay()
 NA=null
 displayConfig()
 if (popupBorderColor==NA && captionBackgroundColor!=NA) popupBorderColor=captionBackgroundColor
 po=eval(popupOpacity)
 if (NS) NSpo=(po/100)
 if (textBackgroundImage!=null) textBackgroundImage="url('"+textBackgroundImage+"') "+textBackgroundImageProperties+""
 if (captionBackgroundImage!=null) captionBackgroundImage="url('"+captionBackgroundImage+"') "+captionBackgroundImageProperties+""


  //Przesuniecie cienia w prawo
  var shadowWidth = 3;
  // Przesuniecie cienia w dol
  var shadowHeight = 3;
  
  var popupWidthPadding = "";
  var tmp = 0;
  var l1 = 0;
  var mainWidth = 0;
  
  //mainWidth=popupWidth+shadowWidth+parseInt(textPadding.substr(0, textPadding.length - 2));
  mainWidth=popupWidth+shadowWidth+textPadding;

  l1 = textPadding;
  tmp = popupWidth + 2*l1;
  popupWidthPadding = tmp;
  
 popupContent="<div id = \"main\" style = \"width: " + mainWidth + "px; height: 0px; border: 0px;\">"
 popupContent+="<div id = \"info\" style=\"z-index: 101; position: absolute; border: " + popupBorderColor + " " + popupBorderWidth + "px " + popupBorderStyle + ";"
 popupContent+="color: " + textColor + "; font-family: " + textFontFamily + "; font-style: " + textFontStyle
 popupContent+="font-weight: " + textFontWeight + "; font-size: " + textFontSize
 popupContent+="; padding: " + textPadding + "px; width: "+popupWidth+"px; border: "+popupBorderWidth
 popupContent+=" "+popupBorderStyle+" "+popupBorderColor+"; background: " + textBackgroundColor + ";\">"
 popupContent+=text
 popupContent+="</div>"
 popupContent+="<div id = \"shadow\" style = \"z-index: 100; position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; background: #0000ff;\">"
 popupContent+="</div>"

 if (NS) {
  content=document.createRange();
  content.setStartBefore(popup);
  content=content.createContextualFragment(popupContent);
  with (popup) {
   if (hasChildNodes()) removeChild(lastChild)
   appendChild(content)
  }
 }
 else popup.innerHTML=popupContent
 pO(po)
 if (IE) gpePos()
 document.onmousemove=function gpePos(evt) {
  if (NS) {
   coordX=evt.pageX
   coordY=evt.pageY
   winWidth=innerWidth
  }
  else {
   coordX=event.clientX+document.body.scrollLeft
   coordY=event.clientY+document.body.scrollTop
   winWidth=document.body.clientWidth
  }
  switch (popupAlign) {
   case "left" :
    if (coordX-popupWidth-popupOffsetX<0) coordX=popupWidth+popupOffsetX
     coordX-=popupWidth+(popupOffsetX*2)
   break
   case "center" :
    if (coordX+popupWidth/2>winWidth) {coordX=winWidth-popupWidth/2; popupOffsetX=0}
    if (coordX-popupWidth/2<0) {coordX=popupWidth/2; popupOffsetX=0}
    coordX-=popupWidth/2+popupOffsetX
   break
   case "right" :
    if (coordX+popupWidth+popupOffsetX>winWidth) coordX=winWidth-popupWidth-popupOffsetX
  }
  popup.style.left=coordX+popupOffsetX
  popup.style.top=coordY+popupOffsetY
 }
 popup.style.display="block"
 if (fadeIn==true) {
  pO(0)
  fade(1)
 }
 popup.style.display="block"
 document.onmouseout=function() {
  if (fadeOut==true) {
   if (fadeIn) fadeIn=false
   else pO(po)
   fade(2)
  }
  else popup.style.display="none"
 }
 
 dostosuj(cienX, cienY, cienKolor);
}
function getValue(keyWord) {
 with (params) {
  if (indexOf(keyWord+":")==-1) return
  keyInd=lastIndexOf(keyWord+":")
  value=substring(keyInd+(keyWord.length+1),indexOf(";",keyInd))
 }
 while (value.indexOf("|:|")!=-1) {
  with (value) {
   value=substring(0,indexOf("|:|"))+";"+substring(indexOf("|:|")+3)
  }
 }
 while (value.indexOf(" ")!=-1 && keyWord!="text" && keyWord!="caption") {
  with (value) {
   value=substring(0,indexOf(" "))+substring(indexOf(" ")+1)
  }
 }
 if (keyWord=="popupOffsetX" || keyWord=="popupOffsetY" || keyWord=="popupWidth") {
  value=eval(value)
 }
 return value
}
function grabLay() {
 layParam=displayConfig+""
 with (layParam) {
  layParam=substring(indexOf("layout["+popupLayout+"]"),indexOf(";\"",indexOf("layout["+popupLayout+"]"))+1)
 }
 return layParam;
}
function fade(num) {
 if (num==1 && fadeIn==true) {
  if (pO()!=po) {
   pO(2,"+")
   fadingIn=setTimeout("fade(1)",fadeInTime)
  }
  else fadeIn=false
 }
 if (num==2 && fadeOut==true) {
  if (pO()!=0) {
   pO(2,"-")
   fadingOut=setTimeout("fade(2)",fadeOutTime)
  }
  else {
   fadeOut=false
   if (NS==false && IE==false) popup.style.display="none"
  }
 }
}
function pO(oL,op) {
 if (IE) {
  with (popup.filters.alpha) {
   if (oL==NA) return opacity
   if (op==NA) opacity=oL
   if (op=="+") {
    if (opacity>=po) opacity=po
        else opacity+=oL
   }
   if (op=="-") opacity-=oL
  }
 }
 else if (NS) {
  with (popup.style) {
   if (oL==NA) return MozOpacity
   else oL=(oL/100)
   if (op==NA) MozOpacity=oL
   if (op=="+") {
    if (MozOpacity>=NSpo) MozOpacity=NSpo
    else MozOpacity=parseFloat(MozOpacity)+oL
   }
   if (op=="-") MozOpacity=parseFloat(MozOpacity)-oL
  }
 }
 else return false
}
// / dymki

