//baner top layer-----------
function close_baner()
{
var theobj= eval ('document.getElementById("banerTopLayer")');
theobj.innerHTML='';
theobj.style.display='none';
}

//close po x sec.
function CloseAfter(sec)
{
 var tgx=setTimeout("close_baner()",sec*1000);
}
//----------------------



function ChClass(divid,newclass)
{
 theobj= eval ('document.getElementById("'+divid+'")');
 theobj.className= newclass;
}





//biblioteka---------------
function SaveBibliotekaId(id,action) {
   url='inc/ajax_biblioteka.php5?';
   var rand = Math.round(Math.random()*10000);
   http.open("GET", url +'saveid='+id+'&cos='+rand+'&action='+action, true);
   //http.onreadystatechange = handleHttpResponse;
   http.send(null);
}


function ShowDiv(divi,maxdiv)
{
//zamknij wszystkie oprocz wybranej
 for(i=0;i<maxdiv;i++)
 {
  if(divi!=i)
  {
  theobj= eval ('document.getElementById("B'+i+'")');
  theobj.style.display='none';
  }
 }

//pokaz wybrana
theobj= eval ('document.getElementById("B'+divi+'")');
if(theobj.style.display == 'none')
{
theobj.style.display='block';
SaveBibliotekaId(divi,'set');
}else{
     theobj.style.display = 'none';
     SaveBibliotekaId(divi,'unset');
     }

}
//-----------------------




















function register_submit() {
 if(document.getElementById('ok').checked)
 {
 document.getElementById('formularz').submit()
 }else{
        alert('proszę zapoznać się i zaznaczyć oświdczenie');

       }
}


function popup(url,w,h) {
		screenWidth =  w;
		screenHeight = h;
    	dx = 50 ;dy = 50;
       var Win = window.open(url,"displayWindow",'width='+screenWidth+',height='+(screenHeight+5)+',resizable=0,scrollbars=yes,menubar=no,left='+dx+',='+dy );
Win.focus();

}



function zmien(nazwa,plik) {
document.images.foto.src=plik;
document.images.foto.title=nazwa;
//warr(nazwa);
}


function warr(txt) { document.getElementById("opis_img").innerHTML = '&nbsp;&nbsp;<b>'+txt+'</b>'; }



function menu_over(co,plik)
{
var akcja=eval ('document.images.'+co);
akcja.src='gfx/menu/'+plik;
}



function getMouseXY(e) // works on IE6,FF,Moz,Opera7
{
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

  if (e)
  {
    if (e.pageX || e.pageY)
    { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
      mousex = e.pageX;
      mousey = e.pageY;
     }
    else if (e.clientX || e.clientY)
    { // works on IE6,FF,Moz,Opera7
      mousex = e.clientX + document.body.scrollLeft;
      mousey = e.clientY + document.body.scrollTop;
    }
  }
}





function dymek(e,v){
  if(v.title){
    var t=document.createElement("div");
    t.className="dymek";
    t.innerHTML=v.title;v.title="";
    v.move=function(e){
      e=e||event;
      getMouseXY(e);

      t.style.left=mousex+20+"px";
      t.style.top=mousey+20+"px";
      //t.style.left=e.clientX+20+"px";
      //t.style.top=e.clientY+20+"px";


    }
    v.move(e);
    document.body.appendChild(t);
    v.onmousemove=function(e){v.move(e)}
    v.onmouseout=function(e){
      v.title=t.innerHTML;
      document.body.removeChild(t);
    }
  }
}


















function getHTTPObject() {

  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();

    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}









var http = getHTTPObject(); // We create the HTTP Object

var SetPlatnosc=0;
Koszt=new Array();






//----
function getKoszt() {

if($F('id_kraj')>0)
{
$('koszt_pl').value=Koszt[$F('id_kraj')]['koszt_pl'];
$('DivKoszt').update('<b>'+Koszt[$F('id_kraj')]['koszt_waluta']+' '+Koszt[$F('id_kraj')]['skrot']+'</b> ('+Koszt[$F('id_kraj')]['koszt_pl']+' zł)');
}else{
     $('DivKoszt').update('');
     }


}
//-----------------------






//----
function platnosci_z_submit() {
err=0;

komunikat='proszę wypełnić formularz';
 if($F('koszt_pl')=='') { err=1; komunikat='Błąd 009 - proszę spróbować za kilka minut'; }

 if($F('id_kraj')=='') { err=1; komunikat='Proszę wybrać kraj'; }

 if($F('imie')=='' || $F('nazwisko')=='' ) { err=1;  }
 if($F('email')=='' ) { err=1;  }
 if($F('kod_pocztowy')=='' ) { err=1;  }
 if($F('miejscowosc')=='' ) { err=1;  }
 if($F('ulica')=='' ) { err=1;  }
 if($F('telefon')=='' ) { err=1;  }



 if(!$('ok').checked)
 {
 err=1;
 komunikat='Prosimy o wyrażenie zgody na przetwarzanie danych';
 }



  if(err==0)
  {
  $('formularz').submit()
  }else{
       alert(komunikat);
       }
}

//-------------------------------------------------------
















//----
function platnosci_pl_submit() {
err=0;

komunikat='proszę wypełnić formularz';

 if(SetPlatnosc!=1) { err=1; komunikat='proszę wybrać sposób zapłaty'; }

 if($F('imie')=='' || $F('nazwisko')=='' ) { err=1;  }
 if($F('email')=='' ) { err=1;  }
 if($F('kod_pocztowy')=='' ) { err=1;  }
 if($F('miejscowosc')=='' ) { err=1;  }
 if($F('ulica')=='' ) { err=1;  }
 if($F('telefon')=='' ) { err=1;  }



 if(!$('ok').checked)
 {
 err=1;
 komunikat='Prosimy o wyrażenie zgody na przetwarzanie danych';
 }



  if(err==0)
  {
  $('formularz').submit()
  }else{
       alert(komunikat);
       }
}

//-------------------------------------------------------





















function rand (min, max)
{

        min = 0;
        max = 2147483647;

    return Math.floor(Math.random() * (max - min + 1)) + min;
}










function ShowPopUp()
{
randu=rand(100,20000000);
displayUrl('modalDialog_contentDiv_foto', 'popup.php5?d=ShowFlv,show_flv&FLV=video13.flv&r='+randu, 530, 390);
//return false;
}

