function flip(rid)
{
	current=(document.getElementById(rid).style.display == 'none') ? 'block' : 'none';
	document.getElementById(rid).style.display = current;
}
function galeria_box(obraz, obrazWidth, obrazHeight, baza, nZdjec, dostepneFoty, dostepneRozmiary){ 
var bodyLewo = 0; 
var bodyGora = 0; 
var bodyWidth = document.body.clientWidth-20; 
//var bodyHeight = document.getElementById('galeria-tlo').style.height; 
var bodyHeight = document.body.clientHeight-20; 
var pYoffset = (document.all&&!window.opera)?document.body.scrollTop:window.pageYOffset; 
var poleGaleria_tlo = document.getElementById('galeria-tlo'); 
var poleGaleria = document.getElementById('galeria-box'); 
var poleObraz = document.getElementById('galeria-obraz'); poleObraz.src = obraz; if(obrazHeight< bodyHeight){bodyGora = pYoffset + ((bodyHeight-obrazHeight)/2);}else{bodyGora = pYoffset;}
//alert (document.height);
if(obrazWidth< bodyWidth){bodyLewo = ((bodyWidth-obrazWidth)/2);}else{bodyLewo = 50;}
poleGaleria.style.top = bodyGora; poleGaleria.style.left = bodyLewo; poleGaleria_tlo.style.width = bodyWidth; poleGaleria_tlo.style.height = bodyHeight; poleGaleria_tlo.style.top = pYoffset; poleGaleria_tlo.style.left = 0; poleGaleria_tlo.style.display = 'block'; poleGaleria.style.display = 'block';}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function changestatus(id) { 
if (window.document.qformdata.elements[id+"_z"].value==0){
MM_swapImage(id,'','gfx/checked.jpg',1);
window.document.qformdata.elements[id+"_z"].value=1;
}
else {
MM_swapImage(id,'','gfx/unchecked.jpg',1);
window.document.qformdata.elements[id+"_z"].value=0;
}
}

function classloader(url) {


if (window.document.geepard_add.ileogloszen.value!==window.document.geepard_add.noticemax1.value){

for(var i=0;i<window.document.geepard_add.noticemax1.value;i++) 
{ 
if (!window.parent.document.getElementById('ogloszenie'+i)){
wolne=i;
i=window.document.geepard_add.noticemax1.value;
}
}

  var ni = document.getElementById('classcontainer'+wolne);
  var newdiv = document.createElement('div');
  var divIdName = 'ogloszenie'+wolne;
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = 'Element Number'+divIdName;
  ni.appendChild(newdiv);

  var pare = window.document;
  url=url+"?ile="+wolne;

  window.document.geepard_add.ileogloszen.value++;

  if (pare.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }

  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = pare.getElementById(divIdName);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
  


}
else {
alert ('Nie posiadasz już ogłoszeń. Możesz je wykupić korzystając z opcji w zakładce Twoje konto.');
}



  
}

function PopupPic(sPicURL) { 
     window.open( "popup.htm?"+sPicURL, "",  
     "resizable=1,HEIGHT=200,WIDTH=200"); 
}

function PopupMovie(sPicURL) { 
     window.open( sPicURL, "",  
     "resizable=0,HEIGHT=370,WIDTH=420"); 
}

function checkaccount() { 
if (document.geepard_add.geepard_account.value<50){
alert('brak wystarczająych środków na koncie. Uzupełnij konto!');
}
else {
document.geepard_add.submit();
}
}

function checkaccount1() { 
if (document.geepard_add.geepard_account.value<2){
alert('brak wystarczająych środków na koncie. Uzupełnij konto!');
}
else {
document.geepard_add.submit();
}
}
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function checkfirm(id) {
if (window.document.qform.elements[id+"_z"].value==1){
MM_swapImage(id,'','gfx/unchecked.jpg',1);
window.document.qform.elements[id+"_z"].value=0;
}
else {
MM_swapImage(id,'','gfx/checked.jpg',1);
window.document.qform.elements[id+"_z"].value=1;
}
}


function DoPrinting(){

if (!window.print){

alert("You must have IE or Netscape!")
return
}
window.print()
}
function savefirm(url,id,userek) {
document.getElementById(userek).style.display='block';
zapis="";
ilepro=0;
ilezostalo=0;

zapis=zapis + id+"|";


var iRnd = Math.random(); 
loadpagesimpler('geepard_note.html?note='+zapis+'&rand='+iRnd+'&rodzaj='+url+'&',userek);
}

