function submitIt()
{
	// Check for Complete Edits
	if ( checkEdits() == true ) {
		document.frmQuote.submit();
		return true;

	}
}
function checkEdits()
{
	//alert(SelectedOption(window.document.frmQuote.optGPS));

	// Check Company Name
	if (window.document.frmQuote.txtCompany.value=='') {
		alert('Please enter the name of your company.');
		window.document.frmQuote.txtCompany.focus();
		return false;
	}
	// Check Contact Name
	if (window.document.frmQuote.txtContact.value=='') {
		alert('Please enter the contact name at your company.');
		window.document.frmQuote.txtContact.focus();
		return false;
	}
	// Check E-Mail
	if (window.document.frmQuote.txtEMail.value=='') {
		alert('Please enter your e-mail address.');
		window.document.frmQuote.txtEMail.focus();
		return false;
	}
	// Check E-Mail
	if (validEmail(window.document.frmQuote.txtEMail.value)==false) {
		alert('You must enter a valid e-mail address.');
		window.document.frmQuote.txtEMail.focus();
		return false;
	}
	// Check Phone
	if (window.document.frmQuote.txtPhone.value=='') {
		alert('Please enter the phone number for your company.');
		window.document.frmQuote.txtPhone.focus();
		return false;
	}
	// Check Phone
	if (formatPhone(window.document.frmQuote.txtPhone.value).length < 10){
		alert('Invalid phone number entered for your company.');
		window.document.frmQuote.txtPhone.focus();
		return false;
	}
	// Check License Quantity
	if (window.document.frmQuote.txtSoftwareLicenses.value=='') {
		alert('Please enter the number of computers requiring access to the software program.');
		window.document.frmQuote.txtSoftwareLicenses.focus();
		return false;
	}
	// Check License Quantity
	if (!IsNumeric(window.document.frmQuote.txtSoftwareLicenses.value)) {
		alert('Please enter the number of computers requiring access to the software program.');
		window.document.frmQuote.txtSoftwareLicenses.focus();
		return false;
	}
	// Check Companies
	if (window.document.frmQuote.txtCompanies.value=='') {
		alert('Please enter the number of companies requiring access to the software program.');
		window.document.frmQuote.txtCompanies.value = '1';		
		window.document.frmQuote.txtCompanies.focus();
		return false;
	}
	// Check License Quantity
	if (!IsNumeric(window.document.frmQuote.txtCompanies.value)) {
		alert('Please enter the number of companies requiring access to the software program.');
		window.document.frmQuote.txtCompanies.value = '1';
		window.document.frmQuote.txtCompanies.focus();
		return false;
	}
	// Check GPS Truck Quantity
	if ((SelectedOption(window.document.frmQuote.optGPS) == 0) && (window.document.frmQuote.txtGPSTrucks.value == '')) {
		alert('Please enter the number of trucks you need GPS integration on.');
		window.document.frmQuote.txtGPSTrucks.focus();
		return false;
	}
	// Check GPS Truck Quantity
	if ((SelectedOption(window.document.frmQuote.optGPS) == 0) && (!IsNumeric(window.document.frmQuote.txtGPSTrucks.value))) {
		alert('Please enter the number of trucks you need GPS integration on.');
		window.document.frmQuote.txtGPSTrucks.focus();
		return false;
	}
	
	return true;
}

function validEmail(email) {
	invalidChars = " /:,;";
	
	if (email == "") {
		return false;
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
		return false;
	}
	if (email.indexOf("@",atPos+1) > -1) {
		return false;
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false;
	}
	if (periodPos+3 > email.length)	{
		return false;
	}
	return true;
}
function selectMessenger(status) {

if (status == 1) {
	document.getElementById('tdMessengerFormat2').disabled = false;
	}

if (status == 0) {
	document.getElementById('tdMessengerFormat2').disabled = true;
	document.frmQuote.optMessengerFormat(1).checked = true;
	}
}

function selectGPS(status) {

if (status == 1) {
	document.getElementById('txtGPSTrucks').disabled = false;
	//document.getElementById('txtGPSTruckStar').style.display = 'block';
	
	}

if (status == 0) {
	document.getElementById('txtGPSTrucks').disabled = true;
	//document.getElementById('txtGPSTruckStar').style.display = 'full';
	}
}

function formatPhone(phone) {
	var stripped = phone.replace(/[\(\)\.\-\ ]/g, '');
	
	return stripped;
}

function validEmail(email) {
	invalidChars = " /:,;";
	
	if (email == "") {
		return false;
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
		return false;
	}
	if (email.indexOf("@",atPos+1) > -1) {
		return false;
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false;
	}
	if (periodPos+3 > email.length)	{
		return false;
	}
	return true;
}
