// http://www.old-tickets.com/tickets/ticketsrequest.htm
function form_ticketRequest(){

var Pattern=/\w{1,}/	
var numPattern=/[1-9]{1,}/

 var nameVal=document.ticketRequest.name.value;
 var phoneVal=document.ticketRequest.phone.value;
 var emailVal=document.ticketRequest.email.value;
 var eventVal=document.ticketRequest.event.value;
 var cityVal=document.ticketRequest.city.value;
 var qtyVal=document.ticketRequest.qty.value;
var seatTypeVal=document.ticketRequest.seatType.value;

 if(Pattern.test(nameVal)==0){
	window.alert("Please fill out your name.");
	return false;
  }

 if(Pattern.test(phoneVal)==0){
	window.alert("Please fill out your telephone number.");
	return false;
  }

 if(Pattern.test(emailVal)==0){
	window.alert("Please fill out your E-mail address.");
	return false;
  }

 if(Pattern.test(eventVal)==0){
	window.alert("Please fill out the event name.");
	return false;
  }

 if(Pattern.test(cityVal)==0){
	window.alert("Please fill out the city where the event is.");
	return false;
  }

 if(numPattern.test(qtyVal)==0){
	window.alert("Please fill out Quantity with only digital numbers.");
	return false;
  }

 if(Pattern.test(seatTypeVal)==0){
	window.alert("Please fill out what kind of seats you want.");
	return false;
  }

}

// ticketRequest.asp
function Form_dealbookTicketRequest(){

 var Pattern=/\w{1,}/
 var areaCodePattern=/[0-9]{3}/
 var pricePattern=/[0-9]{1,}/

 var nameVal=document.dealbookTicketRequest.name.value;
 var areaCodeVal=document.dealbookTicketRequest.areaCode.value;
 var phoneVal=document.dealbookTicketRequest.phone.value;
 var eventVal=document.dealbookTicketRequest.event.value;
 var cityVal=document.dealbookTicketRequest.city.value; 
 var qtyVal=document.dealbookTicketRequest.qty.value;
 

 if(Pattern.test(nameVal)==0){
	window.alert("Please fill out customer's name.");
	return false;
  }

 if(areaCodePattern.test(areaCodeVal)==0){
	window.alert("Please check the area code.");
	return false;
  }

 if(Pattern.test(phoneVal)==0){
	window.alert("Please fill out customer's telephone number.");
	return false;
  }


 if(Pattern.test(eventVal)==0){
	window.alert("Please fill out the event.");
	return false;
  }

 if(Pattern.test(cityVal)==0){
	window.alert("Please fill out the city or venue where the event is.");
	return false;
  }

 if(Pattern.test(qtyVal)==0){
	window.alert("Please fill out number of tickets needed.");
	return false;
  }

}

//sellTickets.asp
function Form_dealbookSellTickets(){

 var Pattern=/\w{1,}/
 var areaCodePattern=/[0-9]{3}/
 var pricePattern=/[0-9]{1,}/

 var nameVal=document.dealbookSellTickets.name.value;
 var phoneVal=document.dealbookSellTickets.phone.value; 
 var eventVal=document.dealbookSellTickets.event.value;
 var cityVal=document.dealbookSellTickets.city.value;
 var venueVal=document.dealbookSellTickets.venue.value;
 var faceVal=document.dealbookSellTickets.face.value;
 var sellingPriceVal=document.dealbookSellTickets.sellingPrice.value;
 var qtyVal=document.dealbookSellTickets.qty.value;
 var sectionVal=document.dealbookSellTickets.section.value;

 if(Pattern.test(nameVal)==0){
	window.alert("Please fill out seller's name.");
	return false;
  }

 if(Pattern.test(phoneVal)==0){
	window.alert("Please fill out seller's telephone number.");
	return false;
  }

 if(Pattern.test(eventVal)==0){
	window.alert("Please fill out the event.");
	return false;
  }

 if(Pattern.test(cityVal)==0){
	window.alert("Please fill out the city where the event is.");
	return false;
  }

 if(Pattern.test(venueVal)==0){
	window.alert("Please fill out the venue name where the event will take place.");
	return false;
  }

if(pricePattern.test(faceVal)==0){
	window.alert("Please fill out the face value per ticket. Use numbers only.");
	return false;
  }

 if(pricePattern.test(sellingPriceVal)==0){
	window.alert("Please fill out the desired price per ticket. Use numbers only.");
	return false;
  }

 if(Pattern.test(qtyVal)==0){
	window.alert("Please fill out number of tickets available.");
	return false;
  }

 if(Pattern.test(sectionVal)==0){
	window.alert("Please fill out the section of the tickets.");
	return false;
  }

}


