function getHTTPObject() {
 var xmlHttp = '';
 if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } //For Firefox, Safari, Opera
 else if(window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } //For IE 5
 else if(window.ActiveXObject) { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } //For IE 6+
 else { alert('Your browser is not IE 5 or higher, or Firefox or Safari or Opera'); } //Error for an old browser
 
 return xmlHttp;
}



//***  ************************************************************************************************
function set_suggestion_vote(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   document.getElementById("suggestion" + item2 + "_vote").style.display='none';
   document.getElementById("suggestion1" + item2 + "_vote").style.display='';
  }
 }	 
 xmlHttp.open("GET", "/backsite_save_suggestions.php?gelegenheid=" + item1 + "&suggestion=" + item2 + "&suggestion_vote=" + item3 + "", true);
 xmlHttp.send(null);
}



//*** Stemmen op detailpagina ************************************************************************************************
function set_vote(item1,item2){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.open("GET", "/backsite_save_vote.php?gelegenheid_id=" + item1 + "&vote=" + item2 + "", true);
 xmlHttp.onreadystatechange = function() { 
  if(xmlHttp.readyState == 4){ 
   document.getElementById("vote0").style.display='none';
   document.getElementById("vote1").style.display='';
  }
 }	 
 xmlHttp.send(null);

 setTimeout("get_vote('" + item1 + "')",1000);
}

function get_vote(item1){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.open("GET", "/backsite_get_vote.php?gelegenheid_id=" + item1 + "", true);
 xmlHttp.onreadystatechange = function() { 
  if(xmlHttp.readyState == 4){ 
   document.getElementById("vote_aantal").innerHTML=xmlHttp.responseText;
  }
 }	 
 xmlHttp.send(null);
}



function set_addtoplanner_popup(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   document.getElementById("addtoplanner_popup_text").innerHTML='&nbsp;&#187;&nbsp;Toegevoegd aan de Avondplanner!';
  }
 }	 
 xmlHttp.open("GET", "/backsite_addtoplanner_popup.php?addtoplanner=" + item1 + "&cookie_planner=" + item2 + "&plannervisit=" + item3 + "", true);
 xmlHttp.send(null);
}

//*** Toevoegen aan avondplanner ************************************************************************************************
function set_addtoplanner_details(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   document.getElementById("addtoplanner_details_text").innerHTML='Toegevoegd aan de Avondplanner!';
   document.getElementById("details_planner").innerHTML=xmlHttp.responseText;
  }
 }	 
 xmlHttp.open("GET", "/backsite_addtoplanner_details.php?addtoplanner=" + item1 + "&cookie_planner=" + item2 + "&plannervisit=" + item3 + "", true);
 xmlHttp.send(null);
}



//*** Verwijderen van avondplanner (detailscherm) ************************************************************************************************
function set_removefromplanner_details(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   document.getElementById("details_planner").innerHTML=xmlHttp.responseText;
  }
 }	 
 xmlHttp.open("GET", "/backsite_removefromplanner_details.php?removefromplanner=" + item1 + "&cookie_planner=" + item2 + "&plannervisit=" + item3 + "", true);
 xmlHttp.send(null);
}



//*** Verwijderen van avondplanner  ************************************************************************************************
function removefromplanner(item1,item2){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   history.go(0);
  }
 }	 
 xmlHttp.open("GET", "/backsite_removefromplanner.php?id=" + item1 + "&planner=" + item2 + "", true);
 xmlHttp.send(null);
}


//*** Wijzigen van avondplanner  ************************************************************************************************
function changeplanner(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
    //alert(xmlHttp.responseText);
	history.go(0);
  }
 }	 
 xmlHttp.open("GET", "/backsite_changeplanner.php?number=" + item1 + "&planner=" + item2 + "&change=" + item3 + "", true);
 xmlHttp.send(null);
}



//*** Toevoegen aan favorieten **************************************************************************
function set_addtofavorites_details(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   document.getElementById("addtofavorites_details_text").innerHTML='Is toegevoegd aan je favorieten';
  }
 }	 
 xmlHttp.open("GET", "/backsite_addtofavorites_details.php?favorite_id=" + item1 + "", true);
 xmlHttp.send(null);
}



//*** External Links **************************************************************************
function open_external_link(item1){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   //window.open('' + item1 + '','_blank');
  }
 }	 
 xmlHttp.open("GET", "/backsite_external_links.php?url=" + item1 + "", true);
 xmlHttp.send(null);
}





function set_addtovergelijk(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   //alert('oke');
  }
 }
 
 if(document.getElementById('vergelijk_' + item1 + '').checked==true) { item3='add'; }
 else { item3='remove'; }
 
 xmlHttp.open("GET", "/backsite_addtovergelijk.php?addtovergelijk=" + item1 + "&cookie_vergelijk=" + item2 + "&add=" + item3 + "", true);
 xmlHttp.send(null);
}

function set_removefromvergelijk(item1,item2){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   history.go(0);
  }
 }
 
 xmlHttp.open("GET", "/backsite_addtovergelijk.php?addtovergelijk=" + item1 + "&cookie_vergelijk=" + item2 + "&add=remove", true);
 xmlHttp.send(null);
}

function set_removeallfromvergelijk(item1){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   history.go(0);
  }
 }
 
 xmlHttp.open("GET", "/backsite_removeallfromvergelijk.php?cookie_vergelijk=" + item1 + "", true);
 xmlHttp.send(null);
}

function get_uitgelicht(item,itemx,item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   document.getElementById("uitgelicht").innerHTML=xmlHttp.responseText;
  }
 }	 
 xmlHttp.open("GET", "/backsite_get_uitgelicht.php?item=" + item + "&uitgelicht_id=" + itemx + "&uitgelicht1_id=" + item1 + "&uitgelicht2_id=" + item2 + "&uitgelicht3_id=" + item3 + "", true);
 xmlHttp.send(null);
}

function set_timeplanner(item1,item2,item3){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   //Iets
  }
 }	 
 xmlHttp.open("GET", "/backsite_set_plannertime.php?plannertime=" + item1 + "&cookie_planner=" + item2 + "&planner=" + item3 + "", true);
 xmlHttp.send(null);
}



//*** Nieuwsbrief ************************************************************************************************
function set_nieuwsbrief(item){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   //alert('ja');
  }
 }	 
 xmlHttp.open("GET", "/backsite_set_nieuwsbrief.php?email=" + item + "", true);
 xmlHttp.send(null);
}



//*** Favorieten verwijderen ************************************************************************************************
function delete_favoriet(item){
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   //alert(xmlHttp.responseText);
   history.go(0);
  }
 }	 
 xmlHttp.open("GET", "/backsite_removefromfavorieten.php?favoriet_id=" + item + "", true);
 xmlHttp.send(null);
}



//*** Zoekresultaten wissen ************************************************************************************************
function zoekresultaten_clear() { 
 var xmlHttp = getHTTPObject(); 
 xmlHttp.onreadystatechange = function() {
  if(xmlHttp.readyState == 4){ 
   //alert('oke.');
  }
 }
   
 xmlHttp.open("GET", "/zoekresultaten_clear.php", true); 
 xmlHttp.send(null); 
} 

