function validateFieldsB()
{
	sendEmailB();
}
function validateFields() {
//var frmEl = document.getElementById('cForm');
//var posName = document.getElementById('posName');
//var posEmail = document.getElementById('posEmail');
//var posRegard = document.getElementById('posRegard');
//var posText = document.getElementById('posText');
//var strCC = document.getElementById('selfCC');
//var whiteSpace = /^[\s]+$/;
	//if ( posText.value == '' || whiteSpace.test(posText.value) ) {
	//	alert("You're trying to send an Empty Email. Please type something and then get on your way.");
	//}
	//else if ( posEmail.value == '' && strCC.checked == true ) {
	//	alert("Why are you trying to CC yourself without an email?");
	//	alert("Just for that...");
	//	alert("I\'m Clearing all the fields!");
	//	frmEl.reset();
	//	alert("There. Satisified.");
	//	alert("Now start over!");
	//	posName.focus();
	//}
	//else {
		sendPosEmail();
	//}
}
function sendEmailB()
{
	var posPageUrl = location.href;
	var posName = document.getElementById('posName');
	var posEmail = document.getElementById('posEmail');
	var posDate = document.getElementById('posMonth').value + "/" + document.getElementById('posDay').value + "/" + document.getElementById('posYear').value + " ";
	
	var posText = 
	
	"Name: " + posName.value + "\r\n" +
	"Company/Organization: " + posEmail.value + "\r\n" +
	"Date of Event: " + posDate + "\r\n" +
	"Came From Page: " + posPageUrl;
	
	var page = "scripts/xmlHttpRequest.php?contact=true&xml=true";
	
	var str1 = posName.value;
	str1 = str1.replace(/&/g,"**am**");
	str1 = str1.replace(/=/g,"**eq**");
	str1 = str1.replace(/\+/g,"**pl**");
	var str2 = posEmail.value;
	str2 = str2.replace(/&/g,"**am**");
	str2 = str2.replace(/=/g,"**eq**");
	str2 = str2.replace(/\+/g,"**pl**");
	var str3 = posDate;
	str3 = str3.replace(/&/g,"**am**");
	str3 = str3.replace(/=/g,"**eq**");
	str3 = str3.replace(/\+/g,"**pl**");
	var str4 = posText;
	str4 = str4.replace(/&/g,"**am**");
	str4 = str4.replace(/=/g,"**eq**");
	str4 = str4.replace(/\+/g,"**pl**");
	
	var stuff = "posName="+str1+"&posEmail="+str2+"&posRegard="+str3+"&posText="+str4;
	loadXMLPosDoc(page,stuff)
	
}
function sendPosEmail () {
	//var success = document.getElementById('emailSuccess');
	var posName = document.getElementById('posName');
	var posCompany = document.getElementById('posCompany');
	var posPhone = document.getElementById('posPhone');
	
	var posEmail = document.getElementById('posEmail');
	var posCity = document.getElementById('posCity');
	var posLocation = document.getElementById('posLocation');
	var posGuests = document.getElementById('posGuests');
	var posEvent = document.getElementById('posEvent');
	var posPriceList = document.getElementById('posPriceList');
	var posHoldDate = document.getElementById('posHoldDate');
	var posReceiveBooklet = document.getElementById('posReceiveBooklet');
	
		var posStreetAddress = document.getElementById('posStreetAddress');
		var posCity2 = document.getElementById('posCity2');
		var posZip = document.getElementById('posZip');
		var posState = document.getElementById('posState');
		var posCountry = document.getElementById('posCountry');
	
	
	var posDate = document.getElementById('posMonth').value + "/" + document.getElementById('posDay').value + "/" + document.getElementById('posYear').value + " ";
	
	var posText =
	
	"Contact Information" + "\r\n" +
	"Name: " + posName.value + "\r\n" +
	"Company/Organization: " + posCompany.value + "\r\n" +
	"Phone: " + posPhone.value + "\r\n" +
	"Email: " + posEmail.value + "\r\n" +"\r\n" +
	
	"Event Information" + "\r\n" +
	"City: " + posCity.value + "\r\n" +
	"Location: " + posLocation.value + "\r\n" +
	"Guests: " + posGuests.value + "\r\n" +
	"Type of Event: " + posEvent.value + "\r\n" +"\r\n" +
	"Would you like to receive a price list? " + posPriceList.checked + "\r\n" +
	"Would you like to temporarily hold a date if available? " + posHoldDate.checked + "\r\n" +
	"Would you like to receive Daniel's planning booklet via mail? " + posReceiveBooklet.checked + "\r\n" +
	
	"Mailing Address:" + "\r\n" +
	"Street Address: " + posStreetAddress.value + "\r\n" +
	"City: " + posCity2.value + "\r\n" +
	"Zip/Postal Code: " + posZip.value + "\r\n" +
	"State/Province: " + posState.value + "\r\n" +
	"Country: " + posCountry.value + "\r\n";
	
	
	
	document.getElementById('posPhone');
	
	//var strCC = document.getElementById('selfCC').value;
	var page = "scripts/xmlHttpRequest.php?contact=true&xml=true";
	
	//showContactTimer(); // quickly begin the load bar l
	//success.style.display = 'none'; // hide the success bar (incase this is a multi-email
	
	// convert (&, +, =) to string equivs. Needed so URL encoded POST won't choke.
	var str1 = posName.value;
	str1 = str1.replace(/&/g,"**am**");
	str1 = str1.replace(/=/g,"**eq**");
	str1 = str1.replace(/\+/g,"**pl**");
	var str2 = posEmail.value;
	str2 = str2.replace(/&/g,"**am**");
	str2 = str2.replace(/=/g,"**eq**");
	str2 = str2.replace(/\+/g,"**pl**");
	var str3 = posDate;
	str3 = str3.replace(/&/g,"**am**");
	str3 = str3.replace(/=/g,"**eq**");
	str3 = str3.replace(/\+/g,"**pl**");
	var str4 = posText;
	str4 = str4.replace(/&/g,"**am**");
	str4 = str4.replace(/=/g,"**eq**");
	str4 = str4.replace(/\+/g,"**pl**");
	
	var stuff = "posName="+str1+"&posEmail="+str2+"&posRegard="+str3+"&posText="+str4;
	loadXMLPosDoc(page,stuff)
}
function showContactTimer () {
	var loader = document.getElementById('loadBar');
	loader.style.display = 'block';
	sentTimer = setTimeout("hideContactTimer()",6000);
}

function hideContactTimer () {
	var loader = document.getElementById('loadBar');
	var success = document.getElementById('emailSuccess');
	var fieldArea = document.getElementById('contactFormArea');
	var inputs = fieldArea.getElementsByTagName('input');
	var inputsLen = inputs.length;
	var tAreas = fieldArea.getElementsByTagName('textarea');
	var tAreasLen = tAreas.length;
	// Hide the load bar alas! Done Loading
	loader.style.display = "none";
	success.style.display = "block";
	success.innerHTML = '<strong style="color:green;">'+grabPosXML("confirmation")+'</strong>';
	// Now Hijack the form elements
	for ( i=0;i<inputsLen;i++ ) {
		if ( inputs[i].getAttribute('type') == 'text' ) {
			inputs[i].value = '';
		}
	}
	for ( j=0;j<tAreasLen;j++ ) {
		tAreas[j].value = '';
	}
}
function ajaxContact2() {
var frmEl2 = document.getElementById('bForm');
addEvent(frmEl2, 'submit', validateFieldsB, false);
frmEl2.onsubmit = function() { location.href="contactForm.php"; }
}
addEvent(window, 'load',ajaxContact2, false);
