function isUSCurrency (sString) 
{
var M;

  M = sString.match(/^\d+(\.\d{2})?$/ );    
  if (!M) {
	  return false;
	}

return true;



}

function ValidateFormPage3(theForm)
{

var totalamt;
var contributeamount;
var numtickets;
var ticketamt;
var tributelevel;
var totalcontribution;

contributeamount=0.0;
numtickets=0;
ticketamt=0.0;
totalamt=0.0;
totalcontribution=0.0;
tributelevel=0.0;

if ( theForm.cantcome.checked && (!theForm.cantcome.disabled) ) {
	if (isUSCurrency(theForm.contributeamount.value)) {
		contributeamount=theForm.contributeamount.value
	}
	else {
		alert('Please enter a contribution amount');
		return false;
		}
  }
if ( !theForm.cantcome.checked ) {

//	if (!(isWhitespace(theForm.contributeamount.value))  && (!theForm.contributeamount.disabled) ) {
//		alert('Please check off the box that says you cannot come if you would like to make a contribution instead');
//		return false;
//	}
//	else {
//		alert('Please enter a contribution amount');
//		return false;
//		}
//	else {
//		theForm.contributeamount.value=0.0;
//		}

  }  
 //alert(theForm.contributeamount.value);

//if  ((!( isWhitespace(theForm.numtickets.value ))) &&  (!theForm.numtickets.disabled) ){ 
//		if (!(isInteger(theForm.numtickets.value ))) {
///			alert("Please enter the number of Gala tickets you would like to purchase");
//			return(false);
//			}
//		else {
//			ticketamt=theForm.numtickets.value * 180.00;
//			}			
//		}
//else {
//		theForm.numtickets.value=0;
//	}

//	if (isUSCurrency(theForm.tributelevel.value) || (isInteger(theForm.tributelevel.value )) ) {
//		tributelevel=theForm.tributelevel.value
//	}
//	else {
//		theForm.tributelevel.value=0.0;
//		alert('Please enter a tribute level');
//		return false;
//		}
 

//	if (isUSCurrency(theForm.totalcontribution.value) || (isInteger(theForm.totalcontribution.value )) ) {
//		totalcontribution=theForm.totalcontribution.value;
//		}
		
 
//totalamt=parseFloat(ticketamt)+parseFloat(contributeamount)+parseFloat(tributelevel);

//alert('totalamt='+totalamt);

//if (totalcontribution != 0.0 ) {
//	if (parseFloat(totalcontribution)==parseFloat(totalamt) ){
//			theForm.totalcontribution.value=totalcontribution;
//			return true;
//		}
//	else {
//		alert('Please make sure the total contribution amount is correct.');
//		return false;
//	}
//}
//else {
//alert('it is 0');
//	totalcontribution=parseFloat(totalamt);
//alert('and now it it'+totalcontribution);	
//	}

//alert('going to return');
//alert('and the value=' + parseFloat(totalcontribution));

//	theForm.totalcontribution.value = parseFloat(totalcontribution);	
//	alert('totalcontr='+theForm.totalcontribution.value);
	return(true);		
}


function ValidateFormPage3CANevent(theForm)
{

var totalamt;
var contributeamount;
var numtickets;
var ticketamt;
var tributelevel;
var totalcontribution;

contributeamount=0.0;
numtickets=0;
ticketamt=0.0;
totalamt=0.0;
totalcontribution=0.0;
tributelevel=0.0;

//alert('here in canevent');
//alert('cantcomechecked='+theForm.cantcome.checked);
//if ( theForm.cantcome.checked && (!theForm.cantcome.disabled) )
// {
//	if (isUSCurrency(theForm.contributeamount.value))
//	 {
//		contributeamount=theForm.contributeamount.value;
//	}
//	else {
//		alert('Please enter a contribution amount');
//		return false;
//		}
 // }
//else {
//	alert('try');
//	alert('setting value='+theForm.totalcontribution.value);
//		contributeamount=theForm.totalcontribution.value;
//	}

//	alert('going to rutn true');
	return(true);		
//
}



