function login_to_vote()
{
alert("Aby wypić piwo z autorem artykułu należy się zalogować...");
return false;
}

function loadXMLDoc(url, area)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		var tmp_votes = xmlhttp.responseText;
		document.getElementById('b'+area).innerHTML= '';
		document.getElementById('g'+area).innerHTML= tmp_votes;
	    }
	}
	}
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.open("GET",url,true)
    xmlhttp.send()
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		var tmp_votes = xmlhttp.responseText;
		document.getElementById('b'+area).innerHTML= '';
		document.getElementById('g'+area).innerHTML= tmp_votes;
	    }
	}
	}


    }
  }
}

function vote(id, vote)
{
document.getElementById('b'+vote).innerHTML= '<img src="images/load.gif" border="0" width="32" height="32">';
loadXMLDoc( "ocena.php?id="+id+"&vote="+vote, id, vote);
return false;
}

function loadXMLDoc2(url, area)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		document.getElementById('x'+area).innerHTML= xmlhttp.responseText;
	    }
	}
	}
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.open("GET",url,true)
    xmlhttp.send()
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		document.getElementById('x'+area).innerHTML= xmlhttp.responseText;
	    }
	}
	}


    }
  }
}

function submitpost(text, topic_id, area)
{
document.getElementById("xr"+topic_id).innerHTML = '<br><center><span style="color: orange; font-size: 22px;font-family: courier new; font-weight: bold">Trwa dodawanie komentarza, proszę czekać...<br><br><img src="loading.gif"></span><br><br></center>';
var url = "posting.php";
var params = "message="+text+"&disable_html=1&t="+topic_id+"&post=1&mode=reply&last_msg=";
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.open("POST",url,true)
  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-2");
  xmlhttp.setRequestHeader("Content-length", params.length);
  xmlhttp.setRequestHeader("Connection", "close");

  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		review(topic_id);
		return false;

	    }
	}
	}
  xmlhttp.send(params);

  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.open("POST",url,true)
  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-2");
  xmlhttp.setRequestHeader("Content-length", params.length);
  xmlhttp.setRequestHeader("Connection", "close");


  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		review(topic_id);
		return false;

	    }
	}
	}
    xmlhttp.send(params);

  }
}
}

function submit_tags(topic_id, tags)
{
loadXMLDoc2( "taguj.php?id="+topic_id+"&tagi="+tags, topic_id);
return false;
}

function review(topic_id, replies)
{
document.getElementById("xr"+topic_id).innerHTML = '<br><center><span style="color: orange; font-size: 22px;font-family: courier new; font-weight: bold">Trwa ładowanie komentarzy, proszę czekać...<br><br><img src="loading.gif"></span><br><br></center>';
document.getElementById("lr"+topic_id).innerHTML = '<a href="#" onclick="return hidereview('+topic_id+','+replies+')" class="gensmall">Ukryj komentarze &uarr;</a>';
loadXMLDoc2( "topic_review.php?id="+topic_id, "r"+topic_id);
return false;
}

function similar(topic_id)
{
document.getElementById("xr"+topic_id).innerHTML = '<br><center><span style="color: orange; font-size: 22px;font-family: courier new; font-weight: bold">Szukanie podobnych tematów, proszę czekać...<br><br><img src="loading.gif"></span><br><br></center>';
loadXMLDoc2( "similar_topics.php?t="+topic_id, "r"+topic_id);
return false;
}

function hidereview(topic_id, replies)
{
document.getElementById('xr'+topic_id).innerHTML = '';
document.getElementById('lr'+topic_id).innerHTML = '<a href="#" onclick="return review('+topic_id+')" class="gensmall">Dodaj swój komentarz</a> &bull; <a href="#" onclick="return review('+topic_id+','+replies+')" class="gensmall">Zobacz komentarze ('+replies+') &darr;</a>';
return false;
}

function reinfo(topic_id)
{
document.getElementById('xr'+topic_id).innerHTML = '<div align="center"><b>Twój komentarz został zapisany</b></div>';
return true;
}

function vote_beer(topic_id, post_id)
{
document.getElementById('b'+topic_id).innerHTML= '<img src="images/load.gif" border="0" width="32" height="32">';
loadXMLDoc( "ocena.php?topic_id="+topic_id+"&post_id="+post_id, topic_id);
return false;
}

function votepic(pic_id, vote)
{
loadXMLDoc( "votepic.php?pic_id="+pic_id+"&vote="+vote, "P"+pic_id);
return false;
}

function browar(post_id)
{
loadXMLDoc3( "dajpiwo.php?post_id="+post_id, post_id);
return false;
}

function loadXMLDoc3(url, area)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		var tmp_votes = xmlhttp.responseText;
		document.getElementById('beer'+area).innerHTML= tmp_votes;
	    }
	}
	}
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.open("GET",url,true)
    xmlhttp.send()
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
		var tmp_votes = xmlhttp.responseText;
		document.getElementById('beer'+area).innerHTML= tmp_votes;
	    }
	}
	}


    }
  }
}

function overliber(post_id)
{
loadXMLover( "overliber.php?post_id="+post_id);
return false;
}


function addRV(id, link)
{
loadXMLrv( "rv.php?id="+id, link);
return false;
}

function loadXMLrv(url, link)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null)
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
	    location.href=link;
	    return true;
	    alert(xmlhttp.responseText);
	    }
	}
	}
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.open("GET",url,true)
    xmlhttp.send()
  xmlhttp.onreadystatechange=function() {
	if (xmlhttp.readyState==4)
	{
	if (xmlhttp.status==200)
    	    {
	    location.href=link;
	    return true;
	    alert(xmlhttp.responseText);
	    }
	}
	}


    }
  }
}
