//sonda.js
function checkPools(idForm, idPool){

var idSonda=document.getElementById(idForm);
  //var idpool=document.getElementsByName("idPool");

var ktory = -1;
var idpools = document.getElementById(idForm).polls_optionId //tak jak poprzednio przypisujemy odwołanie do naszych guzików
for (x=0; x<idpools.length; x++) {
  if (idpools[x].checked) ktory = x
}

if (ktory == -1) 
  alert('Nie zaznaczyles żadnego pola!');
else
  idSonda.submit();        
  
}

//flash.js

function showFlash(nazwa, width, height, linkus){

  if(linkus)
    lin='PR/Images/'+nazwa+'?clickTag='+linkus;
  else
    lin='PR/Images/'+nazwa;


  document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">');
  document.writeln(' <param name="movie" value="'+lin+'"/>');   
  //document.writeln(' <param name="movie" value="PR/Images/'+nazwa+'"/>');   
  document.writeln(' <param name="quality" value="" />');
  document.writeln(' <param name="wmode" value="opaque" />');
  //document.writeln(' <embed src="PR/Images/'+nazwa+'" wmode="opaque" quality="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'+width+'" height="'+height+'"></embed>');
  document.writeln(' <embed src="'+lin+'" wmode="opaque" quality="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'+width+'" height="'+height+'"></embed>');
  document.writeln('</object>');
}

function showFlash2(nazwa, width, height, linkus){

  if(linkus)
    lin='PR/Images/'+nazwa+'?click='+linkus;
  else
    lin='PR/Images/'+nazwa;


  document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'">');
  document.writeln(' <param name="movie" value="'+lin+'"/>');   
  //document.writeln(' <param name="movie" value="PR/Images/'+nazwa+'"/>');   
  document.writeln(' <param name="quality" value="" />');
  document.writeln(' <param name="wmode" value="opaque" />');
  //document.writeln(' <embed src="PR/Images/'+nazwa+'" wmode="opaque" quality="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'+width+'" height="'+height+'"></embed>');
  document.writeln(' <embed src="'+lin+'" wmode="opaque" quality="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'+width+'" height="'+height+'"></embed>');
  document.writeln('</object>');
}

function show_wyjatek(){
  document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="468" height="60">');
  document.writeln(' <param name="movie" value="PR/Images/rewolucja_468x60_01_.swf?clickTag=http://www.getresponse.pl/email-marketing/promo/email-rewolucja.html?utm_source=proto&utm_medium=banner&utm_content=01przelom&utm_campaign=rewolucja"/>');
  document.writeln(' <param name="quality" value="" />');
  document.writeln(' <param name="wmode" value="opaque" />');
  document.writeln(' <embed src="PR/Images/rewolucja_468x60_01_.swf?clickTag=http://www.getresponse.pl/email-marketing/promo/email-rewolucja.html?utm_source=proto&utm_medium=banner&utm_content=01przelom&utm_campaign=rewolucja" wmode="opaque" quality="" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="468" height="60"></embed>');
  document.writeln('</object>');
}


//menu.js

sfHover = function() { 
    var sfEls = document.getElementById("nav").getElementsByTagName("LI"); 
    for (var i=0; i<sfEls.length; i++) { 
         sfEls[i].onmouseover=function() { 
              this.className=this.className.replace(/ sfout/, ""); 
              this.className+=" sfhover"; 
              //alert(this); 
         } 
         sfEls[i].onmouseout=function() { 
              this.className=this.className.replace(/ sfhover/, " sfout"); 
              //alert(this.tagName); 
         } 
 } 
} 
if (window.attachEvent) window.attachEvent("onload", sfHover); 

//old proto
function formKeyDown(idForm) {
   var idForm=document.getElementById(idForm);
    if (event.keyCode==13){
  idForm.submit();
    }
}

function formExecute(idForm) {
   var idForm=document.getElementById(idForm);
   idForm.submit();
}

