function sendemail() {
    document.getElementById('form_status').innerHTML = 'Sending...';
    var request_type = document.getElementById('request_type').value;
    var orderid = document.getElementById('orderid').value;
    var company = document.getElementById('company').value;
    var return_to = document.getElementById('return_to').value;
    var email = document.getElementById('email').value;
    var project_number = document.getElementById('project_number').value;
    var due_mo = document.getElementById('due_mo').value;
    var due_day = document.getElementById('due_day').value;
    var due_yr = document.getElementById('due_yr').value;
    var commercial_name = document.getElementById('commercial_name').value;
    var address = document.getElementById('address').value;
    var city = document.getElementById('city').value;
    var zip = document.getElementById('zip').value;
    var AssessorsParcel = document.getElementById('AssessorsParcel').value;
    var section = document.getElementById('section').value;
    var township = document.getElementById('township').value;
    var range = document.getElementById('range').value;
    var townshipdirection = document.getElementById('townshipdirection').value;
    var rangedirection = document.getElementById('rangedirection').value;
    var commercial_name2 = document.getElementById('commercial_name2').value;
    var address2 = document.getElementById('address2').value;
    var city2 = document.getElementById('city2').value;
    var zip2 = document.getElementById('zip2').value;
    var AssessorsParcel2 = document.getElementById('AssessorsParcel2').value;
    var section2 = document.getElementById('section2').value;
    var township2 = document.getElementById('township2').value;
    var range2 = document.getElementById('range2').value;
    var townshipdirection2 = document.getElementById('townshipdirection2').value;
    var rangedirection2 = document.getElementById('rangedirection2').value;
    var commercial_name3 = document.getElementById('commercial_name3').value;
    var address3 = document.getElementById('address3').value;
    var city3 = document.getElementById('city3').value;
    var zip3 = document.getElementById('zip3').value;
    var AssessorsParcel3 = document.getElementById('AssessorsParcel3').value;
    var section3 = document.getElementById('section3').value;
    var township3 = document.getElementById('township3').value;
    var range3 = document.getElementById('range3').value;
    var townshipdirection3 = document.getElementById('townshipdirection3').value;
    var rangedirection3 = document.getElementById('rangedirection3').value;
    var commercial_name4 = document.getElementById('commercial_name4').value;
    var address4 = document.getElementById('address4').value;
    var city4 = document.getElementById('city4').value;
    var zip4 = document.getElementById('zip4').value;
    var AssessorsParcel4 = document.getElementById('AssessorsParcel4').value;
    var section4 = document.getElementById('section4').value;
    var township4 = document.getElementById('township4').value;
    var range4 = document.getElementById('range4').value;
    var townshipdirection4 = document.getElementById('townshipdirection4').value;
    var rangedirection4 = document.getElementById('rangedirection4').value;
    var historical_maricopa = document.getElementById('historical_maricopa').checked;
    var historical_otherAZcounties = document.getElementById('historical_otherAZcounties').checked;
    var ASTM = document.getElementById('ASTM').checked;
    var historical_ASTM_maricopa = document.getElementById('historical_ASTM_maricopa').checked;
    var historical_ASTM_othercounties = document.getElementById('historical_ASTM_othercounties').checked;
    var TSP = document.getElementById('TSP').checked;
    var ADWR_well = document.getElementById('ADWR_well').checked;
    var envirolien_maricopa = document.getElementById('envirolien_maricopa').checked;
    var envirolien_otherAZcounties = document.getElementById('envirolien_otherAZcounties').checked;
    var envirolien_ASTM_maricopa = document.getElementById('envirolien_ASTM_maricopa').checked;
    var envirolien_ASTM_otherAZcounties = document.getElementById('envirolien_ASTM_otherAZcounties').checked;
	if (document.getElementById('filename')) {
		var attchid = document.getElementById('filename').value;
	}
	var comments = escape(document.getElementById('comments').value);
	new Ajax('ordermailer.aspx', { postBody: '&request_type=' + request_type + '&orderid=' + orderid + '&company=' + company + '&return_to=' + return_to + '&email=' + email + '&project_number=' + project_number + '&due_mo=' + due_mo + '&due_day=' + due_day + '&due_yr=' + due_yr + '&commercial_name=' + commercial_name + '&address=' + address + '&city=' + city + '&zip=' + zip + '&AssessorsParcel=' + AssessorsParcel + '&section=' + section + '&township=' + township + '&range=' + range + '&townshipdirection=' + townshipdirection + '&rangedirection=' + rangedirection + '&commercial_name2=' + commercial_name2 + '&address2=' + address2 + '&city2=' + city2 + '&zip2=' + zip2 + '&AssessorsParcel2=' + AssessorsParcel2 + '&section2=' + section2 + '&township2=' + township2 + '&range2=' + range2 + '&townshipdirection2=' + townshipdirection2 + '&rangedirection2=' + rangedirection2 + '&commercial_name3=' + commercial_name3 + '&address3=' + address3 + '&city3=' + city3 + '&zip3=' + zip3 + '&AssessorsParcel3=' + AssessorsParcel3 + '&section3=' + section3 + '&township3=' + township3 + '&range3=' + range3 + '&townshipdirection3=' + townshipdirection3 + '&rangedirection3=' + rangedirection3 + '&commercial_name4=' + commercial_name4 + '&address4=' + address4 + '&city4=' + city4 + '&zip4=' + zip4 + '&AssessorsParcel4=' + AssessorsParcel4 + '&section4=' + section4 + '&township4=' + township4 + '&range4=' + range4 + '&townshipdirection4=' + townshipdirection4 + '&rangedirection4=' + rangedirection4 + '&historical_maricopa=' + historical_maricopa + '&historical_otherAZcounties=' + historical_otherAZcounties + '&ASTM=' + ASTM + '&historical_ASTM_maricopa=' + historical_ASTM_maricopa + '&historical_ASTM_othercounties=' + historical_ASTM_othercounties + '&TSP=' + TSP + '&ADWR_well=' + ADWR_well + '&envirolien_maricopa=' + envirolien_maricopa + '&envirolien_otherAZcounties=' + envirolien_otherAZcounties + '&envirolien_ASTM_maricopa=' + envirolien_ASTM_maricopa + '&envirolien_ASTM_otherAZcounties=' + envirolien_ASTM_otherAZcounties + '&comments=' + comments + '&attchid=' + attchid, onComplete: function (responseText) { finishsendemail(responseText); } }).request();
}

