	// Set path to PHP script
	var phpscript_send = 'send_newsupport.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 name = document.getElementById('name').value;
		var email = document.getElementById('email').value;
		var category = document.getElementById('category').value;
		var priority = document.getElementById('priority').value;
		var subject = document.getElementById('subject').value;
		var message = document.getElementById('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('name=' + name + '&email=' + email + '&category=' + category + '&priority=' + priority + '&subject=' + subject + '&message=' + message + '&txtCaptcha=' + txtCaptcha);
	
	}
	
	
	function handleResponsePost_send() {
	if(http.readyState == 1){ 
			document.getElementById("response").innerHTML = "Please wait, loading..." ; 
		} else if(http.readyState == 4 && http.status == 200){
	
			// Text returned from PHP script
			var response = http.responseText;

			if (response) {
				// Update ajaxTest2 content
				document.getElementById("response").innerHTML = response;
			}

			var varthankyou_contact = http.responseText.indexOf('Your message was sent');

			if (varthankyou_contact != -1) {

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

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

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

		}
	}


	function clearRequestPost() {
	document.getElementById('frmCaptcha').reset();
	}

	// IMAGE REFRESHING
	function refreshimg() {

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

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

	}