//-------------------- Slownik -------------------------------------------------------------
function openwin(name,win_width,win_height)
{
  var LeftPosition=(screen.availWidth)?(screen.availWidth-win_width)/2:50;
  var TopPosition=(screen.availHeight)?(screen.availHeight-win_height)/2:50;
  var params="height="+win_height+",innerheight="+win_height+",top="+TopPosition+",left="+LeftPosition+",width="+win_width+",innerwidth="+win_width+",resizable=yes,menubar=no,scrollbars=yes,toolbar=no,location=no,statusbar=no,alwaysRaised=yes,dependent=no";
  window.open(name,"movie",params);
}

function popup2(Site){
//  alert(getCookie('isPopupDisplayed'));
  window.open(Site,'PopupName','toolbar=no,statusbar=no, location=no, scrollbars=no, resizable=no, width=400, height=400, left=300, top=300');
}

function Otworz(w,s,src, title) {
Nowe=null; 

if (Nowe) { 
 if (ie4) Nowe.close();
 else if (nn4) Nowe.closed;
 Nowe=null 
 }; 
Nowe=window.open("", "","toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,status=no,directories=no,resizable=no,height="+w+",width="+s);
Nowe.document.write("<HTML><HEAD><title>"+title+"</title><STYLE>BODY{BACKGROUND-REPEAT:no-repeat}</STYLE></HEAD><BODY BACKGROUND="+src+"></BODY></HTML>")
Nowe.focus() 

}


///// mainSite.js
function setPosition(popWidth, popHeight){
  //alert('Your resolution is '+screen.width+'x'+screen.height);
  tmp=(screen.availWidth/2)-popWidth/2; 
  tmpStr=tmp+"px"

  tmpH=(screen.availHeight/2)-(popHeight/2)-130;  //130px to jest w przyblizeniu elementy menu przegladarki
  tmpHStr=tmpH+"px"

  document.getElementById('popup').style.left=tmpStr;
  document.getElementById('popup').style.top=tmpHStr;
}

function closePopUp(){
  document.getElementById('popup').style.visibility="hidden";
}

///////////////////////// ajax.js

var xmlHttp

function GetXmlHttpObject(){
  var xmlHttp=null;
  try{
  // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }catch (e){
  // Internet Explorer
    try{
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}

/////////////////////////////////////////////////////////////////////

function getInfo(index){

  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null){
    alert ("Your browser does not support AJAX!");
    return;
  }

  var url="/PR/ajax_getInfo.php";
  url=url+"?id="+index;

  //xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.onreadystatechange=stateChanged;
  xmlHttp.open("GET", url, true);
  xmlHttp.send(null);
}

function stateChanged(){

  if (xmlHttp.readyState==1){
    //document.getElementById("tabela").innerHTML="<br/><center><img src=\"PR/Images/35.gif\"/></center><br/>";
    //document.getElementById("tabela").innerHTML="<img src=\"PR/Images/UI_grafiki/proto/strona/preloader_ztekstem.gif\" width=\"650\" /><br/>";
    tmpPreloader ="<table cellspacing=\"0\" cellpadding=\"0\">";
    tmpPreloader+="<tr><td colspan=\"3\"><img src=\"PR/Images/UI_grafiki/proto/strona/preloader/belka_gora.gif\" width=\"650\" /></td></tr>";
    tmpPreloader+="<tr>";
    tmpPreloader+="<td width=\"229\" style=\"background-image:url(PR/Images/UI_grafiki/proto/strona/preloader/lewy.gif)\"></td>";
    tmpPreloader+="<td><img src=\"PR/Images/UI_grafiki/proto/strona/preloader/trwa_ladowanie.gif\" width=\"194\"</td>";
    tmpPreloader+="<td width=\"227\" style=\"background-image:url(PR/Images/UI_grafiki/proto/strona/preloader/prawy.gif)\"></td>";
    tmpPreloader+="</tr></table>";

    document.getElementById("tabela").innerHTML=tmpPreloader;

  }

  if (xmlHttp.readyState==4){
    document.getElementById("tabela").innerHTML=xmlHttp.responseText;
    //document.getElementById("tabela").innerHTML=xmlHttp.responseText;
  }
}



//google stats...
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-7092183-3']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
