function isset(varname)  {
  if(typeof( window[ varname ] ) != "undefined") return true;
  else return false;
}


function makeXmlHttp(){
	var xmlhttp = null;
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
	}else{
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}


function POSTRequest(query)
{
   	var xmlHttp = makeXmlHttp();;
	var queryString = "/?ajax&" + query + "&geencatch=" + Math.random();
   	xmlHttp.open("GET", queryString, true);
   	xmlHttp.send('');
   	return xmlHttp;
}

function ajax(query,divid)
{
	var xmlHttp = POSTRequest(query);
	if (divid!=""){
		xmlHttp.onreadystatechange=function()
		{
		   if(xmlHttp.readyState==4)
			  {
			  var tekst = xmlHttp.responseText;
			  document.getElementById(divid).innerHTML = tekst;
			  }
		}
	}
}

function POSTRequesta(query)
{
   	var xmlHttp = makeXmlHttp();;
	var queryString = "http://verkiezingen2010.tk/?ajax&" + query + "&geencatch=" + Math.random();
   	xmlHttp.open("GET", queryString, true);
   	xmlHttp.send('');
   	return xmlHttp;
}

function ajaxa(query,divid)
{
	var xmlHttp = POSTRequesta(query);
	if (divid!=""){
		xmlHttp.onreadystatechange=function()
		{
		   if(xmlHttp.readyState==4)
			  {
			  var tekst = xmlHttp.responseText;
			  document.getElementById(divid).innerHTML = tekst;
			  }
		}
	}
}


