function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}


function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

	// Get the XMLHTTPRequest Object - called each time a new ajax function is called
function GetAjaxObject() {
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else {
		alert("Your browser does not support AJAX.");
		return null;
	}
}

function SubmitForm(){
	
	var params = "message=" + document.getElementById("message").value;
		params += "&email=" + document.getElementById("email").value;
		params += "&name=" + document.getElementById("name").value;
		params += "&coname=" + document.getElementById("coname").value;
		params += "&phone=" + document.getElementById("phone").value;
		params += "&method=" + getCheckedValue(document.getElementsByName("method"));
	
	var url="ajSubmitRequestInfo.php";
	
	oAjax = GetAjaxObject();
	oAjax.open("POST", url, true);
	
	//Send the proper header information along with the request
	oAjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	oAjax.setRequestHeader("Content-length", params.length);
	oAjax.setRequestHeader("Connection", "close");
	oAjax.onreadystatechange = function() {//Call a function when the state changes.
		if (oAjax.readyState == 4 && oAjax.status == 200){
				alert(oAjax.responseText);
		}
	}
	oAjax.send(params);
}
	

function MethodSelect(sValue){
	if (sValue == "E-Mail"){
		document.getElementById("email_div").style.display="Block";
		document.getElementById("phone_div").style.display="None";
	} else {
		document.getElementById("email_div").style.display="None";
		document.getElementById("phone_div").style.display="Block";
	}
}