
// validate Barn Listing

function checkSellBarn(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+(\.[0-9][0-9])?$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (form.vcBarnType.selectedIndex == 0) {alert ('Please select a Barn Type.'); return false;}
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnState.value == '') {alert ('Please select a Region, State or Province.'); return false;}
	//if (form.vcBarnState.selectedIndex == 0) {alert ('Please select a State/Province.'); return false;}
	if (form.vcCondition.selectedIndex == 0) {alert ('Please select the Condition of your Barn.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=Math.floor(tstr);
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellBarn2(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var xmofmt= /^[01][0-9]$/;
	var xyrfmt= /^(06|07|08|09|10|11|12|13|14|15|16|17|18|19)$/;
	//if (!form.vcFName.value) {alert ('Please enter your First Name.'); return false;}
	//if (!form.vcLName.value) {alert ('Please enter your Last Name.'); return false;}
	if (form.MemberType.value == 'New') {
		if (!trim(form.vcPassword.value)) {alert ('Please enter your Password.'); return false;}
		if (!trim(form.vcPassword2.value)) {alert ('Please enter your Password confirmation.'); return false;}
		if (form.vcPassword.value != form.vcPassword2.value) { alert('Your password and confirmation do not match.'); return false;}
	}
	//if (!form.vcAddress.value) {alert ('Please enter your Address.'); return false;}
	//if (!form.vcCity.value) {alert ('Please enter your City.'); return false;}
	//if (form.vcState.value == '') {alert ('Please select a State/Province.'); return false;}
	//if (!form.vcZip.value) {alert ('Please enter your Zip Code.'); return false;}
	//if (!form.vcCountry.value) {alert ('Please enter your Country.'); return false;}
	if (!form.vcBillAddress.value) {alert ('Please enter your Billing Address.'); return false;}
	if (!form.vcBillCity.value) {alert ('Please enter your Billing City.'); return false;}
	if (form.vcBillState.value == '') {alert ('Please select a Billing State/Province.'); return false;}
	if (!form.vcBillZip.value) {alert ('Please enter your Billing Zip Code.'); return false;}
	if (!form.vcBillCountry.value) {alert ('Please enter your Billing Country.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	//if we specified credit card, additional checking
	if (form.nCCTypeID.value < 5) {
		if (!form.vcCCN.value) {alert ('Please enter your Credit Card Number.'); return false;}
		if (!form.vcCCName.value) {alert ('Please enter your CardHolder Name.'); return false;}
		if (form.nCCXMonth.value.search(xmofmt) == -1) {alert('Please select a valid expiration month.'); return false;}
		if (form.nCCXYear.value.search(xyrfmt) == -1) { alert('Please select a valid expiration year.'); return false;}
		var nowDate= new Date();
		var theYear= nowDate.getYear();
		if (theYear > 2000) theYear=theYear - 2000;
		if (theYear > 100) theYear=theYear - 100;
		if (form.nCCXYear.value < theYear) {alert('Your expiration date has already passed.'); return false;}
		if (form.nCCXYear.value == theYear) {
			var theMonth=nowDate.getMonth();
			theMonth=theMonth+1; //Javascript uses 0-11 for the month number
//			alert(theMonth);
			if (form.nCCXMonth.value < theMonth) { alert('Your card expiration date has already passed.'); return false;}
		}
		if (form.nFeaturedID[2].checked == true || form.nFeaturedID[3].checked == true) { alert('You have selected Pay By Check, but with a Credit Card Payment Method. Please adjust your selections.'); return false;}
	} else {
		if (form.nFeaturedID[0].checked == true || form.nFeaturedID[1].checked == true) { alert('You have selected a monthly fee, but chosen Check for Payment Method. Please adjust your selections.'); return false;}
	}
	if (form.agree.checked == false){alert ('Please acknowledge that you have agreed to the Terms and Conditions.'); return false;}
	//if (f.agree.checked == false){alert('Please check the box to continue.'); return false;
	
return true;
}

function checkSellNewBarn(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (form.vcBarnType.selectedIndex == 0) {alert ('Please select a Barn Type.'); return false;}
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnState.value == '') {alert ('Please select a Region, State or Province.'); return false;}
	if (form.nSize.selectedIndex == 0) {alert ('Please select the Size of your Barn.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellBarnConversion(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nSize.selectedIndex == 0) {alert ('Please select a Size.'); return false;}
	if (form.nPrice.selectedIndex == 0) {alert ('Please select a Price.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if (form.nVintage.value.length > 0) {
		if (form.nVintage.value.search(fourdigityr) == -1) {alert('Please enter a four digit year for the barn vintage.'); return false;}
	}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellYourBarnwood(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnwoodState.value == '') {alert ('Please select a State/Province.'); return false;}
	//if (form.nBarnwoodType.selectedIndex == 0) {alert ('Please select a Barnwood Type.'); return false;}
	//if (form.nBarnwoodSpecies.selectedIndex == 0) {alert ('Please select a Barnwood Species.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellYourFurniture(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcFurnitureState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nFurnitureType.selectedIndex == 0) {alert ('Please select a Barnwood Furniture Type.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkOrganizations(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	if (!form.vcName.value) {alert ('Please enter your Organization Name.'); return false;}
	if (form.vcOrgState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
return true;
}

function checkOrganizations2(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	
	if (!form.vcFName.value) {alert ('Please enter your First Name.'); return false;}
	if (!form.vcLName.value) {alert ('Please enter your Last Name.'); return false;}
	if (form.MemberType.value == 'New') {
		if (!trim(form.vcPassword.value)) {alert ('Please enter your Password.'); return false;}
		if (!trim(form.vcPassword2.value)) {alert ('Please enter your Password confirmation.'); return false;}
		if (form.vcPassword.value != form.vcPassword2.value) { alert('Your password and confirmation do not match.'); return false;}
	}
	if (!form.vcAddress.value) {alert ('Please enter your Address.'); return false;}
	if (!form.vcCity.value) {alert ('Please enter your City.'); return false;}
	if (form.vcState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (!form.vcZip.value) {alert ('Please enter your Zip Code.'); return false;}
	if (!form.vcCountry.value) {alert ('Please enter your Country.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (form.agree.checked == false){alert ('Please acknowledge that you have agreed to the Terms and Conditions.'); return false;}

return true;
}

function checkCompanies(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcName.value) {alert ('Please enter your Company Name.'); return false;}
	if (form.vcCompanyState.value == '') {alert ('Please select a Region, State or Province.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellBarnParts(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcPartState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nPartType.selectedIndex == 0) {alert ('Please select a Barn Part Type.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellBarnArt(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcArtState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nArtType.selectedIndex == 0) {alert ('Please select a Barn Art Type.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkSellBarnBooks(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Book Title.'); return false;}
	if (form.vcBookState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nBookType.selectedIndex == 0) {alert ('Please select a Barn Book Type.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkAdvertise(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcAdCompany.value) {alert ('Please enter your Company Name.'); return false;}
	if (!form.vcAdCompanyWebsite.value) {alert ('Please enter your Company Website Address.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo1.value).length < 5) {
		alert('You must specify an ad image. The image must be in GIF, JPG, or PNG format.');
		return false;
	}
	tptr=document.getElementById('sbmtbtn');
	if (tptr != null) {
		tptr.value='Please Wait';
		tptr.disabled=true;
	}
return true;
}

function checkAd2(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var xmofmt= /^[01][0-9]$/;
	var xyrfmt= /^(06|07|08|09|10|11|12|13|14|15|16|17|18|19)$/;
	//if (!form.vcFName.value) {alert ('Please enter your First Name.'); return false;}
	//if (!form.vcLName.value) {alert ('Please enter your Last Name.'); return false;}
	if (form.MemberType.value == 'New') {
		if (!trim(form.vcPassword.value)) {alert ('Please enter your Password.'); return false;}
		if (!trim(form.vcPassword2.value)) {alert ('Please enter your Password confirmation.'); return false;}
		if (form.vcPassword.value != form.vcPassword2.value) { alert('Your password and confirmation do not match.'); return false;}
	}
	//if (!form.vcAddress.value) {alert ('Please enter your Address.'); return false;}
	//if (!form.vcCity.value) {alert ('Please enter your City.'); return false;}
	//if (form.vcState.value == '') {alert ('Please select a State/Province.'); return false;}
	//if (!form.vcZip.value) {alert ('Please enter your Zip Code.'); return false;}
	//if (!form.vcCountry.value) {alert ('Please enter your Country.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	//if we specified credit card, additional checking
	if (form.nFeaturedID.value == 1) {
		if (!form.vcBillAddress.value) {alert ('Please enter your Billing Address.'); return false;}
		if (!form.vcBillCity.value) {alert ('Please enter your Billing City.'); return false;}
		if (form.vcBillState.value == '') {alert ('Please select a Billing State/Province.'); return false;}
		if (!form.vcBillZip.value) {alert ('Please enter your Billing Zip Code.'); return false;}
		if (!form.vcBillCountry.value) {alert ('Please enter your Billing Country.'); return false;}
		if (!form.vcCCN.value) {alert ('Please enter your Credit Card Number.'); return false;}
		if (!form.vcCCName.value) {alert ('Please enter your CardHolder Name.'); return false;}
		}
	if (form.nCCTypeID.value < 5) {
		if (form.nCCXMonth.value.search(xmofmt) == -1) {alert('Please select a valid expiration month.'); return false;}
		if (form.nCCXYear.value.search(xyrfmt) == -1) { alert('Please select a valid expiration year.'); return false;}
		}
	if (form.agree.checked == false){alert ('Please acknowledge that you have agreed to the Terms and Conditions.'); return false;}
	//if (f.agree.checked == false){alert('Please check the box to continue.'); return false;
	
return true;
}

function checkEmailAFriend(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	if (!form.vcReferringName.value) {alert ('Please enter your Name.'); return false;}
	if (!form.vcFriendsName.value) {alert ('Please enter a name for your Friend.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter an Email Address for your Friend.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
return true;
}

function checkWantToAdvertise(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	if (!form.vcName.value) {alert ('Please enter your Name.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
return true;
}

function checkAcctGeneral(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var xmofmt= /^[01][0-9]$/;
	var xyrfmt= /^(06|07|08|09|10|11|12|13|14|15|16|17|18|19)$/;
	if (!form.vcFName.value) {alert ('Please enter your First Name.'); return false;}
	if (!form.vcLName.value) {alert ('Please enter your Last Name.'); return false;}
	if (!form.vcAddress.value) {alert ('Please enter your Address.'); return false;}
	if (!form.vcCity.value) {alert ('Please enter your City.'); return false;}
	if (form.vcState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (!form.vcZip.value) {alert ('Please enter your Zip Code.'); return false;}
	if (!form.vcCountry.value) {alert ('Please enter your Country.'); return false;}
	if (!form.vcBillAddress.value) {alert ('Please enter your Billing Address.'); return false;}
	if (!form.vcBillCity.value) {alert ('Please enter your Billing City.'); return false;}
	if (form.vcBillState.value == '') {alert ('Please select a Billing State/Province.'); return false;}
	if (!form.vcBillZip.value) {alert ('Please enter your Billing Zip Code.'); return false;}
	if (!form.vcBillCountry.value) {alert ('Please enter your Billing Country.'); return false;}
	if (!form.vcCCN.value) {alert ('Please enter your Credit Card Number.'); return false;}
	if (!form.vcCCName.value) {alert ('Please enter your CardHolder Name.'); return false;}
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (form.nCCTypeID.value < 5) {
		if (!form.vcCCN.value) {alert ('Please enter your Credit Card Number.'); return false;}
		if (!form.vcCCName.value) {alert ('Please enter your CardHolder Name.'); return false;}
		if (form.nCCXMonth.value.search(xmofmt) == -1) {alert('Please select a valid expiration month.'); return false;}
		if (form.nCCXYear.value.search(xyrfmt) == -1) { alert('Please select a valid expiration year.'); return false;}
		var nowDate= new Date();
		var theYear= nowDate.getYear();
		if (theYear > 2000) theYear=theYear - 2000;
		if (theYear > 100) theYear=theYear - 100;
		if (form.nCCXYear.value < theYear) {alert('Your expiration date has already passed.'); return false;}
		if (form.nCCXYear.value == theYear) {
			var theMonth=nowDate.getMonth();
			theMonth=theMonth+1; //Javascript uses 0-11 for the month number
//			alert(theMonth);
			if (form.nCCXMonth.value < theMonth) { alert('Your card expiration date has already passed.'); return false;}
		}
	}

return true;
}

function checkEditOrganizations(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	if (!form.vcName.value) {alert ('Please enter your Organization Name.'); return false;}
	if (form.vcOrgState.value == '') {alert ('Please select a State/Province.'); return false;}
return true;
}

function checkEditCompanies(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcName.value) {alert ('Please enter your Company Name.'); return false;}
	if (form.vcCompanyState.value == '') {alert ('Please select a Region, State or Province.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditBarnParts(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcPartState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditBarnListing(form) {

	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnState.value == '') {alert ('Please select a Region, State or Province.'); return false;}
	//if (form.vcBarnState.selectedIndex == 0) {alert ('Please select a State/Province.'); return false;}
	//if (form.vcCondition.selectedIndex == 0) {alert ('Please select the Condition of your Barn.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditNewBarns(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnState.value == '') {alert ('Please select a Region, State or Province.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditConversions(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nVintage.value.length > 0) {
		if (form.nVintage.value.search(fourdigityr) == -1) {alert('Please enter a four digit year for the barn vintage.'); return false;}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditBarnwood(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcBarnwoodState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditFurniture(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var fourdigityr = /^[12][0-9][0-9][0-9]$/;
	var cleanprice = /[\$, ]/g;
	var checkprice = /^[0-9]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcFurnitureState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (form.nPrice.value.length > 0) {
		tstr=form.nPrice.value.replace(cleanprice,'');
		if (tstr.search(checkprice) == -1) {alert('You must enter a valid whole dollar amount in the price field. If you are unsure about the price, please leave the field blank.'); return false;}
		else {
			form.nPrice.value=tstr;
		}
	}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditBarnBooks(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Book Title.'); return false;}
	if (form.vcBookState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkEditBarnArt(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Listing Title.'); return false;}
	if (form.vcArtState.value == '') {alert ('Please select a State/Province.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo2.value).length > 0 && filere.test(form.Photo2.value) ==false) {
		alert('The file used for the second photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo3.value).length > 0 && filere.test(form.Photo3.value) ==false) {
		alert('The file used for the third photo must be in GIF, JPG, or PNG format.');
		return false;
	}
return true;
}

function checkPwd(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}

return true;
}

function checkLogin(form) {

	var emailFormat = /^[\w]+([\w]+|[\.]+[^ ]+)*@[\w]+([\w]+|[-]+|[\.]+[^ ]+)*\.[a-z]+$/;
	
	if (!form.vcEmail.value) {alert ('Please enter your Email Address.'); return false;}
	//if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.emailAddress.value)){alert('Please check your Email Address.'); return false;}
	if  (form.vcEmail.value.search(emailFormat) == -1){alert('Please check your Email Address.'); return false;}
	if (!form.vcPassword.value) {alert ('Please enter your Password.'); return false;}

return true;
}

function checkAddBooks(form) {

	var filere= new RegExp('\.[Jj][Pp][Gg]$|\.[Gg][Ii][Ff]$|\.[Pp][Nn][Gg]$');
	if (!form.vcTitle.value) {alert ('Please enter a Book Title.'); return false;}
	if (form.nCategoryID.value == 0) {alert ('Please select a Book Category.'); return false;}
	if (!form.textURL.value) {alert ('Please enter a URL value.'); return false;}
	if (trim(form.Photo1.value).length > 0 && filere.test(form.Photo1.value) ==false) {
		alert('The file used for the first photo must be in GIF, JPG, or PNG format.');
		return false;
	}
	if (trim(form.Photo1.value).length < 5) {
		alert('You must specify an image. The image must be in GIF, JPG, or PNG format.');
		return false;
	}

return true;
}

