	// Set path to PHP script
	var phpscript_send = 'send.php';
	
	function createRequestObject_send() {
	
		var req;
	
		if(window.XMLHttpRequest){
			// Firefox, Safari, Opera...
			req = new XMLHttpRequest();
		} else if(window.ActiveXObject) {
			// Internet Explorer 5+
			req = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			// There is an error creating the object,
			// just as an old browser is being used.
			alert('There was a problem creating the XMLHttpRequest object');
		}
	
		return req;
	
	}
	
	// Make the XMLHttpRequest object
	var http = createRequestObject_send();
	
	
	function sendRequestPost_send() {
		
		var your_name = document.getElementById('your_name').value;
		var your_email = document.getElementById('your_email').value;
		var email_message = document.getElementById('email_message').value;
		var txtCaptcha = document.getElementById('txtCaptcha').value;

	
		// Open PHP script for requests
		http.open('post', phpscript_send);
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.onreadystatechange = handleResponsePost_send;
		http.send('&your_name=' + your_name + '&your_email=' + your_email + '&email_message=' + email_message + '&txtCaptcha=' + txtCaptcha);
	
	}
	
	
	function handleResponsePost_send() {
	if(http.readyState == 1){ 
			document.getElementById("response_contact").innerHTML = "Please wait, loading..." ; 
		} else if(http.readyState == 4 && http.status == 200){
	
			// Text returned from PHP script
			var response_contact = http.responseText;

			if (response_contact) {
				// Update ajaxTest2 content
				document.getElementById("response_close").style.visibility="visible";
				document.getElementById("response_contact").innerHTML = response_contact;
			}

			var varthankyou_contact = http.responseText.indexOf('<font color=\"#FF0000\"><b>Your message was sent. I will get back to you as soon as possible.</font>');

			if (varthankyou_contact != -1) {

			//Get a reference to CAPTCHA image
			img = document.getElementById('imgCaptcha');

			//Change the image
			img.src = 'captcha_img.php?' + Math.random(); // Search for new image
			document.getElementById('txtCaptcha').value=''; //Reset input Captcha  after succes return 

				document.getElementById('myForm').reset();
			}

		}
	}

	// IMAGE REFRESHING
	function refreshimg() {

	//Get a reference to CAPTCHA image
	img = document.getElementById('imgCaptcha');

	//Change the image
	img.src = 'captcha_img.php?' + Math.random();

	}