function saveproduct(url,id,userek) {
document.getElementById(id).style.display='block';
zapis="";
ilepro=0;
ilezostalo=0;
zapis=zapis+qform.elements["prod"+url+"n"].value+"|";
var iRnd = Math.random(); 
loadpagesimpler('geepard_note.html?note='+zapis+'&rand='+iRnd+'&user='+userek+'&rodzaj=2&',id);
}



function getValue(radioObj) 
{ 
    for(i = 0; i < radioObj.length; i++) 


   { 
            if(radioObj[i].checked) 
           { 
                   return radioObj[i].value;          
   } 
    } 
    return false; 
} 



function saveann(url,id,userek) {

document.getElementById(id).style.display='block';

zapis="";
ilepro=0;
ilezostalo=0;

zapis=zapis+qform.elements["firm"+url+"n"].value+"|";

var iRnd = Math.random(); 
loadpagesimpler('geepard_note.html?note='+zapis+'&rand='+iRnd+'&user='+userek+'&',id);

}

function loadpagesimple(url,id) {

  //parentNode.innerHTML="&nbsp;- Już zanotowane";
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
//alert('dasdas');

}



function loadpagesimpler(url,id) {

var iRnd = Math.random();
url=url+"&rand="+iRnd;

  //parentNode.innerHTML="&nbsp;- Ju zanotowane";
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {



x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }


x.open("GET", url, true);
    x.send(null);
  }

}


function loadpagesimplerx(url,id) {

var iRnd = Math.random();
url=url+"&rand="+iRnd;

document.getElementById(id).innerHTML = "<img src=gfx/indicator.gif>";

  //parentNode.innerHTML="&nbsp;- Ju zanotowane";
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {



x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }


x.open("GET", url, true);
    x.send(null);
  }

}

function pomoc(id,id1) {
if (document.getElementById(id).style.display=='block'){
document.getElementById(id).style.display='none';
}
else{ 
document.getElementById(id).style.display='block';
loadpagesimpler(id1,id);
}
}


function productsinfo(id,id1) {
if (document.getElementById(id).style.display=='block'){
document.getElementById(id).style.display='none';
}
else{ 
document.getElementById(id).style.display='block';
loadpagesimpler(id1,id);
}
}


function tlumacz(id1,id,id2) {

if (id1!="" & id==""){
id=id1;
}

var iRnd = Math.random();
url="add_firm_translate.html?tekst="+id+"&rand="+iRnd+"&pole="+id2;

  //parentNode.innerHTML="&nbsp;- Ju zanotowane";
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById('tlumaczenie');
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", url, true);
    x.send(null);
  }
//alert('dasdas');

}

function wyslijpropozycje() {

if (window.document.geepard_add.propozycja.value!=""){



url="geepard_send.html";
var iRnd = Math.random();
url=url+"&rand="+iRnd;

if (document.getElementById) {
  var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }

    x.open("GET", url, true);
    x.send(null);

  }

alert("propozycja wysana");
document.getElementById('zaproponujbranze').style.display='none';
}

}







function loadpage(url,id,numer) {

var iRnd = Math.random();
url=url+"&rand="+iRnd;

var zmienna="pg"+numer;

if (window.document.geepard_add.elements["pg"+numer].value!="1"){

window.document.geepard_add.elements["pg"+numer].value = '1';



  //parentNode.innerHTML="&nbsp;- Ju zanotowane";

  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = document.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }

    x.open("GET", url, true);
    x.send(null);

  }
}
}





function loaderdisplay_add(argumento)
{
document.getElementById('loader'+argumento).style.display='block'; 
argumentobuf=argumento;
for(var i=1;i<13;i++) 
{ 
if (argumento!=i){
document.getElementById('loader'+i).style.display='none';
}
}
}


function productdelete(id,numero) {

window.document.geepard_add.elements["prphotos"+numero].value=0;
window.document.getElementById("prphoto"+numero).style.display='none';

window.document.geepard_add.ileproduktow.value--;
var pare = document;

  if (pare.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }

  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = pare.getElementById(id);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", "clear.php", true);
    x.send(null);
  }
}


function videodelete(id,numero) {


window.document.getElementById(id).style.display='none';
window.document.geepard_add.ilevideo.value--;
window.document.geepard_add.elements["videophoto"+numero].value="0";
window.document.geepard_add.elements["prvideos"+numero].value="0";
}




