function confirmRemove()
{
	var agree=confirm("Click OK to remove this item from your shopping cart.");
	if (agree) {
		return true;
	}
	else 
	{
		return false;
	}
}

function popup(URL,W,H) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width='+W+',height='+H+',left = 100,top = 50');");
}

function dirtypop(imgName, url, w, h, viewText) {
	var generator=window.open('','name','width='+w+',height='+h);
	generator.document.write('<html><head><title>Close-Up View</title>');
	generator.document.write('</head><body style="font-family:verdana; font-size:12px;"><center>');
	generator.document.write('<p><img src='+imgName+' border=0></p>');
	//generator.document.write('<a href='+url+'>View card as text</a>');
	generator.document.write('<form>');
	generator.document.write('<input type=button value="Close" onClick="self.close();" style="font-family:verdana; font-size:11px; font-weight:bold;">&nbsp;');
	if(viewText == 'true') {
		generator.document.write('<input type="button" value="View as Text" onClick="location.href=\''+url+'\'" style="font-family:verdana; font-size:11px; font-weight:bold;">');
	}
	generator.document.write('</form>');
	//generator.document.write('&nbsp;&nbsp;&nbsp;<a href="javascript:self.close()">Close Window</a></p>');
	generator.document.write('</center></body></html>');
	generator.document.close();
}

function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function

function getSelectedRadioValue(buttonGroup) {

	//checkBoxArr = getSelectedCheckbox(document.forms[0].MyCheckBox);

   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         //return buttonGroup[i].value;
         //alert(buttonGroup[i].value + ' test');
         showThis(buttonGroup[i].value);
      } else { // The button group is just the one button, and it is checked
         //return buttonGroup.value;
         //alert(buttonGroup[i].value);
         showThis(buttonGroup[i].value);
      }
   }
}

// var dArray=new Array("option1","option2","option3","option4");
var dArray=new Array("option1","option2","option3");

function showThis(nme) {

   //alert("showthis(" + nme + ") fired.");
   
   for (var i=0;i<dArray.length;i++) {
      document.getElementById(dArray[i]).style.display='none';
   }
 
   document.getElementById(nme).style.display='';
   
   switch(nme) {
     case "option1":
		document.form1.option1_Quantity.focus();
		document.form1.OptionType[0].checked=true;
		break;
     case "option2":
		document.form1.option2_Quantity.focus();
		document.form1.OptionType[1].checked=true;
		break;
     case "option3":
		document.form1.option3_Quantity.focus();
		document.form1.OptionType[2].checked=true;
		break;
//     case "option4":
//		document.form1.option4_Quantity.focus();
//		document.form1.OptionType[3].checked=true;
//		break;
	 default:
		"Option type unknown.";
   }
}

function showThisMothersday(nme) {
   for (var i=0;i<dArray.length;i++) {
      document.getElementById(dArray[i]).style.display='none';
   }
 
   document.getElementById(nme).style.display='';
   
   switch(nme) {
     case "option1":
		document.form1.option1_Quantity.focus();
		break;
     case "option2":
		document.form1.option2_Quantity.focus();
		break;
     case "option3":
		document.form1.option3_Quantity.focus();
		break;
	 default:
		"Option type unknown.";
   }
}

function getSelectedButton(buttonGroup) {
	for (var i = 0; i < buttonGroup.length; i++) {
		if (buttonGroup[i].checked) {
			return i
		}
	}
	return 0
}

