
// validate Barn Listing


function checkSellBarn2Temp(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.vcNameCompany.value) {alert ('Please enter your Name/Company.'); 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.MonthlyFee.value > 0) {
		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.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.nCCTypeID.value == 5) { alert('You have selected Pay By Check, but with a Credit Card 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;
}