function zaproponuj() {
if (document.getElementById('zaproponujbranze').style.display=='block'){
document.getElementById('zaproponujbranze').style.display='none';

}
else{ 
if (document.getElementById('znajdzbranze').style.display=='block'){
document.getElementById('znajdzbranze').style.display='none';

}
document.getElementById('zaproponujbranze').style.display='block';
}
}


function znajdz() {
if (document.getElementById('znajdzbranze').style.display=='block'){
document.getElementById('znajdzbranze').style.display='none';

}
else{ 

if (document.getElementById('zaproponujbranze').style.display=='block'){
document.getElementById('zaproponujbranze').style.display='none';

}

document.getElementById('znajdzbranze').style.display='block';
}
}




function pokazogloszenie(numero) {
if (document.getElementById('ogloszenie'+numero).style.display=='block'){
document.getElementById('ogloszenie'+numero).style.display='none';

}
else{ 
document.getElementById('ogloszenie'+numero).style.display='block';
}
}


function photodeletenew(nazwa1,nazwa,liczba) {
	var d = document.getElementById('procontainer'+liczba);
	window.document.geepard_add.elements["czyjest"+nazwa].value = '0';
	d.removeChild(nazwa1);

	
}

function photodelete(id,id1) {

window.document.geepard_add.produktusun.value=id;
window.document.geepard_add.produktusuncode.value=id1;
window.document.geepard_add.saveo.value='4';
window.document.geepard_add.submit();

}



function textCounter(field, countfield, maxlimit, countdiv) {

  if (field.value.length < maxlimit) {
    countdiv.style.display = '';
    countfield.innerHTML = maxlimit - field.value.length;
  } else {

    field.value=field.value.substring(0,maxlimit);
    countfield.innerHTML = "0";
//    countfield.innerHTML = '<font color=#ff0000>dsadsad</font>';
  }
}



function pokazele(nazwa) {
if (document.getElementById(nazwa).style.display=='block'){
document.getElementById(nazwa).style.display='none';

}
else{ 
document.getElementById(nazwa).style.display='block';
}
}
 


function usunzaznaczone(id,id1,boxik,userek){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
if (window.parent.document.geepard_add.elements["message"+i+"c"].checked){
zapis=zapis+window.parent.document.geepard_add.elements["message"+i+"n"].value+"|";
window.parent.document.getElementById("message"+i).style.display='none';
}
}
var iRnd = Math.random(); 

loadpagesimple('account_messages.html?usun='+zapis+'&rand='+iRnd+'&box='+boxik+'&user='+userek,'loader8');
}





function usunzaznaczone1(id,id1,boxik,userek){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
if (window.parent.document.geepard_add.elements["note"+i+"c"].checked){
zapis=zapis+window.parent.document.geepard_add.elements["note"+i+"n"].value+"|";
window.parent.document.getElementById("note"+i).style.display='none';
}
}
var iRnd = Math.random(); 

loadpagesimple('account_notepad.html?usun='+zapis+'&rand='+iRnd+'&box='+boxik+'&user='+userek,'loader11');
}





function notemessage(id,id1,boxik,userek){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
if (parent.window.parent.document.geepard_add.elements["note"+i+"c"].checked){
zapis=zapis+parent.window.parent.document.geepard_add.elements["note"+i+"n"].value+"|";
}
}

document.messsend.dokogo.value=zapis;
document.messsend.submit();

}

function sendmessage(id,id1,boxik,userek){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
if (window.parent.document.qformdata.elements["firma"+i+"_z"].value==1){
zapis=zapis+parent.window.parent.document.qformdata.elements["firm"+i+"n"].value+"|";
ilepro++;
}
}

if (ilepro>25){
alert('max do 25 użytkowników na jeden raz!');
}
else {
document.messsend.dokogo.value=zapis;
document.messsend.submit();
}
}





function usunmess(id,boxik,userek){

var iRnd = Math.random(); 
loadpagesimple('account_messages.html?usun='+id+'&rand='+iRnd+'&box='+boxik+'&user='+userek,'loader8');
}


function usunnote(id,boxik,userek){
var iRnd = Math.random(); 
loadpagesimple('account_notepad.html?usun='+id+'&rand='+iRnd+'&box='+boxik+'&user='+userek,'loader11');
}



function zaznaczwszystkie(id,id1){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
window.parent.document.geepard_add.elements["message"+i+"c"].checked='true';
}
}

function zaznaczwszystkie1(id,id1){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
window.parent.document.geepard_add.elements["note"+i+"c"].checked='true';
}
}





function selectall(id,id1){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
MM_swapImage("firma"+i,'','gfx/checked.jpg',1);
window.document.qformdata.elements["firma"+i+"_z"].value=1;
}
}


