
var getQuery = function(){
	var name = document.getElementById("name").value;
	var phone = document.getElementById("homephone").value;
	var email = document.getElementById("email").value;
	var comment = document.getElementById("comment").value;
	return "name=" + encodeURI(name) + "&phone=" + encodeURI(phone) + "&email=" + encodeURI(email) + "&comment=" + encodeURI(comment);
}

var setQuery = function()
{
	var frm = document.getElementsByTagName("form")[0];
	    frm.onsubmit = function(){
			var query = getQuery();
			myHijax(query);
			return false;
		}
}

var myHijax = function(qs)
{
	var x = 	new AO("contact-process.php",qs);
		x.onload = function()
		{
			if (x.init && x.status == "200")
				x.putHere("contact");
		}
		x.post();
	return false;
}

window.onload = function(){
	var bSupport = new AO();
	if (bSupport.init) { // test for support of Ajax
		setQuery();
		bSupport = null;
	}
	else return false;
}