// JavaScript Document


var xmlHttp

function SubmitForm(theForm)
{

var why = "";
var OrgName = theForm.OrgName.value.replace(/[&]/g, 'and');
var start_time_month = theForm.start_time_month.value.replace(/[&]/g, 'and');
var start_time_day = theForm.start_time_day.value.replace(/[&]/g, 'and');
var start_time_year = theForm.start_time_year.value.replace(/[&]/g, 'and');
var end_time_month = theForm.end_time_month.value.replace(/[&]/g, 'and');
var end_time_day = theForm.end_time_day.value.replace(/[&]/g, 'and');
var end_time_year = theForm.end_time_year.value.replace(/[&]/g, 'and');
if (theForm.Side2.checked){
	var Side2 = ("Yes");
}
else{
	var Side2 = ("No");
}
if (theForm.Side3.checked){
	var Side3 = ("Yes");
}
else{
	var Side3 = ("No");
}
if (theForm.Side5.checked){
	var Side5 = ("Yes");
}
else{
	var Side5 = ("No");
}
if (theForm.Side6.checked){
	var Side6 = ("Yes");
}
else{
	var Side6 = ("No");
}
var Choice = theForm.Choice.value.replace(/[&]/g, 'and');
var C1name = theForm.C1name.value.replace (/[&]/g, 'and');
var C1phone = theForm.C1phone.value.replace (/[&]/g, 'and');
	why += checkPhone(C1phone, "Contact 1 Phone: ");
var C1email = theForm.C1email.value.replace (/[&]/g, 'and');
	why += checkEmail(C1email, "Contact 1 Email: ");
var Display = theForm.Display.value.replace (/[&]/g, 'and');

if (why != ""){
alert (why);
return false;
}
else{
	
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
    
var url="formtoemail.php";

url=url+"?OrgName="+OrgName;
url=url+"&start_time_month="+start_time_month;
url=url+"&start_time_day="+start_time_day;
url=url+"&start_time_year="+start_time_year;
url=url+"&end_time_month="+end_time_month;
url=url+"&end_time_day="+end_time_day;
url=url+"&end_time_year="+end_time_year;
url=url+"&Side2="+Side2;
url=url+"&Side3="+Side3;
url=url+"&Side5="+Side5;
url=url+"&Side6="+Side6;
url=url+"&Choice="+Choice;
url=url+"&C1name="+C1name;
url=url+"&C1phone="+C1phone;
url=url+"&C1email="+C1email;
url=url+"&Display="+Display;


url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("form").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}