function unselectall(id,id1){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
MM_swapImage("firma"+i,'','gfx/unchecked.jpg',1);
window.document.qformdata.elements["firma"+i+"_z"].value=0;
}
}


function copyselected(id,id1,userek){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
if (window.document.qformdata.elements["firma"+i+"_z"].value==1){
zapis=zapis+document.qformdata.elements["firm"+i+"n"].value+"|";
}
}
var iRnd = Math.random(); 
loadpagesimple('geepard_note.html?note='+zapis+'&rand='+iRnd+'&user='+userek,'infoloader');
}






function odznaczwszystkie(id,id1){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
window.parent.document.geepard_add.elements["message"+i+"c"].checked='';
}
}

function odznaczwszystkie1(id,id1){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
window.parent.document.geepard_add.elements["note"+i+"c"].checked='';
}
}



function odpisz(id){
zapis="";
ilepro=0;
ilezostalo=0;
for(var i=id;i<id1;i++) 
{ 
if (window.parent.document.geepard_add.elements["message"+i+"c"].checked){
zapis=zapis+window.parent.document.geepard_add.elements["message"+i+"n"].value+"|";
window.parent.document.getElementById("message"+i).style.display='none';
}
}
var iRnd = Math.random(); 

loadpagesimple('account_messages.html?usun=aaaa'+zapis+'&rand='+iRnd,'loader8');
}




















function dodajogloszenie(){

if (window.document.geepard_add.ileogloszen.value!==window.document.geepard_add.noticemax1.value){

idek="";
idek1="";
blad="0";

}
else {
alert ('Nie posiadasz już ogłoszeń. Możesz je wykupić korzystając z opcji w zakładce Twoje konto.');
}

}










function dodajkategorie(){

if (Number(window.document.geepard_add.ileproduktow.value)<Number(window.document.geepard_add.productsmax.value)){
idek="";
idek1="";
blad="0";
for(var i=0;i<window.document.geepard_add.productsmax.value;i++) 
{ 
if (window.parent.document.geepard_add.elements["czyjestproc"+i].value!="1" & idek==""){
idek="produkt"+i;
idek1=i;
}
}
if (blad!="1"){
window.document.getElementById("produkt"+idek1).style.display='block';
window.parent.document.geepard_add.elements["czyjestproc"+idek1].value = '1';
window.document.geepard_add.ileproduktow.value++;
window.parent.document.geepard_add.elements["ileproduktowpro"+idek1].value='0';
//for(var i=1;i<=window.parent.document.geepard_add.ileproduktowpromax.value;i++) 
//{ 
//window.parent.document.geepard_add.elements["pro"+idek1+i].value="0";
//window.parent.document.getElementById("pro"+idek1+"l"+i).style.display='none';
//}
}

}

else {
alert ('max liczba kategorii');
}

}








function messageinfo(){
alert('aby wysłać wiadomość należy zaznaczyć jedną lub wiele firm i skorzystać z opcji wyślij wiadomość w dolnej części strony');
}





function deleteogloszenie(id,id1){

var d = document.getElementById('classcontainer'+id);
d.removeChild(id1);
window.document.geepard_add.ileogloszen.value--;


}





function deletekategorie(id){
if (window.parent.document.geepard_add.elements["ileproduktowpro"+id].value>0){
alert ('Najperw usuń wszystkie produkty z tej kategorii!');
}
else {
window.parent.document.geepard_add.elements["czyjestproc"+id].value="0";
window.parent.document.geepard_add.elements["ileproduktowpro"].value=window.parent.document.geepard_add.elements["ileproduktowpro"].value-window.parent.document.geepard_add.elements["ileproduktowpro"+id].value;
//window.parent.document.geepard_add.elements["ileproduktowpro"+id].value=0;
window.document.getElementById("produkt"+id).style.display='none';
window.document.geepard_add.ileproduktow.value--;

var pare = document;

  if (pare.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }

  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = pare.getElementById('catdiv');
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", "clearcategories.php?pro="+id, true);
    x.send(null);
  }


}

}












function photoogldelete(id,numero) {

window.document.geepard_add.elements[id+numero].value=0;
window.document.geepard_add.elements["ileproduktow"+id].value--;

var pare = document;

  if (pare.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }

  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
        el = pare.getElementById(id+'l'+numero);
        el.innerHTML = x.responseText;
      }
    }
    x.open("GET", "clear.php", true);
    x.send(null);
  }
}