function ValidateForm1(theForm)
{

	var extension;
	var s, s2, s3;

 
  if ((theForm.childName.value == "")|| (isblank(theForm.childName.value)))
 {
   alert("Please enter the child\'s name.");
    theForm.childName.focus();
    return (false);
 }
  
 myOption = -1;
for (i=theForm.sex.length-1; i > -1; i--) {
if (theForm.sex[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select Male or Female.");
return false;
}
  
  if ((theForm.parentName.value == "")|| (isblank(theForm.parentName.value)))
 {
   alert("Please enter the parent\'s name.");
    theForm.parentName.focus();
    return (false);
 }	
   s = theForm.email.value;

  if (isEmpty(s)) {
 	alert("Please enter your email address.");
	theForm.email.focus();  
	return false;
  }
  
  else {
  	if (!(isEmail (s,0))){
  		alert("Please enter a valid email address.");    
  		theForm.email.focus();
    	return false;
   		}
   	}

   s = theForm.Phone; 
   s2 = theForm.evePhone; 
   s3 = theForm.cellPhone; 

   if (isEmpty(s)) { 
   			s=0;
   		} 
    if (isEmpty(s2)) { 
   		s2=0;
   	} 
    if (isEmpty(s3)) { 
   		s3=0;
   		} 
   
     if ((theForm.address.value == "")|| (isblank(theForm.address.value)))
 {
   alert("Please enter your home address.");
    theForm.address.focus();
    return (false);
 }	
   
  if ((theForm.bDate.value == "")|| (isblank(theForm.bDate.value)))
 {
   alert("Please enter the Bar Mitzvah Date.");
    theForm.bDate.focus();
    return (false);
 }	
 if ((!( checkUSPhone (s,0))) && (!( checkUSPhone (s2,0)))  && (!( checkUSPhone (s3,0)))) {
  		alert("Please enter a valid phone number.");    
  		theForm.phone.focus();
    	return false;
   		}

  else {
  	  if ((isEmpty(s)) && (isEmpty(s2)) && (isEmpty(s3))) {
  		alert("Please enter a valid phone number.");    
  		theForm.phone.focus();
    	return false;
   		}
   	}  	
   	
 myOption = -1;
for (i=theForm.tShirt.length-1; i > -1; i--) {
if (theForm.tShirt[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("You must select a t-Shirt Size button");
return false;
}

 myOption = -1;
for (i=theForm.postcard.length-1; i > -1; i--) {
if (theForm.postcard[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("Please select whether you are interested in using our postcard option.");
return false;
}

   s = theForm.guestDate; 
   s2 = theForm.secondDate; 
   s3 = theForm.thirdDate; 
    
    if (isEmpty(s)) { 
   			s=0;
   		} 
    if (isEmpty(s2)) { 
   		s2=0;
   	} 
    if (isEmpty(s3)) { 
   		s3=0;
   		} 
 
   if ((s.value == s2.value) || (s2.value == s3.value) || (s.value == s3.value))
 {
	alert("Please select unique distribution dates.");
    theForm.guestDate.focus();
    return (false);
 }
 

  return (true);
}

function ValidateFormPage1(theForm)
{

	var extension;
	var s, s2, s3;

 
  if ((theForm.name.value == "")|| (isblank(theForm.name.value)))
 {
   alert("Please enter your name.");
    theForm.name.focus();
    return (false);
 }
  
   s = theForm.email.value;

  if (isEmpty(s)) {
 	alert("Please enter your email address.");
	theForm.email.focus();  
	return false;
  }
  
  else {
  	if (!(isEmail (s,0))){
  		alert("Please enter a valid email address.");    
  		theForm.email.focus();
    	return false;
   		}
   	}

   s = theForm.phone; 
   s2 = theForm.homephone; 

   if (isEmpty(s)) { 
   			s=0;
   		} 
    if (isEmpty(s2)) { 
   		s2=0;
   	} 
      if ((theForm.address.value == "")|| (isblank(theForm.address.value)))
 {
   alert("Please enter your address.");
    theForm.address.focus();
    return (false);
 }	
   
 if ((!( checkUSPhone (s,0))) && (!( checkUSPhone (s2,0)))  ) {
  		alert("Please enter a valid phone number.");    
  		theForm.phone.focus();
    	return false;
   		}

  else {
  	  if ((isEmpty(s)) && (isEmpty(s2)) ) {
  		alert("Please enter a valid phone number.");    
  		theForm.phone.focus();
    	return false;
   		}
   	}  	
   	



  return (true);
}

function ValidateFormPage1Expo(theForm)
{

	var extension;
	var s, s2, s3;
 if ((theForm.fname.value == "")|| (isblank(theForm.fname.value)))
 {
   alert("Please enter your first name.");
    theForm.fname.focus();
    return (false);
 }
 
 


 
  if ((theForm.lname.value == "")|| (isblank(theForm.lname.value)))
 {
   alert("Please enter your last name.");
    theForm.lname.focus();
    return (false);
 }
 
 

   if ((theForm.zip.value == "")|| (isblank(theForm.zip.value)))
 {
   alert("Please enter your zip code.");
    theForm.zip.focus();
    return (false);
 }

   s = theForm.zip.value;

  if (isEmpty(s)) {
 	alert("Please enter your  zip code.");
	theForm.zip.focus();  
	return false;
  }
  
  else {
  	if (!(isZIPCode (s,0))){
  		alert("Please enter your zip code.");    
  		theForm.zip.focus();
    	return false;
   		}
   	}



   s = theForm.email.value;


  if (isEmpty(s)) {
 	alert("Please enter your email address.");
	theForm.email.focus();  
	return false;
  }
  
  else {
  	if (!(isEmail (s,0))){
  		alert("Please enter a valid email address.");    
  		theForm.email.focus();
    	return false;
   		}
   	}

   s = theForm.phone; 
   s2 = theForm.homephone; 

   if (isEmpty(s)) { 
   			s=0;
   		} 
    if (isEmpty(s2)) { 
   		s2=0;
   	} 
      if ((theForm.address.value == "")|| (isblank(theForm.address.value)))
 {
   alert("Please enter your address.");
    theForm.address.focus();
    return (false);
 }	
   
 if ((!( checkUSPhone (s,0))) && (!( checkUSPhone (s2,0)))  ) {
  		alert("Please enter a valid phone number.");    
  		theForm.phone.focus();
    	return false;
   		}

  else {
  	  if ((isEmpty(s)) && (isEmpty(s2)) ) {
  		alert("Please enter a valid phone number.");    
  		theForm.phone.focus();
    	return false;
   		}
   	}  	
   	



  return (true);
}


