var xmlhttp;

function showOption(str)
{
document.getElementById("screen").innerHTML="<table style='margin-top: 60px; width: 100%'><tr><td align=center valign=center><img src='img/loading.gif'> Ładowanie danych...</td><tr><table>";
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="getoption.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function ShowImage(str)
{
document.getElementById("BigImages").innerHTML="<table style='margin-top: 60px; width: 200px'><tr><td align=center valign=center><img src='img/loading.gif'> Ładowanie danych...</td><tr><table>";
document.getElementById("BigImages").style.display='block';
centerView("BigImages");
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="showimages.php";
url=url+"?plik="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=ImageChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
centerView("BigImages");
}

function showNext(str)
{
document.getElementById("screen").innerHTML="<table style='margin-top: 60px; width: 100%'><tr><td align=center valign=center><img src='img/loading.gif'> Ładowanie danych...</td><tr><table>";
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="getnext.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function ImageChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("BigImages").innerHTML=xmlhttp.responseText;
}
}



function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("screen").innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function showError()
{
centerView("BigImages");
document.getElementById("BigImages").innerHTML="<div id='new_accordion' style='width: auto;border:0; left:0px; background:red;'><h2 class='current'>Uwaga!!</h1><div class='panel' style='overflow: auto; display: block; color:#fff'><br><br><br>&nbsp;&nbsp; &nbsp;&nbsp;  Opcja w budowie... Przepraszamy!!!&nbsp;&nbsp; &nbsp;&nbsp;     <a href='javascript:void(0)' onclick=document.getElementById('BigImages').style.display='none'><div class='close'><img src='img/close.png'></div></a></div></div>";
document.getElementById("BigImages").style.display='block';
setTimeout("document.getElementById('BigImages').style.display='none';", 2500);

}

function centerView(layer/*no display:none*/, doNotAddOffsets){
if(typeof layer=="string"){layer=document.getElementById(layer);};
if(layer){
var parent=layer.parentNode;/*unless body tag, must have position to relative or absolute*/
layer.style.display='block';        
layer.innerHTML="<table style='margin-top: 60px; width: 500px'><tr><td align=center valign=center><img src='img/loading.gif'> Ładowanie danych...<br><img src='banner_lzs.jpg'></td><tr><table>";
parent.style.overflow="auto";
layer.style.position="absolute";/*much better if top and left are specified in style, with 'px'*/
layer.style.top=layer.style.top||layer.offsetTop+'px';
layer.style.left=layer.style.left||layer.offsetLeft+'px';
var clientH=0, clientW=0, offsetT=0, offsetL=0, top=0, left=0;
        if(parent && parent.nodeType==1/*a tag*/){
                if(parent.nodeName=="BODY"){
                        if(typeof window.innerHeight!="undefined"){clientH=window.innerHeight; clientW=window.innerWidth;}
                        else if(document.documentElement && document.documentElement.clientHeight){clientH=document.documentElement.clientHeight; clientW=document.documentElement.clientWidth;}
                        else if(document.body.clientHeight){clientH=document.body.clientHeight; clientW=document.body.clientWidth;}
                        else{clientH=parent.clientHeight; clientW=parent.clientWidth;};
                        //
                        if(typeof pageYOffset!="undefined"){offsetT=pageYOffset; offsetL=pageXOffset;}
                        else if(document.documentElement && document.documentElement.scrollTop){offsetT=document.documentElement.scrollTop; offsetL=document.documentElement.scrollLeft;}
                        else if(document.body && typeof document.body.scrollTop!="undefined"){offsetT=document.body.scrollTop; offsetL=document.body.scrollLeft;}
                        else{offsetT=0; offsetL=0;};
                top=Math.abs(parent.offsetTop + ((clientH/2) - (layer.offsetHeight/2)));
                left=Math.abs(parent.offsetLeft + ((clientW/2) - (layer.offsetWidth/2)));
                }
                else{
                clientH=parent.offsetHeight; clientW=parent.offsetWidth;
                offsetT=parent.scrollTop; offsetL=parent.scrollLeft;
                top=Math.abs(((clientH/2) - (layer.offsetHeight/2))); left=Math.abs(((clientW/2) - (layer.offsetWidth/2)));
                };
        if(!doNotAddOffsets){top+=offsetT; left+=offsetL;};
        layer.style.top=top+'px';//comment out to avoid positioning and allow returning only
        layer.style.left=left+'px';//comment out to avoid positioning and allow returning only
        
        return [top, left, top+'px', left+'px'];
        };
};

/*keep this comment to reuse freely:
http://www.fullposter.com/?1 */}

function showPost(id)
{
document.getElementById(id).style.display='block';
}

function hidePost(id)
{
document.getElementById(id).style.display='none';
}

function showForum()
{
document.getElementById("forum").innerHTML="<img src='img/loading.gif'>";
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
var url="showforum.php";
url=url+"?sid="+Math.random();
xmlhttp.onreadystatechange=stateForum;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}


function stateForum()
{
if (xmlhttp.readyState==4)
{
document.getElementById("forum").innerHTML=xmlhttp.responseText;
}
}