function sendemail3() {
	document.getElementById('form_status').innerHTML='Sending...';
    var company = document.getElementById('company').value;
    var return_to = document.getElementById('return_to').value;
    var email = document.getElementById('email').value;
    var project_number = document.getElementById('project_number').value;
    var due_mo = document.getElementById('due_mo').value;
    var due_day = document.getElementById('due_day').value;
    var due_yr = document.getElementById('due_yr').value;
    var commercial_name = document.getElementById('commercial_name').value;
    var address = document.getElementById('address').value;
    var city = document.getElementById('city').value;
    var zip = document.getElementById('zip').value;
    var AssessorsParcel = document.getElementById('AssessorsParcel').value;
    var section = document.getElementById('section').value;
    var township = document.getElementById('township').value;
    var range = document.getElementById('range').value;
    var townshipdirection = document.getElementById('townshipdirection').value;
    var rangedirection = document.getElementById('rangedirection').value;
    var commercial_name2 = document.getElementById('commercial_name2').value;
    var address2 = document.getElementById('address2').value;
    var city2 = document.getElementById('city2').value;
    var zip2 = document.getElementById('zip2').value;
    var AssessorsParcel2 = document.getElementById('AssessorsParcel2').value;
    var section2 = document.getElementById('section2').value;
    var township2 = document.getElementById('township2').value;
    var range2 = document.getElementById('range2').value;
    var townshipdirection2 = document.getElementById('townshipdirection2').value;
    var rangedirection2 = document.getElementById('rangedirection2').value;
    var commercial_name3 = document.getElementById('commercial_name3').value;
    var address3 = document.getElementById('address3').value;
    var city3 = document.getElementById('city3').value;
    var zip3 = document.getElementById('zip3').value;
    var AssessorsParcel3 = document.getElementById('AssessorsParcel3').value;
    var section3 = document.getElementById('section3').value;
    var township3 = document.getElementById('township3').value;
    var range3 = document.getElementById('range3').value;
    var townshipdirection3 = document.getElementById('townshipdirection3').value;
    var rangedirection3 = document.getElementById('rangedirection3').value;
    var commercial_name4 = document.getElementById('commercial_name4').value;
    var address4 = document.getElementById('address4').value;
    var city4 = document.getElementById('city4').value;
    var zip4 = document.getElementById('zip4').value;
    var AssessorsParcel4 = document.getElementById('AssessorsParcel4').value;
    var section4 = document.getElementById('section4').value;
    var township4 = document.getElementById('township4').value;
    var range4 = document.getElementById('range4').value;
    var townshipdirection4 = document.getElementById('townshipdirection4').value;
    var rangedirection4 = document.getElementById('rangedirection4').value;
    var historical_maricopa = document.getElementById('historical_maricopa').checked;
    var historical_otherAZcounties = document.getElementById('historical_otherAZcounties').checked;
    var ASTM = document.getElementById('ASTM').checked;
    var historical_ASTM_maricopa = document.getElementById('historical_ASTM_maricopa').checked;
    var historical_ASTM_othercounties = document.getElementById('historical_ASTM_othercounties').checked;
    var TSP = document.getElementById('TSP').checked;
    var ADWR_well = document.getElementById('ADWR_well').checked;
    var envirolien_maricopa = document.getElementById('envirolien_maricopa').checked;
    var envirolien_otherAZcounties = document.getElementById('envirolien_otherAZcounties').checked;
    var envirolien_ASTM_maricopa = document.getElementById('envirolien_ASTM_maricopa').checked;
    var comments = escape(document.getElementById('comments').value);
	if (document.getElementById('filename')) {
		var attchid = document.getElementById('filename').value;
	}
	new Ajax('mailer3.php', { postBody: '&company=' + company + '&return_to=' + return_to + '&email=' + email + '&project_number=' + project_number + '&due_mo=' + due_mo + '&due_day=' + due_day + '&due_yr=' + due_yr + '&commercial_name=' + commercial_name + '&address=' + address + '&city=' + city + '&zip=' + zip + '&AssessorsParcel=' + AssessorsParcel + '&section=' + section + '&township=' + township + '&range=' + range + '&townshipdirection=' + townshipdirection + '&rangedirection=' + rangedirection + '&commercial_name2=' + commercial_name2 + '&address2=' + address2 + '&city2=' + city2 + '&zip2=' + zip2 + '&AssessorsParcel2=' + AssessorsParcel2 + '&section2=' + section2 + '&township2=' + township2 + '&range2=' + range2 + '&townshipdirection2=' + townshipdirection2 + '&rangedirection2=' + rangedirection2 + '&commercial_name3=' + commercial_name3 + '&address3=' + address3 + '&city3=' + city3 + '&zip3=' + zip3 + '&AssessorsParcel3=' + AssessorsParcel3 + '&section3=' + section3 + '&township3=' + township3 + '&range3=' + range3 + '&townshipdirection3=' + townshipdirection3 + '&rangedirection3=' + rangedirection3 + '&commercial_name4=' + commercial_name4 + '&address4=' + address4 + '&city4=' + city4 + '&zip4=' + zip4 + '&AssessorsParcel4=' + AssessorsParcel4 + '&section4=' + section4 + '&township4=' + township4 + '&range4=' + range4 + '&townshipdirection4=' + townshipdirection4 + '&rangedirection4=' + rangedirection4 + '&historical_maricopa=' + historical_maricopa + '&historical_otherAZcounties=' + historical_otherAZcounties + '&ASTM=' + ASTM + '&historical_ASTM_maricopa=' + historical_ASTM_maricopa + '&historical_ASTM_othercounties=' + historical_ASTM_othercounties + '&TSP=' + TSP + '&envirolien=' + envirolien + '&envirolien2=' + envirolien2 + '&ADWR_well=' + ADWR_well + '&comments=' + comments + '&attchid=' + attchid, onComplete: function (responseText) { finishsendemail(responseText); } }).request();
}

