
function porownanie_produktow(tekst) {
hidden_flash('ukryj');
document.getElementById('blad').style.display='block';
document.getElementById('pop_overlay').style.display = 'block';
document.getElementById('ekran').style.display = 'block';

if (!document.getElementById('pop_window_porownanie')) {
  document.getElementById('ekran').innerHTML +=  unescape("<div id='pop_window_porownanie' style='display:block;position:absolute; top:5%; width:90%; height:95%; left:10%; margin-left:-5%; font-size:20px; z-index:9999;'>"+
   "<table style='background-color:#ffffff;border:1px solid #000000;height:95%' width='100%' cellpadding='5' cellspacing='0'><tr><td style='height:25px;background-color: #333344;border-bottom: 2px solid #000000;border-top: 1px solid #78A3F2;border-left: 1px solid #78A3F2;border-right: 1px solid #204095;' align='center'>"+
   "<table width='98%' border='0' cellpadding='0' cellspacing='0'><tr><td width='50%' align='left' style='font: bold 13px tahoma,arial, sans-serif; color:#ffffff'>Porównanie produktów</td><td width='50%' align='right'>"+
   "<img src='popupbox/close.gif' border='0' style='cursor:pointer' onclick='javascript:close_div_porownanie();'></td></tr></table></td></tr><tr><td valign='top' align='left'>"+				
   "<center><div id='wynik_porownania' style='overflow: scroll;'></div></center>"+			
   "<div style='padding:10px;'><input type='button' style='font-size:15px;color:#ff0000;font-family:tahoma;font-weight:bold' value='Zamknij' onclick='javascript:close_div_porownanie();'></div>"+
   "</td></tr></table></div>");
}

var c = document.getElementById('wynik_porownania');
var v = podaj();
if (v != '') {
    c.style.height = document.getElementById('pop_window_porownanie').offsetHeight - 110;
    c.style.width = document.getElementById('pop_window_porownanie').offsetWidth - 30;
    c.innerHTML = "<img src='/popupbox/loader.gif' alt=''>";
    //
    try {
      xml = new ActiveXObject("Microsoft.XMLHTTP"); // IE
    } catch(e) {
    try {
      xml = new XMLHttpRequest(); // Mozilla/FireFox/Opera
    } catch(e) {
      xml = null;
    }
    }
    if (xml != null) {
        xml.open("GET", "compare.php?q="+v, true);
        xml.onreadystatechange=function() {
          if (xml.readyState==4) {
            c.innerHTML = xml.responseText;
          }
        }
        xml.send(null)
    }
  } else {
    okno(tekst);
}
}

function close_div_porownanie() { 
document.getElementById('blad').style.display='none';
document.getElementById('pop_overlay').style.display = 'none';
document.getElementById('ekran').style.display = 'none';  
hidden_flash('pokaz');
}

function podaj() {
  var efekt_koncowy = '';
  var licz_porownaj = document.getElementsByName('porownaj[]');
  for (i=0;i<=licz_porownaj.length-1;i++) {
      if (licz_porownaj[i].checked == true) {
         efekt_koncowy = efekt_koncowy + licz_porownaj[i].value + ',';
      }
  }
  return efekt_koncowy;
}

function ile_zaz(element,tekst) {
  var licz_porownaj = document.getElementsByName('porownaj[]');
  var tyu = 0;
  for (i=0;i<=licz_porownaj.length-1;i++) {
      if (licz_porownaj[i].checked == true) {
        tyu++;
      }
  }    
  if (tyu == 11) {
      okno(tekst);
      element.checked = false;
  }
}