function init()
{ var http = false;
 	if (window.XMLHttpRequest)
  { // Mozilla, Safari,...
 	  http = new XMLHttpRequest();
   	if (http.overrideMimeType)
    { http.overrideMimeType('text/xml');
 	  }
 	}
 	else if (window.ActiveXObject)
 	{ // IE
    try
   	{ http = new ActiveXObject("Msxml2.XMLHTTP");
   	}
   	catch (e)
   	{ try
    	{ http = new ActiveXObject("Microsoft.XMLHTTP");
     	}
     	catch (e)
     	{
     	}
   	}
 	}

	if (!http)
 	{ alert('Cannot create XMLHTTP instance');
    return false;
  }
  else return http;
}

function mailing_go(par2)
{ par=document.getElementById("mailing_email").value;
	if (par!="")
	{	var http=init();
  	if (http)
 	  {	http.open("GET", "mailing.php?email="+par+"&t="+par2, true);
		  	http.onreadystatechange=function()
			  { if(http.readyState == 4)
		  	  { if (http.status == 200)
   	  		{	document.getElementById("mailing_email").value="";
   	  			document.getElementById("mailing").innerHTML=http.responseText;
    	  	}
 	      }
     	}
    	http.send(null);
    }
 	}
 	else
 	{ alert("Proszę podać adres email");
 	}
}
function get_(par)
{ var http=init();
	if (http)
 	{	http.open("GET", "sonda.php?stat="+par, true);
			http.onreadystatechange=function()
			{ if(http.readyState == 4)
		  	{ if (http.status == 200)
 	  		{	document.getElementById("sonda_p").innerHTML=http.responseText;
  	  	}
 	    }
   	}
  	http.send(null);
 	}
}

function get__(par,id)
{ var http=init();
	var el=document.getElementsByName("sq");
	var odp=0;
	for (i = 0; i < el.length; i++)
	{ if (el[i].checked) odp=el[i].value;
	}
	if (odp>0)
	{	if (http)
	 	{	http.open("GET", "sonda.php?t=add&id="+id+"&odp="+odp+"&stat="+par, true);
				http.onreadystatechange=function()
				{ if(http.readyState == 4)
		  		{ if (http.status == 200)
 	  			{	document.getElementById("sonda_p").innerHTML=http.responseText;
	  	  	}
 		    }
   		}
	  	http.send(null);
 		}
 	}
 	else
	{ alert("Proszę wybrać jedną z odpowiedzi.");
	}
}

function show_sonda(id)
{ noweOkno = window.open('sonda.php?t=wyn&id='+id, 'wyniki_sondy', 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=yes, status=no, width=450, height=250')
}

function szukaj(kat)
{ fraza=document.getElementById("qu").value;
	window.location.href=kat+"/index.php?t=se&qu="+fraza;
  return false;
}