function getOption(form) {
	var i = getSelectedButton(document.form1.OptionType)
	var option = document.form1.OptionType[i].value
	//alert("You selected: " + option);

	switch(option) {
		case "option1":
			//alert("You chose option1.");
			
			if (document.form1.option1_Quantity.value < 1) {
				alert('A minimum of 1 card is required.');
				// document.form1.option1_Quantity.focus();
				// document.form1.option1_Quantity.select();
				return false;
			}
			 else {
			 var temp_value = document.form1.option1_DonationPerCard.value; 
			 if (temp_value == "" || temp_value < 5) 
				{ 
					//document.form1.option1_DonationPerCard.value = "5.00"; 
					alert('Unfortunately, we cannot accept a donation for less than $5.00 per card.');	
					return false; 
			} 
				
				var Chars = "0123456789.,$"; 
				for (var i = 0; i < temp_value.length; i++) 
				{ 
					if (Chars.indexOf(temp_value.charAt(i)) == -1) 
					{ 
						alert("Invalid Donation Amount for Option 1!\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
						document.form1.option1_DonationPerCard.focus(); 
						document.form1.option1_DonationPerCard.select(); 
						return false; 
					} 
				} 
			}			
			
			break;
			
		case "option2":
			//alert("You chose option2.");

			if (document.form1.option2_Quantity.value < 1) {
				alert('A minimum of 1 card is required.');
				// document.form1.option2_Quantity.focus();
				// document.form1.option2_Quantity.select();
				return false;
			} else {
				var temp_value = document.form1.option2_DonationPerCard.value; 
				if (temp_value == "" || temp_value < 5) 
				{ 
					//document.form1.option2_DonationPerCard.value = "5.00"; 
					alert('Unfortunately, we cannot accept a donation for less than $5.00 per card.');	
					return false; 
				} 
				var Chars = "0123456789.,$"; 
				for (var i = 0; i < temp_value.length; i++) 
				{ 
					if (Chars.indexOf(temp_value.charAt(i)) == -1) 
					{ 
						alert("Invalid Donation Amount for Option 2!\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
						document.form1.option2_DonationPerCard.focus(); 
						document.form1.option2_DonationPerCard.select(); 
						return false; 
					} 
				} 
			}
			
			if (document.form1.option2_CardSignature.value.length == 0) {
				alert("Card Signature is empty.\nPlease enter a signature or special message.");
				document.form1.option2_CardSignature.focus();
				return false;
			}
			
			
			if (document.form1.option2_Address.value.length != 0) {
			
				var msg = 'You have entered a Envelope Return Address';
				
				if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
				{
					msg = msg + ', but have not entered a City, State, or Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_City.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
				{
					msg = msg + ', but have not entered a State, or Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_State.focus();
					alert(msg);
					return false;
				}

				if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
				{
					msg = msg + ', but have not entered a Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_Zip.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
				{
					msg = msg + ', City and Zip/Postal Code, but you have not entered a State.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_State.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
				{
					msg = msg + ', State and Zip/Postal Code, but you have not entered a City.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_City.focus();
					alert(msg);
					return false;
				}

				if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
				{
					msg = msg + ', and State, but you have not entered a City or Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_City.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
				{
					msg = msg + ' and Zip/Postal Code, but have not entered a City or State.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option2_City.focus();
					alert(msg);
					return false;
				}
				
			} else {
				alert("Envelope return address is empty.\nPlease enter a return address for imprinting.");
				document.form1.option2_Address.focus();
				return false;
			}
			
			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City, State, and Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City and Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or State.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City and State for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value > 0 && document.form1.option2_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City and State for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a State and Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or City.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address, City and State.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have selected a State for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address, City and Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Address.focus();
				alert(msg);
				return false;
			}

			break;
		
		case "option3":
			//alert("You chose option3.");
			
			if (document.form1.option3_Quantity.value < 1) {
				alert('A minimum of 1 card is required.');
				// document.form1.option3_Quantity.focus();
				// document.form1.option3_Quantity.select();
				return false;
			} else {
				var temp_value = document.form1.option3_DonationPerCard.value; 
				if (temp_value == "" || temp_value < 5) 
				{ 
					//document.form1.option3_DonationPerCard.value = "5.00"; 
					alert('Unfortunately, we cannot accept a donation for less than $5.00 per card.');	
					return false; 
					//return; 
				} 
				var Chars = "0123456789.,$"; 
				for (var i = 0; i < temp_value.length; i++) 
				{ 
					if (Chars.indexOf(temp_value.charAt(i)) == -1) 
					{ 
						alert("Invalid Donation Amount for Option 3!\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
						document.form1.option3_DonationPerCard.focus(); 
						document.form1.option3_DonationPerCard.select(); 
						return false; 
					} 
				} 
			}
			
			if (document.form1.option3_CardSignature.value.length == 0) {
				alert("Card Signature is empty.\nPlease enter a signature or special message.");
				document.form1.option3_CardSignature.focus();
				return false;
			}

			
			if (document.form1.option3_Address.value.length != 0) {
			
				var msg = 'You have entered a Envelope Return Address';
				
				if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
				{
					msg = msg + ', but have not entered a City, State, or Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_City.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
				{
					msg = msg + ', but have not entered a State, or Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_State.focus();
					alert(msg);
					return false;
				}

				if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
				{
					msg = msg + ', but have not entered a Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_Zip.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
				{
					msg = msg + ', City and Zip/Postal Code, but you have not entered a State.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_State.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
				{
					msg = msg + ', State and Zip/Postal Code, but you have not entered a City.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_City.focus();
					alert(msg);
					return false;
				}

				if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
				{
					msg = msg + ', and State, but you have not entered a City or Zip/Postal Code.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_City.focus();
					alert(msg);
					return false;
				}
				
				if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
				{
					msg = msg + ' and Zip/Postal Code, but have not entered a City or State.';
					msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
					document.form1.option3_City.focus();
					alert(msg);
					return false;
				}
				
			} else {
				alert("Envelope return address is empty.\nPlease enter a return address for imprinting.");
				document.form1.option3_Address.focus();
				return false;
			}

			
			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City, State, and Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City and Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or State.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City and State for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City and State for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a State and Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address or City.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
			{
				var msg = '';
				msg = msg + 'You have entered a Zip/Postal Code for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address, City and State.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have selected a State for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address, City and Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
			{
				var msg = '';
				msg = msg + 'You have entered a City for Envelope Return Address, ';
				msg = msg + 'but you have not entered a valid street address, State and Zip/Postal Code.\n\n';
				msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Address.focus();
				alert(msg);
				return false;
			}
					
			
			break;
		
		default:
			alert("No option selected.\nPlease select an option.");
	}
	
}


function newValidate()
{
	if (document.form1.OptionType[0].checked) {
		document.write("Option1 is selected.")
	} else if (document.form1.OptionType[1].checked) {
		document.write("Option2 is selected.")
	} else if (document.form1.OptionType[2].checked) {
		document.write("Option3 is selected.")
	} else {
		alert("Unable to determine the option selected.")
	}
}

function showThis2(nme) {

   //alert("showthis2-"+nme+" fired.");
   
   for (var i=0;i<dArray.length;i++) {
      document.getElementById(dArray[i]).style.display='none';
   }
   
   //document.getElementById(nme).style.display='';
   
   switch(nme) {
	case "option1":
		document.getElementById(nme).style.display='';
		document.form1.OptionType[0].checked=true;
		document.form1.option1_Quantity.focus();
		break;
	case "option2":
		document.getElementById(nme).style.display='';
		document.form1.OptionType[1].checked=true;
		document.form1.option2_Quantity.focus();
		break;
	case "option3":
		document.getElementById(nme).style.display='';
		document.form1.OptionType[2].checked=true;
		document.form1.option3_Quantity.focus();
		break;
//	case "option4":
//		document.getElementById(nme).style.display='';
//		document.form1.OptionType[3].checked=true;
//		document.form1.option4_Quantity.focus();
//		break;
	default:
		"Option type undetermined!";	
   }
   
}

function showThis2Mothersday(nme) {

   for (var i=0;i<dArray.length;i++) {
      document.getElementById(dArray[i]).style.display='none';
   }
   
   //document.getElementById(nme).style.display='';
   
   switch(nme) {
	case "option1":
		document.getElementById(nme).style.display='';
		document.form1.OptionType[0].checked=true;
		document.form1.option1_Quantity.focus();
		break;
	case "option2":
		document.getElementById(nme).style.display='';
		document.form1.OptionType[1].checked=true;
		document.form1.option2_Quantity.focus();
		break;
	case "option3":
		document.getElementById(nme).style.display='';
		document.form1.OptionType[2].checked=true;
		document.form1.option3_Quantity.focus();
		break;
	default:
		"Option type undetermined!";	
   }
   
}

function validateform1()
{
	document.write("The option1 radio button is selected: " + 
	document.form1.OptionType[0].checked + "<br>");
	document.write("The option2 radio button is selected: " + 
	document.form1.OptionType[1].checked + "<br>");
	document.write("The option3 radio button is selected: " + 
	document.form1.OptionType[2].checked + "<br>");
}

function validateform()
{
	alert("option1:"+document.form1.OptionType[0].checked+"\noption2:"+document.form1.OptionType[1].checked+"\noption3:"+document.form1.OptionType[2].checked);

	if (document.form1.OptionType[0].checked == false && 
	    document.form1.OptionType[1].checked == false &&
	    document.form1.OptionType[2].checked == false)
	{
		alert('No option was selected.\nPlease select an option first.');
		return false;
	}
	
	if (document.form1.option1_Quantity.value < 1 && document.form1.OptionType[0].checked)
	{
		alert('A minimum of 1 card is required.');
		document.form1.option1_Quantity.focus();
		document.form1.option1_Quantity.select();
		return false;
	} else {

		var temp_value = document.form1.option1_AddDonation.value; 

		if (temp_value == "") 
		{ 
			document.form1.option1_AddDonation.value = "5.00"; 
			return; 
		} 
		var Chars = "0123456789.,$"; 
		for (var i = 0; i < temp_value.length; i++) 
		{ 
			if (Chars.indexOf(temp_value.charAt(i)) == -1) 
			{ 
				alert("Invalid Donation Amount!\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
				document.form1.option1_AddDonation.focus(); 
				document.form1.option1_AddDonation.select(); 
				return false; 
			} 
		} 
	}

	//if (document.form1.option2_Quantity.value < 1 && (document.form1.OptionType[1].checked || document.form1.OptionType[1].checked==true))
	if (document.form1.option2_Quantity.value < 1 && document.form1.OptionType[1].checked==true)
	{
		alert('A minimum of 1 card is required.');
		document.form1.option2_Quantity.focus();
		document.form1.option2_Quantity.select();
		return false;
	}

	if (document.form1.OptionType[1].checked)
	{
		if (document.form1.option2_Address.value.length != 0)
		{
			var msg = 'You have entered a Envelope Return Address';
			
			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a City, State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_State.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Zip.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
			{
				msg = msg + ', City and Zip/Postal Code, but you have not entered a State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_State.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
			{
				msg = msg + ', State and Zip/Postal Code, but you have not entered a City.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', and State, but you have not entered a City or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
			{
				msg = msg + ' and Zip/Postal Code, but have not entered a City or State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}
			
		}
		
		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City, State, and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value > 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a State and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or City.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have selected a State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

	}
	
	if (document.form1.option3_Quantity.value < 1 && document.form1.OptionType[2].checked)
	{
		alert('At least one card is required.');
		document.form1.option3_Quantity.focus();
		document.form1.option3_Quantity.select();
		return false;
	}	

	if (document.form1.option3_DonationPerCard.value == "" && document.form1.OptionType[2].checked)
	{
		alert('Please enter a donation amount.');
		document.form1.option3_DonationPerCard.focus();
		document.form1.option3_DonationPerCard.select();
		return false;
	}

	if (document.form1.OptionType[2].checked)
	{
		if (document.form1.option3_Address.value.length != 0)
		{
			var msg = 'You have entered a Envelope Return Address';
			
			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a City, State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_State.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Zip.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
			{
				msg = msg + ', City and Zip/Postal Code, but you have not entered a State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_State.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
			{
				msg = msg + ', State and Zip/Postal Code, but you have not entered a City.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', and State, but you have not entered a City or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
			{
				msg = msg + ' and Zip/Postal Code, but have not entered a City or State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}
			
		}
		
		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City, State, and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a State and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or City.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have selected a State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, State and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}
	}

	

return true;
}


function validateformmothersday()
{

	if (document.form1.OptionType[0].checked == false && 
	    document.form1.OptionType[1].checked == false &&
	    document.form1.OptionType[2].checked == false) {
		alert('No option was selected.\nPlease select an option first.');
		return false;
	}
	
	if (document.form1.option1_Quantity.value < 1 && document.form1.OptionType[0].checked)
	{
		alert('A minimum quantity of 1 card is required.');
		document.form1.option1_Quantity.focus();
		document.form1.option1_Quantity.select();
		return false;
		
	} else {
	
		var temp_value = document.form1.option1_AddDonation.value; 

		if (temp_value == "") 
		{ 
			document.form1.option1_AddDonation.value = "5.00"; 
			return; 
		} 
		var Chars = "0123456789.,$"; 
		for (var i = 0; i < temp_value.length; i++) 
		{ 
			if (Chars.indexOf(temp_value.charAt(i)) == -1) 
			{ 
				alert("Invalid Donation Amount!\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
				document.form1.option1_AddDonation.focus(); 
				document.form1.option1_AddDonation.select(); 
				return false; 
			} 
		} 
	
	}

	if (document.form1.option2_Quantity.value < 1 && document.form1.OptionType[1].checked)
	{
		alert('A minimum quantity of 1 card is required.');
		document.form1.option2_Quantity.focus();
		document.form1.option2_Quantity.select();
		return false;
	
	} else {
	
		var temp_value = document.form1.option2_AddDonation.value; 

		if (temp_value == "") 
		{ 
			document.form1.option2_AddDonation.value = "5.00"; 
			return; 
		} 
		var Chars = "0123456789.,$"; 
		for (var i = 0; i < temp_value.length; i++) 
		{ 
			if (Chars.indexOf(temp_value.charAt(i)) == -1) 
			{ 
				alert("Invalid Donation Amount!\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
				document.form1.option2_AddDonation.focus(); 
				document.form1.option2_AddDonation.select(); 
				return false; 
			} 
		} 
	
	}

	if (document.form1.OptionType[1].checked)
	{
		if (document.form1.option2_Address.value.length != 0)
		{
			var msg = 'You have entered a Envelope Return Address';
			
			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a City, State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_State.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_Zip.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
			{
				msg = msg + ', City and Zip/Postal Code, but you have not entered a State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_State.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
			{
				msg = msg + ', State and Zip/Postal Code, but you have not entered a City.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
			{
				msg = msg + ', and State, but you have not entered a City or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
			{
				msg = msg + ' and Zip/Postal Code, but have not entered a City or State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option2_City.focus();
				alert(msg);
				return false;
			}
			
		}
		
		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City, State, and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value > 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a State and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or City.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length == 0 && document.form1.option2_State.value.length > 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have selected a State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option2_Address.value == 0 && document.form1.option2_City.value.length > 0 && document.form1.option2_State.value.length == 0 && document.form1.option2_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, State and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option2_Address.focus();
			alert(msg);
			return false;
		}


	}
	
	if (document.form1.option3_Quantity.value < 1 && document.form1.OptionType[2].checked)
	{
		alert('At least one card is required.');
		document.form1.option3_Quantity.focus();
		document.form1.option3_Quantity.select();
		return false;
	}	

	if (document.form1.option3_DonationPerCard.value == "" && document.form1.OptionType[2].checked)
	{
		alert('Please enter a donation amount.');
		document.form1.option3_DonationPerCard.focus();
		document.form1.option3_DonationPerCard.select();
		return false;
	}

	if (document.form1.OptionType[2].checked)
	{
		if (document.form1.option3_Address.value.length != 0)
		{
			var msg = 'You have entered a Envelope Return Address';
			
			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a City, State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a State, or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_State.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', but have not entered a Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_Zip.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
			{
				msg = msg + ', City and Zip/Postal Code, but you have not entered a State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_State.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
			{
				msg = msg + ', State and Zip/Postal Code, but you have not entered a City.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}

			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
			{
				msg = msg + ', and State, but you have not entered a City or Zip/Postal Code.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}
			
			if (document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
			{
				msg = msg + ' and Zip/Postal Code, but have not entered a City or State.';
				msg = msg + '\n\nWhen using a Envelope Return Address, all the Envelope Return Address fields are required.';
				document.form1.option3_City.focus();
				alert(msg);
				return false;
			}
			
		}
		
		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City, State, and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City and State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a State and Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address or City.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length > 0)
		{
			var msg = '';
			msg = msg + 'You have entered a Zip/Postal Code for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and State.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length == 0 && document.form1.option3_State.value.length > 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have selected a State for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, City and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}

		if (document.form1.option3_Address.value == 0 && document.form1.option3_City.value.length > 0 && document.form1.option3_State.value.length == 0 && document.form1.option3_Zip.value.length == 0)
		{
			var msg = '';
			msg = msg + 'You have entered a City for Envelope Return Address, ';
			msg = msg + 'but you have not entered a valid street address, State and Zip/Postal Code.\n\n';
			msg = msg + 'When using a Envelope Return Address, all the Envelope Return Address fields are required.';
			document.form1.option3_Address.focus();
			alert(msg);
			return false;
		}
	}

	

return true;
}



function popUp_Preview(url,w,h,msg) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width='+w+',height='+h);");
}

function popUp_Preview1(url,w,h,msg) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+w+',height='+h);");
}

function previewMessage2(cardid,w,h,scroll) {
	msg = escape(document.form1.option2_CardSignature.value);
	if (msg == "") {
		alert("No card signature to preview!\nPlease enter a card signature first.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars="+scroll+",resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Komen Marketplace 2008  Mother's Day Cards<\/title><\/head><body><img style='border:1px solid #666666' src=\"SignaturePreview.asp\?cardid="+cardid+"&text="+msg+"\"><\/body><\/html>");
		newWindow.document.close();
	}
}

function previewMessage3(cardid,w,h,scroll) {
	msg = escape(document.form1.option3_CardSignature.value);
	if (msg == "") {
		alert("No card signature to preview!\nPlease enter a card signature first.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars="+scroll+",resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Komen Marketplace 2008  Mother's Day Cards<\/title><\/head><body><img style='border:1px solid #666666' src=\"SignaturePreview.asp\?cardid="+cardid+"&text="+ msg +"\"><\/body><\/html>");
		newWindow.document.close();
	}
}

function previewEnvelope2(cardid,w,h) {
	line1 = escape(document.form1.option2_Address.value);
	line2 = document.form1.option2_City.value + ", " + document.form1.option2_State.value + " " + document.form1.option2_Zip.value;
	if (line1 == "") {
		alert("Not enough address information to preview!\n\nThe following fields are required in order to preview your message:\n\n" + 
		"- Envelope Return Address\n- City\n- State\n- Zip/Postal Code\n\nPlease try again.");
		document.form1.option2_Address.focus();
	} else if ((document.form1.option2_City.value == "") || (document.form1.option2_State.value == "") || (document.form1.option2_Zip.value == "")) {
		alert("If you include your address on the return envelope, all the address fields must be filled.\nThis includes City, State and Zip.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars=no,resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Komen Marketplace 2008  Mother's Day Cards<\/title><\/head><body><img src=\"EnvelopePreview.asp\?cardid="+cardid+"&line1="+line1+"&line2="+line2+"\"><\/body><\/html>");
		newWindow.document.close();
	}
}

function previewEnvelope3(cardid,w,h) {
	line1 = escape(document.form1.option3_Address.value);
	line2 = document.form1.option3_City.value + ", " + document.form1.option3_State.value + " " + document.form1.option3_Zip.value;
	if (line1 == "") {
		alert("Not enough address information to preview!\n\nThe following fields are required in order to preview your message:\n\n" + 
		"- Envelope Return Address\n- City\n- State\n- Zip/Postal Code\n\nPlease try again.");
		document.form1.option3_Address.focus();
	} else if ((document.form1.option3_City.value == "") || (document.form1.option3_State.value == "") || (document.form1.option3_Zip.value == "")) {
		alert("If you include your address on the return envelope, all the address fields must be filled.\nThis includes City, State and Zip.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars=no,resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Komen Marketplace 2008  Mother's Day Cards<\/title><\/head><body><img src=\"EnvelopePreview.asp\?cardid="+cardid+"&line1="+line1+"&line2="+line2+"\"><\/body><\/html>");
		newWindow.document.close();
	}
}

/*
function previewWindow2(cardid,w,h) {
	line1 = document.Form1.option2_Address.value;
	line2 = document.Form1.option2_City.value + ", " + document.Form1.option2_State.value + " " + document.Form1.option2_Zip.value;
	if (line1 == "") {
		alert("No address information preview!\nPlease enter your address first.");
	} else if ((document.Form1.option2_City.value == "") || (document.Form1.option2_State.value == "") || (document.form1.option2_Zip.value == "")) {
		alert("If you include your address on the return envelope, all the address fields must be filled.\nThis includes City, State and Zip.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars=no,resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Komen Marketplace 2006 Mother's Day Cards<\/title><\/head><body><img src=\"EnvelopePreview.asp\?cardid="+cardid+"&line1="+line1+"&line2="+line2+"\"><\/body><\/html>");
		newWindow.document.close();
	}
}
*/

function previewWindow3(cardid,w,h) {
	msg = document.Form1.option4_CardSignature.value;
	if (msg == "") {
		alert("No card signature to preview!\nPlease enter a card signature first.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars=no,resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Generated Window<\/title><\/head><body><img src=\"SignaturePreview.asp\?cardid="+cardid+"&text="+msg+"\"><\/body><\/html>");
		newWindow.document.close();
	}
}

function previewWindow4(cardid,w,h) {
	line1 = document.Form1.option4_Address.value;
	line2 = document.Form1.option4_City.value + ", " + document.Form1.option4_State.value + " " + document.Form1.option4_Zip.value;
	if (line1 == "") {
		alert("No address information preview!\nPlease enter your address first.");
	} else if ((document.Form1.option4_City.value == "") || (document.Form1.option4_State.value == "") || (document.form1.option4_Zip.value == "")) {
		alert("If you include your address on the return envelope, all the address fields must be filled.\nThis includes City, State and Zip.");
	} else {
		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars=no,resizable=yes,width="+w+",height="+h);
		newWindow.document.write("<html><head><title>Generated Window<\/title><\/head><body><img src=\"EnvelopePreview.asp\?cardid="+cardid+"&line1="+line1+"&line2="+line2+"\"><\/body><\/html>");
		newWindow.document.close();
	}
}

function EditRecipientList()
{
    document.forms['form1'].action = "CardRecipients.asp";
    document.forms['form1'].method = "POST";
    document.forms['form1'].submit();
}

function DeleteRecipients()
{
if (confirm("This will delete selected recipients!  Are you sure you want to do this!?"))
	{
	document.forms['RecipientsForm'].action = "DeleteRecipients.asp";
	document.forms['RecipientsForm'].method = "POST";
	document.forms['RecipientsForm'].submit();
}
}


function UpdateRecipients()
{
	for (var i = 0; i<document.RecipientsForm.elements.length; i++) {
		//alert(document.RecipientsForm.elements[i].name);
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientName') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient Name is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientAddress1') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient Address line 1 is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientCity') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient City is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientState') > -1)) {
			if (document.RecipientsForm.elements[i].options[document.RecipientsForm.elements[i].selectedIndex].value == "none") {
				alert('Recipient State is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientZip') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient Zip/Postal Code is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
	}

	document.forms['RecipientsForm'].action = "UpdateRecipients.asp";
	document.forms['RecipientsForm'].method = "POST";
	document.forms['RecipientsForm'].submit();
}

function UpdateRecipientsFinished()
{
    document.forms['RecipientsForm'].action = "UpdateRecipients.asp?finished=true";
    document.forms['RecipientsForm'].method = "POST";
    document.forms['RecipientsForm'].submit();
}


function InsertRecipients()
{
	for (var i = 0; i<document.RecipientsForm.elements.length; i++) {
		//alert(document.RecipientsForm.elements[i].name);
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientName') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient Name is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientAddress1') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient Address line 1 is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientCity') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient City is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientState') > -1)) {
			if (document.RecipientsForm.elements[i].options[document.RecipientsForm.elements[i].selectedIndex].value == "none") {
				alert('Recipient State is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
		if ((document.RecipientsForm.elements[i].name.indexOf('RecipientZip') > -1)) {
			if (document.RecipientsForm.elements[i].value == "") {
				alert('Recipient Zip/Postal Code is a required field.');
				document.RecipientsForm.elements[i].focus();
				return false;
			}
		}
	}
    document.forms['RecipientsForm'].action = "InsertRecipients.asp";
    document.forms['RecipientsForm'].method = "POST";
    document.forms['RecipientsForm'].submit();
}

function AddRecipient()
{
    document.forms['RecipientsForm'].action = "CardRecipients.asp?AddNew=1";
    document.forms['RecipientsForm'].method = "POST";
    document.forms['RecipientsForm'].submit();
    document.forms['RecipientsForm'].iCount.focus();
}

function CancelRecipient()
{
    document.forms['RecipientsForm'].action = "ShoppingCart.asp";
    document.forms['RecipientsForm'].method = "POST";
    document.forms['RecipientsForm'].submit();
}

function clearDefault(el) 
{
	if (el.defaultValue==el.value) el.value = ""
}


function validateDollar(fld) 
{ 
   var temp_value = fld.value; 

   if (temp_value == "") 
   { 
     fld.value = "$0.00"; 
     return; 
   } 
   var Chars = "0123456789.,$"; 
   for (var i = 0; i < temp_value.length; i++) 
   { 
       if (Chars.indexOf(temp_value.charAt(i)) == -1) 
       { 
           alert("Invalid Character(s)\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
           fld.focus(); 
       fld.select(); 
           return; 
       } 
   } 
} 

function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) { // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	} else {
		cntfield.value = maxlimit - field.value.length;
	}
}


