function movepic() {
	var randomnumber=Math.floor(Math.random()*6);
	var testimonials = [];
	testimonials[0] = 'agnes';
	testimonials[1] = 'dutchroyal';
	testimonials[2] = 'geocreates';
	testimonials[3] = 'ketnerolsen';
	testimonials[4] = 'legal';
	testimonials[5] = 'twing';
	
	document.getElementById('post-it-img').src = '/images/testimonials/'+testimonials[randomnumber]+'.png';
	setTimeout('movepic()', 5000);
}

var time_variable;

function getXMLObject()  //XML OBJECT
{
   var xmlHttp = false;
   try {
     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
   }
   catch (e) {
     try {
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
     }
     catch (e2) {
       xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
     }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}
 
var xmlhttp = new getXMLObject();	//xmlhttp holds the ajax object
 
function ajaxFunction() {
  var getdate = new Date();  //Used to prevent caching during ajax call
  if(xmlhttp) { 
  	var txtname = document.getElementById("name");
  	var txtphone = document.getElementById("phone");
  	var txtemail = document.getElementById("email");
  	var txtmessage = document.getElementById("message");
  	var txthash  = document.getElementById("hash");
    xmlhttp.open("POST","/include/core/email.php",true); //calling testing.php using POST method
    xmlhttp.onreadystatechange  = handleServerResponse;
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send("form[name]=" + txtname.value + "&form[phone]=" + txtphone.value + "&form[email]=" + txtemail.value + "&form[message]=" + txtmessage.value + "&hAsH=" + txthash.value) ; //Posting txtname to PHP File
  }
}
 
function handleServerResponse() {
   if (xmlhttp.readyState == 4) {
     if(xmlhttp.status == 200) {
    	 	document.getElementById("message").value=''; 
    	    document.getElementById("name").value='';
    	    document.getElementById("phone").value='';
    	    document.getElementById("email").value='';
    	    alert('Uw bericht is verzonden.');
     } else {
        alert("Error during AJAX call. Please try again.");
     }
   }
}