function sendemail2() {
	document.getElementById('form_status').innerHTML='Sending...';
    var name = document.getElementById('name').value;
    var email = document.getElementById('email').value;
    var comments = escape(document.getElementById('comments').value);
    new Ajax('commentmailer.aspx',{postBody:'action=sendemail&name='+name+'&email='+email+'&comments='+comments,onComplete:function(responseText) {finishsendemail2(responseText);}}).request();
}

function finishsendemail2(responseText) {
    document.getElementById('name').value='';
    document.getElementById('email').value='';
    document.getElementById('comments').value='';
	document.getElementById('form_status').innerHTML=responseText;
}

function finishsendemail(responseText) {
	var string=responseText.split(/\:/g);
	if (string[0]=='ERROR') {
		document.getElementById('form_status').innerHTML=responseText;
	}
	else {
		document.getElementById('company').value='';
		document.getElementById('return_to').value='';
		document.getElementById('email').value='';
		document.getElementById('project_number').value='';
		document.getElementById('due_mo').value='';
		document.getElementById('due_day').value='';
		document.getElementById('due_yr').value='';
		document.getElementById('commercial_name').value='';
		document.getElementById('address').value='';
		document.getElementById('city').value='';
		document.getElementById('zip').value='';
		document.getElementById('AssessorsParcel').value='';
		document.getElementById('section').value='';
		document.getElementById('township').value='';
		document.getElementById('range').value='';
		document.getElementById('townshipdirection').value='';
		document.getElementById('rangedirection').value='';
		document.getElementById('commercial_name2').value='';
		document.getElementById('address2').value='';
		document.getElementById('city2').value='';
		document.getElementById('zip2').value='';
		document.getElementById('AssessorsParcel2').value='';
		document.getElementById('section2').value='';
		document.getElementById('township2').value='';
		document.getElementById('range2').value='';
		document.getElementById('townshipdirection2').value='';
		document.getElementById('rangedirection3').value='';
		document.getElementById('commercial_name3').value='';
		document.getElementById('address3').value='';
		document.getElementById('city3').value='';
		document.getElementById('zip3').value='';
		document.getElementById('AssessorsParcel3').value='';
		document.getElementById('section3').value='';
		document.getElementById('township3').value='';
		document.getElementById('range3').value='';
		document.getElementById('townshipdirection3').value='';
		document.getElementById('rangedirection3').value='';
		document.getElementById('commercial_name4').value='';
		document.getElementById('address4').value='';
		document.getElementById('city4').value='';
		document.getElementById('zip4').value='';
		document.getElementById('AssessorsParcel4').value='';
		document.getElementById('section4').value='';
		document.getElementById('township4').value='';
		document.getElementById('range4').value='';
		document.getElementById('townshipdirection4').value='';
		document.getElementById('rangedirection4').value='';
		document.getElementById('historical_maricopa').checked='';
		document.getElementById('historical_otherAZcounties').checked='';
		document.getElementById('ASTM').checked='';
		document.getElementById('historical_ASTM_maricopa').checked='';
		document.getElementById('historical_ASTM_othercounties').checked='';
		document.getElementById('TSP').checked = '';
		document.getElementById('ADWR_well').checked = '';
		document.getElementById('envirolien_maricopa').checked = '';
		document.getElementById('envirolien_otherAZcounties').checked = '';
		document.getElementById('envirolien_ASTM_maricopa').checked = '';
		document.getElementById('envirolien_ASTM_otherAZcounties').checked = '';
		document.getElementById('comments').value = '';
		document.getElementById('form_button').style.display='none';
		document.getElementById('form_status').innerHTML=responseText;
	}
}

function addprop(div,tdiv) {
	var showdomainstuff = new Fx.Styles(div,{duration:250});
	var propheight = document.getElementById(div).scrollHeight;
	showdomainstuff.start({
		'height':[0,propheight],
		'opacity':[0,1]
	});
	document.getElementById(tdiv).href=('javascript:closeprop(\'' + div + '\',\'' + tdiv + '\');');
}

function closeprop(div,tdiv) {
	var showdomainstuff = new Fx.Styles(div,{duration:250});
	var propheight = document.getElementById(div).scrollHeight;
	showdomainstuff.start({
		'height':[propheight,0],
		'opacity':[1,0]
	});
	document.getElementById(tdiv).href=('javascript:addprop(\'' + div + '\',\'' + tdiv + '\');');
}