// http://www.old-tickets.com/tickets/sell_your.html
function Form_sellyours(){

 var Pattern=/\w{1,}/
 var areaCodePattern=/[0-9]{3}/
 var pricePattern=/[0-9]{1,}/

 var nameVal=document.sellyours.name.value;
 var phoneVal=document.sellyours.phone.value;
 var emailVal=document.sellyours.email.value;
 var eventVal=document.sellyours.event.value;
 var cityVal=document.sellyours.city.value;
 var venueVal=document.sellyours.venue.value;
 var faceVal=document.sellyours.face.value;
 var sellingPriceVal=document.sellyours.sellingPrice.value;
 var qtyVal=document.sellyours.qty.value;
 var sectionVal=document.sellyours.section.value;

 if(Pattern.test(nameVal)==0){
	window.alert("Please fill out your name.");
	return false;
  }

 if(Pattern.test(phoneVal)==0){
	window.alert("Please fill out your telephone number.");
	return false;
  }

 if(Pattern.test(emailVal)==0){
	window.alert("Please fill out your E-mail address.");
	return false;
  }

 if(Pattern.test(eventVal)==0){
	window.alert("Please fill out the event.");
	return false;
  }

 if(Pattern.test(cityVal)==0){
	window.alert("Please fill out the city where the event will take place.");
	return false;
  }

 if(Pattern.test(venueVal)==0){
	window.alert("Please fill out the venue name where the event will take place.");
	return false;
  }

if(pricePattern.test(faceVal)==0){
	window.alert("Please fill out the face value per ticket. Use numbers only.");
	return false;
  }

 if(pricePattern.test(sellingPriceVal)==0){
	window.alert("Please fill out the desired price per ticket. Use numbers only.");
	return false;
  }

 if(Pattern.test(qtyVal)==0){
	window.alert("Please fill out number of tickets available.");
	return false;
  }

 if(Pattern.test(sectionVal)==0){
	window.alert("Please fill out the section of the tickets.");
	return false;
  }

}



// Do not submit more than once!

var submitted = false;

function doSubmit() {
	
      if (!submitted) {
              submitted = true; 
              return true;
      }
     
      else{
	    window.alert("We've received your request.  Thank you again!");
		return false;
	  }
	
}


// check onlineordering/customer.asp page 

function customerInput() {

var Msg = "Please check the following fields:\n\n";
var l_Msg = Msg.length;

 var Pattern=/\w{1,}/ 
	
var fnameVal=document.ShoppingCartCheckout.fname.value;
var lnameVal=document.ShoppingCartCheckout.lname.value;
var cctypeVal=document.ShoppingCartCheckout.cctype.value;
var ccmonthVal=document.ShoppingCartCheckout.ccmonth.value;
var ccyearVal=document.ShoppingCartCheckout.ccyear.value;
var ccnumLen=document.ShoppingCartCheckout.ccnum.value.length;
var ccnumVal=document.ShoppingCartCheckout.ccnum.value;
var addressLen=document.ShoppingCartCheckout.Address.value.length;
var cityLen=document.ShoppingCartCheckout.City.value.length;
var stateVal=document.ShoppingCartCheckout.State.value;
var zipVal=document.ShoppingCartCheckout.Zip.value;
var zipLen=document.ShoppingCartCheckout.Zip.value.length;
var countryVal=document.ShoppingCartCheckout.Country.value;
var phoneLen=document.ShoppingCartCheckout.phone.value.length;
var emailVal=document.ShoppingCartCheckout.Email.value;
var pwVal=document.ShoppingCartCheckout.txtPassword.value;
var cfmPwVal=document.ShoppingCartCheckout.txtConfirmPassword.value;

 if(Pattern.test(fnameVal)==0){
	Msg+="- First Name\n";
  }

 if(Pattern.test(lnameVal)==0){
	Msg+="- Last Name\n";
  }

if(cctypeVal==""){
	Msg+="- Payment\n";
}

if(ccmonthVal==""){
	Msg+="- Exp. Date: Month\n";
}

if(ccyearVal==""){
	Msg+="- Exp. Date: Year\n";
}

if(ccnumLen<14 ){
	Msg+="- Credit Card #:\n";
	Msg+="  Please insert a valid credit card number:\n";		
}

if(addressLen<5){
	Msg+="- Address\n";	
}

if(cityLen<3){
	Msg+="- City\n";	
}

if(stateVal==""){
	Msg+="- State\n";
}

if(zipVal==null) {
	Msg+="- Zip Code\n";
}

if(countryVal=="US" && zipLen<5) {
	Msg+="- Zip Code: 5 digits or more in U.S.\n";
}

if(countryVal=="CA" && zipLen!=7) {
	Msg+="- Zip Code:\n";
	Msg+="  Please enter a valid zip code in Canada \n";
	Msg+="  e.g. A0N 1T0 \n";
}

if(phoneLen<12) {
	Msg+="- Daytime Phone:\n";
	Msg+="  Please include area code in the format below:\n";
	Msg+="  e.g. 404-843-1344 \n";
}

if(emailVal.search("@") == -1 || emailVal.search("[.*]") == -1){
	Msg+="- Email Address: \n";
	Msg+="  Please enter a valid email address \n";
	Msg+="  e.g. John@aol.com \n";
}

if (pwVal != cfmPwVal ){
	Msg+="- Password: \n";
	Msg+="  Your password and confirm password do not match.\n";
}		

if (Msg.length == l_Msg){
		
	return true;
	}
	else{
	alert(Msg);
	return false;
	}

}



