<!--
function hide_comments(){
	clearTimeout(timeOutHide);
	document.getElementById('iframe_hack').style.visibility = "hidden";
	document.getElementById('question_submit').style.visibility = "hidden";
	document.getElementById('comment').value = "";
	document.getElementById('name').value = "";
	document.getElementById('email').value = "";
	document.getElementById('Contact_phone_area').value = "";
	document.getElementById('Contact_phone_3').value = "";
	document.getElementById('Contact_phone_4').value = "";
	//Reset select field value
	document.getElementById('subject').selectedIndex = 0;
}

function isEmailAddr(email){
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

//Browser Support Code
function ajaxFunction(){
  if (document.getElementById('name').value == "") {
    alert("Please enter a \"Name\".");
    document.getElementById('name').focus();
    return (false);
  }
	
	if (document.getElementById('email').value == "") {
    alert("Please enter a \"Contact Email\" address.");
    document.getElementById('email').focus();
    return (false);
  }

  if (!isEmailAddr(document.getElementById('email').value)) {
    alert("Please enter a complete email address (e.g., yourname@yourdomain.com)");
    document.getElementById('email').focus();
    return (false);
  }
   
  if (document.getElementById('email').value.length < 3) {
    alert("Please enter a valid email address.");
    document.getElementById('email').focus();
    return (false);
  }
	
	if (isNaN(document.getElementById('Contact_phone_area').value) || isNaN(document.getElementById('Contact_phone_3').value) || isNaN(document.getElementById('Contact_phone_4').value)) {
    alert("Please enter a valid \"Contact Phone #\".");
    document.getElementById('Contact_phone_area').focus();
    return (false);
  }

  if (document.getElementById('Contact_phone_area').value.length < 3 || document.getElementById('Contact_phone_3').value.length < 3 || document.getElementById('Contact_phone_4').value.length < 4) {
    alert("Please enter a valid \"Contact Phone #\".");
    document.getElementById('Contact_phone_area').focus();
    return (false);
  }
	
	if (document.getElementById('subject').selectedIndex == 0) {
    alert("Please choose a subject.");
    document.getElementById('subject').focus();
    return (false);
  }
	
	if (document.getElementById('comment').value == "") {
    alert("Please enter a \"Comment\".");
    document.getElementById('comment').focus();
    return (false);
  }
	
	document.getElementById('question_loading').style.visibility = "visible";
	document.getElementById('iframe_hack').style.visibility = "visible";
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('question_submit').style.visibility = "visible";
			document.getElementById('question_loading').style.visibility = "hidden";
			timeOutHide = setTimeout('hide_comments()',5000);
		}
	}
	var comment = document.getElementById('comment').value;
	var name = document.getElementById('name').value;
	var email = document.getElementById('email').value;
	var phone = document.getElementById('Contact_phone_area').value + document.getElementById('Contact_phone_3').value + document.getElementById('Contact_phone_4').value;
	var subject = document.getElementById('subject').options[document.getElementById('subject').selectedIndex].value;
	var process = document.getElementById('process').value;
	var queryString = "?comment=" + comment + "&name=" + name + "&process=" + process + "&email=" + email + "&subject=" + subject + "&phone=" + phone;
	ajaxRequest.open("GET", "submit_question.php" + queryString, true);
	ajaxRequest.send(null); 
}

// -->